www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10679] New: Stack traces generated are inaccurate

http://d.puremagic.com/issues/show_bug.cgi?id=10679

           Summary: Stack traces generated are inaccurate
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: yazan.dabain gmail.com


--- Comment #0 from yazan.dabain gmail.com 2013-07-20 03:37:42 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 20 2013