Had another 48hr game jam this weekend...

Jonathan M Davis jmdavisProg at gmx.com
Sun Sep 1 22:51:44 PDT 2013


On Monday, September 02, 2013 06:43:28 Iain Buclaw wrote:
> I thought the problem with D strings was dmd, not gdb. As gdb has basic
> debugging capability with D (from experience with gdc).  Such as the
> ability to set breakpoints using pretty names, and it also recognises D
> arrays and prints them out in a pretty manner too.  Ie:  {1, 2, 3} and not
> {.length=3, .ptr=0x7ffff7ed0ff0}  (it does this by probing the type fields,
> if it sees a two field struct with the member names length and ptr then it
> works.  If it sees a ulong (see ABI page for dmd) then it will print you a
> ulong value.
> 
> If anyone has any suggestions for improving gdb support, just let me know
> as I intend to get round to improving some bits and pieces here and there
> someday.

I don't think that I've ever seen gdb be able to print out a d string properly 
by itself. Ideally, if you have

string s = "hello world";

then in gdb, I should be able to do

print s

and have it print "hello world", but I don't recall that ever working. IIRC, 
you had to have it print s.ptr and give it the length from s.length. Maybe it 
handles that better than I remember, and maybe I was doing something wrong, 
but that's what I recall from the last time I tried to mess with it.

However, my experience with gdb and C++ is also that gdb sucks at it, as it 
can't even handle basic stuff like operator overloading. So, I've come to the 
conclusion that the only thing that gdb can handle correctly is actual C code, 
and that if you want to do anything else, you have to fight it. But maybe I 
just suck at using gdb.

- Jonathan M Davis


More information about the Digitalmars-d mailing list