[Dwarf-discuss] Recovering type definitions
Todd Allen
todd.allen
Wed Jun 1 15:39:13 GMT 2005
>
> Is there a better way of encoding these examples in DWARF?
>
FYI: The Concurrent MAXAda description of REC2 would look more like the
following (after removing most of the vendor extensions and some trivia to
cut down on confusion). Note that, in our implementation, the upper bound is
stored independently of the discriminant, and so there's an artificial member
described with that upper bound. It uses DW_AT_artificial and has a
DW_AT_description with "n". If your implementation just reused the
discriminant, you could skip the extra artificial member and just reference
the discriminant directly.
DIE (0x15)
DW_TAG_constant
DW_CHILDREN_no
DW_AT_type(DW_FORM_ref_addr) (integer)
DW_AT_artificial(DW_FORM_flag) TRUE
DW_AT_description(DW_FORM_string) "100"
DW_AT_const_value(DW_FORM_sdata) 100
DIE (0x13)
DW_TAG_structure_type
DW_CHILDREN_yes
DW_AT_name(DW_FORM_string) "rec2"
DIE (0x14)
DW_TAG_member
DW_CHILDREN_no
DW_AT_type(DW_FORM_ref_addr) (teeny)
DW_AT_data_member_location(DW_FORM_block) [DW_OP_plus_uconst 0]
DW_AT_discriminant(DW_FORM_flag) TRUE
DW_AT_name(DW_FORM_string) "n"
DW_AT_default_value(DW_FORM_ref_addr) 0x15 (21) []
DIE (0x1a)
DW_TAG_member
DW_CHILDREN_no
DW_AT_type(DW_FORM_ref_addr) (teeny)
DW_AT_artificial(DW_FORM_flag) TRUE
DW_AT_data_member_location(DW_FORM_block) [DW_OP_plus_uconst 16]
DW_AT_description(DW_FORM_string) "n"
DIE (0x18)
DW_TAG_array_type
DW_CHILDREN_yes
DIE (0x19)
DW_TAG_subrange_type
DW_CHILDREN_no
DW_AT_type(DW_FORM_ref_addr) (integer)
DW_AT_lower_bound(DW_FORM_sdata) 1
DW_AT_upper_bound(DW_FORM_ref_addr) 0x1a (26) []
DIE (0x1b)
DW_TAG_padding
DW_CHILDREN_no
DIE (0x1c)
DW_TAG_member
DW_CHILDREN_no
DW_AT_type(DW_FORM_ref_addr) 0x18 (24)
DW_AT_data_member_location(DW_FORM_block) ...
DW_AT_name(DW_FORM_string) "vec2"
...
DIE (0x24)
DW_TAG_padding
DW_CHILDREN_no
--
Todd Allen
Concurrent Computer Corporation
More information about the Dwarf-discuss
mailing list