From 9873f9ee01c6ccca88fd461d318e107ff303fe88 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 12 Oct 2015 18:39:31 +0200 Subject: Use a more descriptive type for diab debug entries. Instead of using a tuple we now use a record with descriptive names for the different entries. Bug 17392 --- debug/DwarfPrinter.ml | 18 +++++++----------- debug/DwarfTypes.mli | 11 ++++++++++- debug/Dwarfgen.ml | 9 ++++++++- 3 files changed, 25 insertions(+), 13 deletions(-) (limited to 'debug') diff --git a/debug/DwarfPrinter.ml b/debug/DwarfPrinter.ml index 1bd54470..e2f062d8 100644 --- a/debug/DwarfPrinter.ml +++ b/debug/DwarfPrinter.ml @@ -559,11 +559,6 @@ module DwarfPrinter(Target: DWARF_TARGET): if e.children <> [] then print_sleb128 oc 0) entry - (* Print the debug abbrev section *) - let print_debug_abbrev oc entries = - List.iter (fun (_,_,_,e,_) -> compute_abbrev e) entries; - print_abbrev oc - (* Print the debug info section *) let print_debug_info oc start line_start entry = Hashtbl.reset entry_labels; @@ -608,13 +603,14 @@ module DwarfPrinter(Target: DWARF_TARGET): let print_diab_entries oc entries = let abbrev_start = new_label () in - abbrev_start_addr := abbrev_start; - print_debug_abbrev oc entries; - List.iter (fun (s,d,l,e,_) -> - section oc (Section_debug_info s); - print_debug_info oc d l e) entries; + abbrev_start_addr := abbrev_start; + List.iter (fun e -> compute_abbrev e.entry) entries; + print_abbrev oc; + List.iter (fun e -> + section oc (Section_debug_info e.section_name); + print_debug_info oc e.start_label e.line_label e.entry) entries; section oc Section_debug_loc; - List.iter (fun (_,_,_,_,l) -> print_location_list oc l) entries + List.iter (fun e -> print_location_list oc e.locs) entries let print_gnu_entries oc cp loc = compute_abbrev cp; diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index 8f03eb8d..233ada2e 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -249,7 +249,16 @@ type location_entry = } type dw_locations = int option * location_entry list -type diab_entries = (string * int * int * dw_entry * dw_locations) list +type diab_entry = + { + section_name: string; + start_label: int; + line_label: int; + entry: dw_entry; + locs: dw_locations; + } + +type diab_entries = diab_entry list type gnu_entries = dw_entry * dw_locations diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml index eff80110..8048ea43 100644 --- a/debug/Dwarfgen.ml +++ b/debug/Dwarfgen.ml @@ -463,7 +463,14 @@ let gen_diab_debug_info sec_name var_section : debug_entries = } in let cp = new_entry (next_id ()) (DW_TAG_compile_unit cp) in let cp = add_children cp ((gen_types (diab_file_loc s) ty) @ defs) in - (s,debug_start,line_start,cp,(Some low_pc,locs))::acc) defs [] in + let entry = { + section_name = s; + start_label = debug_start; + line_label = line_start; + entry = cp; + locs = Some low_pc,locs; + } in + entry::acc) defs [] in Diab entries let gnu_file_loc (f,l) = -- cgit