www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Can't debug dmd binary

reply Jerry <jlquinn optonline.net> writes:
Hi folks,

I'm unable to debug binaries built with dmd 2.065.  The platform is
x86-64 Ubuntu 14.04.  This is gdb 7.7.

If I have a simple program:

nodebug.d:

void main() {
  int i;
  i = 3;
}

dmd -g nodebug.d

jlquinn wyvern:~/d$ gdb nodebug 
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from nodebug...done.
(gdb) b main
Breakpoint 1 at 0x416ecc
(gdb) run
Starting program: /home/jlquinn/d/nodebug 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, 0x0000000000416ecc in main ()
(gdb) l
1	dl-debug.c: No such file or directory.
(gdb) 


Using dmd -gc doesn't help at all.  Any suggestions?

Thanks
Jerry
Jun 19 2014
next sibling parent "Dicebot" <public dicebot.lv> writes:
'main` is C main function inside druntime. Your program entry 
point is _Dmain. You may also want to try git master built of gdb 
with Iain Buclaw patches for enhanced D support - those are 
awesome beyond imagination and, among other things, add support 
for D symbol (de)mangling :)
Jun 20 2014
prev sibling parent reply Lionello Lunesu <lionello lunesu.remove.com> writes:
On 20/06/14 11:00, Jerry wrote:
 Hi folks,

 I'm unable to debug binaries built with dmd 2.065.  The platform is
 x86-64 Ubuntu 14.04.  This is gdb 7.7.

 If I have a simple program:

 nodebug.d:

 void main() {
    int i;
    i = 3;
 }

 dmd -g nodebug.d

 jlquinn wyvern:~/d$ gdb nodebug
 GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
 Copyright (C) 2014 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 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 "x86_64-linux-gnu".
 Type "show configuration" for configuration details.
 For bug reporting instructions, please see:
 <http://www.gnu.org/software/gdb/bugs/>.
 Find the GDB manual and other documentation resources online at:
 <http://www.gnu.org/software/gdb/documentation/>.
 For help, type "help".
 Type "apropos word" to search for commands related to "word"...
 Reading symbols from nodebug...done.
 (gdb) b main
 Breakpoint 1 at 0x416ecc
 (gdb) run
 Starting program: /home/jlquinn/d/nodebug
 [Thread debugging using libthread_db enabled]
 Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

 Breakpoint 1, 0x0000000000416ecc in main ()
 (gdb) l
 1	dl-debug.c: No such file or directory.
 (gdb)


 Using dmd -gc doesn't help at all.  Any suggestions?

 Thanks
 Jerry
$gdb nodebug (gdb) b _Dmain (gdb) r
Jun 20 2014
parent Jerry <jlquinn optonline.net> writes:
Lionello Lunesu <lionello lunesu.remove.com> writes:

 On 20/06/14 11:00, Jerry wrote:
 (gdb) b main
 Breakpoint 1 at 0x416ecc
 (gdb) run
 Starting program: /home/jlquinn/d/nodebug
 [Thread debugging using libthread_db enabled]
 Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

 Breakpoint 1, 0x0000000000416ecc in main ()
 (gdb) l
 1	dl-debug.c: No such file or directory.
 (gdb)


 Using dmd -gc doesn't help at all.  Any suggestions?

 Thanks
 Jerry
$gdb nodebug (gdb) b _Dmain (gdb) r
That helps. I had thought a lot of D support was already in gdb. I'm surprised this doesn't work. Iain, is this fix not in stock gdb yet? Jerry
Jun 20 2014