xref: /openbsd-src/gnu/usr.bin/binutils/include/elf/dwarf.h (revision b55d46928a2b71c17e5349c93fca2971ba1cafa1)
12159047fSniklas /* Declarations and definitions of codes relating to the DWARF symbolic
22159047fSniklas    debugging information format.
32159047fSniklas 
42159047fSniklas    Written by Ron Guilmette (rfg@ncd.com)
52159047fSniklas 
6*b55d4692Sfgsch Copyright 1992, 1993, 1995, 1999 Free Software Foundation, Inc.
72159047fSniklas 
82159047fSniklas This file is part of GNU CC.
92159047fSniklas 
102159047fSniklas GNU CC is free software; you can redistribute it and/or modify
112159047fSniklas it under the terms of the GNU General Public License as published by
122159047fSniklas the Free Software Foundation; either version 2, or (at your option)
132159047fSniklas any later version.
142159047fSniklas 
152159047fSniklas GNU CC is distributed in the hope that it will be useful,
162159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of
172159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
182159047fSniklas GNU General Public License for more details.
192159047fSniklas 
202159047fSniklas You should have received a copy of the GNU General Public License
212159047fSniklas along with GNU CC; see the file COPYING.  If not, write to
222159047fSniklas the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
232159047fSniklas 
242159047fSniklas /* This file is derived from the DWARF specification (a public document)
252159047fSniklas    Revision 1.0.1 (April 8, 1992) developed by the UNIX International
262159047fSniklas    Programming Languages Special Interest Group (UI/PLSIG) and distributed
272159047fSniklas    by UNIX International.  Copies of this specification are available from
282159047fSniklas    UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
292159047fSniklas */
302159047fSniklas 
312159047fSniklas #ifndef _ELF_DWARF_H
322159047fSniklas #define _ELF_DWARF_H
332159047fSniklas 
342159047fSniklas /* Tag names and codes.  */
352159047fSniklas 
362159047fSniklas enum dwarf_tag {
372159047fSniklas     TAG_padding			= 0x0000,
382159047fSniklas     TAG_array_type		= 0x0001,
392159047fSniklas     TAG_class_type		= 0x0002,
402159047fSniklas     TAG_entry_point		= 0x0003,
412159047fSniklas     TAG_enumeration_type	= 0x0004,
422159047fSniklas     TAG_formal_parameter	= 0x0005,
432159047fSniklas     TAG_global_subroutine	= 0x0006,
442159047fSniklas     TAG_global_variable		= 0x0007,
452159047fSniklas     				/* 0x0008 -- reserved */
462159047fSniklas 				/* 0x0009 -- reserved */
472159047fSniklas     TAG_label			= 0x000a,
482159047fSniklas     TAG_lexical_block		= 0x000b,
492159047fSniklas     TAG_local_variable		= 0x000c,
502159047fSniklas     TAG_member			= 0x000d,
512159047fSniklas 				/* 0x000e -- reserved */
522159047fSniklas     TAG_pointer_type		= 0x000f,
532159047fSniklas     TAG_reference_type		= 0x0010,
542159047fSniklas     TAG_compile_unit		= 0x0011,
552159047fSniklas     TAG_string_type		= 0x0012,
562159047fSniklas     TAG_structure_type		= 0x0013,
572159047fSniklas     TAG_subroutine		= 0x0014,
582159047fSniklas     TAG_subroutine_type		= 0x0015,
592159047fSniklas     TAG_typedef			= 0x0016,
602159047fSniklas     TAG_union_type		= 0x0017,
612159047fSniklas     TAG_unspecified_parameters	= 0x0018,
622159047fSniklas     TAG_variant			= 0x0019,
632159047fSniklas     TAG_common_block		= 0x001a,
642159047fSniklas     TAG_common_inclusion	= 0x001b,
652159047fSniklas     TAG_inheritance		= 0x001c,
662159047fSniklas     TAG_inlined_subroutine	= 0x001d,
672159047fSniklas     TAG_module			= 0x001e,
682159047fSniklas     TAG_ptr_to_member_type	= 0x001f,
692159047fSniklas     TAG_set_type		= 0x0020,
702159047fSniklas     TAG_subrange_type		= 0x0021,
712159047fSniklas     TAG_with_stmt		= 0x0022,
722159047fSniklas 
732159047fSniklas     /* GNU extensions */
742159047fSniklas 
752159047fSniklas     TAG_format_label		= 0x8000,  /* for FORTRAN 77 and Fortran 90 */
762159047fSniklas     TAG_namelist		= 0x8001,  /* For Fortran 90 */
772159047fSniklas     TAG_function_template	= 0x8002,  /* for C++ */
782159047fSniklas     TAG_class_template		= 0x8003   /* for C++ */
792159047fSniklas };
802159047fSniklas 
812159047fSniklas #define TAG_lo_user	0x8000  /* implementation-defined range start */
822159047fSniklas #define TAG_hi_user	0xffff  /* implementation-defined range end */
832159047fSniklas #define TAG_source_file TAG_compile_unit  /* for backward compatibility */
842159047fSniklas 
852159047fSniklas /* Form names and codes.  */
862159047fSniklas 
872159047fSniklas enum dwarf_form {
882159047fSniklas     FORM_ADDR	= 0x1,
892159047fSniklas     FORM_REF	= 0x2,
902159047fSniklas     FORM_BLOCK2	= 0x3,
912159047fSniklas     FORM_BLOCK4	= 0x4,
922159047fSniklas     FORM_DATA2	= 0x5,
932159047fSniklas     FORM_DATA4	= 0x6,
942159047fSniklas     FORM_DATA8	= 0x7,
952159047fSniklas     FORM_STRING	= 0x8
962159047fSniklas };
972159047fSniklas 
982159047fSniklas /* Attribute names and codes.  */
992159047fSniklas 
1002159047fSniklas enum dwarf_attribute {
1012159047fSniklas     AT_sibling			= (0x0010|FORM_REF),
1022159047fSniklas     AT_location			= (0x0020|FORM_BLOCK2),
1032159047fSniklas     AT_name			= (0x0030|FORM_STRING),
1042159047fSniklas     AT_fund_type		= (0x0050|FORM_DATA2),
1052159047fSniklas     AT_mod_fund_type		= (0x0060|FORM_BLOCK2),
1062159047fSniklas     AT_user_def_type		= (0x0070|FORM_REF),
1072159047fSniklas     AT_mod_u_d_type		= (0x0080|FORM_BLOCK2),
1082159047fSniklas     AT_ordering			= (0x0090|FORM_DATA2),
1092159047fSniklas     AT_subscr_data		= (0x00a0|FORM_BLOCK2),
1102159047fSniklas     AT_byte_size		= (0x00b0|FORM_DATA4),
1112159047fSniklas     AT_bit_offset		= (0x00c0|FORM_DATA2),
1122159047fSniklas     AT_bit_size			= (0x00d0|FORM_DATA4),
1132159047fSniklas 				/* (0x00e0|FORM_xxxx) -- reserved */
1142159047fSniklas     AT_element_list		= (0x00f0|FORM_BLOCK4),
1152159047fSniklas     AT_stmt_list		= (0x0100|FORM_DATA4),
1162159047fSniklas     AT_low_pc			= (0x0110|FORM_ADDR),
1172159047fSniklas     AT_high_pc			= (0x0120|FORM_ADDR),
1182159047fSniklas     AT_language			= (0x0130|FORM_DATA4),
1192159047fSniklas     AT_member			= (0x0140|FORM_REF),
1202159047fSniklas     AT_discr			= (0x0150|FORM_REF),
1212159047fSniklas     AT_discr_value		= (0x0160|FORM_BLOCK2),
1222159047fSniklas 				/* (0x0170|FORM_xxxx) -- reserved */
1232159047fSniklas 				/* (0x0180|FORM_xxxx) -- reserved */
1242159047fSniklas     AT_string_length		= (0x0190|FORM_BLOCK2),
1252159047fSniklas     AT_common_reference		= (0x01a0|FORM_REF),
1262159047fSniklas     AT_comp_dir			= (0x01b0|FORM_STRING),
1272159047fSniklas         AT_const_value_string	= (0x01c0|FORM_STRING),
1282159047fSniklas         AT_const_value_data2	= (0x01c0|FORM_DATA2),
1292159047fSniklas         AT_const_value_data4	= (0x01c0|FORM_DATA4),
1302159047fSniklas         AT_const_value_data8	= (0x01c0|FORM_DATA8),
1312159047fSniklas         AT_const_value_block2	= (0x01c0|FORM_BLOCK2),
1322159047fSniklas         AT_const_value_block4	= (0x01c0|FORM_BLOCK4),
1332159047fSniklas     AT_containing_type		= (0x01d0|FORM_REF),
1342159047fSniklas         AT_default_value_addr	= (0x01e0|FORM_ADDR),
1352159047fSniklas         AT_default_value_data2	= (0x01e0|FORM_DATA2),
1362159047fSniklas         AT_default_value_data4	= (0x01e0|FORM_DATA4),
1372159047fSniklas         AT_default_value_data8	= (0x01e0|FORM_DATA8),
1382159047fSniklas         AT_default_value_string	= (0x01e0|FORM_STRING),
1392159047fSniklas     AT_friends			= (0x01f0|FORM_BLOCK2),
1402159047fSniklas     AT_inline			= (0x0200|FORM_STRING),
1412159047fSniklas     AT_is_optional		= (0x0210|FORM_STRING),
1422159047fSniklas         AT_lower_bound_ref	= (0x0220|FORM_REF),
1432159047fSniklas         AT_lower_bound_data2	= (0x0220|FORM_DATA2),
1442159047fSniklas         AT_lower_bound_data4	= (0x0220|FORM_DATA4),
1452159047fSniklas         AT_lower_bound_data8	= (0x0220|FORM_DATA8),
1462159047fSniklas     AT_private			= (0x0240|FORM_STRING),
1472159047fSniklas     AT_producer			= (0x0250|FORM_STRING),
1482159047fSniklas     AT_program			= (0x0230|FORM_STRING),
1492159047fSniklas     AT_protected		= (0x0260|FORM_STRING),
1502159047fSniklas     AT_prototyped		= (0x0270|FORM_STRING),
1512159047fSniklas     AT_public			= (0x0280|FORM_STRING),
1522159047fSniklas     AT_pure_virtual		= (0x0290|FORM_STRING),
1532159047fSniklas     AT_return_addr		= (0x02a0|FORM_BLOCK2),
1542159047fSniklas     AT_abstract_origin		= (0x02b0|FORM_REF),
1552159047fSniklas     AT_start_scope		= (0x02c0|FORM_DATA4),
1562159047fSniklas     AT_stride_size		= (0x02e0|FORM_DATA4),
1572159047fSniklas         AT_upper_bound_ref	= (0x02f0|FORM_REF),
1582159047fSniklas         AT_upper_bound_data2	= (0x02f0|FORM_DATA2),
1592159047fSniklas         AT_upper_bound_data4	= (0x02f0|FORM_DATA4),
1602159047fSniklas         AT_upper_bound_data8	= (0x02f0|FORM_DATA8),
1612159047fSniklas     AT_virtual			= (0x0300|FORM_STRING),
1622159047fSniklas 
1632159047fSniklas     /* GNU extensions.  */
1642159047fSniklas 
1652159047fSniklas     AT_sf_names			= (0x8000|FORM_DATA4),
1662159047fSniklas     AT_src_info			= (0x8010|FORM_DATA4),
1672159047fSniklas     AT_mac_info			= (0x8020|FORM_DATA4),
1682159047fSniklas     AT_src_coords		= (0x8030|FORM_DATA4),
1692159047fSniklas     AT_body_begin		= (0x8040|FORM_ADDR),
1702159047fSniklas     AT_body_end			= (0x8050|FORM_ADDR)
1712159047fSniklas };
1722159047fSniklas 
1732159047fSniklas #define AT_lo_user	0x8000  /* implementation-defined range start */
1742159047fSniklas #define AT_hi_user	0xffff  /* implementation-defined range end */
1752159047fSniklas 
1762159047fSniklas /* Location atom names and codes.  */
1772159047fSniklas 
1782159047fSniklas enum dwarf_location_atom {
1792159047fSniklas     OP_REG	= 0x01,
1802159047fSniklas     OP_BASEREG	= 0x02,
1812159047fSniklas     OP_ADDR	= 0x03,
1822159047fSniklas     OP_CONST	= 0x04,
1832159047fSniklas     OP_DEREF2	= 0x05,
1842159047fSniklas     OP_DEREF4	= 0x06,
1852159047fSniklas     OP_ADD	= 0x07
1862159047fSniklas };
1872159047fSniklas 
1882159047fSniklas #define OP_LO_USER	0x80  /* implementation-defined range start */
1892159047fSniklas #define OP_HI_USER	0xff  /* implementation-defined range end */
1902159047fSniklas 
1912159047fSniklas /* Fundamental type names and codes.  */
1922159047fSniklas 
1932159047fSniklas enum dwarf_fundamental_type {
1942159047fSniklas     FT_char		= 0x0001,
1952159047fSniklas     FT_signed_char	= 0x0002,
1962159047fSniklas     FT_unsigned_char	= 0x0003,
1972159047fSniklas     FT_short		= 0x0004,
1982159047fSniklas     FT_signed_short	= 0x0005,
1992159047fSniklas     FT_unsigned_short	= 0x0006,
2002159047fSniklas     FT_integer		= 0x0007,
2012159047fSniklas     FT_signed_integer	= 0x0008,
2022159047fSniklas     FT_unsigned_integer	= 0x0009,
2032159047fSniklas     FT_long		= 0x000a,
2042159047fSniklas     FT_signed_long	= 0x000b,
2052159047fSniklas     FT_unsigned_long	= 0x000c,
2062159047fSniklas     FT_pointer		= 0x000d,  /* an alias for (void *) */
2072159047fSniklas     FT_float		= 0x000e,
2082159047fSniklas     FT_dbl_prec_float	= 0x000f,
2092159047fSniklas     FT_ext_prec_float	= 0x0010,  /* breaks "classic" svr4 SDB */
2102159047fSniklas     FT_complex		= 0x0011,  /* breaks "classic" svr4 SDB */
2112159047fSniklas     FT_dbl_prec_complex	= 0x0012,  /* breaks "classic" svr4 SDB */
2122159047fSniklas 			/* 0x0013 -- reserved */
2132159047fSniklas     FT_void		= 0x0014,
2142159047fSniklas     FT_boolean		= 0x0015,  /* breaks "classic" svr4 SDB */
2152159047fSniklas     FT_ext_prec_complex	= 0x0016,  /* breaks "classic" svr4 SDB */
2162159047fSniklas     FT_label		= 0x0017,
2172159047fSniklas 
2182159047fSniklas     /* GNU extensions
2192159047fSniklas        The low order byte must indicate the size (in bytes) for the type.
2202159047fSniklas        All of these types will probably break "classic" svr4 SDB */
2212159047fSniklas 
2222159047fSniklas     FT_long_long	= 0x8008,
2232159047fSniklas     FT_signed_long_long	= 0x8108,
2242159047fSniklas     FT_unsigned_long_long = 0x8208,
2252159047fSniklas 
2262159047fSniklas     FT_int8		= 0x9001,
2272159047fSniklas     FT_signed_int8	= 0x9101,
2282159047fSniklas     FT_unsigned_int8	= 0x9201,
2292159047fSniklas     FT_int16		= 0x9302,
2302159047fSniklas     FT_signed_int16	= 0x9402,
2312159047fSniklas     FT_unsigned_int16	= 0x9502,
2322159047fSniklas     FT_int32		= 0x9604,
2332159047fSniklas     FT_signed_int32	= 0x9704,
2342159047fSniklas     FT_unsigned_int32	= 0x9804,
2352159047fSniklas     FT_int64		= 0x9908,
2362159047fSniklas     FT_signed_int64	= 0x9a08,
2372159047fSniklas     FT_unsigned_int64	= 0x9b08,
2382159047fSniklas 
2392159047fSniklas     FT_real32		= 0xa004,
2402159047fSniklas     FT_real64		= 0xa108,
2412159047fSniklas     FT_real96		= 0xa20c,
2422159047fSniklas     FT_real128		= 0xa310
2432159047fSniklas };
2442159047fSniklas 
2452159047fSniklas #define FT_lo_user	0x8000  /* implementation-defined range start */
2462159047fSniklas #define FT_hi_user	0xffff  /* implementation defined range end */
2472159047fSniklas 
2482159047fSniklas /* Type modifier names and codes.  */
2492159047fSniklas 
2502159047fSniklas enum dwarf_type_modifier {
2512159047fSniklas     MOD_pointer_to	= 0x01,
2522159047fSniklas     MOD_reference_to	= 0x02,
2532159047fSniklas     MOD_const		= 0x03,
2542159047fSniklas     MOD_volatile	= 0x04
2552159047fSniklas };
2562159047fSniklas 
2572159047fSniklas #define MOD_lo_user	0x80  /* implementation-defined range start */
2582159047fSniklas #define MOD_hi_user	0xff  /* implementation-defined range end */
2592159047fSniklas 
2602159047fSniklas /* Array ordering names and codes.  */
2612159047fSniklas 
2622159047fSniklas enum dwarf_array_dim_ordering {
2632159047fSniklas     ORD_row_major	= 0,
2642159047fSniklas     ORD_col_major	= 1
2652159047fSniklas };
2662159047fSniklas 
2672159047fSniklas /* Array subscript format names and codes.  */
2682159047fSniklas 
2692159047fSniklas enum dwarf_subscr_data_formats {
2702159047fSniklas     FMT_FT_C_C	= 0x0,
2712159047fSniklas     FMT_FT_C_X	= 0x1,
2722159047fSniklas     FMT_FT_X_C	= 0x2,
2732159047fSniklas     FMT_FT_X_X	= 0x3,
2742159047fSniklas     FMT_UT_C_C	= 0x4,
2752159047fSniklas     FMT_UT_C_X	= 0x5,
2762159047fSniklas     FMT_UT_X_C	= 0x6,
2772159047fSniklas     FMT_UT_X_X	= 0x7,
2782159047fSniklas     FMT_ET	= 0x8
2792159047fSniklas };
2802159047fSniklas 
2812159047fSniklas /* Derived from above for ease of use.  */
2822159047fSniklas 
2832159047fSniklas #define FMT_CODE(_FUNDAMENTAL_TYPE_P, _UB_CONST_P, _LB_CONST_P) \
2842159047fSniklas  (((_FUNDAMENTAL_TYPE_P) ? 0 : 4)	\
2852159047fSniklas   | ((_UB_CONST_P) ? 0 : 2)		\
2862159047fSniklas   | ((_LB_CONST_P) ? 0 : 1))
2872159047fSniklas 
2882159047fSniklas /* Source language names and codes.  */
2892159047fSniklas 
2902159047fSniklas enum dwarf_source_language {
2912159047fSniklas     LANG_C89		= 0x00000001,
2922159047fSniklas     LANG_C		= 0x00000002,
2932159047fSniklas     LANG_ADA83		= 0x00000003,
2942159047fSniklas     LANG_C_PLUS_PLUS	= 0x00000004,
2952159047fSniklas     LANG_COBOL74	= 0x00000005,
2962159047fSniklas     LANG_COBOL85	= 0x00000006,
2972159047fSniklas     LANG_FORTRAN77	= 0x00000007,
2982159047fSniklas     LANG_FORTRAN90	= 0x00000008,
2992159047fSniklas     LANG_PASCAL83	= 0x00000009,
3002159047fSniklas     LANG_MODULA2	= 0x0000000a,
3012159047fSniklas 
3022159047fSniklas     /* GNU extensions */
3032159047fSniklas 
304f7cc78ecSespie     LANG_CHILL		= 0x00009af3,	/* random value for GNU Chill */
305f7cc78ecSespie     LANG_JAVA		= 0x00009af4    /* random value + 1 for GNU Java */
3062159047fSniklas };
3072159047fSniklas 
3082159047fSniklas #define LANG_lo_user	0x00008000  /* implementation-defined range start */
3092159047fSniklas #define LANG_hi_user	0x0000ffff  /* implementation-defined range end */
3102159047fSniklas 
3112159047fSniklas /* Names and codes for GNU "macinfo" extension.  */
3122159047fSniklas 
3132159047fSniklas enum dwarf_macinfo_record_type {
3142159047fSniklas     MACINFO_start	= 's',
3152159047fSniklas     MACINFO_resume	= 'r',
3162159047fSniklas     MACINFO_define	= 'd',
3172159047fSniklas     MACINFO_undef	= 'u'
3182159047fSniklas };
3192159047fSniklas 
3202159047fSniklas #endif /* _ELF_DWARF_H */
321