On Sep 2, 2013 6:52 AM, "Jonathan M Davis" <jmdavisProg@gmx.com> wrote:
>
> 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
Guess it also depends on what version of gdb you use too I guess, as iirc D support I described came in at around 7.4 release.
If you are a gdc 4.8 user of course, you would have gdb 7.5 at least (as it doesn't work with earlier gdb versions). And current development would recommend gdb 7.6
Have you given cgdb a try? It's a curses front end to gdb, I added D syntax highlighting support a while ago for. :)
Regards
--
Iain Buclaw
*(p < e ? p++ : p) = (c & 0x0f) + '0';