1*7fd79137SRobert Mustacchi /* 2*7fd79137SRobert Mustacchi 3*7fd79137SRobert Mustacchi Copyright (C) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 4*7fd79137SRobert Mustacchi Portions Copyright (C) 2007-2010 David Anderson. All Rights Reserved. 5*7fd79137SRobert Mustacchi Portions Copyright (C) 2008-2010 Arxan Technologies, Inc. All Rights Reserved. 6*7fd79137SRobert Mustacchi 7*7fd79137SRobert Mustacchi This program is free software; you can redistribute it and/or modify it 8*7fd79137SRobert Mustacchi under the terms of version 2.1 of the GNU Lesser General Public License 9*7fd79137SRobert Mustacchi as published by the Free Software Foundation. 10*7fd79137SRobert Mustacchi 11*7fd79137SRobert Mustacchi This program is distributed in the hope that it would be useful, but 12*7fd79137SRobert Mustacchi WITHOUT ANY WARRANTY; without even the implied warranty of 13*7fd79137SRobert Mustacchi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14*7fd79137SRobert Mustacchi 15*7fd79137SRobert Mustacchi Further, this software is distributed without any warranty that it is 16*7fd79137SRobert Mustacchi free of the rightful claim of any third person regarding infringement 17*7fd79137SRobert Mustacchi or the like. Any license provided herein, whether implied or 18*7fd79137SRobert Mustacchi otherwise, applies only to this software file. Patent licenses, if 19*7fd79137SRobert Mustacchi any, provided herein do not apply to combinations of this program with 20*7fd79137SRobert Mustacchi other software, or any other product whatsoever. 21*7fd79137SRobert Mustacchi 22*7fd79137SRobert Mustacchi You should have received a copy of the GNU Lesser General Public 23*7fd79137SRobert Mustacchi License along with this program; if not, write the Free Software 24*7fd79137SRobert Mustacchi Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301, 25*7fd79137SRobert Mustacchi USA. 26*7fd79137SRobert Mustacchi 27*7fd79137SRobert Mustacchi Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane, 28*7fd79137SRobert Mustacchi Mountain View, CA 94043, or: 29*7fd79137SRobert Mustacchi 30*7fd79137SRobert Mustacchi http://www.sgi.com 31*7fd79137SRobert Mustacchi 32*7fd79137SRobert Mustacchi For further information regarding this notice, see: 33*7fd79137SRobert Mustacchi 34*7fd79137SRobert Mustacchi http://oss.sgi.com/projects/GenInfo/NoticeExplan 35*7fd79137SRobert Mustacchi 36*7fd79137SRobert Mustacchi */ 37*7fd79137SRobert Mustacchi /* The versions applicable by section are: 38*7fd79137SRobert Mustacchi DWARF2 DWARF3 DWARF4 39*7fd79137SRobert Mustacchi .debug_abbrev - - - 40*7fd79137SRobert Mustacchi .debug_aranges 2 2 2 41*7fd79137SRobert Mustacchi .debug_frame 1 3 4 42*7fd79137SRobert Mustacchi .debug_info 2 3 4 43*7fd79137SRobert Mustacchi .debug_line 2 3 4 44*7fd79137SRobert Mustacchi .debug_loc - - - 45*7fd79137SRobert Mustacchi .debug_macinfo - - - 46*7fd79137SRobert Mustacchi .debug_pubtypes x 2 2 47*7fd79137SRobert Mustacchi .debug_pubnames 2 2 2 48*7fd79137SRobert Mustacchi .debug_ranges x - - 49*7fd79137SRobert Mustacchi .debug_str - - - 50*7fd79137SRobert Mustacchi .debug_types x x 4 51*7fd79137SRobert Mustacchi */ 52*7fd79137SRobert Mustacchi 53*7fd79137SRobert Mustacchi #include <stddef.h> 54*7fd79137SRobert Mustacchi 55*7fd79137SRobert Mustacchi 56*7fd79137SRobert Mustacchi struct Dwarf_Die_s { 57*7fd79137SRobert Mustacchi Dwarf_Byte_Ptr di_debug_info_ptr; 58*7fd79137SRobert Mustacchi Dwarf_Abbrev_List di_abbrev_list; 59*7fd79137SRobert Mustacchi Dwarf_CU_Context di_cu_context; 60*7fd79137SRobert Mustacchi int di_abbrev_code; 61*7fd79137SRobert Mustacchi }; 62*7fd79137SRobert Mustacchi 63*7fd79137SRobert Mustacchi struct Dwarf_Attribute_s { 64*7fd79137SRobert Mustacchi Dwarf_Half ar_attribute; /* Attribute Value. */ 65*7fd79137SRobert Mustacchi Dwarf_Half ar_attribute_form; /* Attribute Form. */ 66*7fd79137SRobert Mustacchi Dwarf_Half ar_attribute_form_direct; 67*7fd79137SRobert Mustacchi /* Identical to ar_attribute_form except that if 68*7fd79137SRobert Mustacchi the original form uleb was DW_FORM_indirect, 69*7fd79137SRobert Mustacchi ar_attribute_form_direct contains DW_FORM_indirect 70*7fd79137SRobert Mustacchi but ar_attribute_form contains the true form. */ 71*7fd79137SRobert Mustacchi 72*7fd79137SRobert Mustacchi Dwarf_CU_Context ar_cu_context; 73*7fd79137SRobert Mustacchi Dwarf_Small *ar_debug_info_ptr; 74*7fd79137SRobert Mustacchi Dwarf_Attribute ar_next; 75*7fd79137SRobert Mustacchi }; 76*7fd79137SRobert Mustacchi 77*7fd79137SRobert Mustacchi /* 78*7fd79137SRobert Mustacchi This structure provides the context for a compilation unit. 79*7fd79137SRobert Mustacchi Thus, it contains the Dwarf_Debug, cc_dbg, that this cu 80*7fd79137SRobert Mustacchi belongs to. It contains the information in the compilation 81*7fd79137SRobert Mustacchi unit header, cc_length, cc_version_stamp, cc_abbrev_offset, 82*7fd79137SRobert Mustacchi and cc_address_size, in the .debug_info section for that cu. 83*7fd79137SRobert Mustacchi In addition, it contains the count, cc_count_cu, of the cu 84*7fd79137SRobert Mustacchi number of that cu in the list of cu's in the .debug_info. 85*7fd79137SRobert Mustacchi The count starts at 1, ie cc_count_cu is 1 for the first cu, 86*7fd79137SRobert Mustacchi 2 for the second and so on. This struct also contains a 87*7fd79137SRobert Mustacchi pointer, cc_abbrev_table, to a list of pairs of abbrev code 88*7fd79137SRobert Mustacchi and a pointer to the start of that abbrev 89*7fd79137SRobert Mustacchi in the .debug_abbrev section. 90*7fd79137SRobert Mustacchi 91*7fd79137SRobert Mustacchi Each die will also contain a pointer to such a struct to 92*7fd79137SRobert Mustacchi record the context for that die. 93*7fd79137SRobert Mustacchi 94*7fd79137SRobert Mustacchi Notice that a pointer to the CU DIE itself is 95*7fd79137SRobert Mustacchi Dwarf_Off off2 = cu_context->cc_debug_info_offset; 96*7fd79137SRobert Mustacchi cu_die_info_ptr = dbg->de_debug_info.dss_data + 97*7fd79137SRobert Mustacchi off2 + _dwarf_length_of_cu_header(dbg, off2); 98*7fd79137SRobert Mustacchi 99*7fd79137SRobert Mustacchi **Updated by dwarf_next_cu_header in dwarf_die_deliv.c 100*7fd79137SRobert Mustacchi */ 101*7fd79137SRobert Mustacchi struct Dwarf_CU_Context_s { 102*7fd79137SRobert Mustacchi Dwarf_Debug cc_dbg; 103*7fd79137SRobert Mustacchi /* The sum of cc_length, cc_length_size, and cc_extension_size 104*7fd79137SRobert Mustacchi is the total length of the CU including its header. */ 105*7fd79137SRobert Mustacchi Dwarf_Word cc_length; 106*7fd79137SRobert Mustacchi /* cc_length_size is the size in bytes of an offset. 107*7fd79137SRobert Mustacchi 4 for 32bit dwarf, 8 for 64bit dwarf (whether MIPS/IRIX 108*7fd79137SRobert Mustacchi 64bit dwarf or standard 64bit dwarf using the extension 109*7fd79137SRobert Mustacchi mechanism). */ 110*7fd79137SRobert Mustacchi Dwarf_Small cc_length_size; 111*7fd79137SRobert Mustacchi /* cc_extension_size is zero unless this is standard 112*7fd79137SRobert Mustacchi DWARF3 and later 64bit dwarf using the extension mechanism. 113*7fd79137SRobert Mustacchi If it is the DWARF3 and later 64bit dwarf cc_extension 114*7fd79137SRobert Mustacchi size is 4. So for 32bit dwarf and MIPS/IRIX 64bit dwarf 115*7fd79137SRobert Mustacchi cc_extension_size is zero. */ 116*7fd79137SRobert Mustacchi Dwarf_Small cc_extension_size; 117*7fd79137SRobert Mustacchi Dwarf_Half cc_version_stamp; 118*7fd79137SRobert Mustacchi Dwarf_Sword cc_abbrev_offset; 119*7fd79137SRobert Mustacchi Dwarf_Small cc_address_size; 120*7fd79137SRobert Mustacchi /* cc_debug_info_offset is the offset in the section 121*7fd79137SRobert Mustacchi of the CU header of this CU. Dwarf_Word 122*7fd79137SRobert Mustacchi should be large enough. */ 123*7fd79137SRobert Mustacchi Dwarf_Word cc_debug_info_offset; 124*7fd79137SRobert Mustacchi Dwarf_Byte_Ptr cc_last_abbrev_ptr; 125*7fd79137SRobert Mustacchi Dwarf_Hash_Table cc_abbrev_hash_table; 126*7fd79137SRobert Mustacchi Dwarf_CU_Context cc_next; 127*7fd79137SRobert Mustacchi /*unsigned char cc_offset_length; */ 128*7fd79137SRobert Mustacchi }; 129*7fd79137SRobert Mustacchi 130*7fd79137SRobert Mustacchi /* Consolidates section-specific data in one place. 131*7fd79137SRobert Mustacchi Section is an Elf specific term, intended as a general 132*7fd79137SRobert Mustacchi term (for non-Elf objects some code must synthesize the 133*7fd79137SRobert Mustacchi values somehow). 134*7fd79137SRobert Mustacchi Makes adding more section-data much simpler. */ 135*7fd79137SRobert Mustacchi struct Dwarf_Section_s { 136*7fd79137SRobert Mustacchi Dwarf_Small * dss_data; 137*7fd79137SRobert Mustacchi Dwarf_Unsigned dss_size; 138*7fd79137SRobert Mustacchi Dwarf_Word dss_index; 139*7fd79137SRobert Mustacchi /* dss_addr is the 'section address' which is only 140*7fd79137SRobert Mustacchi non-zero for a GNU eh section. 141*7fd79137SRobert Mustacchi Purpose: to handle DW_EH_PE_pcrel encoding. Leaving 142*7fd79137SRobert Mustacchi it zero is fine for non-elf. */ 143*7fd79137SRobert Mustacchi Dwarf_Addr dss_addr; 144*7fd79137SRobert Mustacchi Dwarf_Small dss_data_was_malloc; 145*7fd79137SRobert Mustacchi 146*7fd79137SRobert Mustacchi /* For non-elf, leaving the following fields zero 147*7fd79137SRobert Mustacchi will mean they are ignored. */ 148*7fd79137SRobert Mustacchi /* dss_link should be zero unless a section has a link 149*7fd79137SRobert Mustacchi to another (sh_link). Used to access relocation data for 150*7fd79137SRobert Mustacchi a section (and for symtab section, access its strtab). */ 151*7fd79137SRobert Mustacchi Dwarf_Word dss_link; 152*7fd79137SRobert Mustacchi /* The following is used when reading .rela sections 153*7fd79137SRobert Mustacchi (such sections appear in some .o files). */ 154*7fd79137SRobert Mustacchi Dwarf_Half dss_reloc_index; /* Zero means ignore the reloc fields. */ 155*7fd79137SRobert Mustacchi Dwarf_Small * dss_reloc_data; 156*7fd79137SRobert Mustacchi Dwarf_Unsigned dss_reloc_size; 157*7fd79137SRobert Mustacchi Dwarf_Addr dss_reloc_addr; 158*7fd79137SRobert Mustacchi /* dss_reloc_symtab is the sh_link of a .rela to its .symtab, leave 159*7fd79137SRobert Mustacchi it 0 if non-meaningful. */ 160*7fd79137SRobert Mustacchi Dwarf_Addr dss_reloc_symtab; 161*7fd79137SRobert Mustacchi /* dss_reloc_link should be zero unless a reloc section has a link 162*7fd79137SRobert Mustacchi to another (sh_link). Used to access the symtab for relocations 163*7fd79137SRobert Mustacchi a section. */ 164*7fd79137SRobert Mustacchi Dwarf_Word dss_reloc_link; 165*7fd79137SRobert Mustacchi /* Pointer to the elf symtab, used for elf .rela. Leave it 0 166*7fd79137SRobert Mustacchi if not relevant. */ 167*7fd79137SRobert Mustacchi struct Dwarf_Section_s *dss_symtab; 168*7fd79137SRobert Mustacchi }; 169*7fd79137SRobert Mustacchi 170*7fd79137SRobert Mustacchi /* Overview: if next_to_use== first, no error slots are used. 171*7fd79137SRobert Mustacchi If next_to_use+1 (mod maxcount) == first the slots are all used 172*7fd79137SRobert Mustacchi */ 173*7fd79137SRobert Mustacchi struct Dwarf_Harmless_s { 174*7fd79137SRobert Mustacchi unsigned dh_maxcount; 175*7fd79137SRobert Mustacchi unsigned dh_next_to_use; 176*7fd79137SRobert Mustacchi unsigned dh_first; 177*7fd79137SRobert Mustacchi unsigned dh_errs_count; 178*7fd79137SRobert Mustacchi char ** dh_errors; 179*7fd79137SRobert Mustacchi }; 180*7fd79137SRobert Mustacchi 181*7fd79137SRobert Mustacchi struct Dwarf_Debug_s { 182*7fd79137SRobert Mustacchi /* All file access methods and support data 183*7fd79137SRobert Mustacchi are hidden in this structure. 184*7fd79137SRobert Mustacchi We get a pointer, callers control the lifetime of the 185*7fd79137SRobert Mustacchi structure and contents. */ 186*7fd79137SRobert Mustacchi struct Dwarf_Obj_Access_Interface_s *de_obj_file; 187*7fd79137SRobert Mustacchi 188*7fd79137SRobert Mustacchi Dwarf_Handler de_errhand; 189*7fd79137SRobert Mustacchi Dwarf_Ptr de_errarg; 190*7fd79137SRobert Mustacchi 191*7fd79137SRobert Mustacchi /* 192*7fd79137SRobert Mustacchi Context for the compilation_unit just read by a call to 193*7fd79137SRobert Mustacchi dwarf_next_cu_header. **Updated by dwarf_next_cu_header in 194*7fd79137SRobert Mustacchi dwarf_die_deliv.c */ 195*7fd79137SRobert Mustacchi Dwarf_CU_Context de_cu_context; 196*7fd79137SRobert Mustacchi 197*7fd79137SRobert Mustacchi /* 198*7fd79137SRobert Mustacchi Points to linked list of CU Contexts for the CU's already read. 199*7fd79137SRobert Mustacchi These are only CU's read by dwarf_next_cu_header(). */ 200*7fd79137SRobert Mustacchi Dwarf_CU_Context de_cu_context_list; 201*7fd79137SRobert Mustacchi 202*7fd79137SRobert Mustacchi /* 203*7fd79137SRobert Mustacchi Points to the last CU Context added to the list by 204*7fd79137SRobert Mustacchi dwarf_next_cu_header(). */ 205*7fd79137SRobert Mustacchi Dwarf_CU_Context de_cu_context_list_end; 206*7fd79137SRobert Mustacchi 207*7fd79137SRobert Mustacchi /* 208*7fd79137SRobert Mustacchi This is the list of CU contexts read for dwarf_offdie(). These 209*7fd79137SRobert Mustacchi may read ahead of dwarf_next_cu_header(). */ 210*7fd79137SRobert Mustacchi Dwarf_CU_Context de_offdie_cu_context; 211*7fd79137SRobert Mustacchi Dwarf_CU_Context de_offdie_cu_context_end; 212*7fd79137SRobert Mustacchi 213*7fd79137SRobert Mustacchi /* Offset of last byte of last CU read. */ 214*7fd79137SRobert Mustacchi Dwarf_Word de_info_last_offset; 215*7fd79137SRobert Mustacchi 216*7fd79137SRobert Mustacchi /* 217*7fd79137SRobert Mustacchi Number of bytes in the length, and offset field in various 218*7fd79137SRobert Mustacchi .debug_* sections. It's not very meaningful, and is 219*7fd79137SRobert Mustacchi only used in one 'approximate' calculation. */ 220*7fd79137SRobert Mustacchi Dwarf_Small de_length_size; 221*7fd79137SRobert Mustacchi 222*7fd79137SRobert Mustacchi /* number of bytes in a pointer of the target in various .debug_ 223*7fd79137SRobert Mustacchi sections. 4 in 32bit, 8 in MIPS 64, ia64. */ 224*7fd79137SRobert Mustacchi Dwarf_Small de_pointer_size; 225*7fd79137SRobert Mustacchi 226*7fd79137SRobert Mustacchi /* set at creation of a Dwarf_Debug to say if form_string should be 227*7fd79137SRobert Mustacchi checked for valid length at every call. 0 means do the check. 228*7fd79137SRobert Mustacchi non-zero means do not do the check. */ 229*7fd79137SRobert Mustacchi Dwarf_Small de_assume_string_in_bounds; 230*7fd79137SRobert Mustacchi 231*7fd79137SRobert Mustacchi /* 232*7fd79137SRobert Mustacchi Dwarf_Alloc_Hdr_s structs used to manage chunks that are 233*7fd79137SRobert Mustacchi malloc'ed for each allocation type for structs. */ 234*7fd79137SRobert Mustacchi struct Dwarf_Alloc_Hdr_s de_alloc_hdr[ALLOC_AREA_REAL_TABLE_MAX]; 235*7fd79137SRobert Mustacchi #ifdef DWARF_SIMPLE_MALLOC 236*7fd79137SRobert Mustacchi struct simple_malloc_record_s * de_simple_malloc_base; 237*7fd79137SRobert Mustacchi #endif 238*7fd79137SRobert Mustacchi 239*7fd79137SRobert Mustacchi 240*7fd79137SRobert Mustacchi /* 241*7fd79137SRobert Mustacchi These fields are used to process debug_frame section. **Updated 242*7fd79137SRobert Mustacchi by dwarf_get_fde_list in dwarf_frame.h */ 243*7fd79137SRobert Mustacchi /* 244*7fd79137SRobert Mustacchi Points to contiguous block of pointers to Dwarf_Cie_s structs. */ 245*7fd79137SRobert Mustacchi Dwarf_Cie *de_cie_data; 246*7fd79137SRobert Mustacchi /* Count of number of Dwarf_Cie_s structs. */ 247*7fd79137SRobert Mustacchi Dwarf_Signed de_cie_count; 248*7fd79137SRobert Mustacchi /* Keep eh (GNU) separate!. */ 249*7fd79137SRobert Mustacchi Dwarf_Cie *de_cie_data_eh; 250*7fd79137SRobert Mustacchi Dwarf_Signed de_cie_count_eh; 251*7fd79137SRobert Mustacchi /* 252*7fd79137SRobert Mustacchi Points to contiguous block of pointers to Dwarf_Fde_s structs. */ 253*7fd79137SRobert Mustacchi Dwarf_Fde *de_fde_data; 254*7fd79137SRobert Mustacchi /* Count of number of Dwarf_Fde_s structs. */ 255*7fd79137SRobert Mustacchi Dwarf_Signed de_fde_count; 256*7fd79137SRobert Mustacchi /* Keep eh (GNU) separate!. */ 257*7fd79137SRobert Mustacchi Dwarf_Fde *de_fde_data_eh; 258*7fd79137SRobert Mustacchi Dwarf_Signed de_fde_count_eh; 259*7fd79137SRobert Mustacchi 260*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_info; 261*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_abbrev; 262*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_line; 263*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_loc; 264*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_aranges; 265*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_macinfo; 266*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_pubnames; 267*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_str; 268*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_frame; 269*7fd79137SRobert Mustacchi 270*7fd79137SRobert Mustacchi /* gnu: the g++ eh_frame section */ 271*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_frame_eh_gnu; 272*7fd79137SRobert Mustacchi 273*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_pubtypes; /* DWARF3 .debug_pubtypes */ 274*7fd79137SRobert Mustacchi 275*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_funcnames; 276*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_typenames; /* SGI IRIX extension essentially 277*7fd79137SRobert Mustacchi identical to DWARF3 .debug_pubtypes. */ 278*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_varnames; 279*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_weaknames; 280*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_debug_ranges; 281*7fd79137SRobert Mustacchi 282*7fd79137SRobert Mustacchi /* For non-elf, simply leave the following two structs zeroed and 283*7fd79137SRobert Mustacchi they will be ignored. */ 284*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_elf_symtab; 285*7fd79137SRobert Mustacchi struct Dwarf_Section_s de_elf_strtab; 286*7fd79137SRobert Mustacchi 287*7fd79137SRobert Mustacchi 288*7fd79137SRobert Mustacchi void *(*de_copy_word) (void *, const void *, size_t); 289*7fd79137SRobert Mustacchi unsigned char de_same_endian; 290*7fd79137SRobert Mustacchi unsigned char de_elf_must_close; /* if non-zero, then 291*7fd79137SRobert Mustacchi it was dwarf_init (not dwarf_elf_init) 292*7fd79137SRobert Mustacchi so must elf_end() */ 293*7fd79137SRobert Mustacchi 294*7fd79137SRobert Mustacchi /* Default is DW_FRAME_INITIAL_VALUE from header. */ 295*7fd79137SRobert Mustacchi Dwarf_Half de_frame_rule_initial_value; 296*7fd79137SRobert Mustacchi 297*7fd79137SRobert Mustacchi /* Default is DW_FRAME_LAST_REG_NUM. */ 298*7fd79137SRobert Mustacchi Dwarf_Half de_frame_reg_rules_entry_count; 299*7fd79137SRobert Mustacchi 300*7fd79137SRobert Mustacchi Dwarf_Half de_frame_cfa_col_number; 301*7fd79137SRobert Mustacchi Dwarf_Half de_frame_same_value_number; 302*7fd79137SRobert Mustacchi Dwarf_Half de_frame_undefined_value_number; 303*7fd79137SRobert Mustacchi 304*7fd79137SRobert Mustacchi unsigned char de_big_endian_object; /* non-zero if big-endian 305*7fd79137SRobert Mustacchi object opened. */ 306*7fd79137SRobert Mustacchi 307*7fd79137SRobert Mustacchi struct Dwarf_Harmless_s de_harmless_errors; 308*7fd79137SRobert Mustacchi }; 309*7fd79137SRobert Mustacchi 310*7fd79137SRobert Mustacchi typedef struct Dwarf_Chain_s *Dwarf_Chain; 311*7fd79137SRobert Mustacchi struct Dwarf_Chain_s { 312*7fd79137SRobert Mustacchi void *ch_item; 313*7fd79137SRobert Mustacchi Dwarf_Chain ch_next; 314*7fd79137SRobert Mustacchi }; 315*7fd79137SRobert Mustacchi 316*7fd79137SRobert Mustacchi 317*7fd79137SRobert Mustacchi #define CURRENT_VERSION_STAMP 2 /* DWARF2 */ 318*7fd79137SRobert Mustacchi #define CURRENT_VERSION_STAMP3 3 /* DWARF3 */ 319*7fd79137SRobert Mustacchi #define CURRENT_VERSION_STAMP4 4 /* DWARF4 */ 320*7fd79137SRobert Mustacchi 321*7fd79137SRobert Mustacchi /* Size of cu header version stamp field. */ 322*7fd79137SRobert Mustacchi #define CU_VERSION_STAMP_SIZE sizeof(Dwarf_Half) 323*7fd79137SRobert Mustacchi 324*7fd79137SRobert Mustacchi /* Size of cu header address size field. */ 325*7fd79137SRobert Mustacchi #define CU_ADDRESS_SIZE_SIZE sizeof(Dwarf_Small) 326*7fd79137SRobert Mustacchi 327*7fd79137SRobert Mustacchi void *_dwarf_memcpy_swap_bytes(void *s1, const void *s2, size_t len); 328*7fd79137SRobert Mustacchi 329*7fd79137SRobert Mustacchi #define ORIGINAL_DWARF_OFFSET_SIZE 4 330*7fd79137SRobert Mustacchi #define DISTINGUISHED_VALUE 0xffffffff 331*7fd79137SRobert Mustacchi #define DISTINGUISHED_VALUE_OFFSET_SIZE 8 332*7fd79137SRobert Mustacchi 333*7fd79137SRobert Mustacchi /* 334*7fd79137SRobert Mustacchi We don't load the sections until they are needed. This function is 335*7fd79137SRobert Mustacchi used to load the section. 336*7fd79137SRobert Mustacchi */ 337*7fd79137SRobert Mustacchi int _dwarf_load_section(Dwarf_Debug, 338*7fd79137SRobert Mustacchi struct Dwarf_Section_s *, 339*7fd79137SRobert Mustacchi Dwarf_Error *); 340