April 04, 2007
Frits van Bommel Wrote:

> Cristian Vlasceanu wrote:
> > I have verified this, with 1.010, ulong and char[] are indistinguishable in the DWARF.
> > 
> > My personal preference is to have it represented as a struct.
> 
> A struct doesn't tell you how much of the data at .ptr is valid.
> IMHO, for '-g' (native-D debugging info) it should be a special type.
> (Assuming DWARF supports language-specific types, is that the case?)
> That way, D-aware debuggers can for example pretty-print char[] strings
> as regular strings instead of (size_t, char*) pairs.
> For '-gc' (pretends-to-be-C debugging info) a struct should probably be
> used though.


How about adding a "DWARF vendor extension":

add a new tag, DW_TAG_array.
Array "classes" will have a DW_TAG_array corresponding entry in the debug info,
each with children entries such as:
    DW_AT_type // DWARF std, points to the element type
    ...                 // TBD


array instances will be represented by entries that have children of the following types:
    DW_AT_capacity    // D extension
    DW_AT_size          // DWARF standard
    DW_AT_value        // address of 1st elem, DWARF standard
    DW_AT_type          // DWARF std, would point to an entry of DW_TAG_array type

thoughts?


April 04, 2007
Reply to Cristian,

> Frits van Bommel Wrote:
> 
>> Cristian Vlasceanu wrote:
>> 
>>> I have verified this, with 1.010, ulong and char[] are
>>> indistinguishable in the DWARF.
>>> 
>>> My personal preference is to have it represented as a struct.
>>> 
>> A struct doesn't tell you how much of the data at .ptr is valid.
>> IMHO, for '-g' (native-D debugging info) it should be a special type.
>> (Assuming DWARF supports language-specific types, is that the case?)
>> That way, D-aware debuggers can for example pretty-print char[]
>> strings
>> as regular strings instead of (size_t, char*) pairs.
>> For '-gc' (pretends-to-be-C debugging info) a struct should probably
>> be
>> used though.
> How about adding a "DWARF vendor extension":
> 
> add a new tag, DW_TAG_array.
> Array "classes" will have a DW_TAG_array corresponding entry in the
> debug info,
> each with children entries such as:
> DW_AT_type // DWARF std, points to the element type
> ...                 // TBD
> array instances will be represented by entries that have children of
> the following types:
> DW_AT_capacity    // D extension
> DW_AT_size          // DWARF standard
> DW_AT_value        // address of 1st elem, DWARF standard
> DW_AT_type          // DWARF std, would point to an entry of
> DW_TAG_array type
> thoughts?
> 

Sounds good, but I'm no DWARF expert.

Walter?


1 2
Next ›   Last »