www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - line numbers in linux stack traces?

reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
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.
Oct 05 2014
next sibling parent reply "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
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.
Oct 05 2014
parent "yazd" <yazan.dabain gmail.com> writes:
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.
Oct 07 2014
prev sibling parent "Sag Academy" <sagacademyjaipur gmail.com> writes:
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.
Oct 07 2014