-
Notifications
You must be signed in to change notification settings - Fork 57
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
No line numbers with Clang due to missing DWARF .debug_aranges section #42
Comments
Perhaps recent msys2 clang is generating newer DWARF information. I'll try to update the bundled dwarf library to a newer version. Perhaps that solves the issue. |
@Optiligence , please retry with the binaries from https://github.com/jrfonseca/drmingw/releases/tag/0.9.2 that should (hopefully) become available in 15 mins or so. |
hm, it doesn’t seem to work, still i also didn’t think that they would update the DWARF spec that often (and in a breaking manner) do you have a command at hand that displays relevant sections of the binary so i can compare them between gcc and clang or post them here? |
It had been 3 years since I last updated libdwarf. And it did made a difference in the past, be from gcc using newer dwarf features or bugs. Please build the sample from https://github.com/jrfonseca/drmingw/tree/master/sample with MSYS2 Clang, and confirm it doesn't work. If that sample is too trivial to repro the issue, then please modify it to be something more complex that repros. Also confirm the clang version ( I'll then repro locally myself and try to figure out what's going on. Another interesting experiment is confirming whether the problem is the C++ compiler or the linker (as I understand clang/llvm are moving to lld.) So it would be good to know if compiling with G++ and linking with clang++ repros the issue or not, and vice versa, compiling with clang++ and linking with g++. |
i commented
|
i think they both use GNU ld by default |
The problem is that I'm not sure why. I suspect that the addresses emitted by clang have a different base offset. When I use MinGW addr2line tool, it handles clang binaries fine. Perhaps there's some relate offset for debug addresses (or flag) somewhere in DWARF info or PE I'm neglecting to . The only reason there's any symbols, is because mgwhelp is falling back to the PE's symbol table (it's not using DWARF at all.) If you have the ability/opportunity to investigate further it would be appreciated. |
@mati865 sorry to drag you in like this you don’t happen to have a quick helpful insight here? |
Sorry but I hardly know anything about debug symbols in Clang. You could try with this toolchain (there are binaries in |
Thanks @mati865 It also doesn’t work with his toolchain. (and that one uses lld)
@mstorsjo do you have a comment on this? |
It seems the problem is that clang does not generate DWARF There was a patch to add and option for this, http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20140210/099034.html , but the MSYS2 version doesn't seem to support it. Per http://wiki.dwarfstd.org/index.php?title=Best_Practices#Generating_.debug_aranges_data it sounds like generating .debug_aranges is not strictly necessary, and that drmingw should probably walk the compilation units instead.. Per rust-lang/rust#45246 this seems an issue with other Clang based languages and other tools. A solution is to pass If somebody wants to submit a patch that makes drmingw to resolve symbols, even without |
I think a solution is to iterate over compilation units, like done in https://github.com/elftoolchain/elftoolchain/blob/trunk/addr2line/addr2line.c |
Both Although it is not stated as required, it is advocated for in the DWARF wiki. |
great |
Clang does not generate DWARF aranges data by default, which makes DrMingw not able to parse the DWARF debug symbols. Add -gdwarf-aranges explicitly. See: jrfonseca/drmingw#42 (comment)
Clang does not generate DWARF aranges data by default, which makes DrMingw not able to parse the DWARF debug symbols. Add -gdwarf-aranges explicitly. See: jrfonseca/drmingw#42 (comment)
@jrfonseca Why can't the drmingw process write to the log file when the program crashes? Both CreateFile and fopen failed. |
Maybe the process has no write access to the local directory? |
Is there a solution? |
DrMinGW EXE process doesn't write anything automatically. I presume you are or want to use ExcHnld DLL, as per https://github.com/jrfonseca/drmingw/?tab=readme-ov-file#exchndl . You can choose whatever path you want the report to be written calling the |
BTW, @yuansunliang1988 this question has nothing to do with this issue. In the future, it's best to make separate questions in separate issues. |
when i compile a program with msys2 based gcc or clang built with
-g
and run it in gdb, symbols are resolved correctly to file with line numbersbut when i observe a crash with Dr. Mingw i only get line numbers and the source file content with gcc, but not with clang
i think this used to work and i’m not sure what clang would be doing differently now
what can i check to discover differences and why does it work in gdb but not Dr. Mingw?
The text was updated successfully, but these errors were encountered: