I am using "avr-stub" to debug my "arduino mega", but it doesn'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.