Bug 11870 – replace dynamic symbol table (--export-dynamic) for backtraces

Status
REOPENED
Severity
major
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2014-01-05T07:13:13Z
Last change time
2024-12-07T13:33:17Z
Keywords
DebugInfo
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: dmd#17267 →

Comments

Comment #0 by code — 2014-01-05T07:13:13Z
Currently we rely on the dynamic symbol table to generate stack traces. This only works with exported functions of an executable (i.e. visibility=default) and requires the -L--export-dynamic argument. One alternative would be to use DWARF instead. It would also allow to get line numbers, but is only available in debug builds. A better compromise might be to provide MiniDebugInfo which is a compressed symbol table in .gnu_debugdata. https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html related: bug 1001 - print stack trace (in debug mode) when program die C++ DWARF backtrace library https://github.com/bombela/backward-cpp
Comment #1 by code — 2014-03-27T07:56:36Z
Comment #2 by yazan.dabain — 2014-08-01T19:14:35Z
I've just pushed an implementation for resolving addresses to lines using DWARFv2/3 debug info that uses no external dependencies. The implementation is not suitable for druntime, but it can be used as a guide. https://github.com/yazd/elf-d
Comment #3 by code — 2014-08-01T21:30:56Z
Great, this looks really interesting. It shouldn't be too hard to make a traceHandler out of this.
Comment #4 by code — 2016-09-28T16:51:02Z
Fixed by https://github.com/dlang/druntime/pull/1354, implementation is a bit inefficient and uses the GC though.
Comment #5 by code — 2016-09-28T16:51:43Z
*** Issue 7454 has been marked as a duplicate of this issue. ***
Comment #6 by yazan.dabain — 2016-09-28T17:04:10Z
I don't think this should be closed. The implementation only provides file and line information. Function names are still extracted using `backtrace_symbols` which, AFAIR, need `--export-dynamic`. BTW, the reason that the implementation is not @nogc is `core.demangle.demangle` function only.
Comment #7 by pro.mathias.lang — 2020-05-03T19:21:53Z
Yep, this is not fixed, we still rely on backtrace_symbols, and the whole backtrace code in druntime is quite lacking.
Comment #8 by robert.schadek — 2024-12-07T13:33:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17267 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB