Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Stack decoder script #8661

Merged
merged 9 commits into from
Dec 16, 2022
Merged

Stack decoder script #8661

merged 9 commits into from
Dec 16, 2022

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Aug 23, 2022

subj
Needs toolchain path, elf path, and the postmortem either as a file or piped into stdin
Not as colorful as java decoder, though. Like monitor filter, tries to 'update' already existing data with our knowledge of addresses and source locations.

Based on the code from

Defaults to addr2line, which seems to be working just fine.
Optional GDB info output
(could be list, but I hope if there's an easier way than to parse it yet again like java version does)

resolves #6310 , but probably needs some mention in the documentation

@mcspr
Copy link
Collaborator Author

mcspr commented Aug 23, 2022

#include <Arduino.h>

int* somewhere { nullptr };

void setup() {
    delay(5000);
    Serial.begin(115200);
    Serial.printf("%d\n", *somewhere);
}

void loop() {
}
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

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

>>>stack>>>

ctx: cont
sp: 3ffffe00 end: 3fffffd0 offset: 0190
3fffff90:  0001c200 0000001c 00000000 402018d9
3fffffa0:  3fffdad0 00000000 3ffee4bc 40201055
3fffffb0:  feefeffe feefeffe 3ffee510 40201954
3fffffc0:  feefeffe feefeffe 3ffe85d8 40100c39
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------
> decoder.py --toolchain-path ~/.platformio/packages/toolchain-xtensa/ --elf-path .pio/build/d1_mini/firmware.elf stack.txt

Exception (28) - LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
epc1=0x4020105f: setup at /home/runner/dev/arduino8661/src/main.cpp:8


0x402018d9: esp_delay at /home/runner/.platformio/packages/framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910/cores/esp8266/core_esp8266_main.cpp:158
0x40201055: setup at /home/runner/dev/arduino8661/src/main.cpp:8
0x40201954: loop_wrapper() at /home/runner/.platformio/packages/framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910/cores/esp8266/core_esp8266_main.cpp:244
0x40100c39: cont_wrapper at ??:?

either for when tools are already in PATH
or, using `pio pkg exec --package toolchain-xtensa python decoder.py ...`
(where package is a full version spec for pio registry)
@d-a-v d-a-v added the alpha included in alpha release label Sep 13, 2022
@d-a-v d-a-v added this to the 3.1 milestone Sep 13, 2022
@d-a-v d-a-v merged commit eda64f6 into esp8266:master Dec 16, 2022
@mcspr mcspr deleted the tools/decoder branch January 7, 2023 00:18
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
alpha included in alpha release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a CLI version of ESPExceptionDecoder
2 participants