4
votes



Short question: Is there any support of D2 in gdb (I have gdb 7.2) ?

Long story: I compiled next little application ...


// file main.d
int glVar = 0xAAAAAAAA;

void main()
{ 
 glVar = 0xBBBBBBBB; 
}

... using command "dmd -gc -debug main.d";
then I load it to gdb and trying to debug it:

vnm@vnm:~/proj/d_gdb_test$ gdb main
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/vnm/proj/d_gbb_test/main...done.
(gdb) b main
Breakpoint 1 at 0x804b667
(gdb) r
Starting program: /home/vnm/proj/d_gbb_test/main 
[Thread debugging using libthread_db enabled]

Breakpoint 1, 0x0804b667 in main ()
(gdb) info line
No line number information available.
(gdb) info variables glVar
All variables matching regular expression "glVar":

File main.d:
int _D4main5glVari;

Why gdb can't show line information and why it shows symbols in mangled form ? Is this software issues or I'm doing something wrong ?

1

1 Answers

4
votes

gdb has support for D starting with version 7.2. So, you can debug D programs with gdb 7.2.

Now, that doesn't mean that support is perfect - far from it in fact. For instance, I'm not sure that you can get it to print strings properly. And it's not at all surprising if it doesn't demangle D symbols. So, it works, but it's far from perfect.