linux linenumbers in stacktraces and druntime/phobos debug builds..
Jonathan M Davis
jmdavisProg at gmx.com
Mon Feb 6 14:59:54 PST 2012
On Monday, February 06, 2012 21:36:38 simendsjo wrote:
> I get an segfault in druntime, but have no idea where to start looking.
> _D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5pos
> ix6signal9siginfo_tPvZv+0x3c
>
> I cannot seem to find a way to enable line numbers in traces (adding -g
> adds line numbers in win, but not linux), and I cannot find any debug
> build of libphobos2.a - is it included? what is it called?
>
> PS: using dmd 2.057 on kubuntu x64 using the deb package from
> digitalmars.com
Posix' backtrace facilities do not provide a way to get the file names or line
numbers - just the addresses and symbol names (though the fact that module
names and file names are normally the same makes it so that the file name is
essentially in the symbol name in D). Now, according to this answer on
stackoverflow
http://stackoverflow.com/questions/3151779/how-its-better-to-invoke-gdb-from-
program-to-print-its-stacktrace/4611112#4611112
it looks like it's possible to use addr2line to do the job under at least some
circumstances. So, it may be possible to add it to druntime, but there's no
way for you to just enable it.
Now, the stack traces _do_ give you the addresses, so you could use addr2line
yourself to get the file and line numbers for at least some of the stack trace
(some lines will probably yield ??:0). You _will_ have to compile with -g for
that to work though (otherwise _all_ lines will yield ??:0).
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list