poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Introduce dwarf-abbrev.pk pickle for decoding the .debug_abbrev section


From: Martin Cermak
Subject: Introduce dwarf-abbrev.pk pickle for decoding the .debug_abbrev section
Date: Tue, 19 Sep 2023 09:51:36 +0200

Hello folks,

I suggest to introduce the dwarf-abbrev.pk pickle for decoding
the .debug_abbrev section.  The patch comes with a testcase.
Here's a short demo:

------------------------------------8<------------------------------------------
$ dwarfdump -b prog5 | head -15

.debug_abbrev
<    1><0x00000000><code:   1> DW_TAG_compile_unit         DW_children_yes
       <0x00000003>              DW_AT_producer              DW_FORM_strp
       <0x00000005>              DW_AT_language              DW_FORM_data1
       <0x00000007>              DW_AT_name                  DW_FORM_line_strp
       <0x00000009>              DW_AT_comp_dir              DW_FORM_line_strp
       <0x0000000b>              DW_AT_low_pc                DW_FORM_addr
       <0x0000000d>              DW_AT_high_pc               DW_FORM_data8
       <0x0000000f>              DW_AT_stmt_list             DW_FORM_sec_offset
<    2><0x00000013><code:   2> DW_TAG_subprogram           DW_children_no
       <0x00000016>              DW_AT_external              
DW_FORM_flag_present
       <0x00000018>              DW_AT_name                  DW_FORM_strp
       <0x0000001a>              DW_AT_decl_file             DW_FORM_data1
       <0x0000001c>              DW_AT_decl_line             DW_FORM_data1
$ poke --quiet prog5
(poke) load elf
(poke) load dwarf
(poke) var elf = Elf64_File @ 0#B;
(poke) var debug_abbrev_sec = elf.get_sections_by_name (".debug_abbrev")[0];
(poke) var XXX = Dwarf_Abbrev_Tables @ debug_abbrev_sec.sh_offset;
(poke) XXX
Dwarf_Abbrev_Tables {
  abbrev_tables=[1, DW_TAG_compile_unit, DW_CHILDREN_yes
        DW_AT_producer, DW_FORM_strp
        DW_AT_language, DW_FORM_data1
        DW_AT_name, DW_FORM_line_strp
        DW_AT_comp_dir, DW_FORM_line_strp
        DW_AT_low_pc, DW_FORM_addr
        DW_AT_high_pc, DW_FORM_data8
        DW_AT_stmt_list, DW_FORM_sec_offset
,2, DW_TAG_subprogram, DW_CHILDREN_no
        DW_AT_external, DW_FORM_flag_present
        DW_AT_name, DW_FORM_strp
        DW_AT_decl_file, DW_FORM_data1
        DW_AT_decl_line, DW_FORM_data1
        DW_AT_decl_column, DW_FORM_data1
        DW_AT_type, DW_FORM_ref4
        DW_AT_low_pc, DW_FORM_addr
        DW_AT_high_pc, DW_FORM_data8
        DW_AT_frame_base, DW_FORM_exprloc
        DW_AT_call_all_tail_calls, DW_FORM_flag_present
,3, DW_TAG_base_type, DW_CHILDREN_no
        DW_AT_byte_size, DW_FORM_data1
        DW_AT_encoding, DW_FORM_data1
        DW_AT_name, DW_FORM_string
,4, DW_TAG_subprogram, DW_CHILDREN_yes
        DW_AT_external, DW_FORM_flag_present
        DW_AT_name, DW_FORM_strp
        DW_AT_decl_file, DW_FORM_data1
        DW_AT_decl_line, DW_FORM_data1
        DW_AT_decl_column, DW_FORM_data1
        DW_AT_prototyped, DW_FORM_flag_present
        DW_AT_type, DW_FORM_ref4
        DW_AT_low_pc, DW_FORM_addr
        DW_AT_high_pc, DW_FORM_data8
        DW_AT_frame_base, DW_FORM_exprloc
        DW_AT_call_all_calls, DW_FORM_flag_present
,5, DW_TAG_formal_parameter, DW_CHILDREN_no
        DW_AT_name, DW_FORM_string
        DW_AT_decl_file, DW_FORM_data1
        DW_AT_decl_line, DW_FORM_data1
        DW_AT_decl_column, DW_FORM_data1
        DW_AT_type, DW_FORM_ref4
        DW_AT_location, DW_FORM_exprloc
]
}
(poke)
------------------------------------8<------------------------------------------


Cheers,
Martin

Attachment: poke-dwarf-abbrev.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]