[Dwarf-Discuss] Decoding DW_FORM_block1

Mark Wielaard mjw at redhat.com
Fri Jul 27 07:50:14 PDT 2012


On Fri, 2012-07-27 at 19:32 +0530, Arun KS wrote:
> On Fri, Jul 27, 2012 at 6:31 PM, Mark Wielaard <mjw at redhat.com> wrote:
> > On Fri, 2012-07-27 at 15:14 +0530, Arun KS wrote:
>  [    31]      member
>                name                 "vinayak_i"
>                decl_file            2
>                decl_line            2
>                type                 [    4e]
>                data_member_location                 [   0] plus_uconst 0
> >>>>>>>>>>>>>>>>
> <Arun>Things were fine till this point,
> 
>  [    3f]      member
>                name                 "vinayak_u"
>                decl_file            2
>                decl_line            3
>                type                 [    55]
>                data_member_location                 [   0] plus_uconst 4

Note that eu-readelf --debug-dump=info doesn't show you the abbrev
numbers. Most likely is that both members use the same abbrev number.

> .debug_abbrev follows:
> 
>  [    2] offset: 19, children: yes, tag: structure_type
>           attr: name, form: strp, offset: 0x13
>           attr: byte_size, form: data1, offset: 0x15
>           attr: decl_file, form: data1, offset: 0x17
>           attr: decl_line, form: data1, offset: 0x19
>           attr: sibling, form: ref4, offset: 0x1b
>  [    3] offset: 34, children: no, tag: member
>           attr: name, form: strp, offset: 0x22
>           attr: decl_file, form: data1, offset: 0x24
>           attr: decl_line, form: data1, offset: 0x26
>           attr: type, form: ref4, offset: 0x28
>           attr: data_member_location, form: block1, offset: 0x2a
> 
> >>>>>>Why no entry in .debug_abbrev for second member named "vinayak_u"?
> .debug_abbrev is directly going to base_type

The DIE tree in the .debug_info points to the abbrevs that describe
them. Most likely both point to [3] here. See "7.5.2 Debugging
Information Entry" in the DWARF4 spec.

You might want to use a library like libdw from elfutils or libdwarf to
parse DWARF if a tool like eu-readelf doesn't give you the information
you need.

Cheers,

Mark



More information about the Dwarf-Discuss mailing list