Linux 64bit, code compiled with -g flag
void main() { //line 1
auto a = 0; //line 2
func(); //line 3
} //line 4
void func() { //line 6
throw new Exception("Test"); //line 7
} //line 8
Stack generated and addresses provided are checked using addr2line, the address pointing to func (line 3) is pointing to line 2 instead.
Even when moving func above the declaration of a, the address points to the declaration of a. (i.e. points to line 3 in the following example)
void main() { //line 1
func(); //line 2
auto a = 0; //line 3
} //line 4
void func() { //line 6
throw new Exception("Test"); //line 7
} //line 8
There are two possible points where this bug might come from:
1) druntime/core/runtime lines (399 to 425) where the backtrace is generated. (BTW, why are backtrace glibc calls only producing the last address in DMD?).
2) The dwarf debug info produced by dmd are not correct.