diff options
author | Jacques-Henri Jourdan <jacques-henri.jourdan@inria.fr> | 2015-11-07 16:06:33 +0100 |
---|---|---|
committer | Jacques-Henri Jourdan <jacques-henri.jourdan@inria.fr> | 2015-11-07 16:06:33 +0100 |
commit | 99761d109a799f6ca62471058463b5713f37eddc (patch) | |
tree | f8038305ef9596629eb6084ff64044451fac1656 /debug | |
parent | 15e6fc9861641d03ac32ae9ac03b9a6fa68036e9 (diff) | |
parent | d0049e3b6bafb3aa88e173c10183b564918de115 (diff) | |
download | compcert-99761d109a799f6ca62471058463b5713f37eddc.tar.gz compcert-99761d109a799f6ca62471058463b5713f37eddc.zip |
Merge remote-tracking branch 'origin/master' into parser_fix
Diffstat (limited to 'debug')
-rw-r--r-- | debug/Debug.ml | 2 | ||||
-rw-r--r-- | debug/Debug.mli | 2 | ||||
-rw-r--r-- | debug/DebugInformation.ml | 14 | ||||
-rw-r--r-- | debug/DebugTypes.mli | 2 | ||||
-rw-r--r-- | debug/DwarfPrinter.ml | 6 | ||||
-rw-r--r-- | debug/DwarfTypes.mli | 2 | ||||
-rw-r--r-- | debug/DwarfUtil.ml | 6 | ||||
-rw-r--r-- | debug/Dwarfgen.ml | 19 |
8 files changed, 30 insertions, 23 deletions
diff --git a/debug/Debug.ml b/debug/Debug.ml index 87d04ad7..789ecb70 100644 --- a/debug/Debug.ml +++ b/debug/Debug.ml @@ -20,7 +20,7 @@ open Sections (* Interface for generating and printing debug information *) -(* Record used for stroring references to the actual implementation functions *) +(* Record used for storing references to the actual implementation functions *) type implem = { init: string -> unit; diff --git a/debug/Debug.mli b/debug/Debug.mli index 1585e7e4..614fe84b 100644 --- a/debug/Debug.mli +++ b/debug/Debug.mli @@ -18,7 +18,7 @@ open BinNums open Sections -(* Record used for stroring references to the actual implementation functions *) +(* Record used for storing references to the actual implementation functions *) type implem = { init: string -> unit; diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml index 51fbfde9..ed00ea0d 100644 --- a/debug/DebugInformation.ml +++ b/debug/DebugInformation.ml @@ -65,7 +65,7 @@ let strip_attributes typ = strip_attributes_type typ [AConst; AVolatile] (* Find the type id to an type *) let find_type (ty: typ) = - (* We are only interrested in Const and Volatile *) + (* We are only interested in Const and Volatile *) let ty = strip_attributes ty in Hashtbl.find lookup_types (typ_to_string ty) @@ -77,7 +77,7 @@ let insert_type (ty: typ) = Hashtbl.add types id d_ty; Hashtbl.add lookup_types name id; id in - (* We are only interrested in Const and Volatile *) + (* We are only interested in Const and Volatile *) let ty = strip_attributes ty in let rec typ_aux ty = try find_type ty with @@ -255,14 +255,14 @@ let replace_fun id f = (* All local variables *) let local_variables: (int, local_information) Hashtbl.t = Hashtbl.create 7 -(* Mapping from stampt to the debug id of the local variable *) +(* Mapping from stamp to the debug id of the local variable *) let stamp_to_local: (int,int) Hashtbl.t = Hashtbl.create 7 -(* Map from scope id + function id to debug id *) +(* Map from function id + scope id to debug id *) let scope_to_local: (int * int,int) Hashtbl.t = Hashtbl.create 7 -(* Map from scope id + function atom to debug id *) -let atom_to_scope: (atom * int, int) Hashtbl.t = Hashtbl.create 7 +(* Map from function atom + scope id atom to debug id *) +let atom_to_scope: (atom * int,int) Hashtbl.t = Hashtbl.create 7 let find_lvar_stamp id = let id = (Hashtbl.find stamp_to_local id) in @@ -299,7 +299,7 @@ let remove_unused id = Hashtbl.remove stamp_to_definition id.stamp with Not_found -> () -let insert_global_declaration env dec= +let insert_global_declaration env dec = add_file (fst dec.gloc); let insert d_dec stamp = let id = next_id () in diff --git a/debug/DebugTypes.mli b/debug/DebugTypes.mli index b2f19f7a..e885fc59 100644 --- a/debug/DebugTypes.mli +++ b/debug/DebugTypes.mli @@ -147,7 +147,7 @@ type local_variable_information = { lvar_atom: atom option; lvar_file_loc:location; lvar_type: int; - lvar_static: bool; (* Static variable are mapped to symbols *) + lvar_static: bool; (* Static variables are mapped to symbols *) } type scope_information = diff --git a/debug/DwarfPrinter.ml b/debug/DwarfPrinter.ml index 3e85ecfc..7469c4af 100644 --- a/debug/DwarfPrinter.ml +++ b/debug/DwarfPrinter.ml @@ -623,8 +623,10 @@ module DwarfPrinter(Target: DWARF_TARGET): let name = if e.section_name <> ".text" then Some e.section_name else None in section oc (Section_debug_info name); print_debug_info oc e.start_label e.line_label e.entry) entries; - section oc Section_debug_loc; - List.iter (fun e -> print_location_list oc e.locs) entries + if List.exists (fun e -> match e.locs with _,[] -> false | _,_ -> true) entries then begin + section oc Section_debug_loc; + List.iter (fun e -> print_location_list oc e.locs) entries + end let print_ranges oc r = section oc Section_debug_ranges; diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index a4c75201..2af64c0b 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -297,7 +297,7 @@ type debug_entries = | Gnu of gnu_entries (* The target specific functions for printing the debug information *) -module type DWARF_TARGET= +module type DWARF_TARGET = sig val label: out_channel -> int -> unit val section: out_channel -> section_name -> unit diff --git a/debug/DwarfUtil.ml b/debug/DwarfUtil.ml index 3e252dd2..8db80fca 100644 --- a/debug/DwarfUtil.ml +++ b/debug/DwarfUtil.ml @@ -10,7 +10,7 @@ (* *) (* *********************************************************************) -(* Utility functions for the dwarf debuging type *) +(* Utility functions for the dwarf debugging type *) open DwarfTypes @@ -22,12 +22,12 @@ let new_entry id tag = id = id; } -(* Add an entry as child to another entry *) +(* Add an entry as child to another entry *) let add_child entry child = {entry with children = child::entry.children;} -(* Add entries as children to another entry *) +(* Add entries as children to another entry *) let add_children entry children = {entry with children = entry.children@children;} diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml index 56a318fe..f62fac26 100644 --- a/debug/Dwarfgen.ml +++ b/debug/Dwarfgen.ml @@ -182,11 +182,11 @@ module Dwarfgenaux (Target: TARGET) = enumeration_name = string_entry e.enum_name; } in let enum = new_entry id (DW_TAG_enumeration_type enum) in - let child = List.map enumerator_to_entry e.enum_enumerators in - add_children enum child + let children = List.map enumerator_to_entry e.enum_enumerators in + add_children enum children let fun_type_to_entry id f = - let children = if f.fun_prototyped then + let children = if not f.fun_prototyped then let u = { unspecified_parameter_artificial = None; } in @@ -195,7 +195,7 @@ module Dwarfgenaux (Target: TARGET) = List.map (fun p -> let fp = { formal_parameter_artificial = None; - formal_parameter_name = name_opt p.param_name; + formal_parameter_name = None; formal_parameter_type = p.param_type; formal_parameter_variable_parameter = None; formal_parameter_location = None; @@ -475,9 +475,14 @@ module Dwarfgenaux (Target: TARGET) = 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 f_entry = new_entry id (DW_TAG_subprogram f_tag) in - let params,acc = mmap (function_parameter_to_entry f_id) acc f.fun_parameter in - let vars,acc = fun_scope_to_entries f_id acc f.fun_scope in - add_children f_entry (params@vars),acc + let children,acc = + if not !Clflags.option_gglobal then + let params,acc = mmap (function_parameter_to_entry f_id) acc f.fun_parameter in + let vars,acc = fun_scope_to_entries f_id acc f.fun_scope in + params@vars,acc + else + [],acc in + add_children f_entry (children),acc let definition_to_entry acc id t = match t with |