From d7f75509c290d871cb8cd8aa11a0be2923c9ef17 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 22 Sep 2015 19:44:47 +0200 Subject: Record the scope structure during unblocking. Instead of creating separate annotations for the local variables we call the Debug.add_lvar_scope and we construct a mapping from function id + scope id to scope information. --- debug/Debug.ml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'debug/Debug.ml') diff --git a/debug/Debug.ml b/debug/Debug.ml index 10b4e68f..eb616dab 100644 --- a/debug/Debug.ml +++ b/debug/Debug.ml @@ -30,10 +30,11 @@ type implem = mutable add_fun_addr: atom -> (int * int) -> unit; mutable generate_debug_info: unit -> dw_entry option; mutable all_files_iter: (string -> unit) -> unit; - mutable insert_local_declaration: int -> storage -> ident -> typ -> location -> unit; + mutable insert_local_declaration: storage -> ident -> typ -> location -> unit; mutable atom_local_variable: ident -> atom -> unit; - mutable enter_scope: int -> int -> unit; + mutable enter_scope: int -> int -> int -> unit; mutable enter_function_scope: ident -> int -> unit; + mutable add_lvar_scope: int -> ident -> int -> unit; } let implem = @@ -48,10 +49,11 @@ let implem = add_fun_addr = (fun _ _ -> ()); generate_debug_info = (fun _ -> None); all_files_iter = (fun _ -> ()); - insert_local_declaration = (fun _ _ _ _ _ -> ()); + insert_local_declaration = (fun _ _ _ _ -> ()); atom_local_variable = (fun _ _ -> ()); - enter_scope = (fun _ _ -> ()); + enter_scope = (fun _ _ _ -> ()); enter_function_scope = (fun _ _ -> ()); + add_lvar_scope = (fun _ _ _ -> ()); } let init () = @@ -70,6 +72,7 @@ let init () = implem.atom_local_variable <- DebugInformation.atom_local_variable; implem.enter_scope <- DebugInformation.enter_scope; implem.enter_function_scope <- DebugInformation.enter_function_scope; + implem.add_lvar_scope <- DebugInformation.add_lvar_scope; end else begin implem.init <- (fun _ -> ()); implem.atom_function <- (fun _ _ -> ()); @@ -81,10 +84,11 @@ let init () = implem.add_fun_addr <- (fun _ _ -> ()); implem.generate_debug_info <- (fun _ -> None); implem.all_files_iter <- (fun _ -> ()); - implem.insert_local_declaration <- (fun _ _ _ _ _ -> ()); + implem.insert_local_declaration <- (fun _ _ _ _ -> ()); implem.atom_local_variable <- (fun _ _ -> ()); - implem.enter_scope <- (fun _ _ -> ()); + implem.enter_scope <- (fun _ _ _ -> ()); implem.enter_function_scope <- (fun _ _ -> ()); + implem.add_lvar_scope <- (fun _ _ _ -> ()); end let init_compile_unit name = implem.init name @@ -97,7 +101,8 @@ let insert_global_declaration env dec = implem.insert_global_declaration env dec let add_fun_addr atom addr = implem.add_fun_addr atom addr let generate_debug_info () = implem.generate_debug_info () let all_files_iter f = implem.all_files_iter f -let insert_local_declaration scope sto id ty loc = implem.insert_local_declaration scope sto id ty loc +let insert_local_declaration sto id ty loc = implem.insert_local_declaration sto id ty loc let atom_local_variable id atom = implem.atom_local_variable id atom let enter_scope p_id id = implem.enter_scope p_id id let enter_function_scope fun_id sc_id = implem.enter_function_scope fun_id sc_id +let add_lvar_scope fun_id var_id s_id = implem.add_lvar_scope fun_id var_id s_id -- cgit