From dc0ac714064d9627fb17ad5166c2ec2752323425 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 6 Nov 2014 19:13:13 +0100 Subject: Added more functions to print the abbreviations. --- debug/DwarfTypes.ml | 119 ++++++++++++++++------------------------- powerpc/PrintDiab.ml | 147 +++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 167 insertions(+), 99 deletions(-) diff --git a/debug/DwarfTypes.ml b/debug/DwarfTypes.ml index a5b5e3d1..b2779e33 100644 --- a/debug/DwarfTypes.ml +++ b/debug/DwarfTypes.ml @@ -30,12 +30,6 @@ type encoding = | DW_ATE_unsigned | DW_ATE_unsigned_char -type identifier_case = - | DW_ID_case_sensitive - | DW_ID_up_case - | DW_ID_down_case - | DW_ID_case_insensitive - type address = int type language = @@ -44,35 +38,17 @@ type language = type block = string (* Used as bitvector *) -type calling_convention = - | DW_CC_normal - | DW_CC_program - | DW_CC_nocall - | DW_CC_lo_user - | DW_CC_hi_user - -type inline = - | DW_INL_not_inlined - | DW_INL_inlined - | DW_INL_declared_not_inlined - | DW_INL_declared_inlined - -type const_value = - | String of string - | Const of constant - | Block of block - type location_value = - | Const of constant - | Block of block + | LocConst of constant + | LocBlock of block type data_location_value = - | Block of block - | Ref of reference + | DataLocBlock of block + | DataLocRef of reference type bound_value = - | Const of constant - | Ref of reference + | BoundConst of constant + | BoundRef of reference (* Types representing the attribute information per tag value *) @@ -125,14 +101,14 @@ type dw_tag_enumerator = type dw_tag_formal_parameter = { - dw_at_decl_file: constant option; - dw_at_decl_line: constant option; - dw_at_artificial: flag option; - dw_at_location: location_value option; - dw_at_name: string; - dw_at_segment: location_value option; - dw_at_type: reference; - dw_at_variable_parameter: flag option; + formal_parameter_decl_file: constant option; + formal_parameter_decl_line: constant option; + formal_parameter_artificial: flag option; + formal_parameter_location: location_value option; + formal_parameter_name: string; + formal_parameter_segment: location_value option; + formal_parameter_type: reference; + formal_parameter_variable_parameter: flag option; } type dw_tag_label = @@ -176,67 +152,66 @@ type dw_tag_structure_type = type dw_tag_subprogram = { - dw_at_decl_file: constant option; - dw_at_decl_line: constant option; - dw_at_external: flag option; - dw_at_frame_base: location_value option; - dw_at_high_pc: address; - dw_at_inline: inline option; - dw_at_low_pc: address; - dw_at_name: string; - dw_at_prototyped: flag; - dw_at_type: reference; + subprogram_decl_file: constant option; + subprogram_decl_line: constant option; + subprogram_external: flag option; + subprogram_frame_base: location_value option; + subprogram_high_pc: address; + subprogram_low_pc: address; + subprogram_name: string; + subprogram_prototyped: flag; + subprogram_type: reference; } type dw_tag_subrange_type = { - dw_at_type: reference option; - dw_at_upper_bound: bound_value; + subrange_type: reference option; + subrange_upper_bound: bound_value; } type dw_tag_subroutine_type = { - dw_at_prototyped: flag; + subroutine_prototyped: flag; } type dw_tag_typedef = { - dw_at_decl_file: constant option; - dw_at_decl_line: constant option; - dw_at_name: string; - dw_at_type: reference; + typedef_decl_file: constant option; + typedef_decl_line: constant option; + typedef_name: string; + typedef_type: reference; } type dw_tag_union_type = { - dw_at_decl_file: constant option; - dw_at_decl_line: constant option; - dw_at_byte_size: constant; - dw_at_name: string; + union_decl_file: constant option; + union_decl_line: constant option; + union_byte_size: constant; + union_name: string; } type dw_tag_unspecified_parameter = { - dw_at_decl_file: constant option; - dw_at_decl_line: constant option; - dw_at_artificial: flag option; + unspecified_parameter_decl_file: constant option; + unspecified_parameter_decl_line: constant option; + unspecified_parameter_artificial: flag option; } type dw_tag_variable = { - dw_at_decl_file: constant option; - dw_at_decl_line: constant option; - dw_at_declaration: flag option; - dw_at_external: flag option; - dw_at_location: location_value option; - dw_at_name: string; - dw_at_segment: location_value option; - dw_at_type: reference; + variable_decl_file: constant option; + variable_decl_line: constant option; + variable_declaration: flag option; + variable_external: flag option; + variable_location: location_value option; + variable_name: string; + variable_segment: location_value option; + variable_type: reference; } type dw_tag_volatile_type = { - dw_at_type: reference; + volatile_type: reference; } type dw_tag = @@ -252,7 +227,7 @@ type dw_tag = | DW_TAG_member of dw_tag_member | DW_TAG_pointer_type of dw_tag_pointer_type | DW_TAG_structure_type of dw_tag_structure_type - | DW_TAG_tag_subprogram of dw_tag_subprogram + | DW_TAG_subprogram of dw_tag_subprogram | DW_TAG_subrange_type of dw_tag_subrange_type | DW_TAG_subroutine_type of dw_tag_subroutine_type | DW_TAG_typedef of dw_tag_typedef diff --git a/powerpc/PrintDiab.ml b/powerpc/PrintDiab.ml index 516b0038..bbb08229 100644 --- a/powerpc/PrintDiab.ml +++ b/powerpc/PrintDiab.ml @@ -123,27 +123,64 @@ module Diab_System = add_abbr_uleb v1 buf; add_abbr_uleb v2 buf - let add_sibling = add_abbr_entry (1,19) - - let add_decl_file = add_abbr_entry (58,6) + let add_sibling = add_abbr_entry (0x1,0x13) + + let add_decl_file = add_abbr_entry (0x3a,0x6) - let add_decl_line = add_abbr_entry (59,15) + let add_decl_line = add_abbr_entry (0x3b,0xf) - let add_type = add_abbr_entry (73,16) + let add_type = add_abbr_entry (0x49,0x10) - let add_name = add_abbr_entry (3,8) + let add_name = add_abbr_entry (0x3,0x8) - let add_encoding = add_abbr_entry (62,11) + let add_encoding = add_abbr_entry (0x3e,0xb) - let add_byte_size = add_abbr_entry (11,11) + let add_byte_size = add_abbr_entry (0xb,0xb) - let add_high_pc = add_abbr_entry (18,1) + let add_high_pc = add_abbr_entry (0x12,0x1) - let add_low_pc = add_abbr_entry (17,1) + let add_low_pc = add_abbr_entry (0x11,0x1) - let add_stmt_list = add_abbr_entry (16,6) + let add_stmt_list = add_abbr_entry (0x10,0x6) - let add_declaration = add_abbr_entry (60,12) + let add_declaration = add_abbr_entry (0x3c,0xc) + + let add_external = add_abbr_entry (0x3f,0xc) + + let add_prototyped = add_abbr_entry (0x27,0xc) + + let add_bit_offset = add_abbr_entry (0xd,0xb) + + let add_location loc buf = + match loc with + | None -> () + | Some (LocConst _) -> add_abbr_entry (0x2,0x6) buf + | Some (LocBlock _) -> add_abbr_entry (0x2,0x9) buf + + let add_data_location loc buf = + match loc with + | None -> () + | Some (DataLocBlock __) -> add_abbr_entry (0x38,0x9) buf + | Some (DataLocRef _) -> add_abbr_entry (0x38,0x13) buf + + let add_bound_value bound = + match bound with + | BoundConst _ -> add_abbr_entry (0x2f,0xf) + | BoundRef _ -> add_abbr_entry (0x2f,0x13) + + let add_comp_dir = add_abbr_entry (0x1b,0x8) + + let add_language = add_abbr_entry (0x13,0xf) + + let add_producer = add_abbr_entry (0x25,0x8) + + let add_value = add_abbr_entry (0x1c,0xd) + + let add_artificial = add_abbr_entry (0x34,0xc) + + let add_variable_parameter = add_abbr_entry (0x4b,0xc) + + let add_bit_size = add_abbr_entry (0xc,0xb) let abbrv_string_of_entity entity has_sibling = let buf = Buffer.create 12 in @@ -161,42 +198,52 @@ module Diab_System = in (match entity.tag with | DW_TAG_array_type e -> - prologue 1; + prologue 0x1; add_attr_some e.array_type_decl_file add_decl_file; add_attr_some e.array_type_decl_line add_decl_line; add_type buf | DW_TAG_base_type _ -> - prologue 36; + prologue 0x24; add_encoding buf; add_byte_size buf; add_name buf | DW_TAG_compile_unit e -> - prologue 17; - add_abbr_entry (27,8) buf; + prologue 0x11; + add_comp_dir buf; add_high_pc buf; add_low_pc buf; - add_abbr_entry (19,15) buf; + add_language buf; add_name buf; - add_abbr_entry (37,8) buf; + add_producer buf; add_attr_some e.compile_unit_stmt_list add_stmt_list | DW_TAG_const_type _ -> - prologue 40; + prologue 0x26; add_type buf | DW_TAG_enumeration_type e -> - prologue 4; + prologue 0x4; add_attr_some e.enumeration_decl_file add_decl_file; add_attr_some e.enumeration_decl_line add_decl_line; add_byte_size buf; add_name buf; add_attr_some e.enumeration_declaration add_declaration | DW_TAG_enumerator e -> - prologue 40; + prologue 0x28; add_attr_some e.enumerator_decl_file add_decl_file; add_attr_some e.enumerator_decl_line add_decl_line; - add_abbr_entry (28,13) buf; + add_value buf; add_name buf + | DW_TAG_formal_parameter e -> + prologue 0x34; + add_attr_some e.formal_parameter_decl_file add_decl_file; + add_attr_some e.formal_parameter_decl_line add_decl_line; + add_attr_some e.formal_parameter_artificial add_artificial; + add_location e.formal_parameter_location buf; + add_name buf; + add_location e.formal_parameter_segment buf; + add_type buf; + add_attr_some e.formal_parameter_variable_parameter add_variable_parameter | DW_TAG_label _ -> - prologue 10; + prologue 0xa; add_low_pc buf; add_name buf; | DW_TAG_lexical_block _ -> @@ -208,9 +255,9 @@ module Diab_System = add_attr_some e.member_decl_file add_decl_file; add_attr_some e.member_decl_line add_decl_line; add_attr_some e.member_byte_size add_byte_size; - add_attr_some e.member_bit_offset (add_abbr_entry (13,11)); - add_attr_some e.member_bit_size (add_abbr_entry (12,11)); - add_attr_some e.member_data_member_location (add_abbr_entry (56,9)); + add_attr_some e.member_bit_offset add_bit_offset; + add_attr_some e.member_bit_size add_bit_size; + add_data_location e.member_data_member_location buf; add_attr_some e.member_declaration add_declaration; add_name buf; add_type buf @@ -224,7 +271,53 @@ module Diab_System = add_byte_size buf; add_attr_some e.structure_declaration add_declaration; add_name buf - | _ -> ()); + | DW_TAG_subprogram e -> + prologue 0x2e; + add_attr_some e.subprogram_decl_file add_decl_file; + add_attr_some e.subprogram_decl_line add_decl_line; + add_attr_some e.subprogram_external add_external; + add_high_pc buf; + add_low_pc buf; + add_name buf; + add_prototyped buf; + add_type buf + | DW_TAG_subrange_type e -> + prologue 0x21; + add_attr_some e.subrange_type add_type; + add_bound_value e.subrange_upper_bound buf + | DW_TAG_subroutine_type _ -> + prologue 0x15; + add_prototyped buf + | DW_TAG_typedef e -> + prologue 0x16; + add_attr_some e.typedef_decl_file add_decl_file; + add_attr_some e.typedef_decl_line add_decl_line; + add_name buf; + add_type buf + | DW_TAG_union_type e -> + prologue 0x17; + add_attr_some e.union_decl_file add_decl_file; + add_attr_some e.union_decl_line add_decl_line; + add_byte_size buf; + add_name buf + | DW_TAG_unspecified_parameter e -> + prologue 0x18; + add_attr_some e.unspecified_parameter_decl_file add_decl_file; + add_attr_some e.unspecified_parameter_decl_line add_decl_line; + add_attr_some e.unspecified_parameter_artificial add_artificial + | DW_TAG_variable e -> + prologue 0x34; + add_attr_some e.variable_decl_file add_decl_file; + add_attr_some e.variable_decl_line add_decl_line; + add_attr_some e.variable_declaration add_declaration; + add_attr_some e.variable_external add_external; + add_location e.variable_location buf; + add_name buf; + add_location e.variable_segment buf; + add_type buf + | DW_TAG_volatile_type _ -> + prologue 0x35; + add_type buf); Buffer.contents buf let get_abbrv entity has_sibling = -- cgit