dankeboy36 / esp-exception-decoder

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

Can it run with another elf file? #27

Open hitecSmartHome opened 2 weeks ago

hitecSmartHome commented 2 weeks ago

With the previous exception decoder you could select the .elf file before it decodes. Can it be selected with this as well?

dankeboy36 commented 2 weeks ago

Thank you for submitting the proposal.

I am aware that the original implementation has this capability, and I made it possible to specify an elf file path manually in the code, but I have never exposed this functionality to the UI.

The original implementation derives information for decoding from the boards.txt and platform.txt files, while this new implementation is based on the Arduino CLI's compile output. I have not been able to identify a compelling use case for implementing this feature, as the selected elf file and the CLI's compile output can quickly become out of sync. Additionally, I do not have the capacity to support such GitHub issues. Could you provide a specific use case for this feature? If it is reasonable, I can consider implementing it.

Please describe the scenario in which you envision using this feature. For instance, if I open IDE2 and load the previous Blink sketch, the IDE restores my previous board and port selection. Let's say an AVR Uno board has been selected (which is not supported by this extension), and the user clicks on the decode extension and selects the elf file; what should happen, or where would the stack trace come from? Adding an open file dialog action is relatively easy, but it's unclear what issue it resolves.

Thank you!

hitecSmartHome commented 2 weeks ago

Thank you for your response!

The use case for me and for a lot of other folks out there is that we don't use the Arduino IDE at all. In the past year I only opened the Arduino IDE ( 1 ) purely for decoding stack traces. I'm using Visual Studio Code for developing, mainly the PlatformIO IDE. This has the capability to catch and decode expections if your Serial monitor is open but in a lot of other cases we use Putty or other Serial terminal to monitor the esp32. In this case, since Putty and other terminals does not have this decoding capability, we only see the raw stack trace.

What I do right now is that I copy the raw stack trace from the terminal into the Arduino IDE, select the ELF file from my project which is in a totally different place than Arduino IDE and decode it.

When I open the Arduino IDE and select ESP Expection Decoder in the tools, it automatically opens up the windows file manager so I can search and select the ELF file I want. This is really good because I don't rely on any IDE or any compiler, just the raw ELF file.

The best thing would be to make the decoder into a standalone application instead of an Arduino IDE tool so anyone could use it without the IDE dependency. This way it could be integrated into any workflow and make it more robust.

For example it would be benefical to decode Core Dumps generated by IDF on crash. My application reads the Core Dump partition on boot if it was crashed the last time and I can download this data as a file. After I can open the ESP-IDF 5.2 PowerShell, cd into my project dir and run this command to decode the stack trace: esp-coredump.exe --gdb-timeout-sec 10 info_corefile -c .\CoreDump\coreDump.bin -t raw .\CoreDump\firmware.elf In order for this to work, I have to download the Core Dump data from the esp32, and place it into a separate directory along with the ELF file for decoding. This process is really long and uncomfortable.

Since there is no standalone decoder application and every version is integrated into an existing IDE or into some other program, of course I don't expect from you or from anyone else to do it since it satisfies almost every use case right now. I'm just saying that it would be really cool if this tool could select any ELF file and do not rely on the Arduino IDE's compilation pattern.

Thank you very much for reading!

per1234 commented 2 weeks ago

The best thing would be to make the decoder into a standalone application instead of an Arduino IDE tool

You can find several standalone exception decoder tools listed in the threads on these issues in the Arduino IDE 1.x tool's repo:

hitecSmartHome commented 2 weeks ago

@per1234 Thank you very much for the links. Will check them out!