www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Latest GDB version problems

reply Piotrek <starpit tlen.pl> writes:
Hi,

I tried to debug program in gdb (with d support) but with no big success.

I'm on kubuntu 10.04

I compiled gdb from trunk.  7.1.50.20100504

I use the -gc switch with dmd of course.

With this example (brakeboint at line 8)

1. import std.stdio;
2.
3.
4. void main()
5. {
6.     int i = 1;
7.     string s = "Hello";
8.     float f;
9. }

gdb produces:

(gdb) info locals
i = 1
s = 578159222890430469
f = 9.55146781e-38
(gdb) show language
The current source language is "auto; currently d".



worse is that following example:

1. import std.stdio;
2.
3.
4. void main()
5. {
6.     int i = 1;
7.     string s = "Hello";
8.     float f;
9.     writeln ("Hello");
10.}

gives seg falut:

Reading symbols from 
/home/pio/dev/d/projects/cb_test/hello...Segmentation fault


Does anyone can work with gdb on linux?

Cheers
Piotrek
May 10 2010
next sibling parent Piotrek <starpit tlen.pl> writes:
W dniu 10.05.2010 20:48, Piotrek pisze:
 Hi,

 I tried to debug program in gdb (with d support) but with no big success.

 I'm on kubuntu 10.04

 I compiled gdb from trunk. 7.1.50.20100504

 I use the -gc switch with dmd of course.

The dmd version is 2.045.
May 10 2010
prev sibling parent reply Robert Clipsham <robert octarineparrot.com> writes:
On 10/05/10 19:48, Piotrek wrote:
 (gdb) info locals
 i = 1
 s = 578159222890430469
 f = 9.55146781e-38
 (gdb) show language
 The current source language is "auto; currently d".

You are not using a version of gdb with D support if s is not displayed as a string. This said, I've only ever looked at variables using print or a backtrace, could you try 'p s' and see what result it gives? If it's the same you aren't using a D capable version of gdb. This said, it should be working in that version of gdb, I guess there's some other issues there if this is the case.
 Reading symbols from
 /home/pio/dev/d/projects/cb_test/hello...Segmentation fault

This is a gdb issue, not a D issue, you should report this issue to the gdb developers so they can add a test case to their test suite and fix the bug :)
 Does anyone can work with gdb on linux?

I do, and it works great for me :) This said, if you have issues with it it's good to voice them to either the D community or the gdb devs if appropriate so we can work out any issues and make debugging D on linux/freebsd/os x etc a pleasant experience. It isn't right now, but the situation's far better than it was a few weeks ago (it was impossible to do anything non-trivial then :P)
 Cheers
 Piotrek

May 10 2010
next sibling parent Piotrek <starpit tlen.pl> writes:
W dniu 10.05.2010 21:02, Robert Clipsham pisze:
 You are not using a version of gdb with D support if s is not displayed
 as a string. This said, I've only ever looked at variables using print
 or a backtrace, could you try 'p s' and see what result it gives?

(gdb) p s $1 = 578159222890430469 No luck :(
 If it's the same you aren't using a D capable version of gdb. This said, it
 should be working in that version of gdb, I guess there's some other
 issues there if this is the case.

 Does anyone can work with gdb on linux?

I do, and it works great for me :)

So I assume you are working on hand patched version of gdb - not the unchanged one from the official repository?
 This said, if you have issues with it
 it's good to voice them to either the D community or the gdb devs if
 appropriate so we can work out any issues and make debugging D on
 linux/freebsd/os x etc a pleasant experience. It isn't right now, but
 the situation's far better than it was a few weeks ago (it was
 impossible to do anything non-trivial then :P)

I try next gdb snapshot and then if it doesn't work I will fill bug report. Cheers Piotrek
May 10 2010
prev sibling parent Brad Roberts <braddr slice-2.puremagic.com> writes:
On Mon, 10 May 2010, Robert Clipsham wrote:

 On 10/05/10 19:48, Piotrek wrote:
 (gdb) info locals
 i = 1
 s = 578159222890430469
 f = 9.55146781e-38
 (gdb) show language
 The current source language is "auto; currently d".

You are not using a version of gdb with D support if s is not displayed as a string. This said, I've only ever looked at variables using print or a backtrace, could you try 'p s' and see what result it gives? If it's the same you aren't using a D capable version of gdb. This said, it should be working in that version of gdb, I guess there's some other issues there if this is the case.
 Reading symbols from
 /home/pio/dev/d/projects/cb_test/hello...Segmentation fault

This is a gdb issue, not a D issue, you should report this issue to the gdb developers so they can add a test case to their test suite and fix the bug :)
 Does anyone can work with gdb on linux?

I do, and it works great for me :) This said, if you have issues with it it's good to voice them to either the D community or the gdb devs if appropriate so we can work out any issues and make debugging D on linux/freebsd/os x etc a pleasant experience. It isn't right now, but the situation's far better than it was a few weeks ago (it was impossible to do anything non-trivial then :P)
 Cheers
 Piotrek


For what it's worth, I've still had lots of problems with gdb (from cvs) + dmd from svn. It's certainly LOTS better, but there's lots left to fix. Unfortunatly I haven't spent the time to try to reduce the problem down at all. I'll do that, but just haven't yet. Later, Brad
May 10 2010