Using GDB for online debugging ESP8266


For couple of days I’ve been struggling to configure debugging for ESP8266 running on Arduino and using PlatformIO.
I managed to build a proper binary file with

  1. Added build_flags = -Og -ggdb -DDEBUG_ESP_PORT=Serial to platformio.ini
    2.Downloaded full xtensa SDK as this provided for PIO does not include xtensa GDB
    Thanks to these steps I am able to offline debug - see lines numbers etc,but I cannot make it work with online debugging. Here is what i ve done:
  2. Added GDBStub.h include to my mian class
  3. Started GDB with firmware that has debugging symbols included(form step 1) to debug via COM - set baud rate to 115200 (the same as I use for normal state check via serial moniotr - wifi messages etc.) .
  4. I get no response - only timouts etc
  5. In the result I would like to use CLion to insert breakpoints watches etc.

Can someone pint me what I’m mising ? I have 2 suspicions :

  • Is inluding only GDBAtub.h enough or shoul I call gdb_init somewhere (its’s not recognized as a function) or do anything more.
  • Baud rate - should I use the same as the one set for serial communication messages (115200) ?

I am using Windows.

1 Like