platformio / platform-espressif8266

Espressif 8266: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/espressif8266
Apache License 2.0
323 stars 219 forks source link

ESP8266_Exception_decoder filter does not work as expected #207

Open geekbozu opened 4 years ago

geekbozu commented 4 years ago

When monitoring serial output with the filter decoder active I would expect the stack trace to get re-written Instead I get an output saying it can not find the .elf file for the build. Looking harder it seems that the build directory is getting cleared on calling of monitor.

Not sure how to fix this, I tried forcing the elf file to read only as a work around which silenced the error but still got no updated stack trace information.

stavultras commented 4 years ago

PIO Version:

You're up-to-date!
PlatformIO 4.3.4 is currently the newest version available.

For me it does nothing at all. My settings:

build_type = debug
monitor_filters = esp8266_exception_decoder

It just outputs the regular ESP crash data:

Executing task: C:\Users\Ultras\.platformio\penv\Scripts\platformio.exe device monitor <

--- Available filters and text transformations: colorize, debug, default, direct, esp8266_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on COM5  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

Exception (28):
epc1=0x4020f80f epc2=0x00000000 epc3=0x00000000 excvaddr=0x02900004 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffd30 end: 3fffffc0 offset: 0190
3ffffec0:  3ffee770 00000020 00000010 3ffee770
3ffffed0:  00000000 00000001 00000000 4020aadc  
3ffffee0:  00000005 3fff0264 3ffee770 3ffee770
3ffffef0:  3ffee770 00000001 00000000 402068ea
3fffff00:  4020d791 00000bb8 3ffeea10 3ffeea10  
3fffff10:  3fffdad0 00000000 3ffe84fc 4020631b
3fffff20:  feefeffe feefeffe feefeffe feefeffe
3fffff30:  feefeffe feefeffe feefeffe feefeffe
3fffff40:  feefeffe feefeffe feefeffe feefeffe  
3fffff50:  feefeffe feefeffe feefeffe feefeffe
3fffff60:  feefeffe feefeffe feefeffe feefeffe
3fffff70:  feefeffe feefeffe feefeffe feefeffe  
3fffff80:  feefeffe feefeffe feefeffe feefeffe
3fffff90:  feefeffe feefeffe feefeffe 3ffeea10
3fffffa0:  3fffdad0 00000000 3ffe84fc 4020c7ec  
3fffffb0:  feefeffe feefeffe feefeffe 40100fbd
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3456, room 16 
tail 0
chksum 0x84
csum 0x84
va5432625
~ld

Not sure what I'm doing wrong.

Meanwhile, when I use the output in Arduino -> ESP Exception Decoder for the same .elf file, it decodes the data properly:

Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
PC: 0x4020f80f: ModesContainer::get(unsigned char) at lib\ModeAbstract/ModeAbstract.h line 12
EXCVADDR: 0x02900004

Decoding stack results
0x4020aadc: ModesContainersContainer::add(ModesContainer*) at lib\ModesContainersContainer\ModesContainersContainer.cpp line 7
0x402068ea: modesInit() at src\modes.cpp line 27
0x4020631b: setup() at src\main.cpp line 72
0x4020c7ec: loop_wrapper() at C:\Users\Ultras\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_main.cpp line 194
sblantipodi commented 4 years ago

still using the monitor_filters = esp8266_exception_decoder, colorize but it does not work.

nothing changed with the exception decoder or without.

xsrf commented 3 years ago

Doesn't work for me either with espressif8266@2.6.3 - output doesn't change 🤷‍♂️

xsrf commented 3 years ago

Okay, it actually does work, but I ran into two issues:

stavultras commented 3 years ago

@xsrf I tried to rebuild the project many times without success after changing platformio.ini. The binary file was there and nothing was happening. Have no idea why.

Btw, it works fine with ESP32, but I guess it's another project and story.

GOB52 commented 3 years ago

@sblantipodi @xsrf

It also won't work together with the time or colorize filter

If you change the order of the monitor_filters, it might work. see also https://github.com/platformio/platform-espressif32/issues/545

sblantipodi commented 3 years ago

it worked for me by simply adding build_type = debug

saikek commented 3 years ago

You need to remember to compile / upload sketch before you debug, since it's using .elf file for mapping issue. Also, as mentioned:

[platformio]
build_type = debug
monitor_filters = esp8266_exception_decoder