Discussion on D support in gdb

Jerry jlquinn at optonline.net
Fri Nov 25 12:51:50 PST 2011


"Martin Nowak" <dawg at dawgfoto.de> writes:

> On Tue, 22 Nov 2011 04:18:47 +0100, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> Maybe someone knowledgeable could chime in:
>>
>> http://sourceware.org/ml/gdb/2011-11/msg00066.html
>>
>>
>>
>> Andrei
>
> I think we should follow Tom Tromney's proposal to add the extensions
> under the GNU vendor space, i.e. prefix them with 0x41xx.
> Numbers hopefully don't fall under licensing issues.
>
> It should be fairly straightforward to improve gdb debugging support
> given that
> changes are accepted on either side. The GDB codebase is a slightly
> unfriendly
> environment but getting rid of 'p ((char*[2])str)[1]' would be great.

I've done a bit of reading on this issue, at least with regards to D
arrays.  I'm not a DWARF expert, but it appears that D dynamic arrays
could be represented using the existing DWARF support, without an
extension.

Associative arrays are another issue.  The current ABI describes them an
opaque type.  However, for the debugger to work with them, the structure
must be understood somehow by the debugger.  If treating them as a void*
is the right approach (it still will result in compiler
incompatibility), the ABI must define functions that access AA's.  And
debuggers will have to call those functions to read the AA.  Until then,
the debugger would have to cheat to access AA's.

I don't know enough about delegates to comment on the support issues there.

> I would volunteer to do the implementation but it would be great if
> someone helped with
> clarifying the following issues.
>
>  - Can we slowly start to acquire DWARF-3/4?
>
>  - Why were extensions chosen over say representing an array as two
> field struct?

There was a comment on the ABI page that a struct is passed to functions
differently from an array, and therefore debuggers wouldn't handle D
arrays correctly if described that way.

>  - We could probably use DW_TAG_GNU_template_parameter_pack for
> variadic template arguments.
>    http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates

Note that the C++-11 standard also provides variadic templates.
Therefore DWARF probably needs to address this in some standard way if
it doesn't already.  I'd think that D and C++ could share the same
solution.


More information about the Digitalmars-d mailing list