esp-gdbstub
esp-gdbstub copied to clipboard
esp32 compatible?
Hello,
I wanted to know if this gdb stub could do any good with the esp32?
thanks in advance
No, it cannot; the debug architecture of the ESP32 is too different. The ESP32 has its own gdbstub in esp-idf: it gets invoked as a crash-handler. See 'make menuconfig' -> component config -> esp32-specific -> panic handler behaviour to enable this. If you view the serial output of your program with 'make monitor', it will even automatically invoke gdb for you in the event of a crash.
Wow. Hats of for your work on that. Just discovered your work on the SystemView. Wow!
To what extend would it be possible to debug the esp only with the help of a gdb stub over serial without jtag?
Up to the extent that the ESP32 has to crash in order to get into the GDB stub, and that the ESP32s gdbstub is purely a forensic one: you cannot continue execution or call functions from it. You still can get a fair amount of usefullness from it by e.g. calling abort() when a certain situation happens, which counts as a crash and will also invoke gdbstub.
@Spritetm I was wondering what is the reason for such limitation ?
You can call esp_cpu_stall in handle_breakpoint to stop the other core from progressing, and you can probably call esp_cpu_unstall when resuming. If GDB does not take too much time to capture its informations, the hardware buffer should support that latency, no ?
I'd really love to be able to launch a pseudo gdb_server task on FreeRTOS and be able to debug directly over serial without JTAG.
I'd really love to be able to launch a pseudo
gdb_servertask on FreeRTOS and be able to debug directly over serial without JTAG.
I was just looking for something like that (actually I hoped to debug via WiFi, but serial would already be much better than extra cables for JTAG).
I've made some progress for post-mortem debugging in IDF, now you can list tasks and switch them to examine backtrace and walk up or down. In the bug report, there are some discussion about how to implement a real stub with live debugging and it seemed it's possible. I haven't found the time to write it yet, but it's on my todolist.
I've made some progress for post-mortem debugging in IDF, now you can list tasks and switch them to examine backtrace and walk up or down. In the bug report, there are some discussion about how to implement a real stub with live debugging and it seemed it's possible. I haven't found the time to write it yet, but it's on my todolist.
@X-Ryl669 I feel a bit daft, but what are you referring to? I would really like this functionality as I cannot use JTAG (no pins available, and design is already in production). Can you point me to the bug report? Or can you point me to a project where we can collaborate, if you are doing this open source? Thanks!
It's already in esp-idf, see PR #2828. Here, I've discussed about some way to implement debugging via USB/Serial (but I haven't finished this since this is something Espressif said they were working on). Indeed, they rewrote most of it when including the ESP32-S2 code, so I don't know if my former ideas are still applicable.
Meanwhile, a JTAG dongle is $10 on chinese website, so I've decided not to spend weeks of development on this and instead debug with a JTAG (even if it's really really painful on ESP32 and I have to unsolder pins and disable all the code making use of those GPIO for this to work).