line numbers in linux stack traces?

yazd via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 7 02:53:59 PDT 2014


On Sunday, 5 October 2014 at 17:12:28 UTC, Vladimir Panteleev 
wrote:
> On Sunday, 5 October 2014 at 09:10:06 UTC, Nick Sabalausky 
> wrote:
>> I know this keeps getting asked every year or so, but I 
>> couldn't find recent info.
>>
>> Are line numbers in linux stack traces supposed to be working 
>> at this point?
>
> Not the ones that the program itself prints on an unhandled 
> exception. The main problem is with licensing (GPL). See here 
> for details:
> https://d.puremagic.com/issues/show_bug.cgi?id=1001
>
>> Because I'm not getting any with 2.066.0 with either -g or -gc 
>> even when running under gdb. Kind of a pain, esp. compared to 
>> D dev on windows.
>
> It should work when running under gdb. Make sure you're using a 
> recent gdb and you're not stripping the binary. If you link as 
> a separate step, you may need to pass -g to DMD during linking 
> as well. For delegates invoked through the runtime, or to see 
> stack traces of crashes inside the runtime/phobos, you may need 
> to rebuild Phobos and Druntime with -gs. Don't use -gc, it is 
> no longer relevant.

Btw, I have some code that parses elf/dwarf and maps addresses to 
file/line information here: https://github.com/yazd/elf-d

It can be adapted for druntime and used to show better stack 
traces.


More information about the Digitalmars-d-learn mailing list