Analyze ESP32 backtrace on NodeMCU


I'm debugging some crashes on the dev-esp32 branch of the NodeMCU Lua firmware. How do you other NodeMCU devs analyze the backtraces?

During normal ESP32 dev the idf monitor handles decoding the backtrace. I've tried to use the IDF monitor with my NodeMCU build (unsuccessfully). I've also tried with no success.

Before I go any deeper on this problem I figured I would check how others are handling it.

An example of the type of output I'm trying to decode is below.

Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4000c3f5  PS      : 0x00060430  A0      : 0x800ed304  A1      : 0x3ffc3fe0  
A2      : 0x80171ba1  A3      : 0x3ffc4292  A4      : 0x00000001  A5      : 0x3fe1a9a4  
A6      : 0x7ff00000  A7      : 0x000e6c6e  A8      : 0x00000000  A9      : 0x80171ba1  
A10     : 0x0000002d  A11     : 0x00000000  A12     : 0x3ffc9690  A13     : 0x00000010  
A14     : 0x00000001  A15     : 0x3ffc4640  SAR     : 0x00000004  EXCCAUSE: 0x0000001d  
EXCVADDR: 0x80171ba1  LBEG    : 0x400029ac  LEND    : 0x400029cb  LCOUNT  : 0x00000000  

ELF file SHA256: b809d167629a125c85da3f679dd782ec6df740657c8d4ef4df56d7eea784abcd

Backtrace: 0x4000c3f5:0x3ffc3fe0 0x400ed301:0x3ffc4000 0x400e2c8a:0x3ffc4030 0x400df6bd:0x3ffc4340 0x4013bfde:0x3ffc4400 0x4013dff9:0x3ffc4440 0x40137588:0x3ffc4460 0x4016ff04:0x3ffc4480 0x4013d8d7:0x3ffc44b0 0x4013ccdd:0x3ffc44f0 0x4013d9ae:0x3ffc4540 0x4013db89:0x3ffc4560 0x4013d1f5:0x3ffc4580 0x4013da96:0x3ffc4600 0x4013e6a2:0x3ffc4630 0x400d6e21:0x3ffc4660 0x40082c36:0x3ffc4690 0x40108137:0x3ffc46d0 0x40110043:0x3ffc4730 0x401100a2:0x3ffc4750 0x4011014e:0x3ffc4770 0x4010dc8e:0x3ffc4790 0x4008ec46:0x3ffc47b0

Additional Info on decoder attempts

For the EspExceptionDecoder attempts I save the crash output in a file named backtrace. Then I invoke the decoder as follows which results in a parser error (confirmed the paths are correct).

$ shasum -a 256 ../konnected-pro/build/nodemcu-firmware/build/NodeMCU.elf 
fa399df026e014cc988df430b22c58da9a9159cea5aaca9f19f67dc67c339619  ../konnected-pro/build/nodemcu-firmware/build/NodeMCU.elf
$ ./ -e ../konnected-pro/build/nodemcu-firmware/build/NodeMCU.elf -t ~/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf -p ESP32 ../backtrace 
ERROR: Parser not complete!

The backtrace file I attempted the above on has the following content (Note the sha matches the check above).

PANIC: unprotected error in call to Lua API (/lfs/ds18b20.lua:123: failed)
E (27032) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (27032) task_wdt:  - IDLE0 (CPU 0)
E (27032) task_wdt: Tasks currently running:
E (27032) task_wdt: CPU 0: main
E (27032) task_wdt: CPU 1: IDLE1
E (27032) task_wdt: Aborting.
abort() was called at PC 0x400d3708 on core 0

ELF file SHA256: fa399df026e014cc988df430b22c58da9a9159cea5aaca9f19f67dc67c339619

Backtrace: 0x40088cef:0x3ffb0a40 0x40089009:0x3ffb0a60 0x400d3708:0x3ffb0a80 0x4008273d:0x3ffb0aa0 0x4013715d:0x3ffbcde0 0x40138917:0x3ffbce00 0x4013857d:0x3ffbce20 0x40140aa1:0x3ffbce40 0x40137357:0x3ffbce60 0x400d4dfe:0x3ffbceb0 0x40138e6f:0x3ffbcee0 0x4013f1b9:0x3ffbcf20 0x40138f46:0x3ffbcf70 0x401408fd:0x3ffbcf90 0x400d5e6b:0x3ffbcfb0 0x400f9b81:0x3ffbcfd0 0x400fdc37:0x3ffbd000 0x400d27ab:0x3ffbd040

ets Jun  8 2016 00:22:57
asked on Stack Overflow Jan 8, 2021 by Kit Klein • edited Jan 12, 2021 by Kit Klein

1 Answer


I'd suggest getting a JTAG adapter (e.g. the cheap ESP-Prog if you don't already own one), hooking it up to your board per instructions and debugging with gdb. It's a minor hassle to set up, but there's no substitute to an actual debugging workflow.

answered on Stack Overflow Jan 9, 2021 by Tarmo

User contributions licensed under CC BY-SA 3.0