From 6697f6e69fdf87e2de6f1f1b2846e3453c0e3a11 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 15 Dec 2014 12:20:57 +0100 Subject: Started implementation of printing the dwarf entries. --- debug/DwarfAbbrvPrinter.ml | 4 ++++ debug/DwarfTypes.ml | 22 +++++++++++----------- powerpc/PrintDiab.ml | 16 ++++++++++++++++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/debug/DwarfAbbrvPrinter.ml b/debug/DwarfAbbrvPrinter.ml index 4a3ae5b1..214484b6 100644 --- a/debug/DwarfAbbrvPrinter.ml +++ b/debug/DwarfAbbrvPrinter.ml @@ -57,6 +57,8 @@ module type DWARF_ABBRV_DEFS = module DwarfAbbrvPrinter(Defs:DWARF_ABBRV_DEFS) : sig val print_debug_abbrv: out_channel -> dw_entry -> unit + val get_abbrv: dw_entry -> bool -> int + val get_abbrv_start_addr: unit -> int end = (struct @@ -307,4 +309,6 @@ module DwarfAbbrvPrinter(Defs:DWARF_ABBRV_DEFS) : compute_abbrv entry; print_abbrv oc + let get_abbrv_start_addr = Defs.get_abbrv_start_addr + end) diff --git a/debug/DwarfTypes.ml b/debug/DwarfTypes.ml index d920c118..5a832bdf 100644 --- a/debug/DwarfTypes.ml +++ b/debug/DwarfTypes.ml @@ -54,7 +54,7 @@ type bound_value = type dw_tag_array_type = { - array_type_decl_file: constant option; + array_type_decl_file: string option; array_type_decl_line: constant option; array_type: reference; } @@ -84,7 +84,7 @@ type dw_tag_const_type = type dw_tag_enumeration_type = { - enumeration_decl_file: constant option; + enumeration_decl_file: string option; enumeration_decl_line: constant option; enumeration_byte_size: constant; enumeration_declaration: flag option; @@ -93,7 +93,7 @@ type dw_tag_enumeration_type = type dw_tag_enumerator = { - enumerator_decl_file: constant option; + enumerator_decl_file: string option; enumerator_decl_line: constant option; enumerator_value: constant; enumerator_name: string; @@ -101,7 +101,7 @@ type dw_tag_enumerator = type dw_tag_formal_parameter = { - formal_parameter_decl_file: constant option; + formal_parameter_decl_file: string option; formal_parameter_decl_line: constant option; formal_parameter_artificial: flag option; formal_parameter_location: location_value option; @@ -125,7 +125,7 @@ type dw_tag_lexical_block = type dw_tag_member = { - member_decl_file: constant option; + member_decl_file: string option; member_decl_line: constant option; member_byte_size: constant option; member_bit_offset: constant option; @@ -143,7 +143,7 @@ type dw_tag_pointer_type = type dw_tag_structure_type = { - structure_decl_file: constant option; + structure_decl_file: string option; structure_decl_line: constant option; structure_byte_size: constant; structure_declaration: flag option; @@ -152,7 +152,7 @@ type dw_tag_structure_type = type dw_tag_subprogram = { - subprogram_decl_file: constant option; + subprogram_decl_file: string option; subprogram_decl_line: constant option; subprogram_external: flag option; subprogram_frame_base: location_value option; @@ -176,7 +176,7 @@ type dw_tag_subroutine_type = type dw_tag_typedef = { - typedef_decl_file: constant option; + typedef_decl_file: string option; typedef_decl_line: constant option; typedef_name: string; typedef_type: reference; @@ -184,7 +184,7 @@ type dw_tag_typedef = type dw_tag_union_type = { - union_decl_file: constant option; + union_decl_file: string option; union_decl_line: constant option; union_byte_size: constant; union_name: string; @@ -192,14 +192,14 @@ type dw_tag_union_type = type dw_tag_unspecified_parameter = { - unspecified_parameter_decl_file: constant option; + unspecified_parameter_decl_file: string option; unspecified_parameter_decl_line: constant option; unspecified_parameter_artificial: flag option; } type dw_tag_variable = { - variable_decl_file: constant option; + variable_decl_file: string option; variable_decl_line: constant option; variable_declaration: flag option; variable_external: flag option; diff --git a/powerpc/PrintDiab.ml b/powerpc/PrintDiab.ml index 84fd1a22..b39e8e7a 100644 --- a/powerpc/PrintDiab.ml +++ b/powerpc/PrintDiab.ml @@ -122,6 +122,8 @@ module Diab_System = lbl in fprintf oc "%a:\n" label lbl + let register_addr_label = Hashtbl.add addr_label_map + let print_prologue oc = fprintf oc " .xopt align-fill-text=0x60000000\n"; if !Clflags.option_g then @@ -215,5 +217,19 @@ module Diab_System = end) + let print_debug_info oc entry = + AbbrvPrinter.print_debug_abbrv oc entry; + let abbrv_start = AbbrvPrinter.get_abbrv_start_addr in + let debug_start = new_label () in + let print_info () = + fprintf oc" .section .debug_info,,n\n" in + print_info (); + fprintf oc "%a\n" label debug_start; + let debug_length_start = new_label () in (* Address used for length calculation *) + let debug_end = new_label () in + fprintf oc " .4byte %a-%a\n" label debug_end label debug_length_start; + fprintf oc "%a\n" label debug_length_start + + end:SYSTEM) -- cgit