www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Line numbers in backtraces (2017)

reply Tobias Pankrath <tobias pankrath.net> writes:
Hi,

I'm using ArchLinux and the recent DMD from the Arch repositories 
and my backtraces show no line numbers. I now that is an old 
issue, but I'm back to D after a long pause and I thought that 
this used to work out of the box.

My backtraces look likes this:

 ??:? pure  safe void 
 std.exception.bailOut!(Exception).bailOut(immutable(char)[], 
 ulong, const(char[])) [0xab5c9566]
 ??:? pure  safe bool std.exception.enforce!(Exception, 
 bool).enforce(bool, lazy const(char)[], immutable(char)[], 
 ulong) [0xab5c94e2]
I've found this StackOverflow Question from 2011 [1] and if I remember correctly this could be fixed by adding -L--export-dynamic which already is part of my dmd.conf cat /etc/dmd.conf
 [Environment32]
 DFLAGS=-I/usr/include/dlang/dmd -L-L/usr/lib32 
 -L--export-dynamic -fPIC
 
 [Environment64]
 DFLAGS=-I/usr/include/dlang/dmd -L-L/usr/lib -L--export-dynamic 
 -fPIC
which is in fact read by dmd:
 % dmd -v
 DMD64 D Compiler v2.076.1
 Copyright (c) 1999-2017 by Digital Mars written by Walter Bright
 
 Documentation: http://dlang.org/
 Config file: /etc/dmd.conf
How do I get useful back traces back? Thanks, Tobias [1] https://stackoverflow.com/questions/8209494/how-to-show-line-numbers-in-d-backtraces
Oct 31 2017
parent reply Moritz Maxeiner <moritz ucworks.org> writes:
On Tuesday, 31 October 2017 at 11:04:57 UTC, Tobias Pankrath 
wrote:
 [...]
 ??:? pure  safe void 
 std.exception.bailOut!(Exception).bailOut(immutable(char)[], 
 ulong, const(char[])) [0xab5c9566]
 ??:? pure  safe bool std.exception.enforce!(Exception, 
 bool).enforce(bool, lazy const(char)[], immutable(char)[], 
 ulong) [0xab5c94e2]
I've found this StackOverflow Question from 2011 [1] and if I remember correctly this could be fixed by adding -L--export-dynamic which already is part of my dmd.conf [...] [1] https://stackoverflow.com/questions/8209494/how-to-show-line-numbers-in-d-backtraces
Does using dmd's `-g` option (compile with debug symbols) not work[1]? [1] This is also what the answer in your linked SO post suggest?
Oct 31 2017
parent reply Tobias Pankrath <tobias pankrath.net> writes:
On Tuesday, 31 October 2017 at 11:21:30 UTC, Moritz Maxeiner 
wrote:
 On Tuesday, 31 October 2017 at 11:04:57 UTC, Tobias Pankrath 
 wrote:
 [...]
 ??:? pure  safe void 
 std.exception.bailOut!(Exception).bailOut(immutable(char)[], 
 ulong, const(char[])) [0xab5c9566]
 ??:? pure  safe bool std.exception.enforce!(Exception, 
 bool).enforce(bool, lazy const(char)[], immutable(char)[], 
 ulong) [0xab5c94e2]
I've found this StackOverflow Question from 2011 [1] and if I remember correctly this could be fixed by adding -L--export-dynamic which already is part of my dmd.conf [...] [1] https://stackoverflow.com/questions/8209494/how-to-show-line-numbers-in-d-backtraces
Does using dmd's `-g` option (compile with debug symbols) not work[1]? [1] This is also what the answer in your linked SO post suggest?
Of course I've tried this.
Oct 31 2017
parent reply Moritz Maxeiner <moritz ucworks.org> writes:
On Wednesday, 1 November 2017 at 06:44:44 UTC, Tobias Pankrath 
wrote:
 On Tuesday, 31 October 2017 at 11:21:30 UTC, Moritz Maxeiner 
 wrote:
 On Tuesday, 31 October 2017 at 11:04:57 UTC, Tobias Pankrath 
 wrote:
 [...]
 ??:? pure  safe void 
 std.exception.bailOut!(Exception).bailOut(immutable(char)[], 
 ulong, const(char[])) [0xab5c9566]
 ??:? pure  safe bool std.exception.enforce!(Exception, 
 bool).enforce(bool, lazy const(char)[], immutable(char)[], 
 ulong) [0xab5c94e2]
I've found this StackOverflow Question from 2011 [1] and if I remember correctly this could be fixed by adding -L--export-dynamic which already is part of my dmd.conf [...] [1] https://stackoverflow.com/questions/8209494/how-to-show-line-numbers-in-d-backtraces
Does using dmd's `-g` option (compile with debug symbols) not work[1]? [1] This is also what the answer in your linked SO post suggest?
Of course I've tried this.
Including Phobos? Your posted backtrace looks to me like templates instantiated within Phobos, so I think you'd need Phobos with debug symbols for those lines.
Nov 01 2017
parent reply Tobias Pankrath <tobias pankrath.net> writes:
 Including Phobos? Your posted backtrace looks to me like 
 templates instantiated within Phobos, so I think you'd need 
 Phobos with debug symbols for those lines.
--- int main(string[] argv) { return argv[1].length > 0; } ---
 ~ [i] % rdmd -g -debug test.d
 core.exception.RangeError test.d(3): Range violation
 ----------------
No difference when I compile with 'dmd -g -debug' and run in manually.
Nov 02 2017
parent Moritz Maxeiner <moritz ucworks.org> writes:
On Thursday, 2 November 2017 at 19:05:46 UTC, Tobias Pankrath 
wrote:
 Including Phobos? Your posted backtrace looks to me like 
 templates instantiated within Phobos, so I think you'd need 
 Phobos with debug symbols for those lines.
--- int main(string[] argv) { return argv[1].length > 0; } ---
 ~ [i] % rdmd -g -debug test.d
 core.exception.RangeError test.d(3): Range violation
 ----------------
No difference when I compile with 'dmd -g -debug' and run in manually.
That Error is thrown from within druntime. If you want to see line numbers for backtraces locations within druntime, you need to compile druntime with debug symbols. Also `-debug` only changes conditional compilation behaviour[1]. [1] https://dlang.org/spec/version.html#DebugCondition
Nov 02 2017