Configuring CONFIG_ESP32_PANIC_GDBSTUB or CONFIG_ESP32_PANIC_PRINT_HALT

Hey all,

Sorry for the more frequent posts recently, hitting a lot of work related issues.

Currently working with platformIO running with framework arduino and espidf. using the different tasks for my threading I have a very large company project. Protecting a lot of my arduino libraries and peripherals with semaphores has been very successful to prevent multithreading issues. However, I now have an extremely elusive bug that I cannot reliably reproduce. I am using an esp32 wroom with an ethernet attachment.

I would like to leave the device running overnight to ensure that when it crashes I can go back and fix it. My current method of debugging has been crude print debugging. I want to use the following options:

  • Print registers and halt (CONFIG_ESP32_PANIC_PRINT_HALT)

    Outputs the relevant registers over the serial port and halt the processor. Needs a manual reset to restart.

  • Print registers and reboot (CONFIG_ESP32_PANIC_PRINT_REBOOT)

    Outputs the relevant registers over the serial port and immediately reset the processor.

  • Silent reboot (CONFIG_ESP32_PANIC_SILENT_REBOOT)

    Just resets the processor without outputting anything

  • Invoke GDBStub (CONFIG_ESP32_PANIC_GDBSTUB)

    Invoke gdbstub on the serial port, allowing for gdb to attach to it to do a postmortem of the crash.

Found in the esp32 docs here: Configuration Options — ESP-IDF Programming Guide v3.1.5 documentation

In order to do this, I have changed sdkconfig appropriately and even sdkconfig.h appropriately and rebuilt, then tried testing this by calling a web endpoint that just calls abort. This then restarts without halting. I would either like it to pause with a gdb stub or just halt indefinitely so I don’t lose my serial debugging.

I also tried following the advice here, and the menuconfig yields absolutely nothing, the options mentioned for FreeRTOS do not appear to exist and cannot be found under the paths that they reference.

my versions are this:

  • framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b
    
  • framework-espidf @ 3.40407.240606 (4.4.7)
    
  • tool-cmake @ 3.30.2
    
  • tool-esp-rom-elfs @ 0.0.1+20241011
    
  • tool-esptoolpy @ 2.40900.250804 (4.9.0)
    

For reference (from the esp32 thread) , the path to change the panic handler behaviour does not exist, I can get as far as FreeRTOS before there are no more subpaths:

'Component config -> FreeRTOS -> Panic handler behaviour -> Invoke GDBStub'.

All help very gratefully appreciated