-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Stack traces / backtraces in Windows show everything in "main" #20351
Comments
cc @vadimcn |
I'm having this problem too. It makes rust very difficult to use on Windows because panics take a long time to track down. I looked into it, and the symbols produced during compile don't seem to be compatible with SymFromAddr(). The exe does has symbols which can be seen with dumpbin and nm. I googled for a while trying to figure out why the symbols are incompatible, but didn't find anything. Maybe someone else understands more about this. One way to fix this would be to use something other than SymFromAddr() to get the symbol names. I'm not sure how nm works but it seems to have enough information to do the symbol lookups. It also understand the format for the line numbers unlike both dumpbin and SymGetLineFromAddr(). |
The crux of the matter here is that Windows' dbghelp API does not understand DWARF debug info, so it only sees the exported symbols of the module. It then reports all addresses relative to the nearest exported symbol. Of which 'main' is usually the only one in an .exe module, so your whole callstack is reported relative to that. There's also an offset, but Rust's backtrace doesn't print that. |
The proper solution would be to use PDB debug info, but there's no way to generate PDBs short of depending on components of the MSVC toolchain. Maybe one day LLVM will figure it out when they work on LLD. |
This clang webpage (http://clang.llvm.org/docs/MSVCCompatibility.html) On Sun, Feb 15, 2015 at 6:38 PM, Peter Atashian notifications@github.com
|
Being able to use the MSVC |
Rust already includes libbacktrace, which can interpret DWARF; however currently it only supports ELF executables. If you feel strongly about this missing feature, you can try to teach it how to find the relevant section in Windows COFFs. |
For what it's worth, Rust produces correct backtraces on Windows – when ICE'ing |
I think this is basically fixed by #28004, so closing |
When
RUST_BACKTRACE=1
is set and a panic occurs on Windows, the stack trace shows everything inmain
. Example:The text was updated successfully, but these errors were encountered: