Skip to content

Conversation

archef2000
Copy link
Contributor

@archef2000 archef2000 commented Apr 3, 2025

Description

Related

espressif/vscode-esp-idf-web-extension#26

Testing

OS: Windows
Browser: Chrome

  • run console with and without elf file(s)

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Git history is clean — commits are squashed to the minimum necessary.

@archef2000
Copy link
Contributor Author

This should now be able to decode rom and app elf files with a working live example. @brianignacio5

@igrr
Copy link
Member

igrr commented Apr 7, 2025

Question, should the panic decoder perhaps be its own package, not part of esptool-js? It seems that flashing is a common thing for ESP32 series chips, while decoding the panic handler output is tightly coupled with ESP-IDF.

For comparison, in Python ecosystem we have separate esptool package for flashing and esp-idf-panic-decoder for the handling of ESP-IDF crash dumps.

@archef2000
Copy link
Contributor Author

I already put the elf file decoder in a seperate package and the panic decoder is not a lot of code for it to feasible. And it was recommended by @brianignacio5 to move it from the vscodr-esp-idf-web extension to esptool-js

@archef2000
Copy link
Contributor Author

@igrr Do you insist on it being its own package? I just don't like that deep level of unnecessary abstraction, as it results in a difficult to undestand code (It took myself some time of put together to pieces of the python implementation, because I needed to search and reference code from many different repos) and when an improvement is made it takes 3-4 merges

@igrr
Copy link
Member

igrr commented May 4, 2025

I don't insist on anything... I just find it odd that a flashing tool (which could, for instance, be used to Flash a Zephyr or a Rust application, which would have a totally different panic output format) would "know" something specific to esp-idf. You can leave the code in esptool-js if you find that more convenient.

@archef2000
Copy link
Contributor Author

I isn't esp-idf specific. It should work with any elf file.

@archef2000
Copy link
Contributor Author

The console output gets checked for hex numbers (0x...) and then get decoded. The decoding proccess relies on th compiler having put the debug info into to elf file. Which then just gets parsed to get the function (if available line) to address relation. All that is defined in the elf spec.

@igrr
Copy link
Member

igrr commented May 4, 2025

Ah, I see, apologies for not properly reading what your PR does. I agree that part is not ESP-IDF-specific.
(I was hoping that the panic decoder would actually reconstruct the backtraces, similar to what esp-idf-panic-decoder is doing.)
Minor suggestion, perhaps src/panic_decoder.ts could be renamed to src/address_decoder.ts to match the class name and indicate that it's just decoding addresses, not processing panic handler output specifically.

@archef2000
Copy link
Contributor Author

I don't know what the esp-idf-panic-decoder does more than just decode every address it sees to a line. I saw no output difference between it and mine.

@archef2000
Copy link
Contributor Author

archef2000 commented Jun 28, 2025

Sorry for taking so long. I now renamed it to match the class.

@archef2000
Copy link
Contributor Author

@igrr Do you mind taking a look at the PR now?

@archef2000
Copy link
Contributor Author

archef2000 commented Oct 15, 2025

@igrr Will conside to merge it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants