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: ESP exception decoder tool for Arduino IDE #1

Merged
merged 1 commit into from
Jul 3, 2023
Merged

Conversation

@dankeboy36 dankeboy36 marked this pull request as draft May 25, 2023 16:28
@dankeboy36 dankeboy36 marked this pull request as ready for review May 25, 2023 16:31
@dankeboy36 dankeboy36 changed the title Init feat: ESP exception decoder tool for Arduino IDE Jun 20, 2023
README.md Outdated Show resolved Hide resolved
findElfPath(sketchFolderName, buildPath),
]);
if (!elfPath) {
throw new DecodeParamsError(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually pick the .elf file?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will implement it in the first iteration if there is a request. Otherwise, maybe later.

There are cases where user interaction is required by an extension tool (e.g., the ESP8266 fs tool asks for confirmation before creating an empty image), but for the .elf lookup, the CLI should be sufficient to locate the file. The behavior could be unpredictable if users can pick any arbitrary elf files.

Let's see what will be the first user feedback. But I would postpone making this feature parity with the original implementation.

src/decoder.ts Outdated Show resolved Hide resolved
@kittaakos
Copy link

When the path to the file contains spaces, the terminal coloring is broken.

PC: 0x400d129d: loop() (C:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1\neste at with parentheses)\sketch_3\sketch_3.ino:4
EXCVADDR: 0x00000000

Decoding stack results
0x400d129a: loop() (C:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1\neste at with parentheses)\sketch_3\sketch_3.ino:3
0x400d2305: loopTask(void*) at C:\Users\kittaakos\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\cores\esp32\main.cpp:50

Paste exception to decode...

The raw debug message:

updateState: {"decoderResult":{"registerLocations":{"PC":{"address":"0x400d129d","file":"with parentheses)\\sketch_3/sketch_3.ino","line":"4","method":"loop() (C:\\Users\\kittaakos\\Desktop\\sketchbooks\\test_sketchbook__1\\neste"},"EXCVADDR":"0x00000000"},"stacktraceLines":[{"address":"0x400d129a","file":"with parentheses)\\sketch_3/sketch_3.ino","line":"3","method":"loop() (C:\\Users\\kittaakos\\Desktop\\sketchbooks\\test_sketchbook__1\\neste"},{"address":"0x400d2305","file":"C:\\Users\\kittaakos\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.9\\cores\\esp32\\main.cpp","line":"50","method":"loopTask(void*)"}]},"statusMessage":"Paste exception to decode..."}
newState: {"decoderResult":{"registerLocations":{"PC":{"address":"0x400d129d","file":"with parentheses)\\sketch_3/sketch_3.ino","line":"4","method":"loop() (C:\\Users\\kittaakos\\Desktop\\sketchbooks\\test_sketchbook__1\\neste"},"EXCVADDR":"0x00000000"},"stacktraceLines":[{"address":"0x400d129a","file":"with parentheses)\\sketch_3/sketch_3.ino","line":"3","method":"loop() (C:\\Users\\kittaakos\\Desktop\\sketchbooks\\test_sketchbook__1\\neste"},{"address":"0x400d2305","file":"C:\\Users\\kittaakos\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.9\\cores\\esp32\\main.cpp","line":"50","method":"loopTask(void*)"}]},"statusMessage":"Paste exception to decode..."}
redrawTerminal: ESP Exception Decoder
Sketch: �[32msketch_3�[0m FQBN: �[32mesp32:esp32:esp32da�[0m

AJ1Guru Meditation Error: Core  1 panic'ed (Unhandled debug exception). 
Debug exception reason: BREAK instr 
Core  1 register dump:
PC      : 0x400d129d  PS      : 0x00060836  A0      : 0x800d2308  A1      : 0x3ffb2270  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000014  A5      : 0x00000004  
A6      : 0x3ffb8188  A7      : 0x80000001  A8      : 0x800d129d  A9      : 0x3ffb2250  
A10     : 0x00002710  A11     : 0x00000000  A12     : 0x00000001  A13     : 0x00000003  
A14     : 0x00000001  A15     : 0x0000e100  SAR     : 0x00000003  EXCCAUSE: 0x00000001  
EXCVADDR: 0x00000000  LBEG    : 0x40085e50  LEND    : 0x40085e5b  LCOUNT  : 0xffffffff  


Backtrace: 0x400d129a:0x3ffb2270 0x400d2305:0x3ffb2290

�[31mPC�[0m: �[32m0x400d129d�[0m: �[34;1mloop() (C:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1\neste�[0m at with parentheses)\sketch_3\�[1msketch_3.ino�[0m:�[1m4�[0m
�[31mEXCVADDR�[0m: �[32m0x00000000�[0m

Decoding stack results
�[32m0x400d129a�[0m: �[34;1mloop() (C:\Users\kittaakos\Desktop\sketchbooks\test_sketchbook__1\neste�[0m at with parentheses)\sketch_3\�[1msketch_3.ino�[0m:�[1m3�[0m
�[32m0x400d2305�[0m: �[34;1mloopTask(void*)�[0m at C:\Users\kittaakos\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\cores\esp32\�[1mmain.cpp�[0m:�[1m50�[0m

Paste exception to decode...

image

@dankeboy36
Copy link
Owner Author

When the path to the file contains spaces, the terminal coloring is broken.

The parenthesis in the path was the problem. Fixed in e05fb26.

The whitespace in the path causes the terminal link resolver to stop working in Theia. Maybe it's unsupported. In this case, here is the reference implementation: microsoft/vscode#97941

README.md Outdated Show resolved Hide resolved
@dankeboy36
Copy link
Owner Author

@per1234 and @me-no-dev, could you please help me verify the first release? If yes, here are the steps:

I am open to any feedback. Thank you!

@dankeboy36 dankeboy36 changed the title feat: ESP exception decoder tool for Arduino IDE ESP exception decoder tool for Arduino IDE Jun 25, 2023
@dankeboy36 dankeboy36 changed the title ESP exception decoder tool for Arduino IDE feat: ESP exception decoder tool for Arduino IDE Jun 25, 2023
Copy link
Collaborator

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether anything can be done about it in this extension, but I thought it at least worth mentioning that this causes a "Split Terminal" icon to appear on the bottom panel toolbar:

image

This is a bit unexpected since we would normally only expect this to be shown when a terminal view is selected in the panel.

More significantly, this causes Arduino IDE to be impacted by a bug in Theia:

eclipse-theia/theia#12357

It adds a new "Split Terminal" button on the IDE toolbar:

image

An out of place "Split Terminal" icon on the editor toolbar:

image

And another out of place "Split Terminal" icon on the Debug view toolbar:

image

I see a fix is in progress:
eclipse-theia/theia#12626

@dankeboy36
Copy link
Owner Author

I'm not sure whether anything can be done about it in this extension, but I thought it at least worth mentioning that this causes a "Split Terminal" icon to appear on the bottom panel toolbar:

Thank you! Good idea. I can disable it in IDE2 at arduino/arduino-ide#2110 or in another PR.

I see a fix is in progress:
eclipse-theia/theia#12626

I will make the same change in IDE2.

I will also cherry-pick eclipse-theia/theia#12587 into the Arduino IDE.

@dankeboy36
Copy link
Owner Author

I can disable it in IDE2 at arduino/arduino-ide#2110 or in another PR.

I will also cherry-pick eclipse-theia/theia#12587 into the Arduino IDE.

The changes are in IDE2: arduino/arduino-ide#2110

Signed-off-by: dankeboy36 <dankeboy36@gmail.com>
@dankeboy36 dankeboy36 merged commit 227732e into main Jul 3, 2023
@dankeboy36 dankeboy36 deleted the init branch July 3, 2023 16:28
@dankeboy36
Copy link
Owner Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants