[Issue 22905] New: gdb backtrace contains wrong location
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 20 10:33:09 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22905
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 at puremagic.com
Reporter: tim.dlang at t-online.de
The following example produces a wrong backtrace in gdb:
//////////////////// mod_a.d /////////////////////
import mod_b;
void main()
{
funcB();
}
//////////////////// mod_b.d /////////////////////
import mod_c;
void funcB()
{
funcC(0);
}
//////////////////// mod_c.d /////////////////////
void funcC(T)(T param, void delegate() dg = null)
{
asm
{
hlt;
}
}
//////////////////////////////////////////////////
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;
#0 mod_c.funcC!(int).funcC(int, void() delegate) (dg=..., param=0) at
./mod_c.d:5
#1 0x000055555559772c in mod_b.funcB() () at ./mod_c.d:1
#2 0x00005555555976e5 in D main () at ./mod_a.d:4
The backtrace contains the wrong location ./mod_c.d:1 for function funcB.
Correct would be ./mod_b.d:4.
--
More information about the Digitalmars-d-bugs
mailing list