I am using "avr-stub" to debug my "arduino mega", but it doesn't work

I am using “avr-stub” to debug my “arduino mega”, but it doesn’t work.
I don’t know where is the problem.
Can you help me, thank you very much.


I changed “\ .\COM11” to “COM11” and it didn’t work

Please post code as text, not as as picture.

The console says that the COM port did not deliver a response from GDB’s request. So your microcontroller is probably not responding to requests over Serial.

As explained in How to debug on Arduino mega 2560 - #2 by maxgerhardt you cannot use the Serial object in your firmware anymore if you’re using avr-stub to debug, since avr-stub is already using that serial connection to talk to GDB. I don’t see the full code but you do Serial.begin() which seems like you are using the serial. You can still use other serial ports (like Serial2…) on the Mega for debug output. Additionally, you don’t seem to calling debug_init, as the documentation tells you to.

Thank you for your answer.
I will not post pictures in the future. I don’t know if posting pictures will cause reading troubles :rofl:. I’m very sorry :no_mouth:.

Allow me to post another picture :laughing: :laughing:


Try and use \\.\COM11 here and check that it’s the right port.

The problem is solved。
I wrote \\. \COM11 as \\ .\COM11

Thank you for your answer。