Had another 48hr game jam this weekend...

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Sep 1 20:46:32 PDT 2013


On Sun, Sep 01, 2013 at 05:33:12PM -0700, Walter Bright wrote:
> On 9/1/2013 5:14 PM, H. S. Teoh wrote:
> >But I will say that debugging can and must be improved. Currently,
> >about the only thing usable for dmd -g is to get a stacktrace of a
> >program crash. Nothing else seems to be properly supported (I use
> >gdb). Stepping through statements and setting breakpoints
> >more-or-less works, but I can't get at most variables (keeps
> >complains about being unable to reference 'this' or something
> >similar), sometimes variable values are outright wrong or completely
> >unrelated to the actual value, sometimes variables shown right on the
> >source line being debugged don't exist in the debugger ('no such
> >symbol'). Unable to look into nested structs without hitting odd
> >behaviour. Doesn't understand D naming conventions (or does so
> >poorly).
> 
> I've tried to figure this out many times, and have found the Dwarf
> format to be completely impenetrable. As far as I can tell, dmd
> generates correct Dwarf symbolic debug info according to the Dwarf
> spec.
> 
> gdb relies on very undocumented idiosyncratic combinations of things
> to work. It appears to be wrapped tightly around exactly what gcc
> generates.
> 
> I suppose the only way to figure it out is to read the gdb source
> code. Sigh.
[...]

I feared as much. :-(

My guess is that gdb actually uses a superset of Dwarf, with its own
idiosyncratic extensions that only gcc knows about.  I remember in the
early days when I was on Solaris, gdb wouldn't understand debugging
symbols from the native Sun compiler, and the native debugger wouldn't
understand gcc debugging symbols, or only understood a subset of it so
certain features are missing.

Which, unfortunately, means that only gdc stands a chance of being
usable with gdb. (Which makes it a very good thing indeed that we have
Iain on board!)

Maybe we should write our own debugger in D ... ;-) (OK, that may be too
big a chunk to chew off right now. But, one can dream.)


T

-- 
The computer is only a tool. Unfortunately, so is the user. -- Armaphine, K5


More information about the Digitalmars-d mailing list