Module BCHDwarfTypes

type secoffset_kind_t =
  1. | LinePtr
  2. | LoclistPtr
  3. | MacPtr
  4. | RangelistPtr
  5. | UnknownSecoffsetPtr
type dwarf_tag_type_t =
  1. | DW_TAG_array_type
  2. | DW_TAG_class_type
  3. | DW_TAG_entry_point
  4. | DW_TAG_enumeration_type
  5. | DW_TAG_formal_parameter
  6. | DW_TAG_imported_declaration
  7. | DW_TAG_label
  8. | DW_TAG_lexical_block
  9. | DW_TAG_member
  10. | DW_TAG_pointer_type
  11. | DW_TAG_reference_type
  12. | DW_TAG_compile_unit
  13. | DW_TAG_string_type
  14. | DW_TAG_structure_type
  15. | DW_TAG_subroutine_type
  16. | DW_TAG_typedef
  17. | DW_TAG_union_type
  18. | DW_TAG_unspecified_parameters
  19. | DW_TAG_variant
  20. | DW_TAG_common_block
  21. | DW_TAG_common_inclusion
  22. | DW_TAG_inheritance
  23. | DW_TAG_inlined_subroutine
  24. | DW_TAG_module
  25. | DW_TAG_ptr_to_member_type
  26. | DW_TAG_set_type
  27. | DW_TAG_subrange_type
  28. | DW_TAG_with_stmt
  29. | DW_TAG_access_declaration
  30. | DW_TAG_base_type
  31. | DW_TAG_catch_block
  32. | DW_TAG_const_type
  33. | DW_TAG_constant
  34. | DW_TAG_enumerator
  35. | DW_TAG_file_type
  36. | DW_TAG_friend
  37. | DW_TAG_namelist
  38. | DW_TAG_namelist_item
  39. | DW_TAG_packed_type
  40. | DW_TAG_subprogram
  41. | DW_TAG_template_type_parameter
  42. | DW_TAG_template_value_parameter
  43. | DW_TAG_thrown_type
  44. | DW_TAG_try_block
  45. | DW_TAG_variant_part
  46. | DW_TAG_variable
  47. | DW_TAG_volatile_type
  48. | DW_TAG_dwarf_procedure
  49. | DW_TAG_restrict_type
  50. | DW_TAG_interface_type
  51. | DW_TAG_namespace
  52. | DW_TAG_imported_module
  53. | DW_TAG_unspecified_type
  54. | DW_TAG_partial_unit
  55. | DW_TAG_imported_unit
  56. | DW_TAG_condition
  57. | DW_TAG_shared_type
  58. | DW_TAG_type_unit
  59. | DW_TAG_rvalue_reference_type
  60. | DW_TAG_template_alias
  61. | DW_TAG_GNU_call_site
  62. | DW_TAG_GNU_call_site_parameter
  63. | DW_TAG_unknown of string
type dwarf_attr_type_t =
  1. | DW_AT_sibling
  2. | DW_AT_location
  3. | DW_AT_name
  4. | DW_AT_ordering
  5. | DW_AT_byte_size
  6. | DW_AT_bit_offset
  7. | DW_AT_bit_size
  8. | DW_AT_stmt_list
  9. | DW_AT_low_pc
  10. | DW_AT_high_pc
  11. | DW_AT_language
  12. | DW_AT_discr
  13. | DW_AT_discr_value
  14. | DW_AT_visibility
  15. | DW_AT_import
  16. | DW_AT_string_length
  17. | DW_AT_common_reference
  18. | DW_AT_comp_dir
  19. | DW_AT_const_value
  20. | DW_AT_containing_type
  21. | DW_AT_default_value
  22. | DW_AT_inline
  23. | DW_AT_is_optional
  24. | DW_AT_lower_bound
  25. | DW_AT_producer
  26. | DW_AT_prototyped
  27. | DW_AT_return_addr
  28. | DW_AT_start_scope
  29. | DW_AT_bit_stride
  30. | DW_AT_upper_bound
  31. | DW_AT_abstract_origin
  32. | DW_AT_accessibility
  33. | DW_AT_address_class
  34. | DW_AT_artificial
  35. | DW_AT_base_types
  36. | DW_AT_calling_convention
  37. | DW_AT_count
  38. | DW_AT_data_member_location
  39. | DW_AT_decl_column
  40. | DW_AT_decl_file
  41. | DW_AT_decl_line
  42. | DW_AT_declaration
  43. | DW_AT_discr_list
  44. | DW_AT_encoding
  45. | DW_AT_external
  46. | DW_AT_frame_base
  47. | DW_AT_friend
  48. | DW_AT_identifier_case
  49. | DW_AT_macro_info
  50. | DW_AT_namelist_item
  51. | DW_AT_priority
  52. | DW_AT_segment
  53. | DW_AT_specification
  54. | DW_AT_type
  55. | DW_AT_use_location
  56. | DW_AT_variable_parameter
  57. | DW_AT_virtuality
  58. | DW_AT_vtable_elem_location
  59. | DW_AT_allocated
  60. | DW_AT_associated
  61. | DW_AT_data_location
  62. | DW_AT_byte_stride
  63. | DW_AT_entry_pc
  64. | DW_AT_use_UTF8
  65. | DW_AT_extension
  66. | DW_AT_ranges
  67. | DW_AT_trampoline
  68. | DW_AT_call_column
  69. | DW_AT_call_file
  70. | DW_AT_call_line
  71. | DW_AT_description
  72. | DW_AT_binary_scale
  73. | DW_AT_decimal_scale
  74. | DW_AT_small
  75. | DW_AT_decimal_sign
  76. | DW_AT_digit_count
  77. | DW_AT_picture_string
  78. | DW_AT_mutable
  79. | DW_AT_linkage_name
  80. | DW_AT_GNU_call_site_value
  81. | DW_AT_GNU_call_site_target
  82. | DW_AT_GNU_tail_call
  83. | DW_AT_GNU_all_tail_call_sites
  84. | DW_AT_GNU_all_call_sites
  85. | DW_AT_GNU_macros
  86. | DW_AT_unknown of string
type dwarf_form_type_t =
  1. | DW_FORM_addr
  2. | DW_FORM_block2
  3. | DW_FORM_block4
  4. | DW_FORM_data2
  5. | DW_FORM_data4
  6. | DW_FORM_data8
  7. | DW_FORM_string
  8. | DW_FORM_block
  9. | DW_FORM_block1
  10. | DW_FORM_data1
  11. | DW_FORM_flag
  12. | DW_FORM_sdata
  13. | DW_FORM_strp
  14. | DW_FORM_udata
  15. | DW_FORM_ref_addr
  16. | DW_FORM_ref1
  17. | DW_FORM_ref2
  18. | DW_FORM_ref4
  19. | DW_FORM_ref8
  20. | DW_FORM_ref_udata
  21. | DW_FORM_indirect
  22. | DW_FORM_sec_offset
  23. | DW_FORM_exprloc
  24. | DW_FORM_flag_present
  25. | DW_FORM_ref_sig8
  26. | DW_FORM_unknown of string
type dwarf_operand_t =
  1. | ConstantAddress of BCHLibTypes.doubleword_int
  2. | OneByteUnsignedValue of int
  3. | OneByteSignedValue of int
  4. | TwoByteUnsignedValue of int
  5. | TwoByteSignedValue of int
  6. | FourByteUnsignedValue of int
  7. | EightByteUnsignedValue of CHNumerical.numerical_t
  8. | ULEB128Constant of CHNumerical.numerical_t
  9. | SLEB128Constant of CHNumerical.numerical_t
and dwarf_operation_t =
  1. | DW_OP_addr of dwarf_operand_t
  2. | DW_OP_deref
  3. | DW_OP_const1u of dwarf_operand_t
  4. | DW_OP_const1s of dwarf_operand_t
  5. | DW_OP_const2u of dwarf_operand_t
  6. | DW_OP_const4u of dwarf_operand_t
  7. | DW_OP_dup
  8. | DW_OP_drop
  9. | DW_OP_over
  10. | DW_OP_swap
  11. | DW_OP_and
  12. | DW_OP_minus
  13. | DW_OP_mul
  14. | DW_OP_or
  15. | DW_OP_plus
  16. | DW_OP_plus_uconst of dwarf_operand_t
  17. | DW_OP_shl
  18. | DW_OP_shr
  19. | DW_OP_bra of dwarf_operand_t
  20. | DW_OP_eq
  21. | DW_OP_ge
  22. | DW_OP_lt
  23. | DW_OP_ne
  24. | DW_OP_lit of int
  25. | DW_OP_reg of int
  26. | DW_OP_breg of int * dwarf_operand_t
  27. | DW_OP_regx of dwarf_operand_t
  28. | DW_OP_fbreg of dwarf_operand_t
  29. | DW_OP_piece of dwarf_operand_t
  30. | DW_OP_call_frame_cfa
  31. | DW_OP_stack_value
  32. | DW_OP_GNU_implicit_pointer of string * dwarf_operand_t * dwarf_operand_t
  33. | DW_OP_GNU_entry_value of int * dwarf_expr_t
  34. | DW_OP_GNU_regval_type of BCHLibTypes.doubleword_int * dwarf_operand_t * dwarf_operand_t
  35. | DW_OP_GNU_convert of BCHLibTypes.doubleword_int * dwarf_operand_t
  36. | DW_OP_GNU_parameter_ref of BCHLibTypes.doubleword_int * dwarf_operand_t
  37. | DW_OP_unknown of int
and dwarf_expr_t = dwarf_operation_t list
type debug_abbrev_table_entry_t = {
  1. dabb_index : int;
  2. dabb_tag : dwarf_tag_type_t;
  3. dabb_has_children : bool;
  4. dabb_attr_specs : (dwarf_attr_type_t * dwarf_form_type_t) list;
}
type single_location_description_t =
  1. | SimpleLocation of dwarf_expr_t
  2. | CompositeLocation of (dwarf_expr_t * dwarf_operation_t) list

Describes the location of an object whose lifetime is either static or the same as the lexical block that owns it, and that does not move during its lifetime.

A simple location describes the location of one contiguous piece (or all) of an object. It may describe a location in addressable memory or a register, or the lack of a location.

A simple location can be (1) a Memory Location Description, expressed by a dwarf expression, whose value is the address of a piece or all of an entity in memory; (2) a Register Location Description, expressed by a single dwarf operation which can be either one of DW_OP_reg0, ..., DW_OP_reg31, or DW_OP_regx with an unsigned LEB128 that encodes the name of the register. (3) an Implicit Location Description, representing a piece or all of an object that has no actual location, but whose contents are either known or known to be undefined. A known constant or a computed value can be represented by:

  • DW_OP_implicit_value, which specifies an immediate value, or
  • DW_OP_stack_value, which is the at top of the DWARF expression stack as the result of a dwarf expression evaluated. (4) an Empty Location Description, represented by a dwarf expression with zero operations. It represents a piece or all of an object that is present in the source but not in the object code.

A composite location describes the location of an object in terms of pieces, each of which may be contained in part of a register or stored in a memory location unrelated to other pieces.

A composite location consists of a sequence of pieces, where each piece consists of a simple location followed by a composition operator, which can be:

  • DW_OP_piece size, specifying the size in bytes of the piece, or
  • DW_OP_bit size, offset, specifying the size in bits of the piece and the offset in bits from the preceding location description.

Ref: Dwarf v4, page 26-29

type location_list_entry_t = {
  1. lle_start_address : BCHLibTypes.doubleword_int;
  2. lle_end_address : BCHLibTypes.doubleword_int;
  3. lle_location : single_location_description_t;
}
type debug_location_list_entry_t =
  1. | LocationListEntry of location_list_entry_t
  2. | LocBaseAddressSelectionEntry of BCHLibTypes.doubleword_int
  3. | LocEndOfListEntry
type debug_loc_description_t =
  1. | SingleLocation of single_location_description_t
  2. | LocationList of debug_location_list_entry_t list
type debug_range_list_entry_t =
  1. | RangeListEntry of BCHLibTypes.doubleword_int * BCHLibTypes.doubleword_int
  2. | RngBaseAddressSelectionEntry of BCHLibTypes.doubleword_int
  3. | RngEndOfListEntry
type debug_range_description_t =
  1. | SingleAddress of BCHLibTypes.doubleword_int
  2. | ContiguousAddressRange of BCHLibTypes.doubleword_int * BCHLibTypes.doubleword_int
  3. | NoncontiguousAddressRange of debug_range_list_entry_t list
type debug_aranges_table_entry_t = {
  1. dar_length : int;
  2. dar_debug_info_offset : BCHLibTypes.doubleword_int;
  3. dar_pointer_size : int;
  4. dar_tuples : (BCHLibTypes.doubleword_int * BCHLibTypes.doubleword_int) list;
}
type debug_info_entry_t = {
  1. dwie_abbrev : int;
  2. dwie_tag : dwarf_tag_type_t;
  3. dwie_values : (dwarf_attr_type_t * dwarf_attr_value_t) list;
  4. dwie_children : debug_info_entry_t list;
}
and dwarf_attr_value_t =
  1. | DW_ATV_FORM_addr of BCHLibTypes.doubleword_int
  2. | DW_ATV_FORM_block2 of int * int list
  3. | DW_ATV_FORM_block4 of int * int list
  4. | DW_ATV_FORM_data2 of int
  5. | DW_ATV_FORM_data4 of BCHLibTypes.doubleword_int
  6. | DW_ATV_FORM_data8 of BCHLibTypes.doubleword_int * BCHLibTypes.doubleword_int
  7. | DW_ATV_FORM_string of string
  8. | DW_ATV_FORM_block of int * int list
  9. | DW_ATV_FORM_block1 of int * int list
  10. | DW_ATV_FORM_data1 of int
  11. | DW_ATV_FORM_flag of int
  12. | DW_ATV_FORM_flag_present of int
  13. | DW_ATV_FORM_sdata of int
  14. | DW_ATV_FORM_strp of BCHLibTypes.doubleword_int * string
  15. | DW_ATV_FORM_udata of int
  16. | DW_ATV_FORM_ref_addr of int
  17. | DW_ATV_FORM_ref1 of int
  18. | DW_ATV_FORM_ref2 of int
  19. | DW_ATV_FORM_ref4 of BCHLibTypes.doubleword_int
  20. | DW_ATV_FORM_ref8 of int
  21. | DW_ATV_FORM_ref_udata of int
  22. | DW_ATV_FORM_exprloc of int * dwarf_expr_t
  23. | DW_ATV_FORM_sec_offset of secoffset_kind_t * BCHLibTypes.doubleword_int
  24. | DW_ATV_FORM_sec_offset_loclist of BCHLibTypes.doubleword_int * debug_loc_description_t
  25. | DW_ATV_FORM_sec_offset_rangelist of BCHLibTypes.doubleword_int * debug_range_description_t
  26. | DW_ATV_FORM_unknown of string
type debug_compilation_unit_header_t = {
  1. dwcu_length : BCHLibTypes.doubleword_int;
  2. dwcu_offset : BCHLibTypes.doubleword_int;
  3. dwcu_version : int;
  4. dwcu_abbrev_offset : BCHLibTypes.doubleword_int;
  5. dwcu_address_size : int;
}
type debug_compilation_unit_t = {
  1. cu_header : debug_compilation_unit_header_t;
  2. cu_unit : debug_info_entry_t;
}