dwarf.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. /* Declarations and definitions of codes relating to the DWARF symbolic
  2. debugging information format.
  3. Written by Ron Guilmette (rfg@netcom.com)
  4. Copyright (C) 1992-2015 Free Software Foundation, Inc.
  5. This file is part of both GCC and the BFD library.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with GCC; see the file COPYING3. If not, write to the Free
  16. Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
  17. 02110-1301, USA. */
  18. /* This file is derived from the DWARF specification (a public document)
  19. Revision 1.0.1 (April 8, 1992) developed by the UNIX International
  20. Programming Languages Special Interest Group (UI/PLSIG) and distributed
  21. by UNIX International. Copies of this specification are available from
  22. UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054. */
  23. #ifndef _ELF_DWARF_H
  24. #define _ELF_DWARF_H
  25. /* Tag names and codes. */
  26. enum dwarf_tag {
  27. TAG_padding = 0x0000,
  28. TAG_array_type = 0x0001,
  29. TAG_class_type = 0x0002,
  30. TAG_entry_point = 0x0003,
  31. TAG_enumeration_type = 0x0004,
  32. TAG_formal_parameter = 0x0005,
  33. TAG_global_subroutine = 0x0006,
  34. TAG_global_variable = 0x0007,
  35. /* 0x0008 -- reserved */
  36. /* 0x0009 -- reserved */
  37. TAG_label = 0x000a,
  38. TAG_lexical_block = 0x000b,
  39. TAG_local_variable = 0x000c,
  40. TAG_member = 0x000d,
  41. /* 0x000e -- reserved */
  42. TAG_pointer_type = 0x000f,
  43. TAG_reference_type = 0x0010,
  44. TAG_compile_unit = 0x0011,
  45. TAG_string_type = 0x0012,
  46. TAG_structure_type = 0x0013,
  47. TAG_subroutine = 0x0014,
  48. TAG_subroutine_type = 0x0015,
  49. TAG_typedef = 0x0016,
  50. TAG_union_type = 0x0017,
  51. TAG_unspecified_parameters = 0x0018,
  52. TAG_variant = 0x0019,
  53. TAG_common_block = 0x001a,
  54. TAG_common_inclusion = 0x001b,
  55. TAG_inheritance = 0x001c,
  56. TAG_inlined_subroutine = 0x001d,
  57. TAG_module = 0x001e,
  58. TAG_ptr_to_member_type = 0x001f,
  59. TAG_set_type = 0x0020,
  60. TAG_subrange_type = 0x0021,
  61. TAG_with_stmt = 0x0022,
  62. /* GNU extensions */
  63. TAG_format_label = 0x8000, /* for FORTRAN 77 and Fortran 90 */
  64. TAG_namelist = 0x8001, /* For Fortran 90 */
  65. TAG_function_template = 0x8002, /* for C++ */
  66. TAG_class_template = 0x8003 /* for C++ */
  67. };
  68. #define TAG_lo_user 0x8000 /* implementation-defined range start */
  69. #define TAG_hi_user 0xffff /* implementation-defined range end */
  70. #define TAG_source_file TAG_compile_unit /* for backward compatibility */
  71. /* Form names and codes. */
  72. enum dwarf_form {
  73. FORM_ADDR = 0x1,
  74. FORM_REF = 0x2,
  75. FORM_BLOCK2 = 0x3,
  76. FORM_BLOCK4 = 0x4,
  77. FORM_DATA2 = 0x5,
  78. FORM_DATA4 = 0x6,
  79. FORM_DATA8 = 0x7,
  80. FORM_STRING = 0x8
  81. };
  82. /* Attribute names and codes. */
  83. enum dwarf_attribute {
  84. AT_sibling = (0x0010|FORM_REF),
  85. AT_location = (0x0020|FORM_BLOCK2),
  86. AT_name = (0x0030|FORM_STRING),
  87. AT_fund_type = (0x0050|FORM_DATA2),
  88. AT_mod_fund_type = (0x0060|FORM_BLOCK2),
  89. AT_user_def_type = (0x0070|FORM_REF),
  90. AT_mod_u_d_type = (0x0080|FORM_BLOCK2),
  91. AT_ordering = (0x0090|FORM_DATA2),
  92. AT_subscr_data = (0x00a0|FORM_BLOCK2),
  93. AT_byte_size = (0x00b0|FORM_DATA4),
  94. AT_bit_offset = (0x00c0|FORM_DATA2),
  95. AT_bit_size = (0x00d0|FORM_DATA4),
  96. /* (0x00e0|FORM_xxxx) -- reserved */
  97. AT_element_list = (0x00f0|FORM_BLOCK4),
  98. AT_stmt_list = (0x0100|FORM_DATA4),
  99. AT_low_pc = (0x0110|FORM_ADDR),
  100. AT_high_pc = (0x0120|FORM_ADDR),
  101. AT_language = (0x0130|FORM_DATA4),
  102. AT_member = (0x0140|FORM_REF),
  103. AT_discr = (0x0150|FORM_REF),
  104. AT_discr_value = (0x0160|FORM_BLOCK2),
  105. /* (0x0170|FORM_xxxx) -- reserved */
  106. /* (0x0180|FORM_xxxx) -- reserved */
  107. AT_string_length = (0x0190|FORM_BLOCK2),
  108. AT_common_reference = (0x01a0|FORM_REF),
  109. AT_comp_dir = (0x01b0|FORM_STRING),
  110. AT_const_value_string = (0x01c0|FORM_STRING),
  111. AT_const_value_data2 = (0x01c0|FORM_DATA2),
  112. AT_const_value_data4 = (0x01c0|FORM_DATA4),
  113. AT_const_value_data8 = (0x01c0|FORM_DATA8),
  114. AT_const_value_block2 = (0x01c0|FORM_BLOCK2),
  115. AT_const_value_block4 = (0x01c0|FORM_BLOCK4),
  116. AT_containing_type = (0x01d0|FORM_REF),
  117. AT_default_value_addr = (0x01e0|FORM_ADDR),
  118. AT_default_value_data2 = (0x01e0|FORM_DATA2),
  119. AT_default_value_data4 = (0x01e0|FORM_DATA4),
  120. AT_default_value_data8 = (0x01e0|FORM_DATA8),
  121. AT_default_value_string = (0x01e0|FORM_STRING),
  122. AT_friends = (0x01f0|FORM_BLOCK2),
  123. AT_inline = (0x0200|FORM_STRING),
  124. AT_is_optional = (0x0210|FORM_STRING),
  125. AT_lower_bound_ref = (0x0220|FORM_REF),
  126. AT_lower_bound_data2 = (0x0220|FORM_DATA2),
  127. AT_lower_bound_data4 = (0x0220|FORM_DATA4),
  128. AT_lower_bound_data8 = (0x0220|FORM_DATA8),
  129. AT_private = (0x0240|FORM_STRING),
  130. AT_producer = (0x0250|FORM_STRING),
  131. AT_program = (0x0230|FORM_STRING),
  132. AT_protected = (0x0260|FORM_STRING),
  133. AT_prototyped = (0x0270|FORM_STRING),
  134. AT_public = (0x0280|FORM_STRING),
  135. AT_pure_virtual = (0x0290|FORM_STRING),
  136. AT_return_addr = (0x02a0|FORM_BLOCK2),
  137. AT_abstract_origin = (0x02b0|FORM_REF),
  138. AT_start_scope = (0x02c0|FORM_DATA4),
  139. AT_stride_size = (0x02e0|FORM_DATA4),
  140. AT_upper_bound_ref = (0x02f0|FORM_REF),
  141. AT_upper_bound_data2 = (0x02f0|FORM_DATA2),
  142. AT_upper_bound_data4 = (0x02f0|FORM_DATA4),
  143. AT_upper_bound_data8 = (0x02f0|FORM_DATA8),
  144. AT_virtual = (0x0300|FORM_STRING),
  145. /* GNU extensions. */
  146. AT_sf_names = (0x8000|FORM_DATA4),
  147. AT_src_info = (0x8010|FORM_DATA4),
  148. AT_mac_info = (0x8020|FORM_DATA4),
  149. AT_src_coords = (0x8030|FORM_DATA4),
  150. AT_body_begin = (0x8040|FORM_ADDR),
  151. AT_body_end = (0x8050|FORM_ADDR)
  152. };
  153. #define AT_lo_user 0x2000 /* implementation-defined range start */
  154. #define AT_hi_user 0x3ff0 /* implementation-defined range end */
  155. /* Location atom names and codes. */
  156. enum dwarf_location_atom {
  157. OP_REG = 0x01,
  158. OP_BASEREG = 0x02,
  159. OP_ADDR = 0x03,
  160. OP_CONST = 0x04,
  161. OP_DEREF2 = 0x05,
  162. OP_DEREF4 = 0x06,
  163. OP_ADD = 0x07,
  164. /* GNU extensions. */
  165. OP_MULT = 0x80
  166. };
  167. #define OP_LO_USER 0x80 /* implementation-defined range start */
  168. #define OP_HI_USER 0xff /* implementation-defined range end */
  169. /* Fundamental type names and codes. */
  170. enum dwarf_fundamental_type {
  171. FT_char = 0x0001,
  172. FT_signed_char = 0x0002,
  173. FT_unsigned_char = 0x0003,
  174. FT_short = 0x0004,
  175. FT_signed_short = 0x0005,
  176. FT_unsigned_short = 0x0006,
  177. FT_integer = 0x0007,
  178. FT_signed_integer = 0x0008,
  179. FT_unsigned_integer = 0x0009,
  180. FT_long = 0x000a,
  181. FT_signed_long = 0x000b,
  182. FT_unsigned_long = 0x000c,
  183. FT_pointer = 0x000d, /* an alias for (void *) */
  184. FT_float = 0x000e,
  185. FT_dbl_prec_float = 0x000f,
  186. FT_ext_prec_float = 0x0010, /* breaks "classic" svr4 SDB */
  187. FT_complex = 0x0011, /* breaks "classic" svr4 SDB */
  188. FT_dbl_prec_complex = 0x0012, /* breaks "classic" svr4 SDB */
  189. /* 0x0013 -- reserved */
  190. FT_void = 0x0014,
  191. FT_boolean = 0x0015, /* breaks "classic" svr4 SDB */
  192. FT_ext_prec_complex = 0x0016, /* breaks "classic" svr4 SDB */
  193. FT_label = 0x0017,
  194. /* GNU extensions
  195. The low order byte must indicate the size (in bytes) for the type.
  196. All of these types will probably break "classic" svr4 SDB. */
  197. FT_long_long = 0x8008,
  198. FT_signed_long_long = 0x8108,
  199. FT_unsigned_long_long = 0x8208,
  200. FT_int8 = 0x9001,
  201. FT_signed_int8 = 0x9101,
  202. FT_unsigned_int8 = 0x9201,
  203. FT_int16 = 0x9302,
  204. FT_signed_int16 = 0x9402,
  205. FT_unsigned_int16 = 0x9502,
  206. FT_int32 = 0x9604,
  207. FT_signed_int32 = 0x9704,
  208. FT_unsigned_int32 = 0x9804,
  209. FT_int64 = 0x9908,
  210. FT_signed_int64 = 0x9a08,
  211. FT_unsigned_int64 = 0x9b08,
  212. FT_int128 = 0x9c10,
  213. FT_signed_int128 = 0x9d10,
  214. FT_unsigned_int128 = 0x9e10,
  215. FT_real32 = 0xa004,
  216. FT_real64 = 0xa108,
  217. FT_real96 = 0xa20c,
  218. FT_real128 = 0xa310
  219. };
  220. #define FT_lo_user 0x8000 /* implementation-defined range start */
  221. #define FT_hi_user 0xffff /* implementation defined range end */
  222. /* Type modifier names and codes. */
  223. enum dwarf_type_modifier {
  224. MOD_pointer_to = 0x01,
  225. MOD_reference_to = 0x02,
  226. MOD_const = 0x03,
  227. MOD_volatile = 0x04
  228. };
  229. #define MOD_lo_user 0x80 /* implementation-defined range start */
  230. #define MOD_hi_user 0xff /* implementation-defined range end */
  231. /* Array ordering names and codes. */
  232. enum dwarf_array_dim_ordering {
  233. ORD_row_major = 0,
  234. ORD_col_major = 1
  235. };
  236. /* Array subscript format names and codes. */
  237. enum dwarf_subscr_data_formats {
  238. FMT_FT_C_C = 0x0,
  239. FMT_FT_C_X = 0x1,
  240. FMT_FT_X_C = 0x2,
  241. FMT_FT_X_X = 0x3,
  242. FMT_UT_C_C = 0x4,
  243. FMT_UT_C_X = 0x5,
  244. FMT_UT_X_C = 0x6,
  245. FMT_UT_X_X = 0x7,
  246. FMT_ET = 0x8
  247. };
  248. /* Derived from above for ease of use. */
  249. #define FMT_CODE(_FUNDAMENTAL_TYPE_P, _LB_CONST_P, _UB_CONST_P) \
  250. (((_FUNDAMENTAL_TYPE_P) ? 0 : 4) \
  251. | ((_LB_CONST_P) ? 0 : 2) \
  252. | ((_UB_CONST_P) ? 0 : 1))
  253. /* Source language names and codes. */
  254. enum dwarf_source_language {
  255. LANG_C89 = 0x00000001,
  256. LANG_C = 0x00000002,
  257. LANG_ADA83 = 0x00000003,
  258. LANG_C_PLUS_PLUS = 0x00000004,
  259. LANG_COBOL74 = 0x00000005,
  260. LANG_COBOL85 = 0x00000006,
  261. LANG_FORTRAN77 = 0x00000007,
  262. LANG_FORTRAN90 = 0x00000008,
  263. LANG_PASCAL83 = 0x00000009,
  264. LANG_MODULA2 = 0x0000000a,
  265. LANG_JAVA = 0x0000000b
  266. };
  267. #define LANG_lo_user 0x00008000 /* implementation-defined range start */
  268. #define LANG_hi_user 0x0000ffff /* implementation-defined range end */
  269. /* Names and codes for GNU "macinfo" extension. */
  270. enum dwarf_macinfo_record_type {
  271. MACINFO_start = 's',
  272. MACINFO_resume = 'r',
  273. MACINFO_define = 'd',
  274. MACINFO_undef = 'u'
  275. };
  276. #endif /* _ELF_DWARF_H */