1214082Sdim/* dwwrf.h - DWARF support header file
2214634Sdim   Copyright 2005, 2007
3214082Sdim   Free Software Foundation, Inc.
4214082Sdim
5214082SdimThis file is part of GNU Binutils.
6214082Sdim
7214082SdimThis program is free software; you can redistribute it and/or modify
8214082Sdimit under the terms of the GNU General Public License as published by
9214082Sdimthe Free Software Foundation; either version 2 of the License, or
10214082Sdim(at your option) any later version.
11214082Sdim
12214082SdimThis program is distributed in the hope that it will be useful,
13214082Sdimbut WITHOUT ANY WARRANTY; without even the implied warranty of
14214082SdimMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15214082SdimGNU General Public License for more details.
16214082Sdim
17214082SdimYou should have received a copy of the GNU General Public License
18214082Sdimalong with this program; if not, write to the Free Software
19214082SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20214082Sdim
21214082Sdim#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
22214082Sdim/* We can't use any bfd types here since readelf may define BFD64 and
23214082Sdim   objdump may not.  */
24214082Sdimtypedef unsigned long long dwarf_vma;
25214082Sdimtypedef unsigned long long dwarf_size_type;
26214082Sdim#else
27214082Sdimtypedef unsigned long dwarf_vma;
28214082Sdimtypedef unsigned long dwarf_size_type;
29214082Sdim#endif
30214082Sdim
31214082Sdimstruct dwarf_section
32214082Sdim{
33214082Sdim  const char *name;
34214082Sdim  unsigned char *start;
35214082Sdim  dwarf_vma address;
36214082Sdim  dwarf_size_type size;
37214082Sdim};
38214082Sdim
39214082Sdim/* A structure containing the name of a debug section
40214082Sdim   and a pointer to a function that can decode it.  */
41214082Sdimstruct dwarf_section_display
42214082Sdim{
43214082Sdim  struct dwarf_section section;
44214082Sdim  int (*display) (struct dwarf_section *, void *);
45214082Sdim  unsigned int relocate : 1;
46214082Sdim  unsigned int eh_frame : 1;
47214082Sdim};
48214082Sdim
49214082Sdimenum dwarf_section_display_enum {
50214082Sdim  abbrev = 0,
51214082Sdim  aranges,
52214082Sdim  frame,
53214082Sdim  info,
54214082Sdim  line,
55214082Sdim  pubnames,
56214082Sdim  eh_frame,
57214082Sdim  macinfo,
58214082Sdim  str,
59214082Sdim  loc,
60214082Sdim  pubtypes,
61214082Sdim  ranges,
62214082Sdim  static_func,
63214082Sdim  static_vars,
64214082Sdim  types,
65214082Sdim  weaknames,
66214082Sdim  max
67214082Sdim};
68214082Sdim
69214082Sdimextern struct dwarf_section_display debug_displays [];
70214082Sdim
71214082Sdim/* This structure records the information that
72214082Sdim   we extract from the.debug_info section.  */
73214082Sdimtypedef struct
74214082Sdim{
75214082Sdim  unsigned int   pointer_size;
76214082Sdim  unsigned long  cu_offset;
77214082Sdim  unsigned long	 base_address;
78214082Sdim  /* This is an array of offsets to the location list table.  */
79214082Sdim  unsigned long *loc_offsets;
80214082Sdim  int		*have_frame_base;
81214082Sdim  unsigned int   num_loc_offsets;
82214082Sdim  unsigned int   max_loc_offsets;
83214082Sdim  unsigned long *range_lists;
84214082Sdim  unsigned int   num_range_lists;
85214082Sdim  unsigned int   max_range_lists;
86214082Sdim}
87214082Sdimdebug_info;
88214082Sdim
89214082Sdimextern dwarf_vma (*byte_get) (unsigned char *, int);
90214082Sdimextern dwarf_vma byte_get_little_endian (unsigned char *, int);
91214082Sdimextern dwarf_vma byte_get_big_endian (unsigned char *, int);
92214082Sdim
93214082Sdimextern dwarf_vma eh_addr_size;
94214082Sdimextern int is_relocatable;
95214082Sdim
96214082Sdimextern int do_debug_info;
97214082Sdimextern int do_debug_abbrevs;
98214082Sdimextern int do_debug_lines;
99214082Sdimextern int do_debug_pubnames;
100214082Sdimextern int do_debug_aranges;
101214082Sdimextern int do_debug_ranges;
102214082Sdimextern int do_debug_frames;
103214082Sdimextern int do_debug_frames_interp;
104214082Sdimextern int do_debug_macinfo;
105214082Sdimextern int do_debug_str;
106214082Sdimextern int do_debug_loc;
107214082Sdim
108214082Sdimextern int load_debug_section (enum dwarf_section_display_enum,
109214082Sdim			       void *);
110214082Sdimextern void free_debug_section (enum dwarf_section_display_enum);
111214082Sdim
112214082Sdimextern void free_debug_memory (void);
113214082Sdim
114214082Sdimvoid *cmalloc (size_t, size_t);
115214082Sdimvoid *xcmalloc (size_t, size_t);
116214082Sdimvoid *xcrealloc (void *, size_t, size_t);
117214082Sdim
118214082Sdimvoid error (const char *, ...) ATTRIBUTE_PRINTF_1;
119214082Sdimvoid warn (const char *, ...) ATTRIBUTE_PRINTF_1;
120