Merge branch 'vendor/OPENSSH'
[dragonfly.git] / contrib / binutils-2.21 / binutils / dwarf.h
1 /* dwarf.h - DWARF support header file
2    Copyright 2005, 2007, 2008, 2009, 2010
3    Free Software Foundation, Inc.
4
5    This file is part of GNU Binutils.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20    MA 02110-1301, USA.  */
21
22 typedef unsigned HOST_WIDEST_INT dwarf_vma;
23 typedef unsigned HOST_WIDEST_INT dwarf_size_type;
24
25 struct dwarf_section
26 {
27   /* A debug section has a different name when it's stored compressed
28      or not.  COMPRESSED_NAME and UNCOMPRESSED_NAME are the two
29      possibilities.  NAME is set to whichever one is used for this
30      input file, as determined by load_debug_section().  */
31   const char *uncompressed_name;
32   const char *compressed_name;
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.  */
41 struct dwarf_section_display
42 {
43   struct dwarf_section section;
44   int (*display) (struct dwarf_section *, void *);
45   int *enabled;
46   unsigned int relocate : 1;
47 };
48
49 enum dwarf_section_display_enum
50 {
51   abbrev = 0,
52   aranges,
53   frame,
54   info,
55   line,
56   pubnames,
57   eh_frame,
58   macinfo,
59   str,
60   loc,
61   pubtypes,
62   ranges,
63   static_func,
64   static_vars,
65   types,
66   weaknames,
67   trace_info,
68   trace_abbrev,
69   trace_aranges,
70   max
71 };
72
73 extern struct dwarf_section_display debug_displays [];
74
75 /* This structure records the information that
76    we extract from the.debug_info section.  */
77 typedef struct
78 {
79   unsigned int   pointer_size;
80   unsigned int   offset_size;
81   int            dwarf_version;
82   unsigned long  cu_offset;
83   unsigned long  base_address;
84   /* This is an array of offsets to the location list table.  */
85   unsigned long *loc_offsets;
86   int           *have_frame_base;
87   unsigned int   num_loc_offsets;
88   unsigned int   max_loc_offsets;
89   /* List of .debug_ranges offsets seen in this .debug_info.  */
90   unsigned long *range_lists;
91   unsigned int   num_range_lists;
92   unsigned int   max_range_lists;
93 }
94 debug_info;
95
96 extern int eh_addr_size;
97
98 extern int do_debug_info;
99 extern int do_debug_abbrevs;
100 extern int do_debug_lines;
101 extern int do_debug_pubnames;
102 extern int do_debug_pubtypes;
103 extern int do_debug_aranges;
104 extern int do_debug_ranges;
105 extern int do_debug_frames;
106 extern int do_debug_frames_interp;
107 extern int do_debug_macinfo;
108 extern int do_debug_str;
109 extern int do_debug_loc;
110 extern int do_gdb_index;
111 extern int do_trace_info;
112 extern int do_trace_abbrevs;
113 extern int do_trace_aranges;
114 extern int do_wide;
115
116 extern void init_dwarf_regnames (unsigned int);
117 extern void init_dwarf_regnames_i386 (void);
118 extern void init_dwarf_regnames_x86_64 (void);
119
120 extern int load_debug_section (enum dwarf_section_display_enum,
121                                void *);
122 extern void free_debug_section (enum dwarf_section_display_enum);
123
124 extern void free_debug_memory (void);
125
126 extern void dwarf_select_sections_by_names (const char *);
127 extern void dwarf_select_sections_by_letters (const char *);
128 extern void dwarf_select_sections_all (void);
129
130 void *cmalloc (size_t, size_t);
131 void *xcmalloc (size_t, size_t);
132 void *xcrealloc (void *, size_t, size_t);
133
134 unsigned long int read_leb128 (unsigned char *data,
135                                unsigned int *length_return, int sign);