Skip to content

enhanced stack trace decoder for ESP8266 #3013

Open
pljakobs wants to merge 1 commit intoSmingHub:developfrom
pljakobs:feature/stackTraceDecoder
Open

enhanced stack trace decoder for ESP8266 #3013
pljakobs wants to merge 1 commit intoSmingHub:developfrom
pljakobs:feature/stackTraceDecoder

Conversation

@pljakobs
Copy link
Contributor

plus minor fixes on the ESP32 side (mostly for consistency). This also updates gdb_hooks to include the register dump into the portion the user is to copy in to the stack trace decoder

  • decoder now includes the register dump, showing the different memory areas color coded to allow quick distinction of code/data addresses
  • if possible shows a symbol / code line decode of addresses in the register file
  • shows c/c++ context from the source file
  • shows assembly context (only after the offending instruction)
  • provides the same color coded addresses in the hex stack trace
  • shows a list of functions on the stack
  • shows a list of data addresses / labels on the stack

The output, when used interactively, uses a pager and the input now requires to mark the end of the input by ^D (what was necessary to not get mixed lines in the output)

I did change the gdb_hooks.cpp file to

  • define the FSTRING values in a central place but use them in both the gdbstub_exception_handler_flash() and dumpExceptionInfo() functions. This might not be the most elegant way, but with the ======= lines only wrapping around the actual stack dump, the guidance is confusing for the user and they would probably not copy the register file

…2 side (mostly for consistency). This also updates gdb_hooks to include the register dump into the portion the user is to copy in to the stack trace decoder
@what-the-diff
Copy link

what-the-diff bot commented Mar 12, 2026

PR Summary

  • Improved Code Comprehension in decode-stacktrace.py:

    • Introduced CANARY_VALUES, a new constant to replace hard-coded values, improving readability.
    • A new function, colorizeHex was added for color-coding hex values in the output, making it easier to dechiper.
    • Upgraded how disassembly operates by employing getAddrColor to color-code addresses.
    • Implemented checks to spew out warnings when non-code memory gets executed, enhancing safety.
  • Code Optimization in gdb_hooks.cpp:

    • Exchanged recurring string definitions with DEFINE_PSTR_LOCAL, refining the overall code structure, and promoting cleanliness.
    • Performing modifications in debug_print_stack and debug_crash_callback functions to leverage the new string definitions, thereby diminishing redundancy.
    • Ensured a steady print of instructions and separators when exceptions occur, improving consistency in outputs.

@slaff slaff added this to the 6.3.0 milestone Mar 12, 2026
@slaff slaff requested a review from mikee47 March 12, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants