From 68ad5472a78d12e0e4fd4eae422122185403d678 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 28 Sep 2015 18:39:43 +0200 Subject: Change the way the debug sections are printed. If a user uses the #pragma use_section for functions the diab linker requires a separate debug_info section for each entry. This commit adds functionality to emulate this behavior. --- debug/DebugInformation.ml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'debug/DebugInformation.ml') diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml index 8b6ec1ad..7866c339 100644 --- a/debug/DebugInformation.ml +++ b/debug/DebugInformation.ml @@ -774,9 +774,28 @@ let function_end atom loc = List.iter (close_range loc) !open_vars; open_vars:= [] -let compilation_section_start: (string,int) Hashtbl.t = Hashtbl.create 7 +let compilation_section_start: (string,int * int * int * string) Hashtbl.t = Hashtbl.create 7 let compilation_section_end: (string,int) Hashtbl.t = Hashtbl.create 7 +let add_compilation_section_start sec addr = + Hashtbl.add compilation_section_start sec addr + +let add_compilation_section_end sec addr = + Hashtbl.add compilation_section_end sec addr + +let exists_section sec = + Hashtbl.mem compilation_section_start sec + +let filenum: (string * string,int) Hashtbl.t = Hashtbl.create 7 + +let compute_file_enum end_label entry_label line_end = + Hashtbl.iter (fun sec (_,_,_,secname) -> + Hashtbl.add compilation_section_end sec (end_label secname); + StringSet.iter (fun file -> + let lbl = entry_label file in + Hashtbl.add filenum (sec,file) lbl) !all_files; + line_end ()) compilation_section_start + let init name = id := 0; file_name := name; @@ -790,4 +809,6 @@ let init name = Hashtbl.reset atom_to_local; Hashtbl.reset scope_to_local; Hashtbl.reset compilation_section_start; - Hashtbl.reset compilation_section_end + Hashtbl.reset compilation_section_end; + Hashtbl.reset filenum; + all_files := StringSet.empty -- cgit