Bug 10679 – Stack traces generated are inaccurate

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-20T03:37:00Z
Last change time
2015-09-22T06:56:44Z
Assigned to
nobody
Creator
yazan.dabain

Comments

Comment #0 by yazan.dabain — 2013-07-20T03:37:42Z
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.
Comment #1 by yazan.dabain — 2015-09-22T06:56:44Z
The stack trace printed contained the address of the next instruction to be executed on return. This was changed in https://github.com/D-Programming-Language/druntime/commit/8822115bc8d52fa61c15cef38fe77349f18747b9.