dankeboy36 / esp-exception-decoder

ESP8266/ESP32 Exception Decoder Extension for the Arduino IDE
MIT License
62 stars 2 forks source link

Arduino IDE 2.2.1 Board: NodeMCU ESP8266 Lolin v3(ESP-12E). Stacktrace isn't recognized #11

Closed r-hmn closed 8 months ago

r-hmn commented 8 months ago

Hi dankeboy36

i'm posting here as you advised here in that link it shows the settings and board i use. (i also tested by enabling the "C++ exceptions") Aside from the mentioned nightly build, i use Arduino IDE 2.2.1. Both provide the same result.

In case it's interesting my build output is this (i replaced ascii-art with '|---' etc)

. Variables and constants in RAM (global, static), used 39336 / 80192 bytes (49%)
|-   SEGMENT  BYTES    DESCRIPTION
|------- DATA     1516     initialized variables
|------- RODATA   5164     constants       
|------- BSS      32656    zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 60755 / 65536 bytes (92%)
|-   SEGMENT  BYTES    DESCRIPTION
|------- ICACHE   32768    reserved space for flash instruction cache
|------- IRAM     27987    code in IRAM    
. Code in flash (default, ICACHE_FLASH_ATTR), used 322768 / 1048576 bytes (30%)
|-   SEGMENT  BYTES    DESCRIPTION
|------- IROM     322768   code in flash   
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: ec:fa:bc:3f:29:4f
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 361584 bytes to 261258...
Writing at 0x00000000... (6 %)
Writing at 0x00004000... (12 %)
Writing at 0x00008000... (18 %)
Writing at 0x0000c000... (25 %)
Writing at 0x00010000... (31 %)
Writing at 0x00014000... (37 %)
Writing at 0x00018000... (43 %)
Writing at 0x0001c000... (50 %)
Writing at 0x00020000... (56 %)
Writing at 0x00024000... (62 %)
Writing at 0x00028000... (68 %)
Writing at 0x0002c000... (75 %)
Writing at 0x00030000... (81 %)
Writing at 0x00034000... (87 %)
Writing at 0x00038000... (93 %)
Writing at 0x0003c000... (100 %)
Wrote 361584 bytes (261258 compressed) at 0x00000000 in 23.0 seconds (effective 125.8 kbit/s)...
Hash of data verified.

Leaving...

The exeption happens after the 2nd time the ESP8266WebServer receives a POST request and writes a file to LittleFS. My tracktrace is this (actually two?.. happening directy after eachother)


User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Panic core_esp8266_main.cpp:191 __yield

>>>stack>>>

ctx: sys
sp: 3ffff570 end: 3fffffb0 offset: 0010
3ffff580:  00000000 00000001 00000000 40211905  
3ffff590:  00000000 3fff05c8 3fff104c 40206b13  
3ffff5a0:  000020c0 00000418 3ffe85f0 000004ee  
3ffff5b0:  000004ee 00000001 3ffff674 4021056f  
3ffff5c0:  3fff1270 00000001 3ffff674 402108f4  
3ffff5d0:  3fff1270 0000007e 3fff3394 3fff437c  
3ffff5e0:  3fff1270 00000000 3ffff674 00000000  
3ffff5f0:  3fff05c8 3fff08c8 3ffe9440 4020a408  
3ffff600:  0000adb2 00000001 40211834 00000001  
3ffff610:  0000adb2 00000b68 4021493c 00000000  
3ffff620:  000003e8 00000001 00000000 00000000  
3ffff630:  00000000 4020d6a0 00000000 00000000  
3ffff640:  3fff104c 3fff0f94 3fff0ec8 40209118  
3ffff650:  3fff3394 04ee04ef 8a002045 3fff3dec  
3ffff660:  033b033f 8a002020 3fff4134 0231023f  
3ffff670:  8a006c62 3fff437c 04ee04ef 80000000  
3ffff680:  3fff0f20 3fff2588 00000000 6bdae720  
3ffff690:  0000111c 00000000 000f0000 3fff1248  
3ffff6a0:  3fff1270 00000001 3fff2c04 40207ed9  
3ffff6b0:  00000000 3fff0f20 3fff0ec8 402099b0  
3ffff6c0:  00000000 00000000 3fff32d4 00000000  
3ffff6d0:  00000000 3fafc557 00000000 bc786c6b  
3ffff6e0:  000017a0 000002f4 00000000 000f000f  
3ffff6f0:  00000000 00000000 000f0000 00000000  
3ffff700:  00000000 000f0000 00000000 6bdae720  
3ffff710:  00000000 00000000 3fff0ec8 3fff1248  
3ffff720:  3fffdad0 3fff0efc 3fff0ec8 4020a82a  
3ffff730:  40214698 00000000 00001388 4020c47a  
3ffff740:  00000000 00000000 3fff31cc 00000000  
3ffff750:  3fffdad0 3fff1080 3fff121c 3fff1248  
3ffff760:  3fffdad0 00000000 3fff121c 4020a967  
3ffff770:  40209ac8 feefeffe 00000001 3fff0eb8  
3ffff780:  40209ac8 00000000 40213b38 40100114  
3ffff790:  00000001 00000000 00000000 00000000  
3ffff7a0:  3fc00000 40000000 0000005f 3fff0da4  
3ffff7b0:  00010001 42be0000 00000048 feefeffe  
3ffff7c0:  feefeffe 00000000 74207755 74736b65  
3ffff7d0:  36302320 00000000 00000000 00000000  
3ffff7e0:  00000000 00000000 00000000 00000000  
3ffff7f0:  00000000 00000000 00000000 00000000  
3ffff800:  00000000 00000000 00000000 00000000  
3ffff810:  00000000 00000000 00000000 00000000 
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Panic core_esp8266_main.cpp:191 __yield

>>>stack>>>

ctx: sys
sp: 3ffff290 end: 3fffffb0 offset: 0010
3ffff2a0:  00000000 00000000 00000000 40103132  
3ffff2b0:  401031a9 00000031 40302063 00000000  
3ffff2c0:  00000000 00000000 00000000 00000004  
3ffff2d0:  40003b53 2c9f0300 4000050c 3fffc278  
3ffff2e0:  4010314c 3fffc200 00000022 02a993f0  
3ffff2f0:  40003b53 00000030 00000010 ffffffff  
3ffff300:  40001ddc 00000020 00018000 00000000  
3ffff310:  00ff0000 5ffffe00 5ffffe00 00000000  
3ffff320:  00018000 00000000 3ffff2e3 3ffff45c  
3ffff330:  3fff1270 0000003c 3fffffb0 00000030  
3ffff340:  0000003c 3ffe8368 000000a0 402185e5  
3ffff350:  3ffff45d 000000fe 0000006e ffff0208  
3ffff360:  3ffff42c 0000009f 000000a0 3fffffb0  
3ffff370:  00000010 3ffe8368 000000a0 402185e5  
3ffff380:  3ffff484 0000009f 00000077 ffff0208  
3ffff390:  3ffff45c 0000009f 00000004 00000005  
3ffff3a0:  3ffff550 3ffff490 00000004 3fff1e74  
3ffff3b0:  00000024 3fff1e2c 3ffff3c8 00000000  
3ffff3c0:  00000000 3fff1270 3ffff42c 40218621  
3ffff3d0:  3ffff4c0 3ffff400 00000004 402185e5  
3ffff3e0:  3ffff4e0 3fff1270 3ffff44c 40218621  
3ffff3f0:  40211e14 3fff1270 3ffff45c 40211e06  
3ffff400:  3ffff4f0 3ffff810 00000000 00000000  
3ffff410:  00000000 00000000 2b6b215c 40211e06  
3ffff420:  3ffff4c0 3ffff400 00000004 66666633  
3ffff430:  30313866 3020203a 30303030 20303030  
3ffff440:  30303030 30303030 30303020 30303030  
3ffff450:  30302030 30303030 20203030 203a000a  
3ffff460:  66666633 30373566 646e6520 6633203a  
3ffff470:  66666666 6f203062 65736666 30203a74  
3ffff480:  0a303130 00101400 3fff1e2c 40211e06  
3ffff490:  3fff1e2c 000000fe 4024fb9c 3fff1290  
3ffff4a0:  ffffffff 00000000 00000002 3ffe8f4b  
3ffff4b0:  3ffff550 3ffff490 00000004 6573550a  
3ffff4c0:  78652072 74706563 206e6f69 6bdae720  
3ffff4d0:  612f6369 00000020 3ffff820 40211e76  
3ffff4e0:  00000020 00000001 00000005 6bdae720  
3ffff4f0:  40211ec8 3ffff570 0000000f 3fffffb0  
3ffff500:  00000010 3ffff580 3ffff534 4021211f  
3ffff510:  500ffc3c 00010005 ffffffff ffffffff  
3ffff520:  00000000 00000049 3ffe85f0 3fffefd0  
3ffff530:  00000000 000000fe 00000000 00000000  
3ffff540:  00000000 00000000 00000000 00000000  
3ffff550:  40101400 00000000 00101410 00000001  
3ffff560:  00000000 3fff05c8 3ffe85ec 4021218e  
3ffff570:  7461642e 00000000 00000000 402121fb  
3ffff580:  00000000 00000001 00000000 40211905  
3ffff590:  00000000 3fff05c8 3fff104c 40206b13  
3ffff5a0:  000020c0 00000418 3ffe85f0 000004ee  
3ffff5b0:  000004ee 00000001 3ffff674 4021056f  
3ffff5c0:  3fff1270 00000001 3ffff674 402108f4  
3ffff5d0:  3fff1270 0000007e 3fff3394 3fff437c  
3ffff5e0:  3fff1270 00000000 3ffff674 00000000  
3ffff5f0:  3fff05c8 3fff08c8 3ffe9440 4020a408  
3ffff600:  0000adb2 00000001 40211834 00000001  
3ffff610:  0000adb2 00000b68 4021493c 00000000  
3ffff620:  000003e8 00000001 00000000 00000000  
3ffff630:  00000000 4020d6a0 00000000 00000000  
3ffff640:  3fff104c 3fff0f94 3fff0ec8 40209118  
3ffff650:  3fff3394 04ee04ef 8a002045 3fff3dec  
3ffff660:  033b033f 8a002020 3fff4134 0231023f  
3ffff670:  8a006c62 3fff437c 04ee04ef 80000000  
3ffff680:  3fff0f20 3fff2588 00000000 6bdae720  
3ffff690:  0000111c 00000000 000f0000 3fff1248  
3ffff6a0:  3fff1270 00000001 3fff2c04 40207ed9  
3ffff6b0:  00000000 3fff0f20 3fff0ec8 402099b0  
3ffff6c0:  00000000 00000000 3fff32d4 00000000  
3ffff6d0:  00000000 3fafc557 00000000 bc786c6b  
3ffff6e0:  000017a0 000002f4 00000000 000f000f  
3ffff6f0:  00000000 00000000 000f0000 00000000  
3ffff700:  00000000 000f0000 00000000 6bdae720  
3ffff710:  00000000 00000000 3fff0ec8 3fff1248  
3ffff720:  3fffdad0 3fff0efc 3fff0ec8 4020a82a  
3ffff730:  40214698 00000000 00001388 4020c47a  
3ffff740:  00000000 00000000 3fff31cc 00000000  
3ffff750:  3fffdad0 3fff1080 3fff121c 3fff1248  
3ffff760:  3fffdad0 00000000 3fff121c 4020a967  
3ffff770:  40209ac8 feefeffe 00000001 3fff0eb8  
3ffff780:  40209ac8 00000000 40213b38 40100114  
3ffff790:  00000001 00000000 00000000 00000000  
3ffff7a0:  3fc00000 40000000 0000005f 3fff0da4  
3ffff7b0:  00010001 42be0000 00000048 feefeffe  
3ffff7c0:  feefeffe 00000000 74207755 74736b65  
3ffff7d0:  36302320 00000000 00000000 00000000  
3ffff7e0:  00000000 00000000 00000000 00000000  
3ffff7f0:  00000000 00000000 00000000 00000000  
3ffff800:  00000000 00000000 00000000 00000000  
3ffff810:  00000000 00000000 00000000 00000000  
3ffff820:  00000000 00000000 00000000 00000000  
3ffff830:  00000000 00000000 00000000 00000000  
3ffff840:  00000000 00000000 00000000 00000000  
3ffff850:  00000000 00000000 00000000 00000000  
3ffff860:  00000000 00000000 00000000 00000000  
3ffff870:  00000000 00000000 00000000 00000000  
3ffff880:  00000000 00000000 00000000 00000000  
3ffff890:  00000000 00000000 00000000 00000000  
3ffff8a0:  00000000 00000000 00000000 00000000  
3ffff8b0:  00000000 00000000 00000000 00000000  
3ffff8c0:  00000000 00000000 00000000 00000000  
3ffff8d0:  00000000 00000000 00000000 00000000  
3ffff8e0:  00000000 00000000 00000000 00000000  
3ffff8f0:  00000000 00000000 00000000 00000000  
3ffff900:  00000000 00000000 00000000 00000000  
3ffff910:  00000000 00000000 00000000 00000000  
3ffff920:  00000000 00000000 00000000 00000000  
3ffff930:  00000000 00000000 00000000 00000000  
3ffff940:  00000000 00000000 00000000 00000000  
3ffff950:  00000000 00000000 00000000 00000000  
3ffff960:  00000000 00000000 00000000 00000000  
3ffff970:  00000000 00000000 00000000 00000000  
3ffff980:  00000000 00000000 00000000 00000000  
3ffff990:  00000000 ??????bL??*??D??9;????????.??K??????
AP IP address: 192.168.4.1
HTTP server started
Starting  ITimer OK

This is the exception decoder output

ESP Exception Decoder
Sketch: Wifi_AP_LichtKrant_v10 FQBN: esp8266:esp8266:nodemcuv2

Panic core_esp8266_main.cpp:191 __yield

>>>stack>>>

ctx: sys
sp: 3ffff570 end: 3fffffb0 offset: 0010
3ffff580:  00000000 00000001 00000000 40211905  
3ffff590:  00000000 3fff05c8 3fff104c 40206b13  
3ffff5a0:  000020c0 00000418 3ffe85f0 000004ee  
3ffff5b0:  000004ee 00000001 3ffff674 4021056f  
3ffff5c0:  3fff1270 00000001 3ffff674 402108f4  
3ffff5d0:  3fff1270 0000007e 3fff3394 3fff437c  
3ffff5e0:  3fff1270 00000000 3ffff674 00000000  
3ffff5f0:  3fff05c8 3fff08c8 3ffe9440 4020a408  
3ffff600:  0000adb2 00000001 40211834 00000001  
3ffff610:  0000adb2 00000b68 4021493c 00000000  
3ffff620:  000003e8 00000001 00000000 00000000  
3ffff630:  00000000 4020d6a0 00000000 00000000  
3ffff640:  3fff104c 3fff0f94 3fff0ec8 40209118  
3ffff650:  3fff3394 04ee04ef 8a002045 3fff3dec  
3ffff660:  033b033f 8a002020 3fff4134 0231023f  
3ffff670:  8a006c62 3fff437c 04ee04ef 80000000  
3ffff680:  3fff0f20 3fff2588 00000000 6bdae720  
3ffff690:  0000111c 00000000 000f0000 3fff1248  
3ffff6a0:  3fff1270 00000001 3fff2c04 40207ed9  
3ffff6b0:  00000000 3fff0f20 3fff0ec8 402099b0  
3ffff6c0:  00000000 00000000 3fff32d4 00000000  
3ffff6d0:  00000000 3fafc557 00000000 bc786c6b  
3ffff6e0:  000017a0 000002f4 00000000 000f000f  
3ffff6f0:  00000000 00000000 000f0000 00000000  
3ffff700:  00000000 000f0000 00000000 6bdae720  
3ffff710:  00000000 00000000 3fff0ec8 3fff1248  
3ffff720:  3fffdad0 3fff0efc 3fff0ec8 4020a82a  
3ffff730:  40214698 00000000 00001388 4020c47a  
3ffff740:  00000000 00000000 3fff31cc 00000000  
3ffff750:  3fffdad0 3fff1080 3fff121c 3fff1248  
3ffff760:  3fffdad0 00000000 3fff121c 4020a967  
3ffff770:  40209ac8 feefeffe 00000001 3fff0eb8  
3ffff780:  40209ac8 00000000 40213b38 40100114  
3ffff790:  00000001 00000000 00000000 00000000  
3ffff7a0:  3fc00000 40000000 0000005f 3fff0da4  
3ffff7b0:  00010001 42be0000 00000048 feefeffe  
3ffff7c0:  feefeffe 00000000 74207755 74736b65  
3ffff7d0:  36302320 00000000 00000000 00000000  
3ffff7e0:  00000000 00000000 00000000 00000000 
3ffff7f0:  00000000 00000000 00000000 00000000  
3ffff800:  00000000 00000000 00000000 00000000  
3ffff810:  00000000 00000000 00000000 00000000 

Could not recognize stack trace/backtrace

Paste exception to decode...

i tried also pasting the block after the second ----- CUT HERE with all of the heading and tried with ever less rows. but all gives the same result.

Kind regards

dankeboy36 commented 8 months ago

I looked into it, @r-hmn, and I could reproduce the same behavior, but I do not think this is a decoder bug. Your stack dump looks invalid. See here, ESP8266 stack dump starts with >>>stack>>> and ends with <<<stack<<<. Yours not.

Your starts with this:


User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Panic core_esp8266_main.cpp:191 __yield

>>>stack>>>

ctx: sys
sp: 3ffff570 end: 3fffffb0 offset: 0010
3ffff580:  00000000 00000001 00000000 40211905  

And another stack dump comes in before the other dump is fully printed(?):

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Panic core_esp8266_main.cpp:191 __yield

>>>stack>>>

ctx: sys
sp: 3ffff290 end: 3fffffb0 offset: 0010
3ffff2a0:  00000000 00000000 00000000 40103132  

You should ask the Arduino forum (https://forum.arduino.cc/c/software/ide-2-x/93) why you see two stack dumps. Share the board and your sketch (if you can) with the community. The decoder will work once you figure out how to have one stack dump.

dankeboy36 commented 8 months ago

another stack dump comes in before the other dump is fully printed(?):

Maybe it's due to the serial monitor in IDE2: https://github.com/arduino/arduino-ide/issues/1081.

You can print the monitor to an actual terminal and copy it back to the decoder terminal.

% pwd
/Applications/Arduino IDE.app/Contents/Resources/app/lib/backend/resources
% ./arduino-cli version
arduino-cli  Version: 0.34.0 Commit: 304d48cd Date: 2023-08-22T15:54:20Z
% ./arduino-cli monitor -p /dev/cu.usbmodem14101
Connected to /dev/cu.usbmodem14101! Press CTRL-C to exit.
count=10000000, lines/sec=0
count=10000001, lines/sec=0
count=10000002, lines/sec=0
count=10000003, lines/sec=0
count=10000004, lines/sec=0

Now, you can check if you really see two stack dumps overwriting each other. If you see the dump between >>>stack>>> and <<<stack<<<. It's an IDE2 bug with the monitor, and the decoder should work. If you see two starting >>>stack>>> tags but no trailing one, I would ask on the Arduino forum.

I hope this helps.

r-hmn commented 8 months ago

The github you listed is about the selection itself changing. it's quite an anoyance indeed. Thanks for the aduino-cli explanation. that will come in handy the next time.

The stacktrace which i mentioned is how it is listed on the output. Some times there's one stacktrace, sometime i get two. it's probably an indicator of how bad the program is failing :) but i don't recall it having the form as what you linked to.

i copied it in multiple parts to get the whole thing properly reported here. But when i post it to the exception decoder, i use one stacktrace at the time, starting after the ---CUT..

r-hmn commented 8 months ago

I looked into it, @r-hmn, and I could reproduce the same behavior, but I do not think this is a decoder bug. Your stack dump looks invalid. See here, ESP8266 stack dump starts with >>>stack>>> and ends with <<<stack<<<. Yours not.

You should ask the Arduino forum (https://forum.arduino.cc/c/software/ide-2-x/93) why you see two stack dumps. Share the board and your sketch (if you can) with the community. The decoder will work once you figure out how to have one stack dump

Thanks. i will. Cheers

r-hmn commented 8 months ago

Update; I posted my problem here. Turned out i was writing outside a buffer and my stack sometimes got overwritten because memory/stack is quite full, hence strange errors happened.

r-hmn commented 8 months ago

Would just appending the text <<<stack<<< be a way to let the decoder recognize and decode the top part of the stack? (it does print a decoded stack result)

dankeboy36 commented 8 months ago

Would just appending the text <<<stack<<< be a way to let the decoder recognize

Yes. I did the same with your initial example (https://github.com/dankeboy36/esp-exception-decoder/issues/11#issue-1959203954). If added the closing <<<stack<<<, the decoder could recognize and parse the stack.

and decode the top part of the stack?

I think, yes. I am unsure whether it's correct or complete, though.