-
Notifications
You must be signed in to change notification settings - Fork 70
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
Implement DWARF parser for better stack traces #149
Comments
Do you have before/after example? |
So for example, we have the following stack traces for Rust binary:
where all the symbols are mangled by rustc and looks not human readable. This is because the function names in If you look at the Rust binary's header: you will find the
and you could see un-mangled file and directory names in the
and the section is basically allowing us to lookup the file and dir name by the address, and the address used in the section is calculated by the wasm-c-api's |
+the line number corresponding to the address |
realized that we need to parse debug_info too for translating addresses to function names. |
I think it's fine to use I think we should try to demangle the symbols instead, since that works even without |
mangling scheme is language (more precisely, compiler frontend)-specific one. You can see that TinyGo does not mangle symbols and use the The point is whether we want to have line and file information or not, and if the demangled symbols can have enough information, we should try implementing demangler for each language. In anyway, this would require us to have much cycles to complete, but I would like to provide better debugging experience to users in the long rune 🙂 |
found the Rust demangler https://github.com/alexcrichton/rustc-demangle/blob/master/src/v0.rs so maybe we could port this to C++ code here to provide better stack trace for Rust. |
We can link |
OK, that would be nice. just curious do we have any external dependency criteria here in Proxy-Wasm project like Envoy does? |
We have such criteria yet, and that dependency looks trivial... but we'd need to convince Envoy to approve it as a dependency, which might be a bit painful, considering the latest use of OSSF Scorecard, etc. |
I found that Rust binary somehow comes with both of C/C++ mangled symbols (starts with So maybe demangling symbols is much more harder than I though 😞 |
Luckily our SDK languages except AsmScript are LLVM based ones so we have
.debug_line
custom section as long as modules compiled with debug info.I think it's really useful for users if we have minimum implementation of a parse for it and use it for better stack traces (demangled symbols with file names) when the section is available.
This may come with some computational cost so this would be trade-off between mangled-yet-effecient stack traces with name custom section vs demagnled-yet-expensive one.
I have WIP code in my local but yet to be able to finish until I have much cycles to work on this. maybe we could use LLVM's full fledged DWARF parser internally used for llvm-dwarfdump but I think it would be too much just for parsing debug_line.
edited: If we want to get function names, then we have to parse debug_info as well. I wonder if V8 already has API(s) for getting DWARF informations.
The text was updated successfully, but these errors were encountered: