www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Doesn't work: Ubuntu 10.10, DMD 2.049, GDB 7.2

reply Kyle Mallory <kyle.mallory utah.edu> writes:
Am I missing something?  I thought this was supposed to be working with 
the 7.2 release of GDB?  Is this working for anyone else?


$ cat hello.d
import std.stdio;

int main(char[][] args)
{
     writeln("hello world\n");
     writefln("args.length = %d", args.length);
     for (int i = 0; i < args.length; i++)
         writefln("args[%d] = '%s'", i, cast(char *)args[i]);
     return 0;
}

$ dmd -g hello.d

$ gdb hello
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from ./hello...done.
(gdb) list _Dmain
Die: DW_TAG_type_unit (abbrev 4, offset 0x7c)
   parent at offset: 0xb
   has children: FALSE
   attributes:
     DW_AT_byte_size (DW_FORM_data1) constant: 8
     DW_AT_type (DW_FORM_ref4) constant ref: 0x74 (adjusted)
Dwarf Error: Missing children for type unit [in module ./hello]
(gdb)q
$
Oct 14 2010
parent reply Kyle Mallory <kyle.mallory utah.edu> writes:
On 10/14/10 2:31 PM, Kyle Mallory wrote:
 Am I missing something?  I thought this was supposed to be working with
 the 7.2 release of GDB? Is this working for anyone else?

 $ dmd -g hello.d

FYI, I did get this working (mostly) by invoking: $ dmd -gc -debug hello.d I'm curious now if this is the preferred solution/only work-around. --Kyle
Oct 14 2010
parent Robert Clipsham <robert octarineparrot.com> writes:
On 14/10/10 22:00, Kyle Mallory wrote:
 On 10/14/10 2:31 PM, Kyle Mallory wrote:
 Am I missing something? I thought this was supposed to be working with
 the 7.2 release of GDB? Is this working for anyone else?

 $ dmd -g hello.d

FYI, I did get this working (mostly) by invoking: $ dmd -gc -debug hello.d I'm curious now if this is the preferred solution/only work-around. --Kyle

GDB does not, and will not support -g in its current state - the -g option introduces some custom extensions to DWARF which conflict with parts of the DWARF 4 spec. Once dmd fixes this, support will still need to be added to GDB, so yes, -gc is the correct solution. -- Robert http://octarineparrot.com/
Oct 14 2010