dwarf.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. // dwarf.h -- DWARF2 constants -*- C++ -*-
  2. // Copyright (C) 2006-2022 Free Software Foundation, Inc.
  3. // Written by Ian Lance Taylor <iant@google.com>.
  4. // This file is part of elfcpp.
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU Library General Public License
  7. // as published by the Free Software Foundation; either version 2, or
  8. // (at your option) any later version.
  9. // In addition to the permissions in the GNU Library General Public
  10. // License, the Free Software Foundation gives you unlimited
  11. // permission to link the compiled version of this file into
  12. // combinations with other programs, and to distribute those
  13. // combinations without any restriction coming from the use of this
  14. // file. (The Library Public License restrictions do apply in other
  15. // respects; for example, they cover modification of the file, and
  16. /// distribution when not linked into a combined executable.)
  17. // This program is distributed in the hope that it will be useful, but
  18. // WITHOUT ANY WARRANTY; without even the implied warranty of
  19. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. // Library General Public License for more details.
  21. // You should have received a copy of the GNU Library General Public
  22. // License along with this program; if not, write to the Free Software
  23. // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
  24. // 02110-1301, USA.
  25. #ifndef ELFCPP_DWARF_H
  26. #define ELFCPP_DWARF_H
  27. namespace elfcpp
  28. {
  29. // DWARF2 codes.
  30. // Include DW_TAG, DW_FORM, DW_AT, DW_OP, DW_ATE, and DW_CFA
  31. // codes from dwarf2.def.
  32. #define DW_FIRST_TAG(name, value) enum DW_TAG { \
  33. name = value
  34. #define DW_TAG(name, value) , name = value
  35. #define DW_TAG_DUP(name, value) , name = value
  36. #define DW_END_TAG };
  37. #define DW_FIRST_FORM(name, value) enum DW_FORM { \
  38. name = value
  39. #define DW_FORM(name, value) , name = value
  40. #define DW_END_FORM };
  41. #define DW_FIRST_AT(name, value) enum DW_AT { \
  42. name = value
  43. #define DW_AT(name, value) , name = value
  44. #define DW_AT_DUP(name, value) , name = value
  45. #define DW_END_AT };
  46. #define DW_FIRST_OP(name, value) enum DW_OP { \
  47. name = value
  48. #define DW_OP(name, value) , name = value
  49. #define DW_OP_DUP(name, value) , name = value
  50. #define DW_END_OP };
  51. #define DW_FIRST_ATE(name, value) enum DW_ENCODING { \
  52. name = value
  53. #define DW_ATE(name, value) , name = value
  54. #define DW_ATE_DUP(name, value) , name = value
  55. #define DW_END_ATE };
  56. #define DW_FIRST_CFA(name, value) enum DW_CFA { \
  57. name = value
  58. #define DW_CFA(name, value) , name = value
  59. #define DW_CFA_DUP(name, value) , name = value
  60. #define DW_END_CFA };
  61. #define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
  62. name = value
  63. #define DW_IDX(name, value) , name = value
  64. #define DW_IDX_DUP(name, value) , name = value
  65. #define DW_END_IDX };
  66. #define DW_FIRST_UT(name, value) enum dwarf_unit_type { \
  67. name = value
  68. #define DW_UT(name, value) , name = value
  69. #define DW_END_UT };
  70. #include "dwarf2.def"
  71. #undef DW_FIRST_TAG
  72. #undef DW_TAG
  73. #undef DW_TAG_DUP
  74. #undef DW_END_TAG
  75. #undef DW_FIRST_FORM
  76. #undef DW_FORM
  77. #undef DW_END_FORM
  78. #undef DW_FIRST_AT
  79. #undef DW_AT
  80. #undef DW_AT_DUP
  81. #undef DW_END_AT
  82. #undef DW_FIRST_OP
  83. #undef DW_OP
  84. #undef DW_OP_DUP
  85. #undef DW_END_OP
  86. #undef DW_FIRST_ATE
  87. #undef DW_ATE
  88. #undef DW_ATE_DUP
  89. #undef DW_END_ATE
  90. #undef DW_FIRST_CFA
  91. #undef DW_CFA_DUP
  92. #undef DW_CFA
  93. #undef DW_END_CFA
  94. #undef DW_FIRST_IDX
  95. #undef DW_IDX
  96. #undef DW_IDX_DUP
  97. #undef DW_END_IDX
  98. #undef DW_FIRST_UT
  99. #undef DW_UT
  100. #undef DW_END_UT
  101. // Frame unwind information.
  102. enum DW_EH_PE
  103. {
  104. DW_EH_PE_absptr = 0x00,
  105. DW_EH_PE_omit = 0xff,
  106. DW_EH_PE_uleb128 = 0x01,
  107. DW_EH_PE_udata2 = 0x02,
  108. DW_EH_PE_udata4 = 0x03,
  109. DW_EH_PE_udata8 = 0x04,
  110. DW_EH_PE_signed = 0x08,
  111. DW_EH_PE_sleb128 = 0x09,
  112. DW_EH_PE_sdata2 = 0x0a,
  113. DW_EH_PE_sdata4 = 0x0b,
  114. DW_EH_PE_sdata8 = 0x0c,
  115. DW_EH_PE_pcrel = 0x10,
  116. DW_EH_PE_textrel = 0x20,
  117. DW_EH_PE_datarel = 0x30,
  118. DW_EH_PE_funcrel = 0x40,
  119. DW_EH_PE_aligned = 0x50,
  120. DW_EH_PE_indirect = 0x80
  121. };
  122. // Line number table content type codes.
  123. enum DW_LNCT
  124. {
  125. DW_LNCT_path = 0x1,
  126. DW_LNCT_directory_index = 0x2,
  127. DW_LNCT_timestamp = 0x3,
  128. DW_LNCT_size = 0x4,
  129. DW_LNCT_MD5 = 0x5,
  130. DW_LNCT_lo_user = 0x2000,
  131. DW_LNCT_hi_user = 0x3fff
  132. };
  133. // Line number opcodes.
  134. enum DW_LINE_OPS
  135. {
  136. DW_LNS_extended_op = 0x00,
  137. DW_LNS_copy = 0x01,
  138. DW_LNS_advance_pc = 0x02,
  139. DW_LNS_advance_line = 0x03,
  140. DW_LNS_set_file = 0x04,
  141. DW_LNS_set_column = 0x05,
  142. DW_LNS_negate_stmt = 0x06,
  143. DW_LNS_set_basic_block = 0x07,
  144. DW_LNS_const_add_pc = 0x08,
  145. DW_LNS_fixed_advance_pc = 0x09,
  146. // DWARF 3.
  147. DW_LNS_set_prologue_end = 0x0a,
  148. DW_LNS_set_epilogue_begin = 0x0b,
  149. DW_LNS_set_isa = 0x0c
  150. };
  151. // Line number extended opcodes.
  152. enum DW_LINE_EXTENDED_OPS
  153. {
  154. DW_LNE_end_sequence = 0x01,
  155. DW_LNE_set_address = 0x02,
  156. DW_LNE_define_file = 0x03,
  157. // DWARF4.
  158. DW_LNE_set_discriminator = 0x04,
  159. // HP extensions.
  160. DW_LNE_HP_negate_is_UV_update = 0x11,
  161. DW_LNE_HP_push_context = 0x12,
  162. DW_LNE_HP_pop_context = 0x13,
  163. DW_LNE_HP_set_file_line_column = 0x14,
  164. DW_LNE_HP_set_routine_name = 0x15,
  165. DW_LNE_HP_set_sequence = 0x16,
  166. DW_LNE_HP_negate_post_semantics = 0x17,
  167. DW_LNE_HP_negate_function_exit = 0x18,
  168. DW_LNE_HP_negate_front_end_logical = 0x19,
  169. DW_LNE_HP_define_proc = 0x20,
  170. DW_LNE_lo_user = 0x80,
  171. DW_LNE_hi_user = 0xff
  172. };
  173. enum DW_CHILDREN
  174. {
  175. DW_CHILDREN_no = 0,
  176. DW_CHILDREN_yes = 1
  177. };
  178. // Source language names and codes.
  179. enum DW_LANG
  180. {
  181. DW_LANG_C89 = 0x0001,
  182. DW_LANG_C = 0x0002,
  183. DW_LANG_Ada83 = 0x0003,
  184. DW_LANG_C_plus_plus = 0x0004,
  185. DW_LANG_Cobol74 = 0x0005,
  186. DW_LANG_Cobol85 = 0x0006,
  187. DW_LANG_Fortran77 = 0x0007,
  188. DW_LANG_Fortran90 = 0x0008,
  189. DW_LANG_Pascal83 = 0x0009,
  190. DW_LANG_Modula2 = 0x000a,
  191. // DWARF 3.
  192. DW_LANG_Java = 0x000b,
  193. DW_LANG_C99 = 0x000c,
  194. DW_LANG_Ada95 = 0x000d,
  195. DW_LANG_Fortran95 = 0x000e,
  196. DW_LANG_PLI = 0x000f,
  197. DW_LANG_ObjC = 0x0010,
  198. DW_LANG_ObjC_plus_plus = 0x0011,
  199. DW_LANG_UPC = 0x0012,
  200. DW_LANG_D = 0x0013,
  201. // DWARF 4.
  202. DW_LANG_Python = 0x0014,
  203. // DWARF 5.
  204. DW_LANG_Go = 0x0016,
  205. DW_LANG_C_plus_plus_11 = 0x001a,
  206. DW_LANG_C11 = 0x001d,
  207. DW_LANG_C_plus_plus_14 = 0x0021,
  208. DW_LANG_Fortran03 = 0x0022,
  209. DW_LANG_Fortran08 = 0x0023,
  210. DW_LANG_lo_user = 0x8000, // Implementation-defined range start.
  211. DW_LANG_hi_user = 0xffff, // Implementation-defined range start.
  212. // MIPS.
  213. DW_LANG_Mips_Assembler = 0x8001,
  214. // UPC.
  215. DW_LANG_Upc = 0x8765,
  216. // HP extensions.
  217. DW_LANG_HP_Bliss = 0x8003,
  218. DW_LANG_HP_Basic91 = 0x8004,
  219. DW_LANG_HP_Pascal91 = 0x8005,
  220. DW_LANG_HP_IMacro = 0x8006,
  221. DW_LANG_HP_Assembler = 0x8007
  222. };
  223. // Range list entry kinds in .debug_rnglists* section.
  224. enum DW_RLE
  225. {
  226. DW_RLE_end_of_list = 0x00,
  227. DW_RLE_base_addressx = 0x01,
  228. DW_RLE_startx_endx = 0x02,
  229. DW_RLE_startx_length = 0x03,
  230. DW_RLE_offset_pair = 0x04,
  231. DW_RLE_base_address = 0x05,
  232. DW_RLE_start_end = 0x06,
  233. DW_RLE_start_length = 0x07
  234. };
  235. // DWARF section identifiers used in the package format.
  236. // Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFissionDWP.
  237. // Added (with changes) in DWARF 5.
  238. enum DW_SECT
  239. {
  240. DW_SECT_INFO = 1,
  241. DW_SECT_ABBREV = 3,
  242. DW_SECT_LINE = 4,
  243. DW_SECT_LOCLISTS = 5,
  244. DW_SECT_STR_OFFSETS = 6,
  245. DW_SECT_MACINFO = 7,
  246. DW_SECT_RNGLISTS = 8,
  247. DW_SECT_MAX = DW_SECT_RNGLISTS,
  248. // These were used only for the experimental Fission support in DWARF 4.
  249. DW_SECT_TYPES = 2,
  250. DW_SECT_LOC = 5,
  251. DW_SECT_MACRO = 8
  252. };
  253. } // End namespace elfcpp.
  254. #endif // !defined(ELFCPP_DWARF_H)