Thread overview
line numbers in linux stack traces?
Oct 05, 2014
Nick Sabalausky
Oct 05, 2014
Vladimir Panteleev
Oct 07, 2014
yazd
Oct 07, 2014
Sag Academy
October 05, 2014
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? 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.
October 05, 2014
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.
October 07, 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.
October 07, 2014
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? 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.

yeah, I got that problem two or three times.