dwarf.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /* libunwind - a platform-independent unwind library
  2. Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P.
  3. Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
  4. This file is part of libunwind.
  5. Permission is hereby granted, free of charge, to any person obtaining
  6. a copy of this software and associated documentation files (the
  7. "Software"), to deal in the Software without restriction, including
  8. without limitation the rights to use, copy, modify, merge, publish,
  9. distribute, sublicense, and/or sell copies of the Software, and to
  10. permit persons to whom the Software is furnished to do so, subject to
  11. the following conditions:
  12. The above copyright notice and this permission notice shall be
  13. included in all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  18. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  19. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  21. #pragma once
  22. //
  23. #define DWARF_EXTENDED_LENGTH_FLAG (0xffffffff)
  24. #define DWARF_CIE_ID_CIE_FLAG (0)
  25. // Exception Handling Pointer Encoding constants
  26. #define DW_EH_PE_VALUE_MASK (0x0F)
  27. #define DW_EH_PE_RELATIVE_OFFSET_MASK (0x70)
  28. // Register Definitions
  29. #define DW_EN_MAX_REGISTER_NUMBER (120)
  30. enum {
  31. DW_EH_PE_ptr = 0x00,
  32. DW_EH_PE_uleb128 = 0x01,
  33. DW_EH_PE_udata2 = 0x02,
  34. DW_EH_PE_udata4 = 0x03,
  35. DW_EH_PE_udata8 = 0x04,
  36. DW_EH_PE_signed = 0x08,
  37. DW_EH_PE_sleb128 = 0x09,
  38. DW_EH_PE_sdata2 = 0x0A,
  39. DW_EH_PE_sdata4 = 0x0B,
  40. DW_EH_PE_sdata8 = 0x0C,
  41. DW_EH_PE_absptr = 0x00,
  42. DW_EH_PE_pcrel = 0x10,
  43. DW_EH_PE_textrel = 0x20,
  44. DW_EH_PE_datarel = 0x30,
  45. DW_EH_PE_funcrel = 0x40,
  46. DW_EH_PE_aligned = 0x50,
  47. DW_EH_PE_indirect = 0x80,
  48. DW_EH_PE_omit = 0xFF
  49. };
  50. // Unwind Instructions
  51. #define DW_CFA_OPCODE_MASK (0xC0)
  52. #define DW_CFA_OPERAND_MASK (0x3F)
  53. enum {
  54. DW_CFA_nop = 0x0,
  55. DW_CFA_set_loc = 0x1,
  56. DW_CFA_advance_loc1 = 0x2,
  57. DW_CFA_advance_loc2 = 0x3,
  58. DW_CFA_advance_loc4 = 0x4,
  59. DW_CFA_offset_extended = 0x5,
  60. DW_CFA_restore_extended = 0x6,
  61. DW_CFA_undefined = 0x7,
  62. DW_CFA_same_value = 0x8,
  63. DW_CFA_register = 0x9,
  64. DW_CFA_remember_state = 0xA,
  65. DW_CFA_restore_state = 0xB,
  66. DW_CFA_def_cfa = 0xC,
  67. DW_CFA_def_cfa_register = 0xD,
  68. DW_CFA_def_cfa_offset = 0xE,
  69. DW_CFA_def_cfa_expression = 0xF,
  70. DW_CFA_expression = 0x10,
  71. DW_CFA_offset_extended_sf = 0x11,
  72. DW_CFA_def_cfa_sf = 0x12,
  73. DW_CFA_def_cfa_offset_sf = 0x13,
  74. DW_CFA_val_offset = 0x14,
  75. DW_CFA_val_offset_sf = 0x15,
  76. DW_CFA_val_expression = 0x16,
  77. // opcode is in high 2 bits, operand in is lower 6 bits
  78. DW_CFA_advance_loc = 0x40, // operand is delta
  79. DW_CFA_offset = 0x80, // operand is register
  80. DW_CFA_restore = 0xC0, // operand is register
  81. // GNU extensions
  82. DW_CFA_GNU_window_save = 0x2D,
  83. DW_CFA_GNU_args_size = 0x2E,
  84. DW_CFA_GNU_negative_offset_extended = 0x2F
  85. };
  86. // Expression Instructions
  87. enum {
  88. DW_OP_addr = 0x03,
  89. DW_OP_deref = 0x06,
  90. DW_OP_const1u = 0x08,
  91. DW_OP_const1s = 0x09,
  92. DW_OP_const2u = 0x0A,
  93. DW_OP_const2s = 0x0B,
  94. DW_OP_const4u = 0x0C,
  95. DW_OP_const4s = 0x0D,
  96. DW_OP_const8u = 0x0E,
  97. DW_OP_const8s = 0x0F,
  98. DW_OP_constu = 0x10,
  99. DW_OP_consts = 0x11,
  100. DW_OP_dup = 0x12,
  101. DW_OP_drop = 0x13,
  102. DW_OP_over = 0x14,
  103. DW_OP_pick = 0x15,
  104. DW_OP_swap = 0x16,
  105. DW_OP_rot = 0x17,
  106. DW_OP_xderef = 0x18,
  107. DW_OP_abs = 0x19,
  108. DW_OP_and = 0x1A,
  109. DW_OP_div = 0x1B,
  110. DW_OP_minus = 0x1C,
  111. DW_OP_mod = 0x1D,
  112. DW_OP_mul = 0x1E,
  113. DW_OP_neg = 0x1F,
  114. DW_OP_not = 0x20,
  115. DW_OP_or = 0x21,
  116. DW_OP_plus = 0x22,
  117. DW_OP_plus_uconst = 0x23,
  118. DW_OP_shl = 0x24,
  119. DW_OP_shr = 0x25,
  120. DW_OP_shra = 0x26,
  121. DW_OP_xor = 0x27,
  122. DW_OP_skip = 0x2F,
  123. DW_OP_bra = 0x28,
  124. DW_OP_eq = 0x29,
  125. DW_OP_ge = 0x2A,
  126. DW_OP_gt = 0x2B,
  127. DW_OP_le = 0x2C,
  128. DW_OP_lt = 0x2D,
  129. DW_OP_ne = 0x2E,
  130. DW_OP_lit0 = 0x30,
  131. DW_OP_lit1 = 0x31,
  132. DW_OP_lit2 = 0x32,
  133. DW_OP_lit3 = 0x33,
  134. DW_OP_lit4 = 0x34,
  135. DW_OP_lit5 = 0x35,
  136. DW_OP_lit6 = 0x36,
  137. DW_OP_lit7 = 0x37,
  138. DW_OP_lit8 = 0x38,
  139. DW_OP_lit9 = 0x39,
  140. DW_OP_lit10 = 0x3A,
  141. DW_OP_lit11 = 0x3B,
  142. DW_OP_lit12 = 0x3C,
  143. DW_OP_lit13 = 0x3D,
  144. DW_OP_lit14 = 0x3E,
  145. DW_OP_lit15 = 0x3F,
  146. DW_OP_lit16 = 0x40,
  147. DW_OP_lit17 = 0x41,
  148. DW_OP_lit18 = 0x42,
  149. DW_OP_lit19 = 0x43,
  150. DW_OP_lit20 = 0x44,
  151. DW_OP_lit21 = 0x45,
  152. DW_OP_lit22 = 0x46,
  153. DW_OP_lit23 = 0x47,
  154. DW_OP_lit24 = 0x48,
  155. DW_OP_lit25 = 0x49,
  156. DW_OP_lit26 = 0x4A,
  157. DW_OP_lit27 = 0x4B,
  158. DW_OP_lit28 = 0x4C,
  159. DW_OP_lit29 = 0x4D,
  160. DW_OP_lit30 = 0x4E,
  161. DW_OP_lit31 = 0x4F,
  162. DW_OP_reg0 = 0x50,
  163. DW_OP_reg1 = 0x51,
  164. DW_OP_reg2 = 0x52,
  165. DW_OP_reg3 = 0x53,
  166. DW_OP_reg4 = 0x54,
  167. DW_OP_reg5 = 0x55,
  168. DW_OP_reg6 = 0x56,
  169. DW_OP_reg7 = 0x57,
  170. DW_OP_reg8 = 0x58,
  171. DW_OP_reg9 = 0x59,
  172. DW_OP_reg10 = 0x5A,
  173. DW_OP_reg11 = 0x5B,
  174. DW_OP_reg12 = 0x5C,
  175. DW_OP_reg13 = 0x5D,
  176. DW_OP_reg14 = 0x5E,
  177. DW_OP_reg15 = 0x5F,
  178. DW_OP_reg16 = 0x60,
  179. DW_OP_reg17 = 0x61,
  180. DW_OP_reg18 = 0x62,
  181. DW_OP_reg19 = 0x63,
  182. DW_OP_reg20 = 0x64,
  183. DW_OP_reg21 = 0x65,
  184. DW_OP_reg22 = 0x66,
  185. DW_OP_reg23 = 0x67,
  186. DW_OP_reg24 = 0x68,
  187. DW_OP_reg25 = 0x69,
  188. DW_OP_reg26 = 0x6A,
  189. DW_OP_reg27 = 0x6B,
  190. DW_OP_reg28 = 0x6C,
  191. DW_OP_reg29 = 0x6D,
  192. DW_OP_reg30 = 0x6E,
  193. DW_OP_reg31 = 0x6F,
  194. DW_OP_breg0 = 0x70,
  195. DW_OP_breg1 = 0x71,
  196. DW_OP_breg2 = 0x72,
  197. DW_OP_breg3 = 0x73,
  198. DW_OP_breg4 = 0x74,
  199. DW_OP_breg5 = 0x75,
  200. DW_OP_breg6 = 0x76,
  201. DW_OP_breg7 = 0x77,
  202. DW_OP_breg8 = 0x78,
  203. DW_OP_breg9 = 0x79,
  204. DW_OP_breg10 = 0x7A,
  205. DW_OP_breg11 = 0x7B,
  206. DW_OP_breg12 = 0x7C,
  207. DW_OP_breg13 = 0x7D,
  208. DW_OP_breg14 = 0x7E,
  209. DW_OP_breg15 = 0x7F,
  210. DW_OP_breg16 = 0x80,
  211. DW_OP_breg17 = 0x81,
  212. DW_OP_breg18 = 0x82,
  213. DW_OP_breg19 = 0x83,
  214. DW_OP_breg20 = 0x84,
  215. DW_OP_breg21 = 0x85,
  216. DW_OP_breg22 = 0x86,
  217. DW_OP_breg23 = 0x87,
  218. DW_OP_breg24 = 0x88,
  219. DW_OP_breg25 = 0x89,
  220. DW_OP_breg26 = 0x8A,
  221. DW_OP_breg27 = 0x8B,
  222. DW_OP_breg28 = 0x8C,
  223. DW_OP_breg29 = 0x8D,
  224. DW_OP_breg30 = 0x8E,
  225. DW_OP_breg31 = 0x8F,
  226. DW_OP_regx = 0x90,
  227. DW_OP_fbreg = 0x91,
  228. DW_OP_bregx = 0x92,
  229. DW_OP_piece = 0x93,
  230. DW_OP_deref_size = 0x94,
  231. DW_OP_xderef_size = 0x95,
  232. DW_OP_nop = 0x96,
  233. DW_OP_push_object_addres = 0x97,
  234. DW_OP_call2 = 0x98,
  235. DW_OP_call4 = 0x99,
  236. DW_OP_call_ref = 0x9A,
  237. DW_OP_lo_user = 0xE0,
  238. DW_OP_APPLE_uninit = 0xF0,
  239. DW_OP_hi_user = 0xFF
  240. };