aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-09-27 20:13:19 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-09-27 20:13:19 +0200
commit91ed1b752d2661478840e40a0d977b068d99490d (patch)
tree5b0259e66fc0d35d335df6c1e36967c384ddf219
parent3e070cae6a316b7e3363c8159096c3bbc4bf21b2 (diff)
downloadcompcert-kvx-91ed1b752d2661478840e40a0d977b068d99490d.tar.gz
compcert-kvx-91ed1b752d2661478840e40a0d977b068d99490d.zip
Added printing the reference address for the LocRef and started refactoring old
Debuging code. The old functions to store the symbol for the Global variables and retrive this is no longer needed since the atom is stored in DebugInformation. Also the Debug.Abbrev module is no longer needed.
-rw-r--r--arm/TargetPrinter.ml10
-rw-r--r--backend/PrintAsm.ml7
-rw-r--r--backend/PrintAsmaux.ml4
-rw-r--r--debug/DwarfPrinter.ml14
-rw-r--r--debug/DwarfPrinter.mli2
-rw-r--r--debug/DwarfTypes.mli34
-rw-r--r--debug/DwarfUtil.ml57
-rw-r--r--ia32/TargetPrinter.ml8
-rw-r--r--powerpc/TargetPrinter.ml12
9 files changed, 37 insertions, 111 deletions
diff --git a/arm/TargetPrinter.ml b/arm/TargetPrinter.ml
index 30166215..a7188206 100644
--- a/arm/TargetPrinter.ml
+++ b/arm/TargetPrinter.ml
@@ -908,20 +908,12 @@ module Target (Opt: PRINTER_OPTIONS) : TARGET =
let get_stmt_list_addr () = -1 (* Dummy constant *)
let get_debug_start_addr () = -1 (* Dummy constant *)
-
- module DwarfAbbrevs = DwarfUtil.DefaultAbbrevs (* Dummy Abbrev types *)
-
+
let label = elf_label
let new_label = new_label
let print_file_loc _ _ = () (* Dummy function *)
-
- let get_location _ = None (* Dummy function *)
-
- let get_segment_location _ = None (* Dummy function *)
-
- let add_var_location _ = () (* Dummy function *)
end
let sel_target () =
diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml
index 104440c6..59570957 100644
--- a/backend/PrintAsm.ml
+++ b/backend/PrintAsm.ml
@@ -79,7 +79,6 @@ module Printer(Target:TARGET) =
List.iter (Target.print_init oc) id
let print_var oc name v =
- if !Clflags.option_g && Configuration.advanced_debug then Target.add_var_location name;
match v.gvar_init with
| [] -> ()
| _ ->
@@ -120,14 +119,10 @@ module Printer(Target:TARGET) =
let get_end_addr = Target.get_end_addr
let get_stmt_list_addr = Target.get_stmt_list_addr
let name_of_section = Target.name_of_section
- let get_location a = None
- let get_frame_base a = None
let symbol = Target.symbol
end
- module DebugPrinter = DwarfPrinter (DwarfTarget) (Target.DwarfAbbrevs)
-
-
+ module DebugPrinter = DwarfPrinter (DwarfTarget)
end
let print_program oc p db =
diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml
index 3f0b3ea3..1c3b47b5 100644
--- a/backend/PrintAsmaux.ml
+++ b/backend/PrintAsmaux.ml
@@ -52,10 +52,6 @@ module type TARGET =
val new_label: unit -> int
val label: out_channel -> int -> unit
val print_file_loc: out_channel -> file_loc -> unit
- val get_location: P.t -> location_value option
- val get_segment_location: P.t -> location_value option
- val add_var_location: P.t -> unit
- module DwarfAbbrevs: DWARF_ABBREVS
end
(* On-the-fly label renaming *)
diff --git a/debug/DwarfPrinter.ml b/debug/DwarfPrinter.ml
index 3e98f0dd..13c0640d 100644
--- a/debug/DwarfPrinter.ml
+++ b/debug/DwarfPrinter.ml
@@ -19,14 +19,13 @@ open PrintAsmaux
open Sections
(* The printer is parameterized over target specific functions and a set of dwarf type constants *)
-module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
+module DwarfPrinter(Target: DWARF_TARGET):
sig
val print_debug: out_channel -> dw_entry -> dw_locations -> unit
end =
struct
open Target
- open DwarfAbbrevs
(* Byte value to string *)
let string_of_byte value =
@@ -318,6 +317,11 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
print_byte oc dw_op_regx;
print_uleb128 oc i
end
+
+
+ let print_ref oc r =
+ let ref = entry_to_label r in
+ fprintf oc " .4byte %a\n" label ref
let print_loc oc loc =
match loc with
@@ -332,7 +336,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
let size = List.fold_left (fun acc a -> acc + size_of_loc_expr a) 0 e in
print_sleb128 oc size;
List.iter (print_loc_expr oc) e
- | _ -> ()
+ | LocRef f -> print_ref oc f
let print_data_location oc dl =
match dl with
@@ -340,10 +344,6 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
print_loc_expr oc e
| _ -> ()
- let print_ref oc r =
- let ref = entry_to_label r in
- fprintf oc " .4byte %a\n" label ref
-
let print_addr oc a =
fprintf oc " .4byte %a\n" label a
diff --git a/debug/DwarfPrinter.mli b/debug/DwarfPrinter.mli
index ab9ab264..8b206a00 100644
--- a/debug/DwarfPrinter.mli
+++ b/debug/DwarfPrinter.mli
@@ -12,7 +12,7 @@
open DwarfTypes
-module DwarfPrinter: functor (Target: DWARF_TARGET) -> functor (DwarfAbbrevs: DWARF_ABBREVS) ->
+module DwarfPrinter: functor (Target: DWARF_TARGET) ->
sig
val print_debug: out_channel -> dw_entry -> dw_locations -> unit
end
diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli
index ce00474a..86a14163 100644
--- a/debug/DwarfTypes.mli
+++ b/debug/DwarfTypes.mli
@@ -244,38 +244,6 @@ type location_entry =
}
type dw_locations = location_entry list
-(* Module type for a matching from type to dwarf encoding *)
-module type DWARF_ABBREVS =
- sig
- val sibling_type_abbr: int
- val file_loc_type_abbr: int * int
- val type_abbr: int
- 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
- val declaration_type_abbr: int
- val external_type_abbr: int
- val prototyped_type_abbr: int
- val bit_offset_type_abbr: int
- val comp_dir_type_abbr: int
- val language_type_abbr: int
- val producer_type_abbr: int
- val value_type_abbr: int
- val artificial_type_abbr: int
- val variable_parameter_type_abbr: int
- val bit_size_type_abbr: int
- val location_ref_type_abbr: int
- val location_block_type_abbr: int
- val data_location_block_type_abbr: int
- val data_location_ref_type_abbr: int
- val bound_const_type_abbr: int
- val bound_ref_type_abbr: int
- end
-
(* The target specific functions for printing the debug information *)
module type DWARF_TARGET=
sig
@@ -285,7 +253,5 @@ module type DWARF_TARGET=
val get_end_addr: unit -> int
val get_stmt_list_addr: unit -> int
val name_of_section: section_name -> string
- val get_location: int -> location_value option
- val get_frame_base: int -> location_value option
val symbol: out_channel -> atom -> unit
end
diff --git a/debug/DwarfUtil.ml b/debug/DwarfUtil.ml
index b0b80924..e1869281 100644
--- a/debug/DwarfUtil.ml
+++ b/debug/DwarfUtil.ml
@@ -86,33 +86,30 @@ let dw_op_piece = 0x93
(* Default corresponding encoding for the different abbreviations *)
-module DefaultAbbrevs =
- struct
- let sibling_type_abbr = dw_form_ref4
- let file_loc_type_abbr = dw_form_data4,dw_form_udata
- let type_abbr = dw_form_ref_addr
- 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
- let declaration_type_abbr = dw_form_flag
- let external_type_abbr = dw_form_flag
- let prototyped_type_abbr = dw_form_flag
- let bit_offset_type_abbr = dw_form_data1
- let comp_dir_type_abbr = dw_form_string
- let language_type_abbr = dw_form_udata
- let producer_type_abbr = dw_form_string
- let value_type_abbr = dw_form_sdata
- let artificial_type_abbr = dw_form_flag
- let variable_parameter_type_abbr = dw_form_flag
- let bit_size_type_abbr = dw_form_data1
- let location_ref_type_abbr = dw_form_data4
- let location_block_type_abbr = dw_form_block
- let data_location_block_type_abbr = dw_form_block
- let data_location_ref_type_abbr = dw_form_ref4
- let bound_const_type_abbr = dw_form_udata
- let bound_ref_type_abbr=dw_form_ref4
- end
+let sibling_type_abbr = dw_form_ref4
+let file_loc_type_abbr = dw_form_data4,dw_form_udata
+let type_abbr = dw_form_ref_addr
+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
+let declaration_type_abbr = dw_form_flag
+let external_type_abbr = dw_form_flag
+let prototyped_type_abbr = dw_form_flag
+let bit_offset_type_abbr = dw_form_data1
+let comp_dir_type_abbr = dw_form_string
+let language_type_abbr = dw_form_udata
+let producer_type_abbr = dw_form_string
+let value_type_abbr = dw_form_sdata
+let artificial_type_abbr = dw_form_flag
+let variable_parameter_type_abbr = dw_form_flag
+let bit_size_type_abbr = dw_form_data1
+let location_ref_type_abbr = dw_form_data4
+let location_block_type_abbr = dw_form_block
+let data_location_block_type_abbr = dw_form_block
+let data_location_ref_type_abbr = dw_form_ref4
+let bound_const_type_abbr = dw_form_udata
+let bound_ref_type_abbr=dw_form_ref4
diff --git a/ia32/TargetPrinter.ml b/ia32/TargetPrinter.ml
index 215eb4b8..c4045e63 100644
--- a/ia32/TargetPrinter.ml
+++ b/ia32/TargetPrinter.ml
@@ -773,19 +773,11 @@ module Target(System: SYSTEM):TARGET =
let get_debug_start_addr () = -1 (* Dummy constant *)
- module DwarfAbbrevs = DwarfUtil.DefaultAbbrevs (* Dummy Abbrev types *)
-
let label = label
let new_label = new_label
let print_file_loc _ _ = () (* Dummy function *)
-
- let get_location _ = None (* Dummy function *)
-
- let get_segment_location _ = None (* Dummy function *)
-
- let add_var_location _ = () (* Dummy function *)
end
diff --git a/powerpc/TargetPrinter.ml b/powerpc/TargetPrinter.ml
index e53f56a9..c05c995a 100644
--- a/powerpc/TargetPrinter.ml
+++ b/powerpc/TargetPrinter.ml
@@ -869,23 +869,11 @@ module Target (System : SYSTEM):TARGET =
let get_debug_start_addr () = !debug_start_addr
- module DwarfAbbrevs = DwarfUtil.DefaultAbbrevs
-
let new_label = new_label
let section oc sec =
section oc sec;
debug_section oc sec
-
- let locations = (Hashtbl.create 17 : (atom,DwarfTypes.location_value) Hashtbl.t)
-
- let get_location a = try Some (Hashtbl.find locations a) with Not_found -> None
-
- let get_segment_location _ = None
-
- let add_var_location a =
- if !Clflags.option_g && Configuration.advanced_debug then
- Hashtbl.add locations a (DwarfTypes.LocSymbol a);
end
let sel_target () =