aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-11-04 18:21:19 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2015-11-04 18:21:19 +0100
commitcbff6d5b0f84090e2ff7f74bfb6eb7f3e3a29ef9 (patch)
tree931d9c3ac1022685525f5c0c75461d2d0d158aa2 /debug
parent738c07062ea0708fc9208318933fda16fd696cc0 (diff)
downloadcompcert-kvx-cbff6d5b0f84090e2ff7f74bfb6eb7f3e3a29ef9.tar.gz
compcert-kvx-cbff6d5b0f84090e2ff7f74bfb6eb7f3e3a29ef9.zip
New option to control the debug information build.
The new option -gonly-global allows the generation of debuging information for global variables only. Bug 17566.
Diffstat (limited to 'debug')
-rw-r--r--debug/DwarfPrinter.ml6
-rw-r--r--debug/Dwarfgen.ml11
2 files changed, 12 insertions, 5 deletions
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/Dwarfgen.ml b/debug/Dwarfgen.ml
index 56a318fe..d198a92f 100644
--- a/debug/Dwarfgen.ml
+++ b/debug/Dwarfgen.ml
@@ -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