tmedicci opened a new pull request, #13546:
URL: https://github.com/apache/nuttx/pull/13546

   ## Summary
   
   * Documentation: Document stack and backtrace dump for Espressif SoCs
     - Stack and backtrace dump for Espressif's SoCs (ESP32, ESP32-S2, 
ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2) is now documented in a new section 
for each chip entry page.
   
   * xtensa/esp32[|s2|s3]: Fix task backtrace dump
     - Fix `MAKE_PC_FROM_RA` macro to consider the instruction region base 
address;
     - Add sanity check for calculated PC and SP registers;
     - Check if the stack pointer is within the interrupt stack to enable 
backtrace dump if an exception occurs during the ISR;
     - Update the script for decoding the backtrace dump to consider the syntax 
of the backtrace format and properly handle the dump when SMP is enabled;
   
   
   * xtensa/Kconfig: Fix dependency for backtrace dump on Xtensas
     - `CONFIG_XTENSA_INTBACKTRACE` is necessary to enable backtrace dump for 
the tasks because exceptions are treated like interrupts (even when an 
exception occurs during a normal task execution). It's now automatically 
selected when `CONFIG_SCHED_BACKTRACE` is enabled. This commit also removes 
outdated Kconfig options.
   
   ## Impact
   
   Fix backtrace dump on assertions considering assertions triggered by tasks 
or during an interrupt service.
   
   ## Testing
   
   Internal CI testing with HW on all Xtensa-based devices.
   
   ### How to Test on ESP32:
   
   Use `esp32-devkitc:nsh`. Enable `CONFIG_SCHED_BACKTRACE` and 
`CONFIG_SYSTEM_DUMPSTACK`. On nsh, run `dumpstack`:
   
   ```
   nsh> dumpstack
   sched_dumpstack: backtrace| 2: 0x400ee9bc 0x400ef817 0x400e2d0b 0x400e1d63 
0x40000000
   ```
   
   Save this output to a file and use `./tools/espressif/btdecode.sh esp32 
/tmp/backtrace.txt` to check the backtrace dump:
   
   ```
   ./tools/espressif/btdecode.sh esp32 /tmp/backtrace.txt       
   Backtrace for task 2:
   0x400ee9bc: sched_dumpstack at ??:?
   0x400ef817: dumpstack_main at ??:?
   0x400e2d0b: nxtask_startup at ??:?
   0x400e1d63: nxtask_start at ??:?
   0x40000000: ?? ??:0
   ```
   
   Before this PR, the output would generate wrong addresses:
   
   ```
   Backtrace for task 2:
   0x000ee998: ?? ??:0
   0x000ef7f3: ?? ??:0
   0x000e2ce7: ?? ??:0
   0x000e1d3f: ?? ??:0
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to