[Dwarf-Discuss] Decoding DW_FORM_block1

Arun KS arunks.linux@gmail.com
Fri Jul 27 09:44:48 GMT 2012


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"

Please help.

Here is the output given by the eu-readelf -winfo a.out,

DWARF section [29] '.debug_info' at offset 0x781:
 [Offset]
 Compilation unit at offset 0:
 Version: 2, Abbreviation section offset: 0, Address size: 4, Offset size: 4
 [     b]  compile_unit
           producer             "GNU C 4.3.3"
           language             ISO C89 (1)
           name                 "1.c"
           comp_dir             "/home/arun/Desktop/test"
           low_pc               0x000083f8 <main>
           high_pc              0x00008410 <test_func>
           stmt_list            0
 [    25]    structure_type
             name                 "vinayak"
             byte_size            8
             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                       <<<<<<<<<<<<<<<<<<<<<<
 [    3f]      member
               name                 "vinayak_u"
               decl_file            2
               decl_line            3
               type                 [    55]
               data_member_location                 [   0] plus_uconst 4
=================================================
Here is the output from eu-readelf -wabbrev a.out

DWARF section [30] '.debug_abbrev' at offset 0x978:
 [ Code]

Abbreviation section at offset 0:
 [    1] offset: 0, children: yes, tag: compile_unit
          attr: producer, form: strp, offset: 0
          attr: language, form: data1, offset: 0x2
          attr: name, form: string, offset: 0x4
          attr: comp_dir, form: strp, offset: 0x6
          attr: low_pc, form: addr, offset: 0x8
          attr: high_pc, form: addr, offset: 0xa
          attr: stmt_list, form: data4, offset: 0xc
 [    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
 [    4] offset: 49, children: no, tag: base_type
          attr: byte_size, form: data1, offset: 0x31
          attr: encoding, form: data1, offset: 0x33


Thanks,
Arun




More information about the Dwarf-discuss mailing list