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