Re: debugging custom array types

Jan Kratochvil
2013-02-13T17:59:13Z

On Wed, 13 Feb 2013 11:50:34 +0100, Michael Haupt wrote:
> Is there documentation somewhere that explicates which pieces of DWARF gdb
> supports out of the box?

No, read the source.

> <1><5320>: Abbrev Number: 16 (DW_TAG_structure_type)
> <5321> DW_AT_name : (indirect string, offset: 0x177): char_array
> <5325> DW_AT_byte_size : 10 byte block: 97 23 8 94 4 8 2 1e 23 c
> <5330> DW_AT_sibling : <0x5359>
> <2><5334>: Abbrev Number: 10 (DW_TAG_member)
> <5335> DW_AT_name : (indirect string, offset: 0xdc): __hub_reference__
> <5339> DW_AT_type : <0x5c6f>
> <533d> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
> <2><5340>: Abbrev Number: 10 (DW_TAG_member)
> <5341> DW_AT_name : (indirect string, offset: 0x185): __length__
> <5345> DW_AT_type : <0x2d>
> <5349> DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8)
> <2><534c>: Abbrev Number: 10 (DW_TAG_member)
> <534d> DW_AT_name : (indirect string, offset: 0x195): __array__
> <5351> DW_AT_type : <0x5a6c>
> <5355> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12)
> ...
> <1><5a6c>: Abbrev Number: 11 (DW_TAG_array_type)
> <5a6d> DW_AT_type : <0x4f11>
> <5a71> DW_AT_byte_size : 8 byte block: 97 23 8 94 4 8 2 1e
> <5a7a> DW_AT_data_location: 3 byte block: 97 23 c (DW_OP_push_object_address; DW_OP_plus_uconst: 12)
> <5a7e> DW_AT_sibling : <0x5a91>
> <2><5a82>: Abbrev Number: 14 (DW_TAG_subrange_type)
> <5a83> DW_AT_type : <0x2d>
> <5a87> DW_AT_upper_bound : 8 byte block: 97 23 8 94 4 8 1 1c (DW_OP_push_object_address; DW_OP_plus_uconst: 8; DW_OP_deref_size: 4; DW_OP_const1u: 1; DW_OP_minus)

Even archer-jankratochvil-vla branch does not support dynamic structures:
dwarf2read.c:
read_structure_type:
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr)
{
TYPE_LENGTH (type) = DW_UNSND (attr);
}

That DW_TAG_array_type/DW_TAG_subrange_type with dynamic DW_AT_upper_bound
should be supported but not as a directly embedded part of struct.

BTW archer-jankratochvil-vla is generally wrong, its reimplementation was
discussed in:
plan: VLA (Variable Length Arrays) and Fortran dynamic types
http://sourceware.org/ml/gdb/2012-11/msg00094.html

Regards,
Jan