Line numbers in backtraces (2017)

Moritz Maxeiner moritz at ucworks.org
Thu Nov 2 21:36:58 UTC 2017


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 at 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


More information about the Digitalmars-d-learn mailing list