-
-
Notifications
You must be signed in to change notification settings - Fork 219
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 stack trace decoding [$35] #31
Comments
we really need this..now i need to switch back to arduino ide, just do decode stack traces. |
I have created some code that decodes the addresses and is integrated into miniterm as a filter: The code is hardly tested at all, it isn't integrated with PlatformIO and all the paths are hardcoded so it is only a first step towards solving this issue. However, it is enough to continue working on my main project. |
Any progress in this issue? |
Could you look at that @Tasssadar? |
@ivankravets any chance this might get added? It would be awesome to have as much debug information as possible |
Added 15,- to the bounty to make it 50. Anyone else? |
maybe there could be just a button to copy&paste the trace to following command: |
I've used https://github.com/littleyoda/EspStackTraceDecoder as a CLI, but it'd be great if it automagically happened in VS Code. I'd like to add this for my own selfish purposes. Where could I get started at within the code / VS Code extension? Example execution: |
The Arduino one used to work for me a few weeks ago. Now it doesn't. Not sure what changed. I even reverted back to [email protected]. |
I wrote a simple psh script to filter a log file with Backtrace: sections and decode them: https://gist.github.com/HollisTech/18f7bd2963e9c33fc8b630ff414e13a9 |
This filter can decode the crash traces emitted by Espressif devices. Add '--filter=esp_exception_decoder' to monitor_flags to use it. Fixes platformio/platform-espressif8266#31
Add --filter=esp8266_exception_decoder to monitor_flags to use it. Fixes platformio#31
* Implement mechanism for adding platform filters into miniterm Updates platformio/platform-espressif8266#31 * DeviceMonitorFilter: fixes for Windows and Python2
Thanks to @Tasssadar 's great contribution this issue has been finally resolved! We need some feedback/testing before making the final release of PlatformIO Core 4.3 and this dev-platform. Please re-test:
See documentation https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#filters |
@ivankravets I've tried the upstream version of the platform, and I've also used the dev version for pio. Exception (9):
epc1=0x402193d4 epc2=0x00000000 epc3=0x40218174 excvaddr=0x04a00423 depc=0xException in thread rx:
Traceback (most recent call last):
File "C:\Users\cocus\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\cocus\AppData\Local\Programs\Python\Python37\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "c:\users\cocus\.platformio\penv\lib\site-packages\serial\tools\miniterm.py", line 452, in reader
text = transformation.rx(text)
File "C:\Users\cocus\.platformio\platforms\espressif8266@src-eb7495f88eb0afa18fedff98bfb5e40f\monitor\filter_exception_decoder.py", line 160, in rx
extra = self.process_line(line)
File "C:\Users\cocus\.platformio\platforms\espressif8266@src-eb7495f88eb0afa18fedff98bfb5e40f\monitor\filter_exception_decoder.py", line 187, in process_line
return self.process_exception_match(match)
File "C:\Users\cocus\.platformio\platforms\espressif8266@src-eb7495f88eb0afa18fedff98bfb5e40f\monitor\filter_exception_decoder.py", line 225, in process_exception_match
lines = self.get_lines([p[1] for p in pairs])
File "C:\Users\cocus\.platformio\platforms\espressif8266@src-eb7495f88eb0afa18fedff98bfb5e40f\monitor\filter_exception_decoder.py", line 265, in get_lines
subprocess.check_output(args + [addr.encode(enc)])
File "C:\Users\cocus\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 395, in check_output
**kwargs).stdout
File "C:\Users\cocus\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\cocus\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Users\cocus\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1119, in _execute_child
args = list2cmdline(args)
File "C:\Users\cocus\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 530, in list2cmdline
needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: a bytes-like object is required, not 'str' What I get from the serial console (when the esp8266 code crashes) is always this:
EDIT: I've dumped some variables on function
EDIT2: I've taken the mods from (google/adb-sync#37) and added them to the .py file. Not ideal but they do work!. However, I'm not sure if this is a fault only found on Windows or if it applies to other OSes as well. Core 4.3.0b1,Home 3.1.1, platform git hash f81f371 |
@Tasssadar could you help @cocus? |
Definitely, will take a look in the evening. Man, encodings are fun. |
Fixed in #201 and platformio/platform-espressif32#303 respectively. I tested the fix on Linux and Windows with python 2.7 and 3.7 (on 3.8, subprocess eats bytes just fine, so the bug did not manifest). |
@Tasssadar thank you so much!!! 😊 |
How can I use this feature? Please help |
Did you try to use the documentation? https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#filters |
Using PIO 4.3.3 when I Try it seems that PIO registers the filter
|
See note in log that is starting with “ Please build project...” |
if you mean using same result, only hiding the mentioned note
used this code to generate the fault Serial.begin(115200);
auto a = new int[100000000];
while (1); |
That log does not have this part:
The filter is looking for it and won't trigger unless it finds it. Can you please paste here the whole log output, with at least 2 crashes/restart in it so I can see all of the text esp8266 outputs in this case? |
It doesn't have that line!
|
Okay, thanks, I'll change it to also trigger on just the Keep in mind that your crash is rather syntetic, it just triggers the Watchdog because it's stuck, so it should work for other "regular" crashes (but the filter should definitely handle this too). |
@Tasssadar we would be thankful for your PR. |
Much appreciated, |
@Tasssadar This is my actual trace output from real time usage, it does have the
|
Thanks, @Tasssadar! @ali80 please re-test with upstream version https://docs.platformio.org/en/latest/platforms/espressif8266.html#upstream |
@Tasssadar OK, the initial example Serial.begin(115200);
auto a = new int[100000000];
while (1); works, but here is another case that still doesn't work. Serial.begin(115200);
int a = 0;
int b = 10;
int c = b / a; giving this output
|
Yep, I made a mistake in the pull request, fix is already waiting at #212 , sorry :( |
@ali80 please re-run |
Could you please also fix it for ESP32, I think it had the same problem |
@ivankravets moved to upstream and everything is up-to-date, Serial.begin(115200);
int a = 0;
int b = 10;
int c = b / a; still doestn work but Serial.begin(115200);
int a = 0;
int b = 10;
volatile int c = b / a; works! |
That's because if you're not using the I take it the issues here are solved, thanks for testing! As for Esp32, I checked its decoder, but it should already work with any line endings. If you have any trace it does not decode, please report it at https://github.com/platformio/platform-espressif32/issues |
DOH, silly me, many thanks, this was a much needed feature on PIO. |
@Tasssadar many of the faults are occasional and would not repeat that often, also most of the time there is no serial connection to the device |
There is
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rst
https://github.com/me-no-dev/EspExceptionDecoder
https://github.com/littleyoda/EspStackTraceDecoder
There is a $35 open bounty on this issue. Add to the bounty at Bountysource.
The text was updated successfully, but these errors were encountered: