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