LLVM API Documentation

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