Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Exception Stack Trace Decoder for esp32 #1893

Closed
wants to merge 3 commits into from

Conversation

radurentea
Copy link

@radurentea radurentea commented Feb 18, 2023

Exception Stack Trace Decoder for esp32 boards with emphasised data output

Motivation

Decoding exception stack trace

Change description

Adds a component component similar stylistically with the serial monitor in which the user can paste the backtrace.

decoder.mp4

Other information

Based on the decoder from the old arduino ide (https://github.com/me-no-dev/EspExceptionDecoder)

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

Multi address decoder for esp32 boards with emphasised data output
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Feb 20, 2023
@kolipakakondal
Copy link

Hi @radurentea Could you add a screen recording to get a glimpse of this feature?

@kittaakos kittaakos removed their request for review February 27, 2023 09:20
* fix: different version of tool

I found a bug in which, the version of the tool in Arduino15 folder was different from the version the serial monitor was outputting, which would make the link unvalid (unreachable)
@radurentea
Copy link
Author

radurentea commented Mar 9, 2023

Added Screen Recording of the feature.

Also, I feel like I did not give a good enough reasoning behind this PR. I've made this feature with this discussion in mind: #58

This implementation is more for demoing purposes, since I'm not sure if it should be an external plugin or if it can be directly implemented into the ide.

If it receives the ok to be implemented directly into the ide, I can put more work into this PR, if not, I'm opened to suggestions on how to implement it as something else.

@ubidefeo
Copy link

hi @radurentea

We've been discussing this internally for a bit and came to the conclusion that such a feature should not be part of the stock IDE 2, but it should be provided when a user decides to install it, or even better as an extension to the ESP32 platform.

As we try to find ways for developers to access useful features in IDE 2.0, we've investigated the VSIX way, since Theia supports VS Code extension in that format.
Unfortunately such layer won't be able to access things which are very useful.
You want to know which board is selected, installed cores etc, and since extensions won't communicate with the CLI daemon there are a lot of limitations towards implementing this feature.

I have had a chat with @kittaakos regarding this, but maybe this PR can start a conversation and maybe an RFC.

I know for a fact that we don't have the time right now to implement a 3rd party usable API, but it's something which has been on our plate for a while and we really see a great amount of value.
I personally would love to see Stack Decoder in IDE 2 :)

I'd also invite @alranel to chime in on the discussion.

@frank26080115
Copy link

@radurentea can this be installed as some sort of overlay on top of existing IDE installations? As in, a set of files in a folder structure that the user has to simply copy and paste into an existing IDE installation directory? I looked at ed66479 and arduino-ide-frontend-module.ts and arduino-ide-frontend-module.js and it seems like this is the only file where you made insertions, the rest are new files.

Perhaps it isn't too bad having the user making a 17 line patch into one JS file to enable this feature? Maybe later a wizard can be created.

@kittaakos
Copy link
Contributor

kittaakos commented May 12, 2023

can this be installed as some sort of overlay on top of existing IDE installations?

I am not aware of any easy way of doing it. Also, it won't work with the current code base anymore, as the frontend code is directly calling server code. Here is an example.

@dankeboy36
Copy link
Contributor

@radurentea, I have different output from my ESP8266 board. Can you help me to try out your feature proposal? No matter what I copy-paste, I see no decoded output. What is the input of the Decode Box? I use 8d04969. Thanks!

My sketch:

void setup() {
Serial.begin(9600);
}
void loop() {
delay(10000);
abort();
}

(Part of) the monitor output:

[...]
21:44:58.361 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
21:44:58.427 -> ��¡�z���8����
21:45:08.533 -> User exception (panic/abort/assert)
21:45:08.566 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
21:45:08.628 -> 
21:45:08.673 -> Abort called
21:45:08.673 -> 
21:45:08.673 -> >>>stack>>>
21:45:08.673 -> 
21:45:08.695 -> ctx: cont
21:45:08.695 -> sp: 3fffff90 end: 3fffffd0 offset: 0010
21:45:08.750 -> 3fffffa0:  00002580 00000000 3ffee54c 4020104e  
21:45:08.791 -> 3fffffb0:  3fffdad0 00000000 3ffee54c 402018ac  
21:45:08.822 -> 3fffffc0:  feefeffe feefeffe 3fffdab0 40100d19  
21:45:08.888 -> <<<stack<<<
21:45:08.888 -> 
21:45:08.920 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
21:45:08.985 -> �V��5�PT�p	����
21:45:19.083 -> User exception (panic/abort/assert)
21:45:19.116 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
21:45:19.180 -> 
21:45:19.180 -> Abort called
21:45:19.212 -> 
21:45:19.212 -> >>>stack>>>
21:45:19.212 -> 
21:45:19.212 -> ctx: cont
21:45:19.244 -> sp: 3fffff90 end: 3fffffd0 offset: 0010
21:45:19.280 -> 3fffffa0:  00002580 00000000 3ffee54c 4020104e  
21:45:19.340 -> 3fffffb0:  3fffdad0 00000000 3ffee54c 402018ac  
21:45:19.374 -> 3fffffc0:  feefeffe feefeffe 3fffdab0 40100d19  
21:45:19.439 -> <<<stack<<<
21:45:19.439 -> 
21:45:19.439 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
[...]
Screen Shot 2023-05-14 at 21 44 47

@radurentea
Copy link
Author

Hi @dankeboy36,

I've made the decoder as a prototype, unfortunately, it only works for the ESP32 modules. The ESP8266 have a different format.

I could add more logic and add the regex that is needed to work for ESP8266 as well, but I'm not sure how soon I could do that because currently I don't have my hands on that chip.

If you want to have a try at it yourself, you can check the Exception Decoder from the old IDE. This is what I used as a reference https://github.com/me-no-dev/EspExceptionDecoder/blob/master/src/EspExceptionDecoder.java

Just let me know!

@dankeboy36
Copy link
Contributor

I've made the decoder as a prototype, unfortunately, it only works for the ESP32 modules.

Hi, @radurentea! I tried it with my ESP32-S2 Pico after installing the core from https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json. It did not work for me with the same sketch content. Does this prototype work with an ESP32-S2 board?

Veriy and upload worked. The monitor prints nothing, and the board connection is permanently lost. Can somebody please help? I want to try out this example to understand how it works. Thank you!

stacktrace_decoder_esp32_s2.mp4

@ubidefeo
Copy link

ubidefeo commented Jun 8, 2023

I am also unable to get the board to dump the stack after setting Debug Level to Verbose
any hint on why or how?

@dankeboy36 and I are both using an ESP32-S2 by Waveshare

@kittaakos
Copy link
Contributor

Hello, thank you for your contribution. I will close this PR without accepting it. Please use https://github.com/dankeboy36/esp-exception-decoder instead with today's nightly IDE2 from https://www.arduino.cc/en/software#nightly-builds. It's a drop-in Arduino IDE extension that you can use. If you happen to have any issues, please report them at https://github.com/dankeboy36/esp-exception-decoder/issues/new.

If you do not agree with something, please ping me.

@kittaakos kittaakos closed this Jul 6, 2023
@kittaakos kittaakos added the conclusion: declined Will not be worked on label Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: declined Will not be worked on topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants