You cannot use both the Serial
and avr-stub for debugging because avr-stub exactly uses the serial connection to speak to the debugger client (gdb).
This is documented behavior.
- https://docs.platformio.org/en/stable/plus/debug-tools/avr-stub.html#debugger-limitations
- https://github.com/jdolinay/avr_debug/blob/master/doc/avr_debug.pdf
This has also been thoroughly discussed in multiple topics in this forum already.