dwarf2.h 12 KB

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