<p><br>
On Sep 2, 2013 6:52 AM, "Jonathan M Davis" <<a href="mailto:jmdavisProg@gmx.com">jmdavisProg@gmx.com</a>> wrote:<br>
><br>
> On Monday, September 02, 2013 06:43:28 Iain Buclaw wrote:<br>
> > I thought the problem with D strings was dmd, not gdb. As gdb has basic<br>
> > debugging capability with D (from experience with gdc).  Such as the<br>
> > ability to set breakpoints using pretty names, and it also recognises D<br>
> > arrays and prints them out in a pretty manner too.  Ie:  {1, 2, 3} and not<br>
> > {.length=3, .ptr=0x7ffff7ed0ff0}  (it does this by probing the type fields,<br>
> > if it sees a two field struct with the member names length and ptr then it<br>
> > works.  If it sees a ulong (see ABI page for dmd) then it will print you a<br>
> > ulong value.<br>
> ><br>
> > If anyone has any suggestions for improving gdb support, just let me know<br>
> > as I intend to get round to improving some bits and pieces here and there<br>
> > someday.<br>
><br>
> I don't think that I've ever seen gdb be able to print out a d string properly<br>
> by itself. Ideally, if you have<br>
><br>
> string s = "hello world";<br>
><br>
> then in gdb, I should be able to do<br>
><br>
> print s<br>
><br>
> and have it print "hello world", but I don't recall that ever working. IIRC,<br>
> you had to have it print s.ptr and give it the length from s.length. Maybe it<br>
> handles that better than I remember, and maybe I was doing something wrong,<br>
> but that's what I recall from the last time I tried to mess with it.<br>
><br>
> However, my experience with gdb and C++ is also that gdb sucks at it, as it<br>
> can't even handle basic stuff like operator overloading. So, I've come to the<br>
> conclusion that the only thing that gdb can handle correctly is actual C code,<br>
> and that if you want to do anything else, you have to fight it. But maybe I<br>
> just suck at using gdb.<br>
><br>
> - Jonathan M Davis</p>
<p>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.</p>
<p>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</p>
<p>Have you given cgdb a try?  It's a curses front end to gdb, I added D syntax highlighting support a while ago for.  :)</p>
<p>Regards<br>
-- <br>
Iain Buclaw</p>
<p>*(p < e ? p++ : p) = (c & 0x0f) + '0';</p>