aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2019-04-08 17:24:28 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2019-04-16 18:33:35 +0200
commit5beeba02f16b2d65cceec5ee5577547ba3547c94 (patch)
treed2b4a85eb75f06f963648fc995ee9977dfd35f98 /debug
parent06d846bd517cb0e47ab7b55cdbc912939524ca26 (diff)
downloadcompcert-kvx-5beeba02f16b2d65cceec5ee5577547ba3547c94.tar.gz
compcert-kvx-5beeba02f16b2d65cceec5ee5577547ba3547c94.zip
Print only debug info for printed functions.
Functions that are removed from the compilation unit, for example inline functions without extern, should not produce debug information. This commit reuses the mechanism used for variables in order to track additionally the printed functions. Therefore the printed variable versions are exchanged for a printed symbol version. Bug 26234
Diffstat (limited to 'debug')
-rw-r--r--debug/Debug.ml6
-rw-r--r--debug/Debug.mli4
-rw-r--r--debug/DebugInformation.ml12
-rw-r--r--debug/DebugInformation.mli2
-rw-r--r--debug/Dwarfgen.ml5
5 files changed, 16 insertions, 13 deletions
diff --git a/debug/Debug.ml b/debug/Debug.ml
index 168df5a0..812f57cc 100644
--- a/debug/Debug.ml
+++ b/debug/Debug.ml
@@ -47,7 +47,7 @@ type implem =
exists_section: section_name -> bool;
remove_unused: ident -> unit;
remove_unused_function: ident -> unit;
- variable_printed: string -> unit;
+ symbol_printed: string -> unit;
add_diab_info: section_name -> int -> int -> int -> unit;
}
@@ -79,7 +79,7 @@ let default_implem =
exists_section = (fun _ -> true);
remove_unused = (fun _ -> ());
remove_unused_function = (fun _ -> ());
- variable_printed = (fun _ -> ());
+ symbol_printed = (fun _ -> ());
add_diab_info = (fun _ _ _ _ -> ());
}
@@ -111,5 +111,5 @@ let compute_diab_file_enum end_l entry_l line_e = !implem.compute_diab_file_enum
let compute_gnu_file_enum f = !implem.compute_gnu_file_enum f
let remove_unused ident = !implem.remove_unused ident
let remove_unused_function ident = !implem.remove_unused_function ident
-let variable_printed ident = !implem.variable_printed ident
+let symbol_printed ident = !implem.symbol_printed ident
let add_diab_info sec line_start debug_info low_pc = !implem.add_diab_info sec line_start debug_info low_pc
diff --git a/debug/Debug.mli b/debug/Debug.mli
index 3869a056..60e2f9bc 100644
--- a/debug/Debug.mli
+++ b/debug/Debug.mli
@@ -46,7 +46,7 @@ type implem =
exists_section: section_name -> bool;
remove_unused: ident -> unit;
remove_unused_function: ident -> unit;
- variable_printed: string -> unit;
+ symbol_printed: string -> unit;
add_diab_info: section_name -> int -> int -> int -> unit;
}
@@ -80,5 +80,5 @@ val compute_gnu_file_enum: (string -> unit) -> unit
val exists_section: section_name -> bool
val remove_unused: ident -> unit
val remove_unused_function: ident -> unit
-val variable_printed: string -> unit
+val symbol_printed: string -> unit
val add_diab_info: section_name -> int -> int -> int -> unit
diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml
index 4eff6548..21c2ad19 100644
--- a/debug/DebugInformation.ml
+++ b/debug/DebugInformation.ml
@@ -635,12 +635,12 @@ let compute_gnu_file_enum f =
let all_files_iter f = StringSet.iter f !all_files
-let printed_vars: StringSet.t ref = ref StringSet.empty
+let printed_symbols: StringSet.t ref = ref StringSet.empty
-let is_variable_printed id = StringSet.mem id !printed_vars
+let is_symbol_printed id = StringSet.mem id !printed_symbols
-let variable_printed id =
- printed_vars := StringSet.add id !printed_vars
+let symbol_printed id =
+ printed_symbols := StringSet.add id !printed_symbols
let init name =
id := 0;
@@ -663,7 +663,7 @@ let init name =
Hashtbl.reset scope_ranges;
Hashtbl.reset label_translation;
all_files := StringSet.singleton name;
- printed_vars := StringSet.empty
+ printed_symbols := StringSet.empty
let default_debug =
{
@@ -693,6 +693,6 @@ let default_debug =
exists_section = exists_section;
remove_unused = remove_unused;
remove_unused_function = remove_unused_function;
- variable_printed = variable_printed;
+ symbol_printed = symbol_printed;
add_diab_info = (fun _ _ _ _ -> ());
}
diff --git a/debug/DebugInformation.mli b/debug/DebugInformation.mli
index 8905d8bf..0cf34756 100644
--- a/debug/DebugInformation.mli
+++ b/debug/DebugInformation.mli
@@ -23,7 +23,7 @@ val get_type: int -> debug_types
val fold_types: (int -> debug_types -> 'a -> 'a) -> 'a -> 'a
-val is_variable_printed: string -> bool
+val is_symbol_printed: string -> bool
val variable_location: atom -> atom -> var_location
diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml
index de07add1..50063df8 100644
--- a/debug/Dwarfgen.ml
+++ b/debug/Dwarfgen.ml
@@ -344,7 +344,7 @@ module Dwarfgenaux (Target: TARGET) =
let global_variable_to_entry acc id v =
let loc = match v.gvar_atom with
- | Some a when is_variable_printed (extern_atom a) ->
+ | Some a when is_symbol_printed (extern_atom a) ->
Some (LocSymbol a)
| _ -> None in
let var = {
@@ -529,7 +529,10 @@ module Dwarfgenaux (Target: TARGET) =
match t with
| GlobalVariable g -> Some (global_variable_to_entry acc id g)
| Function f ->
+ if is_symbol_printed f.fun_name then
Some (function_to_entry sec_name acc id f)
+ else
+ None
end