Thread overview
Linux Graphical Debugger
Sep 25, 2004
teqDruid
Sep 25, 2004
Ant
Sep 25, 2004
teqDruid
Sep 25, 2004
Ant
Sep 25, 2004
John Reimer
Sep 25, 2004
Ant
Sep 25, 2004
John Reimer
September 25, 2004
Has anyone found a graphical debugger for Linux that'll display D source code?

I've found a few gdb front-ends, but I haven't been able to get a lot of them to display D source files, and other misc. problems.

Thanks
John
September 25, 2004
On Fri, 24 Sep 2004 21:24:30 -0400, teqDruid wrote:

> Has anyone found a graphical debugger for Linux that'll display D source code?
> 
> I've found a few gdb front-ends, but I haven't been able to get a lot of them to display D source files, and other misc. problems.
> 
> Thanks
> John

it's not the front-end.
it's not gdb.

There is no sufficente information on the code to do that. That was one of mine MIID.

gdb can give you the stack trace and
step by machine code instructons.

which front-ends did you find?
(I have been using DDD)

Ant


September 25, 2004
On Fri, 24 Sep 2004 22:03:18 -0400, Ant wrote:

> On Fri, 24 Sep 2004 21:24:30 -0400, teqDruid wrote:
> 
>> Has anyone found a graphical debugger for Linux that'll display D source code?
>> 
>> I've found a few gdb front-ends, but I haven't been able to get a lot of them to display D source files, and other misc. problems.
>> 
>> Thanks
>> John
> 
> it's not the front-end.
> it's not gdb.
> 
> There is no sufficente information on the code to do that. That was one of mine MIID.
> 
> gdb can give you the stack trace and
> step by machine code instructons.
> 
> which front-ends did you find?
> (I have been using DDD)
> 
> Ant

I've tried DDD, insight, and kgdb... gdb kinda works... does the debug executable not include code line numbers, and file names or something? Does GDC do it correctly?

September 25, 2004
On Fri, 24 Sep 2004 22:13:28 -0400, teqDruid wrote:

> On Fri, 24 Sep 2004 22:03:18 -0400, Ant wrote:
> 
>> On Fri, 24 Sep 2004 21:24:30 -0400, teqDruid wrote:
>> 
>>> Has anyone found a graphical debugger for Linux that'll display D source code?
>>> 
> 
> I've tried DDD, insight, and kgdb... gdb kinda works... does the debug executable not include code line numbers, and file names or something? Does GDC do it correctly?

no, from http://www.digitalmars.com/d/dcompiler.html

"
Linux Bugs

    * -g is not implemented, because I haven't figured out how to do it
    yet. gdb still works, though, at the global symbol level.
"

and "global symbol level" to me are class methods.
I don't know what you can see with non OO code.

here is what I have:

Breakpoint 1, 0x407aa9e6 in printf () from /lib/libc.so.6
(gdb) bt
#0  0x407aa9e6 in printf () from /lib/libc.so.6
#1  0x08195e11 in _D4dool6String6String7printlnFAaZv ()
#2  0x0816cb0b in _D4leds4Leds4Leds4initFAAaZv ()
#3  0x0816c9c3 in _D4leds4Leds4Leds4ledsFAAaZC4leds4Leds4Leds ()
#4  0x0816f5ba in _Dmain ()
#5  0x081b573c in main ()

as you see I put a breakpoint on printf. Why? because first I have to
find out what is the name of my method!
however it's very usefull on a segfault as you can see the stack trace.

you can also disassemble and see what functions are called. again you'll have to decode the names.

for instance from the backtrace we can see the leds.init method is at 0x0816cb0b - lets disassemble it:

(gdb) disas 0x0816cb0b
Dump of assembler code for function _D4leds4Leds4Leds4initFAAaZv:
0x0816ca68 <+0>:    push   %ebp
0x0816ca69 <+1>:    mov    %esp,%ebp
0x0816ca6b <+3>:    sub    $0x18,%esp
0x0816ca6e <+6>:    push   %ebx
0x0816ca6f <+7>:    push   %esi
0x0816ca70 <+8>:    push   %edi
0x0816ca71 <+9>:    mov    %eax,0xffffffe8(%ebp)
0x0816ca74 <+12>:   call   0x81b56b0 <_D9invariant12_d_invariantFC6ObjectZv>
0x0816ca79 <+17>:   mov    0xffffffe8(%ebp),%eax
0x0816ca7c <+20>:   mov    (%eax),%ecx
0x0816ca7e <+22>:   call   *0x3c(%ecx)
0x0816ca81 <+25>:   push   %eax
0x0816ca82 <+26>:   pushl  0x81c8d28
0x0816ca88 <+32>:   pushl  0x81c8d24
0x0816ca8e <+38>:   call   0x819861c <_D4dool2io4Path4Path4joinFC4dool6String6StringAaZC4dool6String6String>
0x0816ca93 <+43>:   mov    0xffffffe8(%ebp),%edx
0x0816ca96 <+46>:   mov    %eax,0x1c(%edx)
0x0816ca99 <+49>:   mov    %edx,%eax
0x0816ca9b <+51>:   mov    (%eax),%ebx
0x0816ca9d <+53>:   call   *0x3c(%ebx)

(I changed the output a bit)

you can see that the invariante for the object is called
and that the 'join' method on the 'Path' class from 'dool'
that method returns an instance of String (dool.String.String)
and receives a String and a char[].

that seems to correspond to the begining of the actual source code:

private: void init(char[][]args)
{
	debug(debugStartup) printf("Leds.init 1\n");
	ledsHome = Path.join(getUserHome(),".leds");

the call at address +22 is probably the 'getuserHome()'.

now you can do stepi or nexti or until x<address>
with stepi you will eventualy get into the method getUserHome

that's all I know about gdb and D code
Anybody knows more?

Ant

September 25, 2004
Ant wrote:
> On Fri, 24 Sep 2004 22:13:28 -0400, teqDruid wrote:
> 
> 
>>On Fri, 24 Sep 2004 22:03:18 -0400, Ant wrote:
>>
>>
>>>On Fri, 24 Sep 2004 21:24:30 -0400, teqDruid wrote:
>>>
>>>
>>>>Has anyone found a graphical debugger for Linux that'll display D source
>>>>code?
>>>>
>>
>>I've tried DDD, insight, and kgdb... gdb kinda works... does the debug
>>executable not include code line numbers, and file names or something? Does GDC do it correctly?
> 
> 
> no, from http://www.digitalmars.com/d/dcompiler.html
> 
> "
> Linux Bugs
> 
>     * -g is not implemented, because I haven't figured out how to do it
>     yet. gdb still works, though, at the global symbol level.
> "

Wasn't he asking about GDC, the D frontend integrated with gcc?  How well does gdb work with GDC?
September 25, 2004
teqDruid wrote:
> Has anyone found a graphical debugger for Linux that'll display D source
> code?
> 
> I've found a few gdb front-ends, but I haven't been able to get a lot of
> them to display D source files, and other misc. problems.
> 
> Thanks
> John

Valgrind seems to be slightly useful for working with D programs.  I've played with it a bit and, along with gdb, could be a useful debugging tool for d.
September 25, 2004
On Fri, 24 Sep 2004 19:58:12 -0700, John Reimer wrote:

> Ant wrote:
> 
> Wasn't he asking about GDC, the D frontend integrated with gcc?  How well does gdb work with GDC?

ehhh... fast brain, slow eyes... :p

someone told me GDC works perfectly with gdb
(as one could expect).

Ant