[Dwarf-Discuss] Decoding DW_FORM_block1
Arun KS
arunks.linux@gmail.com
Fri Jul 27 14:02:08 GMT 2012
Hi Mark,
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:
>> Hello Guys,
>>
>> I m not able to decode form DW_FORM_block1. I am able to read till
>> attr data_member_location(marked with <<<<<<<<< below.).
>> The form is comming as DW_FORM_block1. So I went and read debug_info,
>> which gave me 0x2. So this means
>> length is 2 and i have to read two more bytes. The next two bytes in
>> .debug_info are 0x23 and 0x00.
>>
>> What this values represent(0x23 an 0x00)?
>> From where will I get "[ 0] plus_uconst 0" printed by "eu-readelf
>> -winfo a.out"
>
> So that is like eu-readelf tells you a block containing "0x23 0x00" aka
> "DW_OP_plus_uconst 0x0", which together with the address of the
> structure begin address on the dwarf stack, forms a location description
> of the member. Note that newer instead of a block of opcodes, this can
> also be expressed as a constant form by the producer, which would be
> slightly more efficient. See "5.5.6 Data Member Entries" in the DWARF4
> spec.
Thanks for the reply.
I m writting a program which decodes the DWARF sections in vmlinux.
But facing some issues.
decl_file 2
decl_line 1
sibling [ 4e]
[ 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
[ 4e] base_type
byte_size 4
encoding signed (5)
name "int"
.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
[ 4] offset: 49, children: no, tag: base_type
attr: byte_size, form: data1, offset: 0x31
attr: encoding, form: data1, offset: 0x33
Thanks,
Arun
>
> Cheers,
>
> Mark
More information about the Dwarf-discuss
mailing list