From 9ecede34667433bc3cacf47fb75e03a79607223b Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 7 Sep 2015 15:31:00 +0200 Subject: Various changes in the debug printer. The debug printer now uses udata for member sizes since structs can have a size larger than 255 bytes. Also functions that are inlined no longer have an high and low pc in their abbreviation entry. --- debug/CtoDwarf.ml | 7 ++----- debug/DwarfPrinter.ml | 13 +++++++------ debug/DwarfTypes.mli | 1 + debug/DwarfUtil.ml | 1 + 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'debug') diff --git a/debug/CtoDwarf.ml b/debug/CtoDwarf.ml index dca33f38..c2085eb0 100644 --- a/debug/CtoDwarf.ml +++ b/debug/CtoDwarf.ml @@ -305,15 +305,12 @@ let typedef_to_dwarf gloc (name,t) = (* Translate a global var to its corresponding dwarf representation *) let glob_var_to_dwarf (s,n,t,_) gloc = let i,t = type_to_dwarf t in - let at_decl = (match s with - | Storage_extern -> true - | _ -> false) in let ext = (match s with | Storage_static -> false | _ -> true) in let decl = { variable_file_loc = (Some gloc); - variable_declaration = Some at_decl; + variable_declaration = None; variable_external = Some ext; variable_location = None; variable_name = n.name; @@ -372,7 +369,7 @@ let enum_to_dwarf (n,at,e) gloc = let enum = { enumeration_file_loc = Some gloc; enumeration_byte_size = bs; - enumeration_declaration = Some false; + enumeration_declaration = None; enumeration_name = if n.name <> "" then Some n.name else None; } in let id = get_composite_type n.stamp in diff --git a/debug/DwarfPrinter.ml b/debug/DwarfPrinter.ml index 7f1caaf6..15843eb9 100644 --- a/debug/DwarfPrinter.ml +++ b/debug/DwarfPrinter.ml @@ -58,6 +58,8 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS): let add_byte_size = add_abbr_entry (0xb,byte_size_type_abbr) + let add_member_size = add_abbr_entry (0xb,member_size_abbr) + let add_high_pc = add_abbr_entry (0x12,high_pc_type_abbr) let add_low_pc = add_abbr_entry (0x11,low_pc_type_abbr) @@ -143,7 +145,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS): | DW_TAG_member e -> prologue 0xd; add_attr_some e.member_file_loc add_file_loc; - add_attr_some e.member_byte_size add_byte_size; + add_attr_some e.member_byte_size add_member_size; add_attr_some e.member_bit_offset (add_abbr_entry (0xd,bit_offset_type_abbr)); add_attr_some e.member_bit_size (add_abbr_entry (0xc,bit_size_type_abbr)); (match e.member_data_member_location with @@ -159,15 +161,14 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS): | DW_TAG_structure_type e -> prologue 0x13; add_attr_some e.structure_file_loc add_file_loc; - add_attr_some e.structure_byte_size add_byte_size; + add_attr_some e.structure_byte_size add_member_size; add_attr_some e.structure_declaration add_declaration; add_attr_some e.structure_name add_name | DW_TAG_subprogram e -> prologue 0x2e; add_attr_some e.subprogram_file_loc add_file_loc; add_attr_some e.subprogram_external (add_abbr_entry (0x3f,external_type_abbr)); - add_high_pc buf; - add_low_pc buf; + add_fun_pc e buf; add_name buf; add_abbr_entry (0x27,prototyped_type_abbr) buf; add_attr_some e.subprogram_type add_type; @@ -190,7 +191,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS): | DW_TAG_union_type e -> prologue 0x17; add_attr_some e.union_file_loc add_file_loc; - add_attr_some e.union_byte_size add_byte_size; + add_attr_some e.union_byte_size add_member_size; add_attr_some e.union_declaration add_declaration; add_attr_some e.union_name add_name | DW_TAG_unspecified_parameter e -> @@ -253,7 +254,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS): fprintf oc " .uleb128 %d\n" id; output_string oc s; fprintf oc " .uleb128 0\n"; - fprintf oc " .uleb128 0\n") abbrevs; + fprintf oc " .uleb128 0\n\n") abbrevs; fprintf oc " .sleb128 0\n" let debug_start_addr = ref (-1) diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index d6592bd9..eaf07e1e 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -237,6 +237,7 @@ module type DWARF_ABBREVS = val name_type_abbr: int val encoding_type_abbr: int val byte_size_type_abbr: int + val member_size_abbr: int val high_pc_type_abbr: int val low_pc_type_abbr: int val stmt_list_type_abbr: int diff --git a/debug/DwarfUtil.ml b/debug/DwarfUtil.ml index e2c87a9d..f47c2b58 100644 --- a/debug/DwarfUtil.ml +++ b/debug/DwarfUtil.ml @@ -95,6 +95,7 @@ module DefaultAbbrevs = let name_type_abbr = dw_form_string let encoding_type_abbr = dw_form_data1 let byte_size_type_abbr = dw_form_data1 + let member_size_abbr = dw_form_udata let high_pc_type_abbr = dw_form_addr let low_pc_type_abbr = dw_form_addr let stmt_list_type_abbr = dw_form_data4 -- cgit