Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upStack traces / backtraces in Windows show everything in "main" #20351
Comments
This comment has been minimized.
This comment has been minimized.
|
cc @vadimcn |
kmcallister
added
A-debuginfo
O-windows
labels
Jan 16, 2015
This comment has been minimized.
This comment has been minimized.
tsemple
commented
Feb 15, 2015
|
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(). |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
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 comment has been minimized.
This comment has been minimized.
tsemple
commented
Feb 16, 2015
|
This clang webpage (http://clang.llvm.org/docs/MSVCCompatibility.html) On Sun, Feb 15, 2015 at 6:38 PM, Peter Atashian notifications@github.com
|
This comment has been minimized.
This comment has been minimized.
|
Being able to use the MSVC |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
For what it's worth, Rust produces correct backtraces on Windows – when ICE'ing |
This comment has been minimized.
This comment has been minimized.
|
I think this is basically fixed by #28004, so closing |
sivadeilra commentedDec 30, 2014
When
RUST_BACKTRACE=1is set and a panic occurs on Windows, the stack trace shows everything inmain. Example: