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