1*3d8817e4Smiod /* dwwrf.h - DWARF support header file 2*3d8817e4Smiod Copyright 2005 3*3d8817e4Smiod Free Software Foundation, Inc. 4*3d8817e4Smiod 5*3d8817e4Smiod This file is part of GNU Binutils. 6*3d8817e4Smiod 7*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 8*3d8817e4Smiod it under the terms of the GNU General Public License as published by 9*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 10*3d8817e4Smiod (at your option) any later version. 11*3d8817e4Smiod 12*3d8817e4Smiod This program is distributed in the hope that it will be useful, 13*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 14*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*3d8817e4Smiod GNU General Public License for more details. 16*3d8817e4Smiod 17*3d8817e4Smiod You should have received a copy of the GNU General Public License 18*3d8817e4Smiod along with this program; if not, write to the Free Software 19*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 20*3d8817e4Smiod 21*3d8817e4Smiod #include "bfd.h" 22*3d8817e4Smiod #include "elf/dwarf2.h" 23*3d8817e4Smiod 24*3d8817e4Smiod #if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) 25*3d8817e4Smiod /* We can't use any bfd types here since readelf may define BFD64 and 26*3d8817e4Smiod objdump may not. */ 27*3d8817e4Smiod typedef unsigned long long dwarf_vma; 28*3d8817e4Smiod typedef unsigned long long dwarf_size_type; 29*3d8817e4Smiod #else 30*3d8817e4Smiod typedef unsigned long dwarf_vma; 31*3d8817e4Smiod typedef unsigned long dwarf_size_type; 32*3d8817e4Smiod #endif 33*3d8817e4Smiod 34*3d8817e4Smiod struct dwarf_section 35*3d8817e4Smiod { 36*3d8817e4Smiod const char *name; 37*3d8817e4Smiod unsigned char *start; 38*3d8817e4Smiod dwarf_vma address; 39*3d8817e4Smiod dwarf_size_type size; 40*3d8817e4Smiod }; 41*3d8817e4Smiod 42*3d8817e4Smiod /* A structure containing the name of a debug section 43*3d8817e4Smiod and a pointer to a function that can decode it. */ 44*3d8817e4Smiod struct dwarf_section_display 45*3d8817e4Smiod { 46*3d8817e4Smiod struct dwarf_section section; 47*3d8817e4Smiod int (*display) (struct dwarf_section *, void *); 48*3d8817e4Smiod unsigned int relocate : 1; 49*3d8817e4Smiod unsigned int eh_frame : 1; 50*3d8817e4Smiod }; 51*3d8817e4Smiod 52*3d8817e4Smiod enum dwarf_section_display_enum { 53*3d8817e4Smiod abbrev = 0, 54*3d8817e4Smiod aranges, 55*3d8817e4Smiod frame, 56*3d8817e4Smiod info, 57*3d8817e4Smiod line, 58*3d8817e4Smiod pubnames, 59*3d8817e4Smiod eh_frame, 60*3d8817e4Smiod macinfo, 61*3d8817e4Smiod str, 62*3d8817e4Smiod loc, 63*3d8817e4Smiod pubtypes, 64*3d8817e4Smiod ranges, 65*3d8817e4Smiod static_func, 66*3d8817e4Smiod static_vars, 67*3d8817e4Smiod types, 68*3d8817e4Smiod weaknames, 69*3d8817e4Smiod max 70*3d8817e4Smiod }; 71*3d8817e4Smiod 72*3d8817e4Smiod extern struct dwarf_section_display debug_displays []; 73*3d8817e4Smiod 74*3d8817e4Smiod /* This structure records the information that 75*3d8817e4Smiod we extract from the.debug_info section. */ 76*3d8817e4Smiod typedef struct 77*3d8817e4Smiod { 78*3d8817e4Smiod unsigned int pointer_size; 79*3d8817e4Smiod unsigned long cu_offset; 80*3d8817e4Smiod unsigned long base_address; 81*3d8817e4Smiod /* This is an array of offsets to the location list table. */ 82*3d8817e4Smiod unsigned long *loc_offsets; 83*3d8817e4Smiod int *have_frame_base; 84*3d8817e4Smiod unsigned int num_loc_offsets; 85*3d8817e4Smiod unsigned int max_loc_offsets; 86*3d8817e4Smiod unsigned long *range_lists; 87*3d8817e4Smiod unsigned int num_range_lists; 88*3d8817e4Smiod unsigned int max_range_lists; 89*3d8817e4Smiod } 90*3d8817e4Smiod debug_info; 91*3d8817e4Smiod 92*3d8817e4Smiod extern dwarf_vma (*byte_get) (unsigned char *, int); 93*3d8817e4Smiod extern dwarf_vma byte_get_little_endian (unsigned char *, int); 94*3d8817e4Smiod extern dwarf_vma byte_get_big_endian (unsigned char *, int); 95*3d8817e4Smiod 96*3d8817e4Smiod extern dwarf_vma eh_addr_size; 97*3d8817e4Smiod extern int is_relocatable; 98*3d8817e4Smiod 99*3d8817e4Smiod extern int do_debug_info; 100*3d8817e4Smiod extern int do_debug_abbrevs; 101*3d8817e4Smiod extern int do_debug_lines; 102*3d8817e4Smiod extern int do_debug_pubnames; 103*3d8817e4Smiod extern int do_debug_aranges; 104*3d8817e4Smiod extern int do_debug_ranges; 105*3d8817e4Smiod extern int do_debug_frames; 106*3d8817e4Smiod extern int do_debug_frames_interp; 107*3d8817e4Smiod extern int do_debug_macinfo; 108*3d8817e4Smiod extern int do_debug_str; 109*3d8817e4Smiod extern int do_debug_loc; 110*3d8817e4Smiod 111*3d8817e4Smiod extern int load_debug_section (enum dwarf_section_display_enum, 112*3d8817e4Smiod void *); 113*3d8817e4Smiod extern void free_debug_section (enum dwarf_section_display_enum); 114*3d8817e4Smiod 115*3d8817e4Smiod extern void free_debug_memory (void); 116*3d8817e4Smiod 117*3d8817e4Smiod void *cmalloc (size_t, size_t); 118*3d8817e4Smiod void *xcmalloc (size_t, size_t); 119*3d8817e4Smiod void *xcrealloc (void *, size_t, size_t); 120*3d8817e4Smiod 121*3d8817e4Smiod void error (const char *, ...) ATTRIBUTE_PRINTF_1; 122*3d8817e4Smiod void warn (const char *, ...) ATTRIBUTE_PRINTF_1; 123