From 05acff8bcb4f127a6f0ff6c587ba38d1c8cbe2fc Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 29 Sep 2015 18:35:36 +0200 Subject: More fixes for the DebugInformation. Changed the sizeof function to take into account the bytes needed for the sleb128/uleb128 encoding of the DW_OP_* arguments and changed the end_live_range function to only close functions where the live range is currently open. --- debug/DebugInformation.ml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'debug/DebugInformation.ml') diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml index 7866c339..73f9163a 100644 --- a/debug/DebugInformation.ml +++ b/debug/DebugInformation.ml @@ -256,10 +256,15 @@ let insert_type (ty: typ) = } in FunctionType ftype | TNamed (id,_) -> + let typ = try + let _,t = + List.find (fun a -> fst a = id.name) CBuiltins.builtins.Builtins.typedefs in + Some (attr_aux t) + with Not_found -> None in let t = { typedef_file_loc = None; typedef_name = id.name; - typ = None; + typ = typ; } in Typedef t | TStruct (id,_) -> @@ -749,17 +754,7 @@ let end_live_range atom lbl = let old_r = Hashtbl.find var_locations atom in match old_r with | RangeLoc (n_r::old_r) -> - let n_r = {n_r with range_end = Some lbl} in - Hashtbl.replace var_locations atom (RangeLoc (n_r::old_r)) - | _ -> assert false - with Not_found -> () - -let close_range lbl atom = - try - let old_r = Hashtbl.find var_locations atom in - match old_r with - | RangeLoc (n_r::old_r) -> - if n_r.range_end = None then + if n_r.range_end = None then (* We can skip non open locations *) let n_r = {n_r with range_end = Some lbl} in Hashtbl.replace var_locations atom (RangeLoc (n_r::old_r)) | _ -> assert false @@ -771,7 +766,7 @@ let stack_variable atom (sp,loc) = let function_end atom loc = IntSet.iter (fun id -> close_scope atom id loc) !open_scopes; open_scopes := IntSet.empty; - List.iter (close_range loc) !open_vars; + List.iter (fun atom -> end_live_range atom loc) !open_vars; open_vars:= [] let compilation_section_start: (string,int * int * int * string) Hashtbl.t = Hashtbl.create 7 -- cgit