dwarf2.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. /* Declarations and definitions of codes relating to the DWARF2 and
  2. DWARF3 symbolic debugging information formats.
  3. Copyright (C) 1992-2015 Free Software Foundation, Inc.
  4. Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
  5. Office (AJPO), Florida State University and Silicon Graphics Inc.
  6. provided support for this effort -- June 21, 1995.
  7. Derived from the DWARF 1 implementation written by Ron Guilmette
  8. (rfg@netcom.com), November 1990.
  9. This file is part of GCC.
  10. GCC is free software; you can redistribute it and/or modify it under
  11. the terms of the GNU General Public License as published by the Free
  12. Software Foundation; either version 3, or (at your option) any later
  13. version.
  14. GCC is distributed in the hope that it will be useful, but WITHOUT
  15. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  16. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  17. License for more details.
  18. Under Section 7 of GPL version 3, you are granted additional
  19. permissions described in the GCC Runtime Library Exception, version
  20. 3.1, as published by the Free Software Foundation.
  21. You should have received a copy of the GNU General Public License and
  22. a copy of the GCC Runtime Library Exception along with this program;
  23. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  24. <http://www.gnu.org/licenses/>. */
  25. /* This file is derived from the DWARF specification (a public document)
  26. Revision 2.0.0 (July 27, 1993) developed by the UNIX International
  27. Programming Languages Special Interest Group (UI/PLSIG) and distributed
  28. by UNIX International. Copies of this specification are available from
  29. UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
  30. This file also now contains definitions from the DWARF 3 specification
  31. published Dec 20, 2005, available from: http://dwarf.freestandards.org. */
  32. #ifndef _DWARF2_H
  33. #define _DWARF2_H
  34. #define DW_TAG(name, value) , name = value
  35. #define DW_TAG_DUP(name, value) , name = value
  36. #define DW_FORM(name, value) , name = value
  37. #define DW_AT(name, value) , name = value
  38. #define DW_AT_DUP(name, value) , name = value
  39. #define DW_OP(name, value) , name = value
  40. #define DW_OP_DUP(name, value) , name = value
  41. #define DW_ATE(name, value) , name = value
  42. #define DW_ATE_DUP(name, value) , name = value
  43. #define DW_CFA(name, value) , name = value
  44. #define DW_FIRST_TAG(name, value) enum dwarf_tag { \
  45. name = value
  46. #define DW_END_TAG };
  47. #define DW_FIRST_FORM(name, value) enum dwarf_form { \
  48. name = value
  49. #define DW_END_FORM };
  50. #define DW_FIRST_AT(name, value) enum dwarf_attribute { \
  51. name = value
  52. #define DW_END_AT };
  53. #define DW_FIRST_OP(name, value) enum dwarf_location_atom { \
  54. name = value
  55. #define DW_END_OP };
  56. #define DW_FIRST_ATE(name, value) enum dwarf_type { \
  57. name = value
  58. #define DW_END_ATE };
  59. #define DW_FIRST_CFA(name, value) enum dwarf_call_frame_info { \
  60. name = value
  61. #define DW_END_CFA };
  62. #include "dwarf2.def"
  63. #undef DW_FIRST_TAG
  64. #undef DW_END_TAG
  65. #undef DW_FIRST_FORM
  66. #undef DW_END_FORM
  67. #undef DW_FIRST_AT
  68. #undef DW_END_AT
  69. #undef DW_FIRST_OP
  70. #undef DW_END_OP
  71. #undef DW_FIRST_ATE
  72. #undef DW_END_ATE
  73. #undef DW_FIRST_CFA
  74. #undef DW_END_CFA
  75. #undef DW_TAG
  76. #undef DW_TAG_DUP
  77. #undef DW_FORM
  78. #undef DW_AT
  79. #undef DW_AT_DUP
  80. #undef DW_OP
  81. #undef DW_OP_DUP
  82. #undef DW_ATE
  83. #undef DW_ATE_DUP
  84. #undef DW_CFA
  85. /* Flag that tells whether entry has a child or not. */
  86. #define DW_children_no 0
  87. #define DW_children_yes 1
  88. #define DW_AT_stride_size DW_AT_bit_stride /* Note: The use of DW_AT_stride_size is deprecated. */
  89. #define DW_AT_stride DW_AT_byte_stride /* Note: The use of DW_AT_stride is deprecated. */
  90. /* Decimal sign encodings. */
  91. enum dwarf_decimal_sign_encoding
  92. {
  93. /* DWARF 3. */
  94. DW_DS_unsigned = 0x01,
  95. DW_DS_leading_overpunch = 0x02,
  96. DW_DS_trailing_overpunch = 0x03,
  97. DW_DS_leading_separate = 0x04,
  98. DW_DS_trailing_separate = 0x05
  99. };
  100. /* Endianity encodings. */
  101. enum dwarf_endianity_encoding
  102. {
  103. /* DWARF 3. */
  104. DW_END_default = 0x00,
  105. DW_END_big = 0x01,
  106. DW_END_little = 0x02,
  107. DW_END_lo_user = 0x40,
  108. DW_END_hi_user = 0xff
  109. };
  110. /* Array ordering names and codes. */
  111. enum dwarf_array_dim_ordering
  112. {
  113. DW_ORD_row_major = 0,
  114. DW_ORD_col_major = 1
  115. };
  116. /* Access attribute. */
  117. enum dwarf_access_attribute
  118. {
  119. DW_ACCESS_public = 1,
  120. DW_ACCESS_protected = 2,
  121. DW_ACCESS_private = 3
  122. };
  123. /* Visibility. */
  124. enum dwarf_visibility_attribute
  125. {
  126. DW_VIS_local = 1,
  127. DW_VIS_exported = 2,
  128. DW_VIS_qualified = 3
  129. };
  130. /* Virtuality. */
  131. enum dwarf_virtuality_attribute
  132. {
  133. DW_VIRTUALITY_none = 0,
  134. DW_VIRTUALITY_virtual = 1,
  135. DW_VIRTUALITY_pure_virtual = 2
  136. };
  137. /* Case sensitivity. */
  138. enum dwarf_id_case
  139. {
  140. DW_ID_case_sensitive = 0,
  141. DW_ID_up_case = 1,
  142. DW_ID_down_case = 2,
  143. DW_ID_case_insensitive = 3
  144. };
  145. /* Calling convention. */
  146. enum dwarf_calling_convention
  147. {
  148. DW_CC_normal = 0x1,
  149. DW_CC_program = 0x2,
  150. DW_CC_nocall = 0x3,
  151. DW_CC_lo_user = 0x40,
  152. DW_CC_hi_user = 0xff,
  153. DW_CC_GNU_renesas_sh = 0x40,
  154. DW_CC_GNU_borland_fastcall_i386 = 0x41,
  155. /* This DW_CC_ value is not currently generated by any toolchain. It is
  156. used internally to GDB to indicate OpenCL C functions that have been
  157. compiled with the IBM XL C for OpenCL compiler and use a non-platform
  158. calling convention for passing OpenCL C vector types. This value may
  159. be changed freely as long as it does not conflict with any other DW_CC_
  160. value defined here. */
  161. DW_CC_GDB_IBM_OpenCL = 0xff
  162. };
  163. /* Inline attribute. */
  164. enum dwarf_inline_attribute
  165. {
  166. DW_INL_not_inlined = 0,
  167. DW_INL_inlined = 1,
  168. DW_INL_declared_not_inlined = 2,
  169. DW_INL_declared_inlined = 3
  170. };
  171. /* Discriminant lists. */
  172. enum dwarf_discrim_list
  173. {
  174. DW_DSC_label = 0,
  175. DW_DSC_range = 1
  176. };
  177. /* Line number opcodes. */
  178. enum dwarf_line_number_ops
  179. {
  180. DW_LNS_extended_op = 0,
  181. DW_LNS_copy = 1,
  182. DW_LNS_advance_pc = 2,
  183. DW_LNS_advance_line = 3,
  184. DW_LNS_set_file = 4,
  185. DW_LNS_set_column = 5,
  186. DW_LNS_negate_stmt = 6,
  187. DW_LNS_set_basic_block = 7,
  188. DW_LNS_const_add_pc = 8,
  189. DW_LNS_fixed_advance_pc = 9,
  190. /* DWARF 3. */
  191. DW_LNS_set_prologue_end = 10,
  192. DW_LNS_set_epilogue_begin = 11,
  193. DW_LNS_set_isa = 12
  194. };
  195. /* Line number extended opcodes. */
  196. enum dwarf_line_number_x_ops
  197. {
  198. DW_LNE_end_sequence = 1,
  199. DW_LNE_set_address = 2,
  200. DW_LNE_define_file = 3,
  201. DW_LNE_set_discriminator = 4,
  202. /* HP extensions. */
  203. DW_LNE_HP_negate_is_UV_update = 0x11,
  204. DW_LNE_HP_push_context = 0x12,
  205. DW_LNE_HP_pop_context = 0x13,
  206. DW_LNE_HP_set_file_line_column = 0x14,
  207. DW_LNE_HP_set_routine_name = 0x15,
  208. DW_LNE_HP_set_sequence = 0x16,
  209. DW_LNE_HP_negate_post_semantics = 0x17,
  210. DW_LNE_HP_negate_function_exit = 0x18,
  211. DW_LNE_HP_negate_front_end_logical = 0x19,
  212. DW_LNE_HP_define_proc = 0x20,
  213. DW_LNE_HP_source_file_correlation = 0x80,
  214. DW_LNE_lo_user = 0x80,
  215. DW_LNE_hi_user = 0xff
  216. };
  217. /* Sub-opcodes for DW_LNE_HP_source_file_correlation. */
  218. enum dwarf_line_number_hp_sfc_ops
  219. {
  220. DW_LNE_HP_SFC_formfeed = 1,
  221. DW_LNE_HP_SFC_set_listing_line = 2,
  222. DW_LNE_HP_SFC_associate = 3
  223. };
  224. /* Type codes for location list entries.
  225. Extension for Fission. See http://gcc.gnu.org/wiki/DebugFission. */
  226. enum dwarf_location_list_entry_type
  227. {
  228. DW_LLE_GNU_end_of_list_entry = 0,
  229. DW_LLE_GNU_base_address_selection_entry = 1,
  230. DW_LLE_GNU_start_end_entry = 2,
  231. DW_LLE_GNU_start_length_entry = 3
  232. };
  233. #define DW_CIE_ID 0xffffffff
  234. #define DW64_CIE_ID 0xffffffffffffffffULL
  235. #define DW_CIE_VERSION 1
  236. #define DW_CFA_extended 0
  237. #define DW_CHILDREN_no 0x00
  238. #define DW_CHILDREN_yes 0x01
  239. #define DW_ADDR_none 0
  240. /* Source language names and codes. */
  241. enum dwarf_source_language
  242. {
  243. DW_LANG_C89 = 0x0001,
  244. DW_LANG_C = 0x0002,
  245. DW_LANG_Ada83 = 0x0003,
  246. DW_LANG_C_plus_plus = 0x0004,
  247. DW_LANG_Cobol74 = 0x0005,
  248. DW_LANG_Cobol85 = 0x0006,
  249. DW_LANG_Fortran77 = 0x0007,
  250. DW_LANG_Fortran90 = 0x0008,
  251. DW_LANG_Pascal83 = 0x0009,
  252. DW_LANG_Modula2 = 0x000a,
  253. /* DWARF 3. */
  254. DW_LANG_Java = 0x000b,
  255. DW_LANG_C99 = 0x000c,
  256. DW_LANG_Ada95 = 0x000d,
  257. DW_LANG_Fortran95 = 0x000e,
  258. DW_LANG_PLI = 0x000f,
  259. DW_LANG_ObjC = 0x0010,
  260. DW_LANG_ObjC_plus_plus = 0x0011,
  261. DW_LANG_UPC = 0x0012,
  262. DW_LANG_D = 0x0013,
  263. /* DWARF 4. */
  264. DW_LANG_Python = 0x0014,
  265. /* DWARF 5. */
  266. DW_LANG_Go = 0x0016,
  267. DW_LANG_C_plus_plus_11 = 0x001a, /* dwarf5.20141029.pdf DRAFT */
  268. DW_LANG_C11 = 0x001d,
  269. DW_LANG_C_plus_plus_14 = 0x0021,
  270. DW_LANG_Fortran03 = 0x0022,
  271. DW_LANG_Fortran08 = 0x0023,
  272. DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */
  273. DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */
  274. /* MIPS. */
  275. DW_LANG_Mips_Assembler = 0x8001,
  276. /* UPC. */
  277. DW_LANG_Upc = 0x8765,
  278. /* HP extensions. */
  279. DW_LANG_HP_Bliss = 0x8003,
  280. DW_LANG_HP_Basic91 = 0x8004,
  281. DW_LANG_HP_Pascal91 = 0x8005,
  282. DW_LANG_HP_IMacro = 0x8006,
  283. DW_LANG_HP_Assembler = 0x8007
  284. };
  285. /* Names and codes for macro information. */
  286. enum dwarf_macinfo_record_type
  287. {
  288. DW_MACINFO_define = 1,
  289. DW_MACINFO_undef = 2,
  290. DW_MACINFO_start_file = 3,
  291. DW_MACINFO_end_file = 4,
  292. DW_MACINFO_vendor_ext = 255
  293. };
  294. /* Names and codes for new style macro information. */
  295. enum dwarf_macro_record_type
  296. {
  297. DW_MACRO_GNU_define = 1,
  298. DW_MACRO_GNU_undef = 2,
  299. DW_MACRO_GNU_start_file = 3,
  300. DW_MACRO_GNU_end_file = 4,
  301. DW_MACRO_GNU_define_indirect = 5,
  302. DW_MACRO_GNU_undef_indirect = 6,
  303. DW_MACRO_GNU_transparent_include = 7,
  304. /* Extensions for DWZ multifile.
  305. See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open . */
  306. DW_MACRO_GNU_define_indirect_alt = 8,
  307. DW_MACRO_GNU_undef_indirect_alt = 9,
  308. DW_MACRO_GNU_transparent_include_alt = 10,
  309. DW_MACRO_GNU_lo_user = 0xe0,
  310. DW_MACRO_GNU_hi_user = 0xff
  311. };
  312. /* @@@ For use with GNU frame unwind information. */
  313. #define DW_EH_PE_absptr 0x00
  314. #define DW_EH_PE_omit 0xff
  315. #define DW_EH_PE_uleb128 0x01
  316. #define DW_EH_PE_udata2 0x02
  317. #define DW_EH_PE_udata4 0x03
  318. #define DW_EH_PE_udata8 0x04
  319. #define DW_EH_PE_sleb128 0x09
  320. #define DW_EH_PE_sdata2 0x0A
  321. #define DW_EH_PE_sdata4 0x0B
  322. #define DW_EH_PE_sdata8 0x0C
  323. #define DW_EH_PE_signed 0x08
  324. #define DW_EH_PE_pcrel 0x10
  325. #define DW_EH_PE_textrel 0x20
  326. #define DW_EH_PE_datarel 0x30
  327. #define DW_EH_PE_funcrel 0x40
  328. #define DW_EH_PE_aligned 0x50
  329. #define DW_EH_PE_indirect 0x80
  330. /* Codes for the debug sections in a dwarf package (.dwp) file.
  331. Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFissionDWP. */
  332. enum dwarf_sect
  333. {
  334. DW_SECT_INFO = 1,
  335. DW_SECT_TYPES = 2,
  336. DW_SECT_ABBREV = 3,
  337. DW_SECT_LINE = 4,
  338. DW_SECT_LOC = 5,
  339. DW_SECT_STR_OFFSETS = 6,
  340. DW_SECT_MACINFO = 7,
  341. DW_SECT_MACRO = 8,
  342. DW_SECT_MAX = 8
  343. };
  344. #ifdef __cplusplus
  345. extern "C" {
  346. #endif /* __cplusplus */
  347. /* Return the name of a DW_TAG_ constant, or NULL if the value is not
  348. recognized. */
  349. extern const char *get_DW_TAG_name (unsigned int tag);
  350. /* Return the name of a DW_AT_ constant, or NULL if the value is not
  351. recognized. */
  352. extern const char *get_DW_AT_name (unsigned int attr);
  353. /* Return the name of a DW_FORM_ constant, or NULL if the value is not
  354. recognized. */
  355. extern const char *get_DW_FORM_name (unsigned int form);
  356. /* Return the name of a DW_OP_ constant, or NULL if the value is not
  357. recognized. */
  358. extern const char *get_DW_OP_name (unsigned int op);
  359. /* Return the name of a DW_ATE_ constant, or NULL if the value is not
  360. recognized. */
  361. extern const char *get_DW_ATE_name (unsigned int enc);
  362. /* Return the name of a DW_CFA_ constant, or NULL if the value is not
  363. recognized. */
  364. extern const char *get_DW_CFA_name (unsigned int opc);
  365. #ifdef __cplusplus
  366. }
  367. #endif /* __cplusplus */
  368. #endif /* _DWARF2_H */