-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Add a CLI version of ESPExceptionDecoder #6310
Comments
This CLI decoder has worked for me in the past https://github.com/littleyoda/EspStackTraceDecoder |
Thanks @liebman. It needs a little updating (it still uses addr2line which has issues with reporting on the Xtensa architecture and is missing the last failed allocation parsing) but OTW looks like something I can add to the toolchain build and be part of the installed binaries easily enough! |
I was just looking at it as well and came across this one (I've not used it): https://github.com/luffykesh/EspExceptionDecoder-CLI |
I was also thinking it should not be too hard to implement in python which may be easier for PlatformIO and other non-java based tool sets. |
Jackpot on #6310 (comment). It's a fork of the GUI with the GUI bits stripped off. It has my updates to use GDB and parse the OOM error already, so that's a plug-and-play one. A Python or even a compiled C++ app would also be pretty trivial, like you suggested. Really, it is just a wrapper for gdb, so parsing the text and finding the PC/EXCVPC/STACK/OOM-Line are the only complicated tasks. |
FWIW if you update the binutils to a recent version (2.31), the issue will be solved. That version also improves objdump output by taking instruction padding into account (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=4b8e28c79356265b2c111e044142fb6d6d2db44e). |
Good to see you still around, @igrr. Looks like we're OK to use addr2line: 2.5.2 release:
And we're at whatever GNU head is for the GCC 9.1 compiler chain:
|
Just as an additional info, this small python script does the decoding using addr2line: Also, ref ESP8266 platform issue: platformio/platform-espressif8266#31 How would it be expected to be used though? PlatformIO cli supports additional custom "targets" (like |
Wow, a CLI decoder seems popular! It's trivial to add a pre-existing CLI tool to the release, but I'm definitely not the one to choose it since it seems other folks actually are running into problems. Just on the fact that it's Python (and we have Python on Win in our tools dir) and cross platform, I'm inclined to either include https://github.com/me21/EspArduinoExceptionDecoder or list it in the readme so others can find it. But PIO integration or VS.code, that seems like it needs to be handled in the respective repos, no? |
Here's another vote for including the CLI decoder. |
idf_monitor seems to be the most user friendly to me. All others need some kind of manual work to load/pipe the stacktrace into the decoder. If it ain't idf_monitor for any reason, then I'd prefer a python script to a java application. we have to have python anyway already. |
I tested nr 2 today (see #6574 ) and just a few remarks:
About the line order in the stack dump; Not sure if it was an unintended change in how the stack dump is printed, but I had to move the
|
I also didn't get any line numbers on Linux with number 2. I didn't look into it, but it should be a simple fix. The problem with idf-monitor (number 5) is that it seems to me that you can't cut-n-paste stack dumps into it since it's trying to connect to a serial port and be the master interface (vs. screen or cu or Putty/PowerTerm on Windows). Can idf-monitor.py take a snippet somehow from a file or cut-n-paste? We already have Python and PySerial installed on Windows in a private portable dir, so that's not a problem. |
Pushing this back. |
I tried idf-monitor with this "segfault.ino" sketch:
and this command-line:
and the result was:
On bare serial console it is:
The stack does not seem to be decoded. |
I don't think it should? IDF has a different output for backtrace |
Reducing 2.7.0 scope, pushing back |
Someone with a working solution or feedback post any findings ! |
FYI. In PlatformIO.ini:
It still only works while dev'ing, so I cannot use it for user provided stack dumps, but at least it is a (very good) start. |
Another interesting path:
(the line is indeed: By using
instead of
That may be interesting with makeEspArduino @plerup |
Before pushing to a further release, or closing, |
You are welcome to help with #8763 |
This is closed, but I think it's a good place to ask here. Is it necessary to build a debug environment ( |
Seems like Platform.IO doesn't have JAVA plugins, so running the stack dump decoder is not an option for them.
It would be nice to have a CLI version of the exception decoder that would take the ELF file and stack dump as input and produce the same output as the java plugin.
The text was updated successfully, but these errors were encountered: