www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22905] New: gdb backtrace contains wrong location


          Issue ID: 22905
           Summary: gdb backtrace contains wrong location
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tim.dlang t-online.de

The following example produces a wrong backtrace in gdb:

//////////////////// mod_a.d /////////////////////
import mod_b;
void main()
//////////////////// mod_b.d /////////////////////
import mod_c;
void funcB()
//////////////////// mod_c.d /////////////////////
void funcC(T)(T param, void delegate() dg = null)

The example can be compiled with:
dmd -g mod_a.d mod_b.d mod_c.d

Running it with gdb allows to show a backtrace for the hlt-instruction:
gdb --batch -ex run -ex bt ./mod_a
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
mod_c.funcC!(int).funcC(int, void() delegate) (dg=..., param=0) at ./mod_c.d:5
5               hlt;


The backtrace contains the wrong location ./mod_c.d:1 for function funcB.
Correct would be ./mod_b.d:4.

Mar 20 2022