xref: /dragonfly/contrib/gdb-7/include/elf/dwarf.h (revision 1b722dce)
1 /* Declarations and definitions of codes relating to the DWARF symbolic
2    debugging information format.
3 
4    Written by Ron Guilmette (rfg@netcom.com)
5 
6 Copyright 1992, 1993, 1995, 1999, 2005 Free Software Foundation, Inc.
7 
8 This file is part of GCC.
9 
10 GCC is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 2, or (at your option) any later
13 version.
14 
15 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18 for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with GCC; see the file COPYING.  If not, write to the Free
22 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
23 02110-1301, USA.  */
24 
25 /* This file is derived from the DWARF specification (a public document)
26    Revision 1.0.1 (April 8, 1992) developed by the UNIX International
27    Programming Languages Special Interest Group (UI/PLSIG) and distributed
28    by UNIX International.  Copies of this specification are available from
29    UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
30 */
31 
32 #ifndef _ELF_DWARF_H
33 #define _ELF_DWARF_H
34 
35 /* Tag names and codes.  */
36 
37 enum dwarf_tag {
38     TAG_padding			= 0x0000,
39     TAG_array_type		= 0x0001,
40     TAG_class_type		= 0x0002,
41     TAG_entry_point		= 0x0003,
42     TAG_enumeration_type	= 0x0004,
43     TAG_formal_parameter	= 0x0005,
44     TAG_global_subroutine	= 0x0006,
45     TAG_global_variable		= 0x0007,
46     				/* 0x0008 -- reserved */
47 				/* 0x0009 -- reserved */
48     TAG_label			= 0x000a,
49     TAG_lexical_block		= 0x000b,
50     TAG_local_variable		= 0x000c,
51     TAG_member			= 0x000d,
52 				/* 0x000e -- reserved */
53     TAG_pointer_type		= 0x000f,
54     TAG_reference_type		= 0x0010,
55     TAG_compile_unit		= 0x0011,
56     TAG_string_type		= 0x0012,
57     TAG_structure_type		= 0x0013,
58     TAG_subroutine		= 0x0014,
59     TAG_subroutine_type		= 0x0015,
60     TAG_typedef			= 0x0016,
61     TAG_union_type		= 0x0017,
62     TAG_unspecified_parameters	= 0x0018,
63     TAG_variant			= 0x0019,
64     TAG_common_block		= 0x001a,
65     TAG_common_inclusion	= 0x001b,
66     TAG_inheritance		= 0x001c,
67     TAG_inlined_subroutine	= 0x001d,
68     TAG_module			= 0x001e,
69     TAG_ptr_to_member_type	= 0x001f,
70     TAG_set_type		= 0x0020,
71     TAG_subrange_type		= 0x0021,
72     TAG_with_stmt		= 0x0022,
73 
74     /* GNU extensions */
75 
76     TAG_format_label		= 0x8000,  /* for FORTRAN 77 and Fortran 90 */
77     TAG_namelist		= 0x8001,  /* For Fortran 90 */
78     TAG_function_template	= 0x8002,  /* for C++ */
79     TAG_class_template		= 0x8003   /* for C++ */
80 };
81 
82 #define TAG_lo_user	0x8000  /* implementation-defined range start */
83 #define TAG_hi_user	0xffff  /* implementation-defined range end */
84 #define TAG_source_file TAG_compile_unit  /* for backward compatibility */
85 
86 /* Form names and codes.  */
87 
88 enum dwarf_form {
89     FORM_ADDR	= 0x1,
90     FORM_REF	= 0x2,
91     FORM_BLOCK2	= 0x3,
92     FORM_BLOCK4	= 0x4,
93     FORM_DATA2	= 0x5,
94     FORM_DATA4	= 0x6,
95     FORM_DATA8	= 0x7,
96     FORM_STRING	= 0x8
97 };
98 
99 /* Attribute names and codes.  */
100 
101 enum dwarf_attribute {
102     AT_sibling			= (0x0010|FORM_REF),
103     AT_location			= (0x0020|FORM_BLOCK2),
104     AT_name			= (0x0030|FORM_STRING),
105     AT_fund_type		= (0x0050|FORM_DATA2),
106     AT_mod_fund_type		= (0x0060|FORM_BLOCK2),
107     AT_user_def_type		= (0x0070|FORM_REF),
108     AT_mod_u_d_type		= (0x0080|FORM_BLOCK2),
109     AT_ordering			= (0x0090|FORM_DATA2),
110     AT_subscr_data		= (0x00a0|FORM_BLOCK2),
111     AT_byte_size		= (0x00b0|FORM_DATA4),
112     AT_bit_offset		= (0x00c0|FORM_DATA2),
113     AT_bit_size			= (0x00d0|FORM_DATA4),
114 				/* (0x00e0|FORM_xxxx) -- reserved */
115     AT_element_list		= (0x00f0|FORM_BLOCK4),
116     AT_stmt_list		= (0x0100|FORM_DATA4),
117     AT_low_pc			= (0x0110|FORM_ADDR),
118     AT_high_pc			= (0x0120|FORM_ADDR),
119     AT_language			= (0x0130|FORM_DATA4),
120     AT_member			= (0x0140|FORM_REF),
121     AT_discr			= (0x0150|FORM_REF),
122     AT_discr_value		= (0x0160|FORM_BLOCK2),
123 				/* (0x0170|FORM_xxxx) -- reserved */
124 				/* (0x0180|FORM_xxxx) -- reserved */
125     AT_string_length		= (0x0190|FORM_BLOCK2),
126     AT_common_reference		= (0x01a0|FORM_REF),
127     AT_comp_dir			= (0x01b0|FORM_STRING),
128         AT_const_value_string	= (0x01c0|FORM_STRING),
129         AT_const_value_data2	= (0x01c0|FORM_DATA2),
130         AT_const_value_data4	= (0x01c0|FORM_DATA4),
131         AT_const_value_data8	= (0x01c0|FORM_DATA8),
132         AT_const_value_block2	= (0x01c0|FORM_BLOCK2),
133         AT_const_value_block4	= (0x01c0|FORM_BLOCK4),
134     AT_containing_type		= (0x01d0|FORM_REF),
135         AT_default_value_addr	= (0x01e0|FORM_ADDR),
136         AT_default_value_data2	= (0x01e0|FORM_DATA2),
137         AT_default_value_data4	= (0x01e0|FORM_DATA4),
138         AT_default_value_data8	= (0x01e0|FORM_DATA8),
139         AT_default_value_string	= (0x01e0|FORM_STRING),
140     AT_friends			= (0x01f0|FORM_BLOCK2),
141     AT_inline			= (0x0200|FORM_STRING),
142     AT_is_optional		= (0x0210|FORM_STRING),
143         AT_lower_bound_ref	= (0x0220|FORM_REF),
144         AT_lower_bound_data2	= (0x0220|FORM_DATA2),
145         AT_lower_bound_data4	= (0x0220|FORM_DATA4),
146         AT_lower_bound_data8	= (0x0220|FORM_DATA8),
147     AT_private			= (0x0240|FORM_STRING),
148     AT_producer			= (0x0250|FORM_STRING),
149     AT_program			= (0x0230|FORM_STRING),
150     AT_protected		= (0x0260|FORM_STRING),
151     AT_prototyped		= (0x0270|FORM_STRING),
152     AT_public			= (0x0280|FORM_STRING),
153     AT_pure_virtual		= (0x0290|FORM_STRING),
154     AT_return_addr		= (0x02a0|FORM_BLOCK2),
155     AT_abstract_origin		= (0x02b0|FORM_REF),
156     AT_start_scope		= (0x02c0|FORM_DATA4),
157     AT_stride_size		= (0x02e0|FORM_DATA4),
158         AT_upper_bound_ref	= (0x02f0|FORM_REF),
159         AT_upper_bound_data2	= (0x02f0|FORM_DATA2),
160         AT_upper_bound_data4	= (0x02f0|FORM_DATA4),
161         AT_upper_bound_data8	= (0x02f0|FORM_DATA8),
162     AT_virtual			= (0x0300|FORM_STRING),
163 
164     /* GNU extensions.  */
165 
166     AT_sf_names			= (0x8000|FORM_DATA4),
167     AT_src_info			= (0x8010|FORM_DATA4),
168     AT_mac_info			= (0x8020|FORM_DATA4),
169     AT_src_coords		= (0x8030|FORM_DATA4),
170     AT_body_begin		= (0x8040|FORM_ADDR),
171     AT_body_end			= (0x8050|FORM_ADDR)
172 };
173 
174 #define AT_lo_user	0x2000	/* implementation-defined range start */
175 #define AT_hi_user	0x3ff0	/* implementation-defined range end */
176 
177 /* Location atom names and codes.  */
178 
179 enum dwarf_location_atom {
180     OP_REG	= 0x01,
181     OP_BASEREG	= 0x02,
182     OP_ADDR	= 0x03,
183     OP_CONST	= 0x04,
184     OP_DEREF2	= 0x05,
185     OP_DEREF4	= 0x06,
186     OP_ADD	= 0x07,
187 
188     /* GNU extensions.  */
189 
190     OP_MULT	= 0x80
191 };
192 
193 #define OP_LO_USER	0x80  /* implementation-defined range start */
194 #define OP_HI_USER	0xff  /* implementation-defined range end */
195 
196 /* Fundamental type names and codes.  */
197 
198 enum dwarf_fundamental_type {
199     FT_char		= 0x0001,
200     FT_signed_char	= 0x0002,
201     FT_unsigned_char	= 0x0003,
202     FT_short		= 0x0004,
203     FT_signed_short	= 0x0005,
204     FT_unsigned_short	= 0x0006,
205     FT_integer		= 0x0007,
206     FT_signed_integer	= 0x0008,
207     FT_unsigned_integer	= 0x0009,
208     FT_long		= 0x000a,
209     FT_signed_long	= 0x000b,
210     FT_unsigned_long	= 0x000c,
211     FT_pointer		= 0x000d,  /* an alias for (void *) */
212     FT_float		= 0x000e,
213     FT_dbl_prec_float	= 0x000f,
214     FT_ext_prec_float	= 0x0010,  /* breaks "classic" svr4 SDB */
215     FT_complex		= 0x0011,  /* breaks "classic" svr4 SDB */
216     FT_dbl_prec_complex	= 0x0012,  /* breaks "classic" svr4 SDB */
217 			/* 0x0013 -- reserved */
218     FT_void		= 0x0014,
219     FT_boolean		= 0x0015,  /* breaks "classic" svr4 SDB */
220     FT_ext_prec_complex	= 0x0016,  /* breaks "classic" svr4 SDB */
221     FT_label		= 0x0017,
222 
223     /* GNU extensions
224        The low order byte must indicate the size (in bytes) for the type.
225        All of these types will probably break "classic" svr4 SDB.  */
226 
227     FT_long_long	= 0x8008,
228     FT_signed_long_long	= 0x8108,
229     FT_unsigned_long_long = 0x8208,
230 
231     FT_int8		= 0x9001,
232     FT_signed_int8	= 0x9101,
233     FT_unsigned_int8	= 0x9201,
234     FT_int16		= 0x9302,
235     FT_signed_int16	= 0x9402,
236     FT_unsigned_int16	= 0x9502,
237     FT_int32		= 0x9604,
238     FT_signed_int32	= 0x9704,
239     FT_unsigned_int32	= 0x9804,
240     FT_int64		= 0x9908,
241     FT_signed_int64	= 0x9a08,
242     FT_unsigned_int64	= 0x9b08,
243     FT_int128		= 0x9c10,
244     FT_signed_int128	= 0x9d10,
245     FT_unsigned_int128	= 0x9e10,
246 
247     FT_real32		= 0xa004,
248     FT_real64		= 0xa108,
249     FT_real96		= 0xa20c,
250     FT_real128		= 0xa310
251 };
252 
253 #define FT_lo_user	0x8000  /* implementation-defined range start */
254 #define FT_hi_user	0xffff  /* implementation defined range end */
255 
256 /* Type modifier names and codes.  */
257 
258 enum dwarf_type_modifier {
259     MOD_pointer_to	= 0x01,
260     MOD_reference_to	= 0x02,
261     MOD_const		= 0x03,
262     MOD_volatile	= 0x04
263 };
264 
265 #define MOD_lo_user	0x80  /* implementation-defined range start */
266 #define MOD_hi_user	0xff  /* implementation-defined range end */
267 
268 /* Array ordering names and codes.  */
269 
270 enum dwarf_array_dim_ordering {
271     ORD_row_major	= 0,
272     ORD_col_major	= 1
273 };
274 
275 /* Array subscript format names and codes.  */
276 
277 enum dwarf_subscr_data_formats {
278     FMT_FT_C_C	= 0x0,
279     FMT_FT_C_X	= 0x1,
280     FMT_FT_X_C	= 0x2,
281     FMT_FT_X_X	= 0x3,
282     FMT_UT_C_C	= 0x4,
283     FMT_UT_C_X	= 0x5,
284     FMT_UT_X_C	= 0x6,
285     FMT_UT_X_X	= 0x7,
286     FMT_ET	= 0x8
287 };
288 
289 /* Derived from above for ease of use.  */
290 
291 #define FMT_CODE(_FUNDAMENTAL_TYPE_P, _LB_CONST_P, _UB_CONST_P) \
292  (((_FUNDAMENTAL_TYPE_P) ? 0 : 4)	\
293   | ((_LB_CONST_P) ? 0 : 2)		\
294   | ((_UB_CONST_P) ? 0 : 1))
295 
296 /* Source language names and codes.  */
297 
298 enum dwarf_source_language {
299     LANG_C89		= 0x00000001,
300     LANG_C		= 0x00000002,
301     LANG_ADA83		= 0x00000003,
302     LANG_C_PLUS_PLUS	= 0x00000004,
303     LANG_COBOL74	= 0x00000005,
304     LANG_COBOL85	= 0x00000006,
305     LANG_FORTRAN77	= 0x00000007,
306     LANG_FORTRAN90	= 0x00000008,
307     LANG_PASCAL83	= 0x00000009,
308     LANG_MODULA2	= 0x0000000a,
309     LANG_JAVA		= 0x0000000b
310 };
311 
312 #define LANG_lo_user	0x00008000  /* implementation-defined range start */
313 #define LANG_hi_user	0x0000ffff  /* implementation-defined range end */
314 
315 /* Names and codes for GNU "macinfo" extension.  */
316 
317 enum dwarf_macinfo_record_type {
318     MACINFO_start	= 's',
319     MACINFO_resume	= 'r',
320     MACINFO_define	= 'd',
321     MACINFO_undef	= 'u'
322 };
323 
324 #endif /* _ELF_DWARF_H */
325