LLVM  mainline
Dwarf.h
Go to the documentation of this file.
00001 //===-- llvm/Support/Dwarf.h ---Dwarf Constants------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // \file
00011 // \brief This file contains constants used for implementing Dwarf
00012 // debug support.
00013 //
00014 // For details on the Dwarf specfication see the latest DWARF Debugging
00015 // Information Format standard document on http://www.dwarfstd.org. This
00016 // file often includes support for non-released standard features.
00017 //
00018 //===----------------------------------------------------------------------===//
00019 
00020 #ifndef LLVM_SUPPORT_DWARF_H
00021 #define LLVM_SUPPORT_DWARF_H
00022 
00023 #include "llvm/ADT/StringRef.h"
00024 #include "llvm/Support/Compiler.h"
00025 #include "llvm/Support/DataTypes.h"
00026 
00027 namespace llvm {
00028 
00029 namespace dwarf {
00030 
00031 //===----------------------------------------------------------------------===//
00032 // Dwarf constants as gleaned from the DWARF Debugging Information Format V.4
00033 // reference manual http://www.dwarfstd.org/.
00034 //
00035 
00036 // Do not mix the following two enumerations sets.  DW_TAG_invalid changes the
00037 // enumeration base type.
00038 
00039 enum LLVMConstants : uint32_t {
00040   // LLVM mock tags (see also llvm/Support/Dwarf.def).
00041   DW_TAG_invalid = ~0U,        // Tag for invalid results.
00042   DW_VIRTUALITY_invalid = ~0U, // Virtuality for invalid results.
00043   DW_MACINFO_invalid = ~0U,    // Macinfo type for invalid results.
00044 
00045   // Other constants.
00046   DWARF_VERSION = 4,       // Default dwarf version we output.
00047   DW_PUBTYPES_VERSION = 2, // Section version number for .debug_pubtypes.
00048   DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
00049   DW_ARANGES_VERSION = 2   // Section version number for .debug_aranges.
00050 };
00051 
00052 // Special ID values that distinguish a CIE from a FDE in DWARF CFI.
00053 // Not inside an enum because a 64-bit value is needed.
00054 const uint32_t DW_CIE_ID = UINT32_MAX;
00055 const uint64_t DW64_CIE_ID = UINT64_MAX;
00056 
00057 enum Tag : uint16_t {
00058 #define HANDLE_DW_TAG(ID, NAME) DW_TAG_##NAME = ID,
00059 #include "llvm/Support/Dwarf.def"
00060   DW_TAG_lo_user = 0x4080,
00061   DW_TAG_hi_user = 0xffff,
00062   DW_TAG_user_base = 0x1000 // Recommended base for user tags.
00063 };
00064 
00065 inline bool isType(Tag T) {
00066   switch (T) {
00067   case DW_TAG_array_type:
00068   case DW_TAG_class_type:
00069   case DW_TAG_interface_type:
00070   case DW_TAG_enumeration_type:
00071   case DW_TAG_pointer_type:
00072   case DW_TAG_reference_type:
00073   case DW_TAG_rvalue_reference_type:
00074   case DW_TAG_string_type:
00075   case DW_TAG_structure_type:
00076   case DW_TAG_subroutine_type:
00077   case DW_TAG_union_type:
00078   case DW_TAG_ptr_to_member_type:
00079   case DW_TAG_set_type:
00080   case DW_TAG_subrange_type:
00081   case DW_TAG_base_type:
00082   case DW_TAG_const_type:
00083   case DW_TAG_file_type:
00084   case DW_TAG_packed_type:
00085   case DW_TAG_volatile_type:
00086   case DW_TAG_typedef:
00087     return true;
00088   default:
00089     return false;
00090   }
00091 }
00092 
00093 enum Attribute : uint16_t {
00094   // Attributes
00095   DW_AT_sibling = 0x01,
00096   DW_AT_location = 0x02,
00097   DW_AT_name = 0x03,
00098   DW_AT_ordering = 0x09,
00099   DW_AT_byte_size = 0x0b,
00100   DW_AT_bit_offset = 0x0c,
00101   DW_AT_bit_size = 0x0d,
00102   DW_AT_stmt_list = 0x10,
00103   DW_AT_low_pc = 0x11,
00104   DW_AT_high_pc = 0x12,
00105   DW_AT_language = 0x13,
00106   DW_AT_discr = 0x15,
00107   DW_AT_discr_value = 0x16,
00108   DW_AT_visibility = 0x17,
00109   DW_AT_import = 0x18,
00110   DW_AT_string_length = 0x19,
00111   DW_AT_common_reference = 0x1a,
00112   DW_AT_comp_dir = 0x1b,
00113   DW_AT_const_value = 0x1c,
00114   DW_AT_containing_type = 0x1d,
00115   DW_AT_default_value = 0x1e,
00116   DW_AT_inline = 0x20,
00117   DW_AT_is_optional = 0x21,
00118   DW_AT_lower_bound = 0x22,
00119   DW_AT_producer = 0x25,
00120   DW_AT_prototyped = 0x27,
00121   DW_AT_return_addr = 0x2a,
00122   DW_AT_start_scope = 0x2c,
00123   DW_AT_bit_stride = 0x2e,
00124   DW_AT_upper_bound = 0x2f,
00125   DW_AT_abstract_origin = 0x31,
00126   DW_AT_accessibility = 0x32,
00127   DW_AT_address_class = 0x33,
00128   DW_AT_artificial = 0x34,
00129   DW_AT_base_types = 0x35,
00130   DW_AT_calling_convention = 0x36,
00131   DW_AT_count = 0x37,
00132   DW_AT_data_member_location = 0x38,
00133   DW_AT_decl_column = 0x39,
00134   DW_AT_decl_file = 0x3a,
00135   DW_AT_decl_line = 0x3b,
00136   DW_AT_declaration = 0x3c,
00137   DW_AT_discr_list = 0x3d,
00138   DW_AT_encoding = 0x3e,
00139   DW_AT_external = 0x3f,
00140   DW_AT_frame_base = 0x40,
00141   DW_AT_friend = 0x41,
00142   DW_AT_identifier_case = 0x42,
00143   DW_AT_macro_info = 0x43,
00144   DW_AT_namelist_item = 0x44,
00145   DW_AT_priority = 0x45,
00146   DW_AT_segment = 0x46,
00147   DW_AT_specification = 0x47,
00148   DW_AT_static_link = 0x48,
00149   DW_AT_type = 0x49,
00150   DW_AT_use_location = 0x4a,
00151   DW_AT_variable_parameter = 0x4b,
00152   DW_AT_virtuality = 0x4c,
00153   DW_AT_vtable_elem_location = 0x4d,
00154   DW_AT_allocated = 0x4e,
00155   DW_AT_associated = 0x4f,
00156   DW_AT_data_location = 0x50,
00157   DW_AT_byte_stride = 0x51,
00158   DW_AT_entry_pc = 0x52,
00159   DW_AT_use_UTF8 = 0x53,
00160   DW_AT_extension = 0x54,
00161   DW_AT_ranges = 0x55,
00162   DW_AT_trampoline = 0x56,
00163   DW_AT_call_column = 0x57,
00164   DW_AT_call_file = 0x58,
00165   DW_AT_call_line = 0x59,
00166   DW_AT_description = 0x5a,
00167   DW_AT_binary_scale = 0x5b,
00168   DW_AT_decimal_scale = 0x5c,
00169   DW_AT_small = 0x5d,
00170   DW_AT_decimal_sign = 0x5e,
00171   DW_AT_digit_count = 0x5f,
00172   DW_AT_picture_string = 0x60,
00173   DW_AT_mutable = 0x61,
00174   DW_AT_threads_scaled = 0x62,
00175   DW_AT_explicit = 0x63,
00176   DW_AT_object_pointer = 0x64,
00177   DW_AT_endianity = 0x65,
00178   DW_AT_elemental = 0x66,
00179   DW_AT_pure = 0x67,
00180   DW_AT_recursive = 0x68,
00181   DW_AT_signature = 0x69,
00182   DW_AT_main_subprogram = 0x6a,
00183   DW_AT_data_bit_offset = 0x6b,
00184   DW_AT_const_expr = 0x6c,
00185   DW_AT_enum_class = 0x6d,
00186   DW_AT_linkage_name = 0x6e,
00187 
00188   // New in DWARF 5:
00189   DW_AT_string_length_bit_size = 0x6f,
00190   DW_AT_string_length_byte_size = 0x70,
00191   DW_AT_rank = 0x71,
00192   DW_AT_str_offsets_base = 0x72,
00193   DW_AT_addr_base = 0x73,
00194   DW_AT_ranges_base = 0x74,
00195   DW_AT_dwo_id = 0x75,
00196   DW_AT_dwo_name = 0x76,
00197   DW_AT_reference = 0x77,
00198   DW_AT_rvalue_reference = 0x78,
00199   DW_AT_macros = 0x79,
00200 
00201   DW_AT_lo_user = 0x2000,
00202   DW_AT_hi_user = 0x3fff,
00203 
00204   DW_AT_MIPS_loop_begin = 0x2002,
00205   DW_AT_MIPS_tail_loop_begin = 0x2003,
00206   DW_AT_MIPS_epilog_begin = 0x2004,
00207   DW_AT_MIPS_loop_unroll_factor = 0x2005,
00208   DW_AT_MIPS_software_pipeline_depth = 0x2006,
00209   DW_AT_MIPS_linkage_name = 0x2007,
00210   DW_AT_MIPS_stride = 0x2008,
00211   DW_AT_MIPS_abstract_name = 0x2009,
00212   DW_AT_MIPS_clone_origin = 0x200a,
00213   DW_AT_MIPS_has_inlines = 0x200b,
00214   DW_AT_MIPS_stride_byte = 0x200c,
00215   DW_AT_MIPS_stride_elem = 0x200d,
00216   DW_AT_MIPS_ptr_dopetype = 0x200e,
00217   DW_AT_MIPS_allocatable_dopetype = 0x200f,
00218   DW_AT_MIPS_assumed_shape_dopetype = 0x2010,
00219 
00220   // This one appears to have only been implemented by Open64 for
00221   // fortran and may conflict with other extensions.
00222   DW_AT_MIPS_assumed_size = 0x2011,
00223 
00224   // GNU extensions
00225   DW_AT_sf_names = 0x2101,
00226   DW_AT_src_info = 0x2102,
00227   DW_AT_mac_info = 0x2103,
00228   DW_AT_src_coords = 0x2104,
00229   DW_AT_body_begin = 0x2105,
00230   DW_AT_body_end = 0x2106,
00231   DW_AT_GNU_vector = 0x2107,
00232   DW_AT_GNU_template_name = 0x2110,
00233 
00234   DW_AT_GNU_odr_signature = 0x210f,
00235   DW_AT_GNU_macros = 0x2119,
00236 
00237   // Extensions for Fission proposal.
00238   DW_AT_GNU_dwo_name = 0x2130,
00239   DW_AT_GNU_dwo_id = 0x2131,
00240   DW_AT_GNU_ranges_base = 0x2132,
00241   DW_AT_GNU_addr_base = 0x2133,
00242   DW_AT_GNU_pubnames = 0x2134,
00243   DW_AT_GNU_pubtypes = 0x2135,
00244   DW_AT_GNU_discriminator = 0x2136,
00245 
00246   // Borland extensions.
00247   DW_AT_BORLAND_property_read = 0x3b11,
00248   DW_AT_BORLAND_property_write = 0x3b12,
00249   DW_AT_BORLAND_property_implements = 0x3b13,
00250   DW_AT_BORLAND_property_index = 0x3b14,
00251   DW_AT_BORLAND_property_default = 0x3b15,
00252   DW_AT_BORLAND_Delphi_unit = 0x3b20,
00253   DW_AT_BORLAND_Delphi_class = 0x3b21,
00254   DW_AT_BORLAND_Delphi_record = 0x3b22,
00255   DW_AT_BORLAND_Delphi_metaclass = 0x3b23,
00256   DW_AT_BORLAND_Delphi_constructor = 0x3b24,
00257   DW_AT_BORLAND_Delphi_destructor = 0x3b25,
00258   DW_AT_BORLAND_Delphi_anonymous_method = 0x3b26,
00259   DW_AT_BORLAND_Delphi_interface = 0x3b27,
00260   DW_AT_BORLAND_Delphi_ABI = 0x3b28,
00261   DW_AT_BORLAND_Delphi_return = 0x3b29,
00262   DW_AT_BORLAND_Delphi_frameptr = 0x3b30,
00263   DW_AT_BORLAND_closure = 0x3b31,
00264 
00265   // LLVM project extensions.
00266   DW_AT_LLVM_include_path = 0x3e00,
00267   DW_AT_LLVM_config_macros = 0x3e01,
00268   DW_AT_LLVM_isysroot = 0x3e02,
00269 
00270   // Apple extensions.
00271   DW_AT_APPLE_optimized = 0x3fe1,
00272   DW_AT_APPLE_flags = 0x3fe2,
00273   DW_AT_APPLE_isa = 0x3fe3,
00274   DW_AT_APPLE_block = 0x3fe4,
00275   DW_AT_APPLE_major_runtime_vers = 0x3fe5,
00276   DW_AT_APPLE_runtime_class = 0x3fe6,
00277   DW_AT_APPLE_omit_frame_ptr = 0x3fe7,
00278   DW_AT_APPLE_property_name = 0x3fe8,
00279   DW_AT_APPLE_property_getter = 0x3fe9,
00280   DW_AT_APPLE_property_setter = 0x3fea,
00281   DW_AT_APPLE_property_attribute = 0x3feb,
00282   DW_AT_APPLE_objc_complete_type = 0x3fec,
00283   DW_AT_APPLE_property = 0x3fed
00284 };
00285 
00286 enum Form : uint16_t {
00287   // Attribute form encodings
00288   DW_FORM_addr = 0x01,
00289   DW_FORM_block2 = 0x03,
00290   DW_FORM_block4 = 0x04,
00291   DW_FORM_data2 = 0x05,
00292   DW_FORM_data4 = 0x06,
00293   DW_FORM_data8 = 0x07,
00294   DW_FORM_string = 0x08,
00295   DW_FORM_block = 0x09,
00296   DW_FORM_block1 = 0x0a,
00297   DW_FORM_data1 = 0x0b,
00298   DW_FORM_flag = 0x0c,
00299   DW_FORM_sdata = 0x0d,
00300   DW_FORM_strp = 0x0e,
00301   DW_FORM_udata = 0x0f,
00302   DW_FORM_ref_addr = 0x10,
00303   DW_FORM_ref1 = 0x11,
00304   DW_FORM_ref2 = 0x12,
00305   DW_FORM_ref4 = 0x13,
00306   DW_FORM_ref8 = 0x14,
00307   DW_FORM_ref_udata = 0x15,
00308   DW_FORM_indirect = 0x16,
00309   DW_FORM_sec_offset = 0x17,
00310   DW_FORM_exprloc = 0x18,
00311   DW_FORM_flag_present = 0x19,
00312   DW_FORM_ref_sig8 = 0x20,
00313 
00314   // Extensions for Fission proposal
00315   DW_FORM_GNU_addr_index = 0x1f01,
00316   DW_FORM_GNU_str_index = 0x1f02,
00317 
00318   // Alternate debug sections proposal (output of "dwz" tool).
00319   DW_FORM_GNU_ref_alt = 0x1f20,
00320   DW_FORM_GNU_strp_alt = 0x1f21
00321 };
00322 
00323 enum LocationAtom {
00324 #define HANDLE_DW_OP(ID, NAME) DW_OP_##NAME = ID,
00325 #include "llvm/Support/Dwarf.def"
00326   DW_OP_lo_user = 0xe0,
00327   DW_OP_hi_user = 0xff
00328 };
00329 
00330 enum TypeKind {
00331 #define HANDLE_DW_ATE(ID, NAME) DW_ATE_##NAME = ID,
00332 #include "llvm/Support/Dwarf.def"
00333   DW_ATE_lo_user = 0x80,
00334   DW_ATE_hi_user = 0xff
00335 };
00336 
00337 enum DecimalSignEncoding {
00338   // Decimal sign attribute values
00339   DW_DS_unsigned = 0x01,
00340   DW_DS_leading_overpunch = 0x02,
00341   DW_DS_trailing_overpunch = 0x03,
00342   DW_DS_leading_separate = 0x04,
00343   DW_DS_trailing_separate = 0x05
00344 };
00345 
00346 enum EndianityEncoding {
00347   // Endianity attribute values
00348   DW_END_default = 0x00,
00349   DW_END_big = 0x01,
00350   DW_END_little = 0x02,
00351   DW_END_lo_user = 0x40,
00352   DW_END_hi_user = 0xff
00353 };
00354 
00355 enum AccessAttribute {
00356   // Accessibility codes
00357   DW_ACCESS_public = 0x01,
00358   DW_ACCESS_protected = 0x02,
00359   DW_ACCESS_private = 0x03
00360 };
00361 
00362 enum VisibilityAttribute {
00363   // Visibility codes
00364   DW_VIS_local = 0x01,
00365   DW_VIS_exported = 0x02,
00366   DW_VIS_qualified = 0x03
00367 };
00368 
00369 enum VirtualityAttribute {
00370 #define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
00371 #include "llvm/Support/Dwarf.def"
00372   DW_VIRTUALITY_max = 0x02
00373 };
00374 
00375 enum SourceLanguage {
00376 #define HANDLE_DW_LANG(ID, NAME) DW_LANG_##NAME = ID,
00377 #include "llvm/Support/Dwarf.def"
00378   DW_LANG_lo_user = 0x8000,
00379   DW_LANG_hi_user = 0xffff
00380 };
00381 
00382 enum CaseSensitivity {
00383   // Identifier case codes
00384   DW_ID_case_sensitive = 0x00,
00385   DW_ID_up_case = 0x01,
00386   DW_ID_down_case = 0x02,
00387   DW_ID_case_insensitive = 0x03
00388 };
00389 
00390 enum CallingConvention {
00391   // Calling convention codes
00392   DW_CC_normal = 0x01,
00393   DW_CC_program = 0x02,
00394   DW_CC_nocall = 0x03,
00395   DW_CC_lo_user = 0x40,
00396   DW_CC_GNU_borland_fastcall_i386 = 0x41,
00397   DW_CC_BORLAND_safecall = 0xb0,
00398   DW_CC_BORLAND_stdcall = 0xb1,
00399   DW_CC_BORLAND_pascal = 0xb2,
00400   DW_CC_BORLAND_msfastcall = 0xb3,
00401   DW_CC_BORLAND_msreturn = 0xb4,
00402   DW_CC_BORLAND_thiscall = 0xb5,
00403   DW_CC_BORLAND_fastcall = 0xb6,
00404   DW_CC_hi_user = 0xff
00405 };
00406 
00407 enum InlineAttribute {
00408   // Inline codes
00409   DW_INL_not_inlined = 0x00,
00410   DW_INL_inlined = 0x01,
00411   DW_INL_declared_not_inlined = 0x02,
00412   DW_INL_declared_inlined = 0x03
00413 };
00414 
00415 enum ArrayDimensionOrdering {
00416   // Array ordering
00417   DW_ORD_row_major = 0x00,
00418   DW_ORD_col_major = 0x01
00419 };
00420 
00421 enum DiscriminantList {
00422   // Discriminant descriptor values
00423   DW_DSC_label = 0x00,
00424   DW_DSC_range = 0x01
00425 };
00426 
00427 enum LineNumberOps {
00428   // Line Number Standard Opcode Encodings
00429   DW_LNS_extended_op = 0x00,
00430   DW_LNS_copy = 0x01,
00431   DW_LNS_advance_pc = 0x02,
00432   DW_LNS_advance_line = 0x03,
00433   DW_LNS_set_file = 0x04,
00434   DW_LNS_set_column = 0x05,
00435   DW_LNS_negate_stmt = 0x06,
00436   DW_LNS_set_basic_block = 0x07,
00437   DW_LNS_const_add_pc = 0x08,
00438   DW_LNS_fixed_advance_pc = 0x09,
00439   DW_LNS_set_prologue_end = 0x0a,
00440   DW_LNS_set_epilogue_begin = 0x0b,
00441   DW_LNS_set_isa = 0x0c
00442 };
00443 
00444 enum LineNumberExtendedOps {
00445   // Line Number Extended Opcode Encodings
00446   DW_LNE_end_sequence = 0x01,
00447   DW_LNE_set_address = 0x02,
00448   DW_LNE_define_file = 0x03,
00449   DW_LNE_set_discriminator = 0x04,
00450   DW_LNE_lo_user = 0x80,
00451   DW_LNE_hi_user = 0xff
00452 };
00453 
00454 enum MacinfoRecordType {
00455   // Macinfo Type Encodings
00456   DW_MACINFO_define = 0x01,
00457   DW_MACINFO_undef = 0x02,
00458   DW_MACINFO_start_file = 0x03,
00459   DW_MACINFO_end_file = 0x04,
00460   DW_MACINFO_vendor_ext = 0xff
00461 };
00462 
00463 enum MacroEntryType {
00464   // Macro Information Entry Type Encodings
00465   DW_MACRO_define = 0x01,
00466   DW_MACRO_undef = 0x02,
00467   DW_MACRO_start_file = 0x03,
00468   DW_MACRO_end_file = 0x04,
00469   DW_MACRO_define_indirect = 0x05,
00470   DW_MACRO_undef_indirect = 0x06,
00471   DW_MACRO_transparent_include = 0x07,
00472   DW_MACRO_define_indirect_sup = 0x08,
00473   DW_MACRO_undef_indirect_sup = 0x09,
00474   DW_MACRO_transparent_include_sup = 0x0a,
00475   DW_MACRO_define_indirectx = 0x0b,
00476   DW_MACRO_undef_indirectx = 0x0c,
00477   DW_MACRO_lo_user = 0xe0,
00478   DW_MACRO_hi_user = 0xff
00479 };
00480 
00481 enum CallFrameInfo {
00482   // Call frame instruction encodings
00483   DW_CFA_extended = 0x00,
00484   DW_CFA_nop = 0x00,
00485   DW_CFA_advance_loc = 0x40,
00486   DW_CFA_offset = 0x80,
00487   DW_CFA_restore = 0xc0,
00488   DW_CFA_set_loc = 0x01,
00489   DW_CFA_advance_loc1 = 0x02,
00490   DW_CFA_advance_loc2 = 0x03,
00491   DW_CFA_advance_loc4 = 0x04,
00492   DW_CFA_offset_extended = 0x05,
00493   DW_CFA_restore_extended = 0x06,
00494   DW_CFA_undefined = 0x07,
00495   DW_CFA_same_value = 0x08,
00496   DW_CFA_register = 0x09,
00497   DW_CFA_remember_state = 0x0a,
00498   DW_CFA_restore_state = 0x0b,
00499   DW_CFA_def_cfa = 0x0c,
00500   DW_CFA_def_cfa_register = 0x0d,
00501   DW_CFA_def_cfa_offset = 0x0e,
00502   DW_CFA_def_cfa_expression = 0x0f,
00503   DW_CFA_expression = 0x10,
00504   DW_CFA_offset_extended_sf = 0x11,
00505   DW_CFA_def_cfa_sf = 0x12,
00506   DW_CFA_def_cfa_offset_sf = 0x13,
00507   DW_CFA_val_offset = 0x14,
00508   DW_CFA_val_offset_sf = 0x15,
00509   DW_CFA_val_expression = 0x16,
00510   DW_CFA_MIPS_advance_loc8 = 0x1d,
00511   DW_CFA_GNU_window_save = 0x2d,
00512   DW_CFA_GNU_args_size = 0x2e,
00513   DW_CFA_lo_user = 0x1c,
00514   DW_CFA_hi_user = 0x3f
00515 };
00516 
00517 enum Constants {
00518   // Children flag
00519   DW_CHILDREN_no = 0x00,
00520   DW_CHILDREN_yes = 0x01,
00521 
00522   DW_EH_PE_absptr = 0x00,
00523   DW_EH_PE_omit = 0xff,
00524   DW_EH_PE_uleb128 = 0x01,
00525   DW_EH_PE_udata2 = 0x02,
00526   DW_EH_PE_udata4 = 0x03,
00527   DW_EH_PE_udata8 = 0x04,
00528   DW_EH_PE_sleb128 = 0x09,
00529   DW_EH_PE_sdata2 = 0x0A,
00530   DW_EH_PE_sdata4 = 0x0B,
00531   DW_EH_PE_sdata8 = 0x0C,
00532   DW_EH_PE_signed = 0x08,
00533   DW_EH_PE_pcrel = 0x10,
00534   DW_EH_PE_textrel = 0x20,
00535   DW_EH_PE_datarel = 0x30,
00536   DW_EH_PE_funcrel = 0x40,
00537   DW_EH_PE_aligned = 0x50,
00538   DW_EH_PE_indirect = 0x80
00539 };
00540 
00541 // Constants for debug_loc.dwo in the DWARF5 Split Debug Info Proposal
00542 enum LocationListEntry : unsigned char {
00543   DW_LLE_end_of_list_entry,
00544   DW_LLE_base_address_selection_entry,
00545   DW_LLE_start_end_entry,
00546   DW_LLE_start_length_entry,
00547   DW_LLE_offset_pair_entry
00548 };
00549 
00550 /// Contstants for the DW_APPLE_PROPERTY_attributes attribute.
00551 /// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind.
00552 enum ApplePropertyAttributes {
00553   // Apple Objective-C Property Attributes
00554   DW_APPLE_PROPERTY_readonly = 0x01,
00555   DW_APPLE_PROPERTY_getter = 0x02,
00556   DW_APPLE_PROPERTY_assign = 0x04,
00557   DW_APPLE_PROPERTY_readwrite = 0x08,
00558   DW_APPLE_PROPERTY_retain = 0x10,
00559   DW_APPLE_PROPERTY_copy = 0x20,
00560   DW_APPLE_PROPERTY_nonatomic = 0x40,
00561   DW_APPLE_PROPERTY_setter = 0x80,
00562   DW_APPLE_PROPERTY_atomic = 0x100,
00563   DW_APPLE_PROPERTY_weak =   0x200,
00564   DW_APPLE_PROPERTY_strong = 0x400,
00565   DW_APPLE_PROPERTY_unsafe_unretained = 0x800
00566 };
00567 
00568 // Constants for the DWARF5 Accelerator Table Proposal
00569 enum AcceleratorTable {
00570   // Data layout descriptors.
00571   DW_ATOM_null = 0u,       // Marker as the end of a list of atoms.
00572   DW_ATOM_die_offset = 1u, // DIE offset in the debug_info section.
00573   DW_ATOM_cu_offset = 2u, // Offset of the compile unit header that contains the
00574                           // item in question.
00575   DW_ATOM_die_tag = 3u,   // A tag entry.
00576   DW_ATOM_type_flags = 4u, // Set of flags for a type.
00577 
00578   // DW_ATOM_type_flags values.
00579 
00580   // Always set for C++, only set for ObjC if this is the @implementation for a
00581   // class.
00582   DW_FLAG_type_implementation = 2u,
00583 
00584   // Hash functions.
00585 
00586   // Daniel J. Bernstein hash.
00587   DW_hash_function_djb = 0u
00588 };
00589 
00590 // Constants for the GNU pubnames/pubtypes extensions supporting gdb index.
00591 enum GDBIndexEntryKind {
00592   GIEK_NONE,
00593   GIEK_TYPE,
00594   GIEK_VARIABLE,
00595   GIEK_FUNCTION,
00596   GIEK_OTHER,
00597   GIEK_UNUSED5,
00598   GIEK_UNUSED6,
00599   GIEK_UNUSED7
00600 };
00601 
00602 enum GDBIndexEntryLinkage {
00603   GIEL_EXTERNAL,
00604   GIEL_STATIC
00605 };
00606 
00607 /// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
00608 ///
00609 /// All these functions map their argument's value back to the
00610 /// corresponding enumerator name or return nullptr if the value isn't
00611 /// known.
00612 ///
00613 /// @{
00614 const char *TagString(unsigned Tag);
00615 const char *ChildrenString(unsigned Children);
00616 const char *AttributeString(unsigned Attribute);
00617 const char *FormEncodingString(unsigned Encoding);
00618 const char *OperationEncodingString(unsigned Encoding);
00619 const char *AttributeEncodingString(unsigned Encoding);
00620 const char *DecimalSignString(unsigned Sign);
00621 const char *EndianityString(unsigned Endian);
00622 const char *AccessibilityString(unsigned Access);
00623 const char *VisibilityString(unsigned Visibility);
00624 const char *VirtualityString(unsigned Virtuality);
00625 const char *LanguageString(unsigned Language);
00626 const char *CaseString(unsigned Case);
00627 const char *ConventionString(unsigned Convention);
00628 const char *InlineCodeString(unsigned Code);
00629 const char *ArrayOrderString(unsigned Order);
00630 const char *DiscriminantString(unsigned Discriminant);
00631 const char *LNStandardString(unsigned Standard);
00632 const char *LNExtendedString(unsigned Encoding);
00633 const char *MacinfoString(unsigned Encoding);
00634 const char *CallFrameString(unsigned Encoding);
00635 const char *ApplePropertyString(unsigned);
00636 const char *AtomTypeString(unsigned Atom);
00637 const char *GDBIndexEntryKindString(GDBIndexEntryKind Kind);
00638 const char *GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
00639 /// @}
00640 
00641 /// \defgroup DwarfConstantsParsing Dwarf constants parsing functions
00642 ///
00643 /// These functions map their strings back to the corresponding enumeration
00644 /// value or return 0 if there is none, except for these exceptions:
00645 ///
00646 /// \li \a getTag() returns \a DW_TAG_invalid on invalid input.
00647 /// \li \a getVirtuality() returns \a DW_VIRTUALITY_invalid on invalid input.
00648 /// \li \a getMacinfo() returns \a DW_MACINFO_invalid on invalid input.
00649 ///
00650 /// @{
00651 unsigned getTag(StringRef TagString);
00652 unsigned getOperationEncoding(StringRef OperationEncodingString);
00653 unsigned getVirtuality(StringRef VirtualityString);
00654 unsigned getLanguage(StringRef LanguageString);
00655 unsigned getAttributeEncoding(StringRef EncodingString);
00656 unsigned getMacinfo(StringRef MacinfoString);
00657 /// @}
00658 
00659 /// \brief Returns the symbolic string representing Val when used as a value
00660 /// for attribute Attr.
00661 const char *AttributeValueString(uint16_t Attr, unsigned Val);
00662 
00663 /// \brief Decsribes an entry of the various gnu_pub* debug sections.
00664 ///
00665 /// The gnu_pub* kind looks like:
00666 ///
00667 /// 0-3  reserved
00668 /// 4-6  symbol kind
00669 /// 7    0 == global, 1 == static
00670 ///
00671 /// A gdb_index descriptor includes the above kind, shifted 24 bits up with the
00672 /// offset of the cu within the debug_info section stored in those 24 bits.
00673 struct PubIndexEntryDescriptor {
00674   GDBIndexEntryKind Kind;
00675   GDBIndexEntryLinkage Linkage;
00676   PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
00677       : Kind(Kind), Linkage(Linkage) {}
00678   /* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
00679       : Kind(Kind), Linkage(GIEL_EXTERNAL) {}
00680   explicit PubIndexEntryDescriptor(uint8_t Value)
00681       : Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
00682                                             KIND_OFFSET)),
00683         Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
00684                                                   LINKAGE_OFFSET)) {}
00685   uint8_t toBits() { return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET; }
00686 
00687 private:
00688   enum {
00689     KIND_OFFSET = 4,
00690     KIND_MASK = 7 << KIND_OFFSET,
00691     LINKAGE_OFFSET = 7,
00692     LINKAGE_MASK = 1 << LINKAGE_OFFSET
00693   };
00694 };
00695 
00696 } // End of namespace dwarf
00697 
00698 } // End of namespace llvm
00699 
00700 #endif