Back to index

cell-binutils  2.17cvs20070401
dwarf.h
Go to the documentation of this file.
00001 /* Declarations and definitions of codes relating to the DWARF symbolic
00002    debugging information format.
00003 
00004    Written by Ron Guilmette (rfg@netcom.com)
00005 
00006 Copyright 1992, 1993, 1995, 1999, 2005 Free Software Foundation, Inc.
00007 
00008 This file is part of GCC.
00009 
00010 GCC is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU General Public License as published by the Free
00012 Software Foundation; either version 2, or (at your option) any later
00013 version.
00014 
00015 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
00016 WARRANTY; without even the implied warranty of MERCHANTABILITY or
00017 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00018 for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with GCC; see the file COPYING.  If not, write to the Free
00022 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00023 02110-1301, USA.  */
00024 
00025 /* This file is derived from the DWARF specification (a public document)
00026    Revision 1.0.1 (April 8, 1992) developed by the UNIX International
00027    Programming Languages Special Interest Group (UI/PLSIG) and distributed
00028    by UNIX International.  Copies of this specification are available from
00029    UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
00030 */
00031 
00032 #ifndef _ELF_DWARF_H
00033 #define _ELF_DWARF_H
00034 
00035 /* Tag names and codes.  */
00036 
00037 enum dwarf_tag {
00038     TAG_padding                    = 0x0000,
00039     TAG_array_type          = 0x0001,
00040     TAG_class_type          = 0x0002,
00041     TAG_entry_point         = 0x0003,
00042     TAG_enumeration_type    = 0x0004,
00043     TAG_formal_parameter    = 0x0005,
00044     TAG_global_subroutine   = 0x0006,
00045     TAG_global_variable            = 0x0007,
00046                             /* 0x0008 -- reserved */
00047                             /* 0x0009 -- reserved */
00048     TAG_label               = 0x000a,
00049     TAG_lexical_block              = 0x000b,
00050     TAG_local_variable             = 0x000c,
00051     TAG_member                     = 0x000d,
00052                             /* 0x000e -- reserved */
00053     TAG_pointer_type        = 0x000f,
00054     TAG_reference_type             = 0x0010,
00055     TAG_compile_unit        = 0x0011,
00056     TAG_string_type         = 0x0012,
00057     TAG_structure_type             = 0x0013,
00058     TAG_subroutine          = 0x0014,
00059     TAG_subroutine_type            = 0x0015,
00060     TAG_typedef                    = 0x0016,
00061     TAG_union_type          = 0x0017,
00062     TAG_unspecified_parameters     = 0x0018,
00063     TAG_variant                    = 0x0019,
00064     TAG_common_block        = 0x001a,
00065     TAG_common_inclusion    = 0x001b,
00066     TAG_inheritance         = 0x001c,
00067     TAG_inlined_subroutine  = 0x001d,
00068     TAG_module                     = 0x001e,
00069     TAG_ptr_to_member_type  = 0x001f,
00070     TAG_set_type            = 0x0020,
00071     TAG_subrange_type              = 0x0021,
00072     TAG_with_stmt           = 0x0022,
00073 
00074     /* GNU extensions */
00075 
00076     TAG_format_label        = 0x8000,  /* for FORTRAN 77 and Fortran 90 */
00077     TAG_namelist            = 0x8001,  /* For Fortran 90 */
00078     TAG_function_template   = 0x8002,  /* for C++ */
00079     TAG_class_template             = 0x8003   /* for C++ */
00080 };
00081 
00082 #define TAG_lo_user  0x8000  /* implementation-defined range start */
00083 #define TAG_hi_user  0xffff  /* implementation-defined range end */
00084 #define TAG_source_file TAG_compile_unit  /* for backward compatibility */
00085 
00086 /* Form names and codes.  */
00087 
00088 enum dwarf_form {
00089     FORM_ADDR = 0x1,
00090     FORM_REF  = 0x2,
00091     FORM_BLOCK2      = 0x3,
00092     FORM_BLOCK4      = 0x4,
00093     FORM_DATA2       = 0x5,
00094     FORM_DATA4       = 0x6,
00095     FORM_DATA8       = 0x7,
00096     FORM_STRING      = 0x8
00097 };
00098 
00099 /* Attribute names and codes.  */
00100 
00101 enum dwarf_attribute {
00102     AT_sibling                     = (0x0010|FORM_REF),
00103     AT_location                    = (0x0020|FORM_BLOCK2),
00104     AT_name                 = (0x0030|FORM_STRING),
00105     AT_fund_type            = (0x0050|FORM_DATA2),
00106     AT_mod_fund_type        = (0x0060|FORM_BLOCK2),
00107     AT_user_def_type        = (0x0070|FORM_REF),
00108     AT_mod_u_d_type         = (0x0080|FORM_BLOCK2),
00109     AT_ordering                    = (0x0090|FORM_DATA2),
00110     AT_subscr_data          = (0x00a0|FORM_BLOCK2),
00111     AT_byte_size            = (0x00b0|FORM_DATA4),
00112     AT_bit_offset           = (0x00c0|FORM_DATA2),
00113     AT_bit_size                    = (0x00d0|FORM_DATA4),
00114                             /* (0x00e0|FORM_xxxx) -- reserved */
00115     AT_element_list         = (0x00f0|FORM_BLOCK4),
00116     AT_stmt_list            = (0x0100|FORM_DATA4),
00117     AT_low_pc               = (0x0110|FORM_ADDR),
00118     AT_high_pc                     = (0x0120|FORM_ADDR),
00119     AT_language                    = (0x0130|FORM_DATA4),
00120     AT_member               = (0x0140|FORM_REF),
00121     AT_discr                = (0x0150|FORM_REF),
00122     AT_discr_value          = (0x0160|FORM_BLOCK2),
00123                             /* (0x0170|FORM_xxxx) -- reserved */
00124                             /* (0x0180|FORM_xxxx) -- reserved */
00125     AT_string_length        = (0x0190|FORM_BLOCK2),
00126     AT_common_reference            = (0x01a0|FORM_REF),
00127     AT_comp_dir                    = (0x01b0|FORM_STRING),
00128         AT_const_value_string      = (0x01c0|FORM_STRING),
00129         AT_const_value_data2       = (0x01c0|FORM_DATA2),
00130         AT_const_value_data4       = (0x01c0|FORM_DATA4),
00131         AT_const_value_data8       = (0x01c0|FORM_DATA8),
00132         AT_const_value_block2      = (0x01c0|FORM_BLOCK2),
00133         AT_const_value_block4      = (0x01c0|FORM_BLOCK4),
00134     AT_containing_type             = (0x01d0|FORM_REF),
00135         AT_default_value_addr      = (0x01e0|FORM_ADDR),
00136         AT_default_value_data2     = (0x01e0|FORM_DATA2),
00137         AT_default_value_data4     = (0x01e0|FORM_DATA4),
00138         AT_default_value_data8     = (0x01e0|FORM_DATA8),
00139         AT_default_value_string    = (0x01e0|FORM_STRING),
00140     AT_friends                     = (0x01f0|FORM_BLOCK2),
00141     AT_inline               = (0x0200|FORM_STRING),
00142     AT_is_optional          = (0x0210|FORM_STRING),
00143         AT_lower_bound_ref  = (0x0220|FORM_REF),
00144         AT_lower_bound_data2       = (0x0220|FORM_DATA2),
00145         AT_lower_bound_data4       = (0x0220|FORM_DATA4),
00146         AT_lower_bound_data8       = (0x0220|FORM_DATA8),
00147     AT_private                     = (0x0240|FORM_STRING),
00148     AT_producer                    = (0x0250|FORM_STRING),
00149     AT_program                     = (0x0230|FORM_STRING),
00150     AT_protected            = (0x0260|FORM_STRING),
00151     AT_prototyped           = (0x0270|FORM_STRING),
00152     AT_public               = (0x0280|FORM_STRING),
00153     AT_pure_virtual         = (0x0290|FORM_STRING),
00154     AT_return_addr          = (0x02a0|FORM_BLOCK2),
00155     AT_abstract_origin             = (0x02b0|FORM_REF),
00156     AT_start_scope          = (0x02c0|FORM_DATA4),
00157     AT_stride_size          = (0x02e0|FORM_DATA4),
00158         AT_upper_bound_ref  = (0x02f0|FORM_REF),
00159         AT_upper_bound_data2       = (0x02f0|FORM_DATA2),
00160         AT_upper_bound_data4       = (0x02f0|FORM_DATA4),
00161         AT_upper_bound_data8       = (0x02f0|FORM_DATA8),
00162     AT_virtual                     = (0x0300|FORM_STRING),
00163 
00164     /* GNU extensions.  */
00165 
00166     AT_sf_names                    = (0x8000|FORM_DATA4),
00167     AT_src_info                    = (0x8010|FORM_DATA4),
00168     AT_mac_info                    = (0x8020|FORM_DATA4),
00169     AT_src_coords           = (0x8030|FORM_DATA4),
00170     AT_body_begin           = (0x8040|FORM_ADDR),
00171     AT_body_end                    = (0x8050|FORM_ADDR)
00172 };
00173 
00174 #define AT_lo_user   0x2000 /* implementation-defined range start */
00175 #define AT_hi_user   0x3ff0 /* implementation-defined range end */
00176 
00177 /* Location atom names and codes.  */
00178 
00179 enum dwarf_location_atom {
00180     OP_REG    = 0x01,
00181     OP_BASEREG       = 0x02,
00182     OP_ADDR   = 0x03,
00183     OP_CONST  = 0x04,
00184     OP_DEREF2 = 0x05,
00185     OP_DEREF4 = 0x06,
00186     OP_ADD    = 0x07,
00187 
00188     /* GNU extensions.  */
00189 
00190     OP_MULT   = 0x80
00191 };
00192 
00193 #define OP_LO_USER   0x80  /* implementation-defined range start */
00194 #define OP_HI_USER   0xff  /* implementation-defined range end */
00195 
00196 /* Fundamental type names and codes.  */
00197 
00198 enum dwarf_fundamental_type {
00199     FT_char          = 0x0001,
00200     FT_signed_char   = 0x0002,
00201     FT_unsigned_char = 0x0003,
00202     FT_short         = 0x0004,
00203     FT_signed_short  = 0x0005,
00204     FT_unsigned_short       = 0x0006,
00205     FT_integer              = 0x0007,
00206     FT_signed_integer       = 0x0008,
00207     FT_unsigned_integer     = 0x0009,
00208     FT_long          = 0x000a,
00209     FT_signed_long   = 0x000b,
00210     FT_unsigned_long = 0x000c,
00211     FT_pointer              = 0x000d,  /* an alias for (void *) */
00212     FT_float         = 0x000e,
00213     FT_dbl_prec_float       = 0x000f,
00214     FT_ext_prec_float       = 0x0010,  /* breaks "classic" svr4 SDB */
00215     FT_complex              = 0x0011,  /* breaks "classic" svr4 SDB */
00216     FT_dbl_prec_complex     = 0x0012,  /* breaks "classic" svr4 SDB */
00217                      /* 0x0013 -- reserved */
00218     FT_void          = 0x0014,
00219     FT_boolean              = 0x0015,  /* breaks "classic" svr4 SDB */
00220     FT_ext_prec_complex     = 0x0016,  /* breaks "classic" svr4 SDB */
00221     FT_label         = 0x0017,
00222   
00223     /* GNU extensions
00224        The low order byte must indicate the size (in bytes) for the type.
00225        All of these types will probably break "classic" svr4 SDB.  */
00226 
00227     FT_long_long     = 0x8008,
00228     FT_signed_long_long     = 0x8108,
00229     FT_unsigned_long_long = 0x8208,
00230 
00231     FT_int8          = 0x9001,
00232     FT_signed_int8   = 0x9101,
00233     FT_unsigned_int8 = 0x9201,
00234     FT_int16         = 0x9302,
00235     FT_signed_int16  = 0x9402,
00236     FT_unsigned_int16       = 0x9502,
00237     FT_int32         = 0x9604,
00238     FT_signed_int32  = 0x9704,
00239     FT_unsigned_int32       = 0x9804,
00240     FT_int64         = 0x9908,
00241     FT_signed_int64  = 0x9a08,
00242     FT_unsigned_int64       = 0x9b08,
00243     FT_int128        = 0x9c10,
00244     FT_signed_int128 = 0x9d10,
00245     FT_unsigned_int128      = 0x9e10,
00246 
00247     FT_real32        = 0xa004,
00248     FT_real64        = 0xa108,
00249     FT_real96        = 0xa20c,
00250     FT_real128              = 0xa310
00251 };
00252 
00253 #define FT_lo_user   0x8000  /* implementation-defined range start */
00254 #define FT_hi_user   0xffff  /* implementation defined range end */
00255 
00256 /* Type modifier names and codes.  */
00257 
00258 enum dwarf_type_modifier {
00259     MOD_pointer_to   = 0x01,
00260     MOD_reference_to = 0x02,
00261     MOD_const        = 0x03,
00262     MOD_volatile     = 0x04
00263 };
00264 
00265 #define MOD_lo_user  0x80  /* implementation-defined range start */
00266 #define MOD_hi_user  0xff  /* implementation-defined range end */
00267 
00268 /* Array ordering names and codes.  */
00269 
00270 enum dwarf_array_dim_ordering {
00271     ORD_row_major    = 0,
00272     ORD_col_major    = 1
00273 };
00274 
00275 /* Array subscript format names and codes.  */
00276 
00277 enum dwarf_subscr_data_formats {
00278     FMT_FT_C_C       = 0x0,
00279     FMT_FT_C_X       = 0x1,
00280     FMT_FT_X_C       = 0x2,
00281     FMT_FT_X_X       = 0x3,
00282     FMT_UT_C_C       = 0x4,
00283     FMT_UT_C_X       = 0x5,
00284     FMT_UT_X_C       = 0x6,
00285     FMT_UT_X_X       = 0x7,
00286     FMT_ET    = 0x8
00287 };
00288 
00289 /* Derived from above for ease of use.  */
00290 
00291 #define FMT_CODE(_FUNDAMENTAL_TYPE_P, _LB_CONST_P, _UB_CONST_P) \
00292  (((_FUNDAMENTAL_TYPE_P) ? 0 : 4)  \
00293   | ((_LB_CONST_P) ? 0 : 2)        \
00294   | ((_UB_CONST_P) ? 0 : 1))
00295 
00296 /* Source language names and codes.  */
00297 
00298 enum dwarf_source_language {
00299     LANG_C89         = 0x00000001,
00300     LANG_C           = 0x00000002,
00301     LANG_ADA83              = 0x00000003,
00302     LANG_C_PLUS_PLUS = 0x00000004,
00303     LANG_COBOL74     = 0x00000005,
00304     LANG_COBOL85     = 0x00000006,
00305     LANG_FORTRAN77   = 0x00000007,
00306     LANG_FORTRAN90   = 0x00000008,
00307     LANG_PASCAL83    = 0x00000009,
00308     LANG_MODULA2     = 0x0000000a,
00309     LANG_JAVA        = 0x0000000b
00310 };
00311 
00312 #define LANG_lo_user 0x00008000  /* implementation-defined range start */
00313 #define LANG_hi_user 0x0000ffff  /* implementation-defined range end */
00314 
00315 /* Names and codes for GNU "macinfo" extension.  */
00316 
00317 enum dwarf_macinfo_record_type {
00318     MACINFO_start    = 's',
00319     MACINFO_resume   = 'r',
00320     MACINFO_define   = 'd',
00321     MACINFO_undef    = 'u'
00322 };
00323 
00324 #endif /* _ELF_DWARF_H */