aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-11-25 12:56:41 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2016-11-25 12:56:41 +0100
commitea4f17513442fa14ab18f46ec82949e6e80c5a2f (patch)
tree70d61b60d7a09c3f7c19ca4f33a12a8c3083c0f9 /debug
parente8f2ef5c8c926462277afb520cacaa265b7e612c (diff)
downloadcompcert-kvx-ea4f17513442fa14ab18f46ec82949e6e80c5a2f.tar.gz
compcert-kvx-ea4f17513442fa14ab18f46ec82949e6e80c5a2f.zip
Reset all Hashtbls.
A non reseted Hashtbl caused problems with multiple input files. Bug 20462
Diffstat (limited to 'debug')
-rw-r--r--debug/DwarfPrinter.ml5
-rw-r--r--debug/Dwarfgen.ml19
2 files changed, 14 insertions, 10 deletions
diff --git a/debug/DwarfPrinter.ml b/debug/DwarfPrinter.ml
index 1d336965..c9eb5acc 100644
--- a/debug/DwarfPrinter.ml
+++ b/debug/DwarfPrinter.ml
@@ -663,7 +663,10 @@ module DwarfPrinter(Target: DWARF_TARGET):
(* Print the debug info and abbrev section *)
- let print_debug oc = function
+ let print_debug oc debug =
+ Hashtbl.clear abbrev_mapping;
+ Hashtbl.clear loc_labels;
+ match debug with
| Diab entries -> print_diab_entries oc entries
| Gnu (cp,loc,s,r) -> print_gnu_entries oc cp loc s r
diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml
index 617c4570..65cd4951 100644
--- a/debug/Dwarfgen.ml
+++ b/debug/Dwarfgen.ml
@@ -65,13 +65,13 @@ type dwarf_accu =
ranges: int * dw_ranges
}
-let (=<<) acc t =
+let up_typs acc t =
{acc with typs = IntSet.add t acc.typs;}
-let (<=<) acc loc =
+let up_locs acc loc =
{acc with locs = loc@acc.locs;}
-let (>>=) acc r =
+let up_ranges acc r =
{acc with ranges = r;}
let empty_accu =
@@ -351,7 +351,7 @@ module Dwarfgenaux (Target: TARGET) =
variable_type = v.gvar_type;
variable_location = loc;
} in
- let acc = acc =<< v.gvar_type in
+ let acc = up_typs acc v.gvar_type in
new_entry id (DW_TAG_variable var),acc
let gen_splitlong op_hi op_lo =
@@ -421,7 +421,7 @@ module Dwarfgenaux (Target: TARGET) =
formal_parameter_variable_parameter = None;
formal_parameter_location = loc;
} in
- let acc = (acc =<< p.formal_parameter_type) <=< loc_list in
+ let acc = up_locs (up_typs acc p.formal_parameter_type) loc_list in
new_entry (next_id ()) (DW_TAG_formal_parameter p),acc
let scope_range f_id id (o,dwr) =
@@ -462,7 +462,7 @@ module Dwarfgenaux (Target: TARGET) =
variable_type = v.lvar_type;
variable_location = loc;
} in
- let acc = (acc =<< v.lvar_type) <=< loc_list in
+ let acc = up_locs (up_typs acc v.lvar_type) loc_list in
Some (new_entry id (DW_TAG_variable var)),acc
and scope_to_entry f_id acc sc id =
@@ -470,7 +470,7 @@ module Dwarfgenaux (Target: TARGET) =
let scope = {
lexical_block_range = r;
} in
- let acc = (acc >>= dwr) in
+ let acc = up_ranges acc dwr in
let vars,acc = mmap_opt (local_to_entry f_id) acc sc.scope_variables in
let entry = new_entry id (DW_TAG_lexical_block scope) in
add_children entry vars,acc
@@ -503,7 +503,7 @@ module Dwarfgenaux (Target: TARGET) =
subprogram_range = r;
} in
let f_id = get_opt_val f.fun_atom in
- let acc = match f.fun_return_type with Some s -> acc =<< s | None -> acc in
+ let acc = match f.fun_return_type with Some s -> up_typs acc s | None -> acc in
let f_entry = new_entry id (DW_TAG_subprogram f_tag) in
let children,acc =
if !Clflags.option_gdepth > 1 then
@@ -591,6 +591,7 @@ let gnu_string_entry s =
let gen_gnu_debug_info sec_name var_section : debug_entries =
+ Hashtbl.clear string_table;
let r,dwr,low_pc =
try if !Clflags.option_gdwarf > 3 then
let pcs = fold_section_start (fun s low acc ->
@@ -604,7 +605,7 @@ let gen_gnu_debug_info sec_name var_section : debug_entries =
and h = section_end ".text" in
Pc_pair(l,h),(0,[]),Some l
with Not_found -> Empty,(0,[]),None in
- let accu = empty_accu >>= dwr in
+ let accu = up_ranges empty_accu dwr in
let module Gen = Dwarfgenaux (struct
let file_loc = gnu_file_loc
let string_entry = gnu_string_entry