aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug/DwarfPrinter.ml6
-rw-r--r--debug/Dwarfgen.ml11
-rw-r--r--driver/Clflags.ml1
-rw-r--r--driver/Driver.ml2
4 files changed, 15 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
diff --git a/driver/Clflags.ml b/driver/Clflags.ml
index b0c24f08..1eaa5449 100644
--- a/driver/Clflags.ml
+++ b/driver/Clflags.ml
@@ -47,6 +47,7 @@ let option_dasm = ref false
let option_sdump = ref false
let option_g = ref false
let option_gdwarf = ref 2
+let option_gglobal = ref false
let option_o = ref (None: string option)
let option_E = ref false
let option_S = ref false
diff --git a/driver/Driver.ml b/driver/Driver.ml
index a0d742c2..59e3fa3b 100644
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -435,6 +435,7 @@ Language support options (use -fno-<opt> to turn off -f<opt>) :
Debugging options:
-g Generate debugging information
-gdwarf- (GCC only) Generate debug information in DWARF v2 or DWARF v3
+ -gonly-global Generate debugging information only for globals
-frename-static Rename static functions and declarations
Optimization options: (use -fno-<opt> to turn off -f<opt>)
-O Optimize the compiled code [on by default]
@@ -547,6 +548,7 @@ let cmdline_actions =
Exact "-gdwarf-3", Self (fun s -> option_g := true;
option_gdwarf := 3);
Exact "-frename-static", Self (fun s -> option_rename_static:= true);
+ Exact "-gonly-global", Self (fun s -> option_gglobal := true);
(* Code generation options -- more below *)
Exact "-O0", Self (fun _ -> unset_all optimization_options);
Exact "-O", Self (fun _ -> set_all optimization_options);