/* Map file for ELF files with DWARF -*- mode: poke-map -*- */

/* Sections and DWARF data:
 *
 * .debug_info
 *     Dwarf_CU_Header
 * .debug_types
 *     Dwarf_Type_Unit_Header
 * .debug_aranges
 * .debug_frame
 *     Dwarf_Call_Frame_Entry[]
 * .debug_abbrev
 * .debug_str
 * .debug_loc
 * .debug_ranges
 * .debug_macinfo
 * .debug_line
 * .debug_pubnames
 *     Dwarf_Name_Lookup_Table
 * .debug_pubtypes
 *     Dwarf_Name_Lookup_Table
 */

load dwarf;
load elf;

var _dwarf_map_elf = Elf64_File @ 0#B;

%%

%entry
%name info
%type Dwarf_CU_Header
%condition _dwarf_map_elf.section_name_p (".debug_info")
%offset _dwarf_map_elf.get_sections_by_name (".debug_info")[0].sh_offset

%entry
%name types
%type Dwarf_Type_Unit_Header
%condition _dwarf_map_elf.section_name_p (".debug_types")
%offset _dwarf_map_elf.get_section_by_name (".debug_types")[0].sh_offset

%entry
%name pubnames
%type Dwarf_Name_Lookup_Table
%condition _dwarf_map_elf.section_name_p (".debug_pubnames")
%offset _dwarf_map_elf.get_sections_by_name (".debug_pubnames")[0].sh_offset

%entry
%name pubtypes
%type Dwarf_Name_Lookup_Table
%condition _dwarf_map_elf.section_name_p (".debug_pubtypes")
%offset _dwarf_map_elf.get_sections_by_name (".debug_pubtypes")[0].sh_offset

%entry
%name frame
%type Dwarf_Call_Frame_Entry[_dwarf_map_elf.get_sections_by_name (".debug_frame")[0].sh_size]
%condition _dwarf_map_elf.section_name_p (".debug_frame")
%offset _dwarf_map_elf.get_sections_by_name (".debug_frame")[0].sh_offset

%entry
%name types
%type Dwarf_Type_Unit_Header
%condition _dwarf_map_elf.section_name_p (".debug_types")
%offset _dwarf_map_elf.get_sections_by_name (".debug_types")[0].sh_offset
