Dwarf.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. //===-- llvm/Support/Dwarf.h ---Dwarf Constants------------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // \file
  11. // \brief This file contains constants used for implementing Dwarf
  12. // debug support.
  13. //
  14. // For details on the Dwarf specfication see the latest DWARF Debugging
  15. // Information Format standard document on http://www.dwarfstd.org. This
  16. // file often includes support for non-released standard features.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_SUPPORT_DWARF_H
  20. #define LLVM_SUPPORT_DWARF_H
  21. #include "llvm/ADT/StringRef.h"
  22. #include "llvm/Support/Compiler.h"
  23. #include "llvm/Support/DataTypes.h"
  24. namespace llvm {
  25. namespace dwarf {
  26. // //
  27. ///////////////////////////////////////////////////////////////////////////////
  28. // Dwarf constants as gleaned from the DWARF Debugging Information Format V.4
  29. // reference manual http://www.dwarfstd.org/.
  30. //
  31. // Do not mix the following two enumerations sets. DW_TAG_invalid changes the
  32. // enumeration base type.
  33. enum LLVMConstants : uint32_t {
  34. // LLVM mock tags (see also llvm/Support/Dwarf.def).
  35. DW_TAG_invalid = ~0U, // Tag for invalid results.
  36. DW_VIRTUALITY_invalid = ~0U, // Virtuality for invalid results.
  37. // Other constants.
  38. DWARF_VERSION = 4, // Default dwarf version we output.
  39. DW_PUBTYPES_VERSION = 2, // Section version number for .debug_pubtypes.
  40. DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
  41. DW_ARANGES_VERSION = 2 // Section version number for .debug_aranges.
  42. };
  43. // Special ID values that distinguish a CIE from a FDE in DWARF CFI.
  44. // Not inside an enum because a 64-bit value is needed.
  45. const uint32_t DW_CIE_ID = UINT32_MAX;
  46. const uint64_t DW64_CIE_ID = UINT64_MAX;
  47. enum Tag : uint16_t {
  48. #define HANDLE_DW_TAG(ID, NAME) DW_TAG_##NAME = ID,
  49. #include "llvm/Support/Dwarf.def"
  50. DW_TAG_lo_user = 0x4080,
  51. DW_TAG_hi_user = 0xffff,
  52. DW_TAG_user_base = 0x1000 // Recommended base for user tags.
  53. };
  54. inline bool isType(Tag T) {
  55. switch (T) {
  56. case DW_TAG_array_type:
  57. case DW_TAG_class_type:
  58. case DW_TAG_interface_type:
  59. case DW_TAG_enumeration_type:
  60. case DW_TAG_pointer_type:
  61. case DW_TAG_reference_type:
  62. case DW_TAG_rvalue_reference_type:
  63. case DW_TAG_string_type:
  64. case DW_TAG_structure_type:
  65. case DW_TAG_subroutine_type:
  66. case DW_TAG_union_type:
  67. case DW_TAG_ptr_to_member_type:
  68. case DW_TAG_set_type:
  69. case DW_TAG_subrange_type:
  70. case DW_TAG_base_type:
  71. case DW_TAG_const_type:
  72. case DW_TAG_file_type:
  73. case DW_TAG_packed_type:
  74. case DW_TAG_volatile_type:
  75. case DW_TAG_typedef:
  76. return true;
  77. default:
  78. return false;
  79. }
  80. }
  81. enum Attribute : uint16_t {
  82. // Attributes
  83. DW_AT_sibling = 0x01,
  84. DW_AT_location = 0x02,
  85. DW_AT_name = 0x03,
  86. DW_AT_ordering = 0x09,
  87. DW_AT_byte_size = 0x0b,
  88. DW_AT_bit_offset = 0x0c,
  89. DW_AT_bit_size = 0x0d,
  90. DW_AT_stmt_list = 0x10,
  91. DW_AT_low_pc = 0x11,
  92. DW_AT_high_pc = 0x12,
  93. DW_AT_language = 0x13,
  94. DW_AT_discr = 0x15,
  95. DW_AT_discr_value = 0x16,
  96. DW_AT_visibility = 0x17,
  97. DW_AT_import = 0x18,
  98. DW_AT_string_length = 0x19,
  99. DW_AT_common_reference = 0x1a,
  100. DW_AT_comp_dir = 0x1b,
  101. DW_AT_const_value = 0x1c,
  102. DW_AT_containing_type = 0x1d,
  103. DW_AT_default_value = 0x1e,
  104. DW_AT_inline = 0x20,
  105. DW_AT_is_optional = 0x21,
  106. DW_AT_lower_bound = 0x22,
  107. DW_AT_producer = 0x25,
  108. DW_AT_prototyped = 0x27,
  109. DW_AT_return_addr = 0x2a,
  110. DW_AT_start_scope = 0x2c,
  111. DW_AT_bit_stride = 0x2e,
  112. DW_AT_upper_bound = 0x2f,
  113. DW_AT_abstract_origin = 0x31,
  114. DW_AT_accessibility = 0x32,
  115. DW_AT_address_class = 0x33,
  116. DW_AT_artificial = 0x34,
  117. DW_AT_base_types = 0x35,
  118. DW_AT_calling_convention = 0x36,
  119. DW_AT_count = 0x37,
  120. DW_AT_data_member_location = 0x38,
  121. DW_AT_decl_column = 0x39,
  122. DW_AT_decl_file = 0x3a,
  123. DW_AT_decl_line = 0x3b,
  124. DW_AT_declaration = 0x3c,
  125. DW_AT_discr_list = 0x3d,
  126. DW_AT_encoding = 0x3e,
  127. DW_AT_external = 0x3f,
  128. DW_AT_frame_base = 0x40,
  129. DW_AT_friend = 0x41,
  130. DW_AT_identifier_case = 0x42,
  131. DW_AT_macro_info = 0x43,
  132. DW_AT_namelist_item = 0x44,
  133. DW_AT_priority = 0x45,
  134. DW_AT_segment = 0x46,
  135. DW_AT_specification = 0x47,
  136. DW_AT_static_link = 0x48,
  137. DW_AT_type = 0x49,
  138. DW_AT_use_location = 0x4a,
  139. DW_AT_variable_parameter = 0x4b,
  140. DW_AT_virtuality = 0x4c,
  141. DW_AT_vtable_elem_location = 0x4d,
  142. DW_AT_allocated = 0x4e,
  143. DW_AT_associated = 0x4f,
  144. DW_AT_data_location = 0x50,
  145. DW_AT_byte_stride = 0x51,
  146. DW_AT_entry_pc = 0x52,
  147. DW_AT_use_UTF8 = 0x53,
  148. DW_AT_extension = 0x54,
  149. DW_AT_ranges = 0x55,
  150. DW_AT_trampoline = 0x56,
  151. DW_AT_call_column = 0x57,
  152. DW_AT_call_file = 0x58,
  153. DW_AT_call_line = 0x59,
  154. DW_AT_description = 0x5a,
  155. DW_AT_binary_scale = 0x5b,
  156. DW_AT_decimal_scale = 0x5c,
  157. DW_AT_small = 0x5d,
  158. DW_AT_decimal_sign = 0x5e,
  159. DW_AT_digit_count = 0x5f,
  160. DW_AT_picture_string = 0x60,
  161. DW_AT_mutable = 0x61,
  162. DW_AT_threads_scaled = 0x62,
  163. DW_AT_explicit = 0x63,
  164. DW_AT_object_pointer = 0x64,
  165. DW_AT_endianity = 0x65,
  166. DW_AT_elemental = 0x66,
  167. DW_AT_pure = 0x67,
  168. DW_AT_recursive = 0x68,
  169. DW_AT_signature = 0x69,
  170. DW_AT_main_subprogram = 0x6a,
  171. DW_AT_data_bit_offset = 0x6b,
  172. DW_AT_const_expr = 0x6c,
  173. DW_AT_enum_class = 0x6d,
  174. DW_AT_linkage_name = 0x6e,
  175. // New in DWARF 5:
  176. DW_AT_string_length_bit_size = 0x6f,
  177. DW_AT_string_length_byte_size = 0x70,
  178. DW_AT_rank = 0x71,
  179. DW_AT_str_offsets_base = 0x72,
  180. DW_AT_addr_base = 0x73,
  181. DW_AT_ranges_base = 0x74,
  182. DW_AT_dwo_id = 0x75,
  183. DW_AT_dwo_name = 0x76,
  184. DW_AT_reference = 0x77,
  185. DW_AT_rvalue_reference = 0x78,
  186. DW_AT_lo_user = 0x2000,
  187. DW_AT_hi_user = 0x3fff,
  188. DW_AT_MIPS_loop_begin = 0x2002,
  189. DW_AT_MIPS_tail_loop_begin = 0x2003,
  190. DW_AT_MIPS_epilog_begin = 0x2004,
  191. DW_AT_MIPS_loop_unroll_factor = 0x2005,
  192. DW_AT_MIPS_software_pipeline_depth = 0x2006,
  193. DW_AT_MIPS_linkage_name = 0x2007,
  194. DW_AT_MIPS_stride = 0x2008,
  195. DW_AT_MIPS_abstract_name = 0x2009,
  196. DW_AT_MIPS_clone_origin = 0x200a,
  197. DW_AT_MIPS_has_inlines = 0x200b,
  198. DW_AT_MIPS_stride_byte = 0x200c,
  199. DW_AT_MIPS_stride_elem = 0x200d,
  200. DW_AT_MIPS_ptr_dopetype = 0x200e,
  201. DW_AT_MIPS_allocatable_dopetype = 0x200f,
  202. DW_AT_MIPS_assumed_shape_dopetype = 0x2010,
  203. // This one appears to have only been implemented by Open64 for
  204. // fortran and may conflict with other extensions.
  205. DW_AT_MIPS_assumed_size = 0x2011,
  206. // GNU extensions
  207. DW_AT_sf_names = 0x2101,
  208. DW_AT_src_info = 0x2102,
  209. DW_AT_mac_info = 0x2103,
  210. DW_AT_src_coords = 0x2104,
  211. DW_AT_body_begin = 0x2105,
  212. DW_AT_body_end = 0x2106,
  213. DW_AT_GNU_vector = 0x2107,
  214. DW_AT_GNU_template_name = 0x2110,
  215. DW_AT_GNU_odr_signature = 0x210f,
  216. // Extensions for Fission proposal.
  217. DW_AT_GNU_dwo_name = 0x2130,
  218. DW_AT_GNU_dwo_id = 0x2131,
  219. DW_AT_GNU_ranges_base = 0x2132,
  220. DW_AT_GNU_addr_base = 0x2133,
  221. DW_AT_GNU_pubnames = 0x2134,
  222. DW_AT_GNU_pubtypes = 0x2135,
  223. // LLVM project extensions.
  224. DW_AT_LLVM_include_path = 0x3e00,
  225. DW_AT_LLVM_config_macros = 0x3e01,
  226. DW_AT_LLVM_isysroot = 0x3e02,
  227. // Apple extensions.
  228. DW_AT_APPLE_optimized = 0x3fe1,
  229. DW_AT_APPLE_flags = 0x3fe2,
  230. DW_AT_APPLE_isa = 0x3fe3,
  231. DW_AT_APPLE_block = 0x3fe4,
  232. DW_AT_APPLE_major_runtime_vers = 0x3fe5,
  233. DW_AT_APPLE_runtime_class = 0x3fe6,
  234. DW_AT_APPLE_omit_frame_ptr = 0x3fe7,
  235. DW_AT_APPLE_property_name = 0x3fe8,
  236. DW_AT_APPLE_property_getter = 0x3fe9,
  237. DW_AT_APPLE_property_setter = 0x3fea,
  238. DW_AT_APPLE_property_attribute = 0x3feb,
  239. DW_AT_APPLE_objc_complete_type = 0x3fec,
  240. DW_AT_APPLE_property = 0x3fed
  241. };
  242. enum Form : uint16_t {
  243. // Attribute form encodings
  244. DW_FORM_addr = 0x01,
  245. DW_FORM_block2 = 0x03,
  246. DW_FORM_block4 = 0x04,
  247. DW_FORM_data2 = 0x05,
  248. DW_FORM_data4 = 0x06,
  249. DW_FORM_data8 = 0x07,
  250. DW_FORM_string = 0x08,
  251. DW_FORM_block = 0x09,
  252. DW_FORM_block1 = 0x0a,
  253. DW_FORM_data1 = 0x0b,
  254. DW_FORM_flag = 0x0c,
  255. DW_FORM_sdata = 0x0d,
  256. DW_FORM_strp = 0x0e,
  257. DW_FORM_udata = 0x0f,
  258. DW_FORM_ref_addr = 0x10,
  259. DW_FORM_ref1 = 0x11,
  260. DW_FORM_ref2 = 0x12,
  261. DW_FORM_ref4 = 0x13,
  262. DW_FORM_ref8 = 0x14,
  263. DW_FORM_ref_udata = 0x15,
  264. DW_FORM_indirect = 0x16,
  265. DW_FORM_sec_offset = 0x17,
  266. DW_FORM_exprloc = 0x18,
  267. DW_FORM_flag_present = 0x19,
  268. DW_FORM_ref_sig8 = 0x20,
  269. // Extensions for Fission proposal
  270. DW_FORM_GNU_addr_index = 0x1f01,
  271. DW_FORM_GNU_str_index = 0x1f02,
  272. // Alternate debug sections proposal (output of "dwz" tool).
  273. DW_FORM_GNU_ref_alt = 0x1f20,
  274. DW_FORM_GNU_strp_alt = 0x1f21
  275. };
  276. enum LocationAtom {
  277. #define HANDLE_DW_OP(ID, NAME) DW_OP_##NAME = ID,
  278. #include "llvm/Support/Dwarf.def"
  279. DW_OP_lo_user = 0xe0,
  280. DW_OP_hi_user = 0xff
  281. };
  282. enum TypeKind {
  283. #define HANDLE_DW_ATE(ID, NAME) DW_ATE_##NAME = ID,
  284. #include "llvm/Support/Dwarf.def"
  285. DW_ATE_lo_user = 0x80,
  286. DW_ATE_hi_user = 0xff
  287. };
  288. enum DecimalSignEncoding {
  289. // Decimal sign attribute values
  290. DW_DS_unsigned = 0x01,
  291. DW_DS_leading_overpunch = 0x02,
  292. DW_DS_trailing_overpunch = 0x03,
  293. DW_DS_leading_separate = 0x04,
  294. DW_DS_trailing_separate = 0x05
  295. };
  296. enum EndianityEncoding {
  297. // Endianity attribute values
  298. DW_END_default = 0x00,
  299. DW_END_big = 0x01,
  300. DW_END_little = 0x02,
  301. DW_END_lo_user = 0x40,
  302. DW_END_hi_user = 0xff
  303. };
  304. enum AccessAttribute {
  305. // Accessibility codes
  306. DW_ACCESS_public = 0x01,
  307. DW_ACCESS_protected = 0x02,
  308. DW_ACCESS_private = 0x03
  309. };
  310. enum VisibilityAttribute {
  311. // Visibility codes
  312. DW_VIS_local = 0x01,
  313. DW_VIS_exported = 0x02,
  314. DW_VIS_qualified = 0x03
  315. };
  316. enum VirtualityAttribute {
  317. #define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
  318. #include "llvm/Support/Dwarf.def"
  319. DW_VIRTUALITY_max = 0x02
  320. };
  321. enum SourceLanguage {
  322. #define HANDLE_DW_LANG(ID, NAME) DW_LANG_##NAME = ID,
  323. #include "llvm/Support/Dwarf.def"
  324. DW_LANG_lo_user = 0x8000,
  325. DW_LANG_hi_user = 0xffff
  326. };
  327. enum CaseSensitivity {
  328. // Identifier case codes
  329. DW_ID_case_sensitive = 0x00,
  330. DW_ID_up_case = 0x01,
  331. DW_ID_down_case = 0x02,
  332. DW_ID_case_insensitive = 0x03
  333. };
  334. enum CallingConvention {
  335. // Calling convention codes
  336. DW_CC_normal = 0x01,
  337. DW_CC_program = 0x02,
  338. DW_CC_nocall = 0x03,
  339. DW_CC_lo_user = 0x40,
  340. DW_CC_hi_user = 0xff
  341. };
  342. enum InlineAttribute {
  343. // Inline codes
  344. DW_INL_not_inlined = 0x00,
  345. DW_INL_inlined = 0x01,
  346. DW_INL_declared_not_inlined = 0x02,
  347. DW_INL_declared_inlined = 0x03
  348. };
  349. enum ArrayDimensionOrdering {
  350. // Array ordering
  351. DW_ORD_row_major = 0x00,
  352. DW_ORD_col_major = 0x01
  353. };
  354. enum DiscriminantList {
  355. // Discriminant descriptor values
  356. DW_DSC_label = 0x00,
  357. DW_DSC_range = 0x01
  358. };
  359. enum LineNumberOps {
  360. // Line Number Standard Opcode Encodings
  361. DW_LNS_extended_op = 0x00,
  362. DW_LNS_copy = 0x01,
  363. DW_LNS_advance_pc = 0x02,
  364. DW_LNS_advance_line = 0x03,
  365. DW_LNS_set_file = 0x04,
  366. DW_LNS_set_column = 0x05,
  367. DW_LNS_negate_stmt = 0x06,
  368. DW_LNS_set_basic_block = 0x07,
  369. DW_LNS_const_add_pc = 0x08,
  370. DW_LNS_fixed_advance_pc = 0x09,
  371. DW_LNS_set_prologue_end = 0x0a,
  372. DW_LNS_set_epilogue_begin = 0x0b,
  373. DW_LNS_set_isa = 0x0c
  374. };
  375. enum LineNumberExtendedOps {
  376. // Line Number Extended Opcode Encodings
  377. DW_LNE_end_sequence = 0x01,
  378. DW_LNE_set_address = 0x02,
  379. DW_LNE_define_file = 0x03,
  380. DW_LNE_set_discriminator = 0x04,
  381. DW_LNE_lo_user = 0x80,
  382. DW_LNE_hi_user = 0xff
  383. };
  384. enum MacinfoRecordType {
  385. // Macinfo Type Encodings
  386. DW_MACINFO_define = 0x01,
  387. DW_MACINFO_undef = 0x02,
  388. DW_MACINFO_start_file = 0x03,
  389. DW_MACINFO_end_file = 0x04,
  390. DW_MACINFO_vendor_ext = 0xff
  391. };
  392. enum CallFrameInfo {
  393. // Call frame instruction encodings
  394. DW_CFA_extended = 0x00,
  395. DW_CFA_nop = 0x00,
  396. DW_CFA_advance_loc = 0x40,
  397. DW_CFA_offset = 0x80,
  398. DW_CFA_restore = 0xc0,
  399. DW_CFA_set_loc = 0x01,
  400. DW_CFA_advance_loc1 = 0x02,
  401. DW_CFA_advance_loc2 = 0x03,
  402. DW_CFA_advance_loc4 = 0x04,
  403. DW_CFA_offset_extended = 0x05,
  404. DW_CFA_restore_extended = 0x06,
  405. DW_CFA_undefined = 0x07,
  406. DW_CFA_same_value = 0x08,
  407. DW_CFA_register = 0x09,
  408. DW_CFA_remember_state = 0x0a,
  409. DW_CFA_restore_state = 0x0b,
  410. DW_CFA_def_cfa = 0x0c,
  411. DW_CFA_def_cfa_register = 0x0d,
  412. DW_CFA_def_cfa_offset = 0x0e,
  413. DW_CFA_def_cfa_expression = 0x0f,
  414. DW_CFA_expression = 0x10,
  415. DW_CFA_offset_extended_sf = 0x11,
  416. DW_CFA_def_cfa_sf = 0x12,
  417. DW_CFA_def_cfa_offset_sf = 0x13,
  418. DW_CFA_val_offset = 0x14,
  419. DW_CFA_val_offset_sf = 0x15,
  420. DW_CFA_val_expression = 0x16,
  421. DW_CFA_MIPS_advance_loc8 = 0x1d,
  422. DW_CFA_GNU_window_save = 0x2d,
  423. DW_CFA_GNU_args_size = 0x2e,
  424. DW_CFA_lo_user = 0x1c,
  425. DW_CFA_hi_user = 0x3f
  426. };
  427. enum Constants {
  428. // Children flag
  429. DW_CHILDREN_no = 0x00,
  430. DW_CHILDREN_yes = 0x01,
  431. DW_EH_PE_absptr = 0x00,
  432. DW_EH_PE_omit = 0xff,
  433. DW_EH_PE_uleb128 = 0x01,
  434. DW_EH_PE_udata2 = 0x02,
  435. DW_EH_PE_udata4 = 0x03,
  436. DW_EH_PE_udata8 = 0x04,
  437. DW_EH_PE_sleb128 = 0x09,
  438. DW_EH_PE_sdata2 = 0x0A,
  439. DW_EH_PE_sdata4 = 0x0B,
  440. DW_EH_PE_sdata8 = 0x0C,
  441. DW_EH_PE_signed = 0x08,
  442. DW_EH_PE_pcrel = 0x10,
  443. DW_EH_PE_textrel = 0x20,
  444. DW_EH_PE_datarel = 0x30,
  445. DW_EH_PE_funcrel = 0x40,
  446. DW_EH_PE_aligned = 0x50,
  447. DW_EH_PE_indirect = 0x80
  448. };
  449. // Constants for debug_loc.dwo in the DWARF5 Split Debug Info Proposal
  450. enum LocationListEntry : unsigned char {
  451. DW_LLE_end_of_list_entry,
  452. DW_LLE_base_address_selection_entry,
  453. DW_LLE_start_end_entry,
  454. DW_LLE_start_length_entry,
  455. DW_LLE_offset_pair_entry
  456. };
  457. /// Contstants for the DW_APPLE_PROPERTY_attributes attribute.
  458. /// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind.
  459. enum ApplePropertyAttributes {
  460. // Apple Objective-C Property Attributes
  461. DW_APPLE_PROPERTY_readonly = 0x01,
  462. DW_APPLE_PROPERTY_getter = 0x02,
  463. DW_APPLE_PROPERTY_assign = 0x04,
  464. DW_APPLE_PROPERTY_readwrite = 0x08,
  465. DW_APPLE_PROPERTY_retain = 0x10,
  466. DW_APPLE_PROPERTY_copy = 0x20,
  467. DW_APPLE_PROPERTY_nonatomic = 0x40,
  468. DW_APPLE_PROPERTY_setter = 0x80,
  469. DW_APPLE_PROPERTY_atomic = 0x100,
  470. DW_APPLE_PROPERTY_weak = 0x200,
  471. DW_APPLE_PROPERTY_strong = 0x400,
  472. DW_APPLE_PROPERTY_unsafe_unretained = 0x800
  473. };
  474. // Constants for the DWARF5 Accelerator Table Proposal
  475. enum AcceleratorTable {
  476. // Data layout descriptors.
  477. DW_ATOM_null = 0u, // Marker as the end of a list of atoms.
  478. DW_ATOM_die_offset = 1u, // DIE offset in the debug_info section.
  479. DW_ATOM_cu_offset = 2u, // Offset of the compile unit header that contains the
  480. // item in question.
  481. DW_ATOM_die_tag = 3u, // A tag entry.
  482. DW_ATOM_type_flags = 4u, // Set of flags for a type.
  483. // DW_ATOM_type_flags values.
  484. // Always set for C++, only set for ObjC if this is the @implementation for a
  485. // class.
  486. DW_FLAG_type_implementation = 2u,
  487. // Hash functions.
  488. // Daniel J. Bernstein hash.
  489. DW_hash_function_djb = 0u
  490. };
  491. // Constants for the GNU pubnames/pubtypes extensions supporting gdb index.
  492. enum GDBIndexEntryKind {
  493. GIEK_NONE,
  494. GIEK_TYPE,
  495. GIEK_VARIABLE,
  496. GIEK_FUNCTION,
  497. GIEK_OTHER,
  498. GIEK_UNUSED5,
  499. GIEK_UNUSED6,
  500. GIEK_UNUSED7
  501. };
  502. enum GDBIndexEntryLinkage {
  503. GIEL_EXTERNAL,
  504. GIEL_STATIC
  505. };
  506. /// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
  507. ///
  508. /// All these functions map their argument's value back to the
  509. /// corresponding enumerator name or return nullptr if the value isn't
  510. /// known.
  511. ///
  512. /// @{
  513. const char *TagString(unsigned Tag);
  514. const char *ChildrenString(unsigned Children);
  515. const char *AttributeString(unsigned Attribute);
  516. const char *FormEncodingString(unsigned Encoding);
  517. const char *OperationEncodingString(unsigned Encoding);
  518. const char *AttributeEncodingString(unsigned Encoding);
  519. const char *DecimalSignString(unsigned Sign);
  520. const char *EndianityString(unsigned Endian);
  521. const char *AccessibilityString(unsigned Access);
  522. const char *VisibilityString(unsigned Visibility);
  523. const char *VirtualityString(unsigned Virtuality);
  524. const char *LanguageString(unsigned Language);
  525. const char *CaseString(unsigned Case);
  526. const char *ConventionString(unsigned Convention);
  527. const char *InlineCodeString(unsigned Code);
  528. const char *ArrayOrderString(unsigned Order);
  529. const char *DiscriminantString(unsigned Discriminant);
  530. const char *LNStandardString(unsigned Standard);
  531. const char *LNExtendedString(unsigned Encoding);
  532. const char *MacinfoString(unsigned Encoding);
  533. const char *CallFrameString(unsigned Encoding);
  534. const char *ApplePropertyString(unsigned);
  535. const char *AtomTypeString(unsigned Atom);
  536. const char *GDBIndexEntryKindString(GDBIndexEntryKind Kind);
  537. const char *GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
  538. /// @}
  539. /// \defgroup DwarfConstantsParsing Dwarf constants parsing functions
  540. ///
  541. /// These functions map their strings back to the corresponding enumeration
  542. /// value or return 0 if there is none, except for these exceptions:
  543. ///
  544. /// \li \a getTag() returns \a DW_TAG_invalid on invalid input.
  545. /// \li \a getVirtuality() returns \a DW_VIRTUALITY_invalid on invalid input.
  546. ///
  547. /// @{
  548. unsigned getTag(StringRef TagString);
  549. unsigned getOperationEncoding(StringRef OperationEncodingString);
  550. unsigned getVirtuality(StringRef VirtualityString);
  551. unsigned getLanguage(StringRef LanguageString);
  552. unsigned getAttributeEncoding(StringRef EncodingString);
  553. /// @}
  554. /// \brief Returns the symbolic string representing Val when used as a value
  555. /// for attribute Attr.
  556. const char *AttributeValueString(uint16_t Attr, unsigned Val);
  557. /// \brief Decsribes an entry of the various gnu_pub* debug sections.
  558. ///
  559. /// The gnu_pub* kind looks like:
  560. ///
  561. /// 0-3 reserved
  562. /// 4-6 symbol kind
  563. /// 7 0 == global, 1 == static
  564. ///
  565. /// A gdb_index descriptor includes the above kind, shifted 24 bits up with the
  566. /// offset of the cu within the debug_info section stored in those 24 bits.
  567. struct PubIndexEntryDescriptor {
  568. GDBIndexEntryKind Kind;
  569. GDBIndexEntryLinkage Linkage;
  570. PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
  571. : Kind(Kind), Linkage(Linkage) {}
  572. /* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
  573. : Kind(Kind), Linkage(GIEL_EXTERNAL) {}
  574. explicit PubIndexEntryDescriptor(uint8_t Value)
  575. : Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
  576. KIND_OFFSET)),
  577. Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
  578. LINKAGE_OFFSET)) {}
  579. uint8_t toBits() { return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET; }
  580. private:
  581. enum {
  582. KIND_OFFSET = 4,
  583. KIND_MASK = 7 << KIND_OFFSET,
  584. LINKAGE_OFFSET = 7,
  585. LINKAGE_MASK = 1 << LINKAGE_OFFSET
  586. };
  587. };
  588. } // End of namespace dwarf
  589. } // End of namespace llvm
  590. #endif