dbgdwarfconst.pas 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. {
  2. Copyright (c) 2003-2006 by Peter Vreman and Florian Klaempfl
  3. This units contains support for DWARF debug info generation
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit dbgdwarfconst;
  18. {$i fpcdefs.inc}
  19. interface
  20. type
  21. { Tag names and codes. }
  22. tdwarf_tag = (DW_TAG_padding := $00,DW_TAG_array_type := $01,
  23. DW_TAG_class_type := $02,DW_TAG_entry_point := $03,
  24. DW_TAG_enumeration_type := $04,DW_TAG_formal_parameter := $05,
  25. DW_TAG_imported_declaration := $08,DW_TAG_label := $0a,
  26. DW_TAG_lexical_block := $0b,DW_TAG_member := $0d,
  27. DW_TAG_pointer_type := $0f,DW_TAG_reference_type := $10,
  28. DW_TAG_compile_unit := $11,DW_TAG_string_type := $12,
  29. DW_TAG_structure_type := $13,DW_TAG_subroutine_type := $15,
  30. DW_TAG_typedef := $16,DW_TAG_union_type := $17,
  31. DW_TAG_unspecified_parameters := $18,
  32. DW_TAG_variant := $19,DW_TAG_common_block := $1a,
  33. DW_TAG_common_inclusion := $1b,DW_TAG_inheritance := $1c,
  34. DW_TAG_inlined_subroutine := $1d,DW_TAG_module := $1e,
  35. DW_TAG_ptr_to_member_type := $1f,DW_TAG_set_type := $20,
  36. DW_TAG_subrange_type := $21,DW_TAG_with_stmt := $22,
  37. DW_TAG_access_declaration := $23,DW_TAG_base_type := $24,
  38. DW_TAG_catch_block := $25,DW_TAG_const_type := $26,
  39. DW_TAG_constant := $27,DW_TAG_enumerator := $28,
  40. DW_TAG_file_type := $29,DW_TAG_friend := $2a,
  41. DW_TAG_namelist := $2b,DW_TAG_namelist_item := $2c,
  42. DW_TAG_packed_type := $2d,DW_TAG_subprogram := $2e,
  43. DW_TAG_template_type_param := $2f,DW_TAG_template_value_param := $30,
  44. DW_TAG_thrown_type := $31,DW_TAG_try_block := $32,
  45. DW_TAG_variant_part := $33,DW_TAG_variable := $34,
  46. DW_TAG_volatile_type := $35,
  47. { DWARF 3. }
  48. DW_TAG_dwarf_procedure := $36,
  49. DW_TAG_restrict_type := $37,DW_TAG_interface_type := $38,
  50. DW_TAG_namespace := $39,DW_TAG_imported_module := $3a,
  51. DW_TAG_unspecified_type := $3b,DW_TAG_partial_unit := $3c,
  52. DW_TAG_imported_unit := $3d,
  53. DW_TAG_condition := $3f,
  54. DW_TAG_shared_type := $40,
  55. { DWARF 4 }
  56. DW_TAG_type_unit := $41,
  57. DW_TAG_rvalue_reference_type := $42,
  58. DW_TAG_template_alias := $43,
  59. { SGI/MIPS Extensions. }
  60. DW_TAG_MIPS_loop := $4081,
  61. { HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . }
  62. DW_TAG_HP_array_descriptor := $4090,
  63. { GNU extensions. }
  64. { For FORTRAN 77 and Fortran 90. }
  65. DW_TAG_format_label := $4101,
  66. { For C++. }
  67. DW_TAG_function_template := $4102,DW_TAG_class_template := $4103,
  68. DW_TAG_GNU_BINCL := $4104,DW_TAG_GNU_EINCL := $4105,
  69. { Extensions for UPC. See: http://upc.gwu.edu/~upc. }
  70. DW_TAG_upc_shared_type := $8765,DW_TAG_upc_strict_type := $8766,
  71. DW_TAG_upc_relaxed_type := $8767,
  72. { PGI (STMicroelectronics) extensions. No documentation available. }
  73. DW_TAG_PGI_kanji_type := $A000,
  74. DW_TAG_PGI_interface_block := $A020
  75. );
  76. { Type encodings. }
  77. Tdwarf_type = (DW_ATE_void := $0,DW_ATE_address := $1,
  78. DW_ATE_boolean := $2,DW_ATE_complex_float := $3,
  79. DW_ATE_float := $4,DW_ATE_signed := $5,
  80. DW_ATE_signed_char := $6,DW_ATE_unsigned := $7,
  81. DW_ATE_unsigned_char := $8,DW_ATE_imaginary_float := $9,
  82. { HP extensions. }
  83. DW_ATE_HP_float80 := $80,DW_ATE_HP_complex_float80 := $81,
  84. DW_ATE_HP_float128 := $82,DW_ATE_HP_complex_float128 := $83,
  85. DW_ATE_HP_floathpintel := $84,DW_ATE_HP_imaginary_float80 := $85,
  86. DW_ATE_HP_imaginary_float128 := $86
  87. );
  88. {$push}
  89. {$notes off}
  90. { Attribute names and codes. }
  91. tdwarf_attribute = (DW_AT_sibling := $01,DW_AT_location := $02,
  92. DW_AT_name := $03,DW_AT_ordering := $09,
  93. DW_AT_subscr_data := $0a,DW_AT_byte_size := $0b,
  94. DW_AT_bit_offset := $0c,DW_AT_bit_size := $0d,
  95. DW_AT_element_list := $0f,DW_AT_stmt_list := $10,
  96. DW_AT_low_pc := $11,DW_AT_high_pc := $12,
  97. DW_AT_language := $13,DW_AT_member := $14,
  98. DW_AT_discr := $15,DW_AT_discr_value := $16,
  99. DW_AT_visibility := $17,DW_AT_import := $18,
  100. DW_AT_string_length := $19,DW_AT_common_reference := $1a,
  101. DW_AT_comp_dir := $1b,DW_AT_const_value := $1c,
  102. DW_AT_containing_type := $1d,DW_AT_default_value := $1e,
  103. DW_AT_inline := $20,DW_AT_is_optional := $21,
  104. DW_AT_lower_bound := $22,DW_AT_producer := $25,
  105. DW_AT_prototyped := $27,DW_AT_return_addr := $2a,
  106. DW_AT_start_scope := $2c,DW_AT_stride_size := $2e,
  107. DW_AT_upper_bound := $2f,DW_AT_abstract_origin := $31,
  108. DW_AT_accessibility := $32,DW_AT_address_class := $33,
  109. DW_AT_artificial := $34,DW_AT_base_types := $35,
  110. DW_AT_calling_convention := $36,DW_AT_count := $37,
  111. DW_AT_data_member_location := $38,DW_AT_decl_column := $39,
  112. DW_AT_decl_file := $3a,DW_AT_decl_line := $3b,
  113. DW_AT_declaration := $3c,DW_AT_discr_list := $3d,
  114. DW_AT_encoding := $3e,DW_AT_external := $3f,
  115. DW_AT_frame_base := $40,DW_AT_friend := $41,
  116. DW_AT_identifier_case := $42,DW_AT_macro_info := $43,
  117. DW_AT_namelist_items := $44,DW_AT_priority := $45,
  118. DW_AT_segment := $46,DW_AT_specification := $47,
  119. DW_AT_static_link := $48,DW_AT_type := $49,
  120. DW_AT_use_location := $4a,DW_AT_variable_parameter := $4b,
  121. DW_AT_virtuality := $4c,DW_AT_vtable_elem_location := $4d,
  122. { DWARF 3 values. }
  123. DW_AT_allocated := $4e,DW_AT_associated := $4f,
  124. DW_AT_data_location := $50,DW_AT_byte_stride := $51,
  125. DW_AT_entry_pc := $52,DW_AT_use_UTF8 := $53,
  126. DW_AT_extension := $54,DW_AT_ranges := $55,
  127. DW_AT_trampoline := $56,DW_AT_call_column := $57,
  128. DW_AT_call_file := $58,DW_AT_call_line := $59,
  129. DW_AT_description := $5a, { string }
  130. DW_AT_binary_scale := $5b, { constant }
  131. DW_AT_decimal_scale := $5c, { constant }
  132. DW_AT_small := $5d, { reference }
  133. DW_AT_decimal_sign := $5e, { constant }
  134. DW_AT_digit_count := $5f, { constant }
  135. DW_AT_picture_string := $60, { string }
  136. DW_AT_mutable := $61, { flag }
  137. DW_AT_threads_scaled := $62, { flag }
  138. DW_AT_explicit := $63, { flag }
  139. DW_AT_object_pointer := $64, { reference }
  140. DW_AT_endianity := $65, { constant }
  141. DW_AT_elemental := $66, { flag }
  142. DW_AT_pure := $67, { flag }
  143. DW_AT_recursive := $68, { flag }
  144. { DWARF 4 values }
  145. DW_AT_signature := $69, { reference }
  146. DW_AT_main_subprogram := $6a, { flag }
  147. DW_AT_data_bit_offset := $6b, { constant }
  148. DW_AT_const_expr := $6c, { flag }
  149. DW_AT_enum_class := $6d, { flag }
  150. DW_AT_linkage_name := $6e, { string }
  151. { SGI/MIPS extensions. }
  152. DW_AT_MIPS_fde := $2001,DW_AT_MIPS_loop_begin := $2002,
  153. DW_AT_MIPS_tail_loop_begin := $2003,DW_AT_MIPS_epilog_begin := $2004,
  154. DW_AT_MIPS_loop_unroll_factor := $2005,
  155. DW_AT_MIPS_software_pipeline_depth := $2006,
  156. DW_AT_MIPS_linkage_name := $2007,DW_AT_MIPS_stride := $2008,
  157. DW_AT_MIPS_abstract_name := $2009,DW_AT_MIPS_clone_origin := $200a,
  158. DW_AT_MIPS_has_inlines := $200b,
  159. { HP extensions. }
  160. DW_AT_HP_block_index := $2000,
  161. DW_AT_HP_unmodifiable := $2001,DW_AT_HP_actuals_stmt_list := $2010,
  162. DW_AT_HP_proc_per_section := $2011,DW_AT_HP_raw_data_ptr := $2012,
  163. DW_AT_HP_pass_by_reference := $2013,DW_AT_HP_opt_level := $2014,
  164. DW_AT_HP_prof_version_id := $2015,DW_AT_HP_opt_flags := $2016,
  165. DW_AT_HP_cold_region_low_pc := $2017,DW_AT_HP_cold_region_high_pc := $2018,
  166. DW_AT_HP_all_variables_modifiable := $2019,
  167. DW_AT_HP_linkage_name := $201a,DW_AT_HP_prof_flags := $201b,
  168. { WATCOM extensions. }
  169. DW_AT_WATCOM_memory_model := $2082,
  170. DW_AT_WATCOM_references_start := $2083,
  171. DW_AT_WATCOM_parm_entry := $2084,
  172. { GNU extensions. }
  173. DW_AT_sf_names := $2101,DW_AT_src_info := $2102,
  174. DW_AT_mac_info := $2103,DW_AT_src_coords := $2104,
  175. DW_AT_body_begin := $2105,DW_AT_body_end := $2106,
  176. DW_AT_GNU_vector := $2107,
  177. { VMS extensions. }
  178. DW_AT_VMS_rtnbeg_pd_address := $2201,
  179. { UPC extension. }
  180. DW_AT_upc_threads_scaled := $3210,
  181. { PGI (STMicroelectronics) extensions. }
  182. DW_AT_PGI_lbase := $3a00,
  183. DW_AT_PGI_soffset := $3a01,DW_AT_PGI_lstride := $3a02,
  184. { Apple extensions }
  185. DW_AT_APPLE_optimized := $3fe1,
  186. DW_AT_APPLE_flags := $3fe2,
  187. DW_AT_APPLE_major_runtime_vers := $3fe5,
  188. DW_AT_APPLE_runtime_class := $3fe6
  189. );
  190. {$pop}
  191. { Form names and codes. }
  192. Tdwarf_form = (DW_FORM_addr := $01,DW_FORM_block2 := $03,
  193. DW_FORM_block4 := $04,DW_FORM_data2 := $05,
  194. DW_FORM_data4 := $06,DW_FORM_data8 := $07,
  195. DW_FORM_string := $08,DW_FORM_block := $09,
  196. DW_FORM_block1 := $0a,DW_FORM_data1 := $0b,
  197. DW_FORM_flag := $0c,DW_FORM_sdata := $0d,
  198. DW_FORM_strp := $0e,DW_FORM_udata := $0f,
  199. DW_FORM_ref_addr := $10,DW_FORM_ref1 := $11,
  200. DW_FORM_ref2 := $12,DW_FORM_ref4 := $13,
  201. DW_FORM_ref8 := $14,DW_FORM_ref_udata := $15,
  202. DW_FORM_indirect := $16,
  203. { DWARF 4 }
  204. DW_FORM_sec_offset := $17, { lineptr, loclistptr, macptr, rangelistptr }
  205. DW_FORM_exprloc := $18, { exprloc }
  206. DW_FORM_flag_present := $19, { flag }
  207. DW_FORM_ref_sig8 := $20 { reference }
  208. );
  209. { values of DW_AT_address_class }
  210. Tdwarf_addr = (
  211. DW_ADDR_none := 0,
  212. DW_ADDR_near16 := 1,
  213. DW_ADDR_far16 := 2,
  214. DW_ADDR_huge16 := 3,
  215. DW_ADDR_near32 := 4,
  216. DW_ADDR_far32 := 5
  217. );
  218. { values of DW_AT_WATCOM_memory_model }
  219. Tdwarf_watcom_memory_model = (
  220. DW_WATCOM_MEMORY_MODEL_none := 0,
  221. DW_WATCOM_MEMORY_MODEL_flat := 1,
  222. DW_WATCOM_MEMORY_MODEL_small := 2,
  223. DW_WATCOM_MEMORY_MODEL_medium := 3,
  224. DW_WATCOM_MEMORY_MODEL_compact := 4,
  225. DW_WATCOM_MEMORY_MODEL_large := 5,
  226. DW_WATCOM_MEMORY_MODEL_huge := 6
  227. );
  228. type
  229. { Source language names and codes. }
  230. tdwarf_source_language = (DW_LANG_C89 := $0001,DW_LANG_C := $0002,DW_LANG_Ada83 := $0003,
  231. DW_LANG_C_plus_plus := $0004,DW_LANG_Cobol74 := $0005,
  232. DW_LANG_Cobol85 := $0006,DW_LANG_Fortran77 := $0007,
  233. DW_LANG_Fortran90 := $0008,DW_LANG_Pascal83 := $0009,
  234. DW_LANG_Modula2 := $000a,DW_LANG_Java := $000b,
  235. { DWARF 3. }
  236. DW_LANG_C99 := $000c,DW_LANG_Ada95 := $000d,
  237. DW_LANG_Fortran95 := $000e,
  238. { Objective-C }
  239. DW_LANG_ObjC := $10,
  240. { MIPS. }
  241. DW_LANG_Mips_Assembler := $8001,
  242. { UPC. }
  243. DW_LANG_Upc := $8765
  244. );
  245. {$push}
  246. {$notes off}
  247. { Location atom names and codes. }
  248. Tdwarf_location_atom = (DW_OP_addr := $03,DW_OP_deref := $06,DW_OP_const1u := $08,
  249. DW_OP_const1s := $09,DW_OP_const2u := $0a,
  250. DW_OP_const2s := $0b,DW_OP_const4u := $0c,
  251. DW_OP_const4s := $0d,DW_OP_const8u := $0e,
  252. DW_OP_const8s := $0f,DW_OP_constu := $10,
  253. DW_OP_consts := $11,DW_OP_dup := $12,DW_OP_drop := $13,
  254. DW_OP_over := $14,DW_OP_pick := $15,DW_OP_swap := $16,
  255. DW_OP_rot := $17,DW_OP_xderef := $18,DW_OP_abs := $19,
  256. DW_OP_and := $1a,DW_OP_div := $1b,DW_OP_minus := $1c,
  257. DW_OP_mod := $1d,DW_OP_mul := $1e,DW_OP_neg := $1f,
  258. DW_OP_not := $20,DW_OP_or := $21,DW_OP_plus := $22,
  259. DW_OP_plus_uconst := $23,DW_OP_shl := $24,
  260. DW_OP_shr := $25,DW_OP_shra := $26,DW_OP_xor := $27,
  261. DW_OP_bra := $28,DW_OP_eq := $29,DW_OP_ge := $2a,
  262. DW_OP_gt := $2b,DW_OP_le := $2c,DW_OP_lt := $2d,
  263. DW_OP_ne := $2e,DW_OP_skip := $2f,DW_OP_lit0 := $30,
  264. DW_OP_lit1 := $31,DW_OP_lit2 := $32,DW_OP_lit3 := $33,
  265. DW_OP_lit4 := $34,DW_OP_lit5 := $35,DW_OP_lit6 := $36,
  266. DW_OP_lit7 := $37,DW_OP_lit8 := $38,DW_OP_lit9 := $39,
  267. DW_OP_lit10 := $3a,DW_OP_lit11 := $3b,
  268. DW_OP_lit12 := $3c,DW_OP_lit13 := $3d,
  269. DW_OP_lit14 := $3e,DW_OP_lit15 := $3f,
  270. DW_OP_lit16 := $40,DW_OP_lit17 := $41,
  271. DW_OP_lit18 := $42,DW_OP_lit19 := $43,
  272. DW_OP_lit20 := $44,DW_OP_lit21 := $45,
  273. DW_OP_lit22 := $46,DW_OP_lit23 := $47,
  274. DW_OP_lit24 := $48,DW_OP_lit25 := $49,
  275. DW_OP_lit26 := $4a,DW_OP_lit27 := $4b,
  276. DW_OP_lit28 := $4c,DW_OP_lit29 := $4d,
  277. DW_OP_lit30 := $4e,DW_OP_lit31 := $4f,
  278. DW_OP_reg0 := $50,DW_OP_reg1 := $51,DW_OP_reg2 := $52,
  279. DW_OP_reg3 := $53,DW_OP_reg4 := $54,DW_OP_reg5 := $55,
  280. DW_OP_reg6 := $56,DW_OP_reg7 := $57,DW_OP_reg8 := $58,
  281. DW_OP_reg9 := $59,DW_OP_reg10 := $5a,DW_OP_reg11 := $5b,
  282. DW_OP_reg12 := $5c,DW_OP_reg13 := $5d,
  283. DW_OP_reg14 := $5e,DW_OP_reg15 := $5f,
  284. DW_OP_reg16 := $60,DW_OP_reg17 := $61,
  285. DW_OP_reg18 := $62,DW_OP_reg19 := $63,
  286. DW_OP_reg20 := $64,DW_OP_reg21 := $65,
  287. DW_OP_reg22 := $66,DW_OP_reg23 := $67,
  288. DW_OP_reg24 := $68,DW_OP_reg25 := $69,
  289. DW_OP_reg26 := $6a,DW_OP_reg27 := $6b,
  290. DW_OP_reg28 := $6c,DW_OP_reg29 := $6d,
  291. DW_OP_reg30 := $6e,DW_OP_reg31 := $6f,
  292. DW_OP_breg0 := $70,DW_OP_breg1 := $71,
  293. DW_OP_breg2 := $72,DW_OP_breg3 := $73,
  294. DW_OP_breg4 := $74,DW_OP_breg5 := $75,
  295. DW_OP_breg6 := $76,DW_OP_breg7 := $77,
  296. DW_OP_breg8 := $78,DW_OP_breg9 := $79,
  297. DW_OP_breg10 := $7a,DW_OP_breg11 := $7b,
  298. DW_OP_breg12 := $7c,DW_OP_breg13 := $7d,
  299. DW_OP_breg14 := $7e,DW_OP_breg15 := $7f,
  300. DW_OP_breg16 := $80,DW_OP_breg17 := $81,
  301. DW_OP_breg18 := $82,DW_OP_breg19 := $83,
  302. DW_OP_breg20 := $84,DW_OP_breg21 := $85,
  303. DW_OP_breg22 := $86,DW_OP_breg23 := $87,
  304. DW_OP_breg24 := $88,DW_OP_breg25 := $89,
  305. DW_OP_breg26 := $8a,DW_OP_breg27 := $8b,
  306. DW_OP_breg28 := $8c,DW_OP_breg29 := $8d,
  307. DW_OP_breg30 := $8e,DW_OP_breg31 := $8f,
  308. DW_OP_regx := $90,DW_OP_fbreg := $91,DW_OP_bregx := $92,
  309. DW_OP_piece := $93,DW_OP_deref_size := $94,
  310. DW_OP_xderef_size := $95,DW_OP_nop := $96,
  311. { DWARF 3 extensions. }
  312. DW_OP_push_object_address := $97,DW_OP_call2 := $98,
  313. DW_OP_call4 := $99,DW_OP_call_ref := $9a,
  314. { DWARF 4 extensions. }
  315. DW_OP_implicit_value := $9e, DW_OP_stack_value := $9f,
  316. { GNU extensions. }
  317. DW_OP_GNU_push_tls_address := $e0,
  318. { HP extensions. }
  319. DW_OP_HP_unknown := $e0,
  320. DW_OP_HP_is_value := $e1,DW_OP_HP_fltconst4 := $e2,
  321. DW_OP_HP_fltconst8 := $e3,DW_OP_HP_mod_range := $e4,
  322. DW_OP_HP_unmod_range := $e5,DW_OP_HP_tls := $e6,
  323. { WebAssembly extensions. }
  324. DW_OP_WASM_location = $ed
  325. );
  326. {$pop}
  327. implementation
  328. end.