aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-10-01 12:19:16 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-10-01 12:19:16 +0200
commiteaf4bab84af4b3db1ca9c6785ed803bbbd61b9a7 (patch)
treef6233fc2272d6495ec22afafd5ef5534ba32df44 /debug
parent06a1a35d759dc780e389218b5f78ce3415d4b3cd (diff)
downloadcompcert-kvx-eaf4bab84af4b3db1ca9c6785ed803bbbd61b9a7.tar.gz
compcert-kvx-eaf4bab84af4b3db1ca9c6785ed803bbbd61b9a7.zip
Only print locations for symbols that are present in the assembler.
Diffstat (limited to 'debug')
-rw-r--r--debug/Debug.ml3
-rw-r--r--debug/Debug.mli2
-rw-r--r--debug/DebugInformation.ml8
-rw-r--r--debug/DebugInit.ml6
-rw-r--r--debug/Dwarfgen.ml6
5 files changed, 21 insertions, 4 deletions
diff --git a/debug/Debug.ml b/debug/Debug.ml
index 79da3695..30ff288f 100644
--- a/debug/Debug.ml
+++ b/debug/Debug.ml
@@ -49,6 +49,7 @@ type implem =
mutable compute_file_enum: (string -> int) -> (string-> int) -> (unit -> unit) -> unit;
mutable exists_section: string -> bool;
mutable remove_unused: ident -> unit;
+ mutable variable_printed: string -> unit;
}
let implem =
@@ -80,6 +81,7 @@ let implem =
compute_file_enum = (fun _ _ _ -> ());
exists_section = (fun _ -> true);
remove_unused = (fun _ -> ());
+ variable_printed = (fun _ -> ());
}
let init_compile_unit name = implem.init name
@@ -109,3 +111,4 @@ let add_compilation_section_start sec addr = implem.add_compilation_section_star
let exists_section sec = implem.exists_section sec
let compute_file_enum end_l entry_l line_e = implem.compute_file_enum end_l entry_l line_e
let remove_unused ident = implem.remove_unused ident
+let variable_printed ident = implem.variable_printed ident
diff --git a/debug/Debug.mli b/debug/Debug.mli
index 4677fdf8..a1b4408d 100644
--- a/debug/Debug.mli
+++ b/debug/Debug.mli
@@ -47,6 +47,7 @@ type implem =
mutable compute_file_enum: (string -> int) -> (string-> int) -> (unit -> unit) -> unit;
mutable exists_section: string -> bool;
mutable remove_unused: ident -> unit;
+ mutable variable_printed: string -> unit;
}
val implem: implem
@@ -78,3 +79,4 @@ val add_compilation_section_start: string -> (int * int * int * string) -> unit
val compute_file_enum: (string -> int) -> (string-> int) -> (unit -> unit) -> unit
val exists_section: string -> bool
val remove_unused: ident -> unit
+val variable_printed: string -> unit
diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml
index b14548e7..654c983c 100644
--- a/debug/DebugInformation.ml
+++ b/debug/DebugInformation.ml
@@ -810,6 +810,11 @@ let compute_file_enum end_label entry_label line_end =
Hashtbl.add filenum (sec,file) lbl) !all_files;
line_end ()) compilation_section_start
+let printed_vars: StringSet.t ref = ref StringSet.empty
+
+let variable_printed id =
+ printed_vars := StringSet.add id !printed_vars
+
let init name =
id := 0;
file_name := name;
@@ -826,4 +831,5 @@ let init name =
Hashtbl.reset compilation_section_start;
Hashtbl.reset compilation_section_end;
Hashtbl.reset filenum;
- all_files := StringSet.empty
+ all_files := StringSet.empty;
+ printed_vars := StringSet.empty;
diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml
index 8c74e38e..d3ce8d18 100644
--- a/debug/DebugInit.ml
+++ b/debug/DebugInit.ml
@@ -45,7 +45,8 @@ let init_debug () =
implem.add_compilation_section_start <- DebugInformation.add_compilation_section_start;
implem.compute_file_enum <- DebugInformation.compute_file_enum;
implem.exists_section <- DebugInformation.exists_section;
- implem.remove_unused <- DebugInformation.remove_unused
+ implem.remove_unused <- DebugInformation.remove_unused;
+ implem.variable_printed <- DebugInformation.variable_printed
let init_none () =
implem.init <- (fun _ -> ());
@@ -73,7 +74,8 @@ let init_none () =
implem.atom_parameter <- (fun _ _ _ -> ());
implem.add_compilation_section_start <- (fun _ _ -> ());
implem.exists_section <- (fun _ -> true);
- implem.remove_unused <- (fun _ -> ())
+ implem.remove_unused <- (fun _ -> ());
+ implem.variable_printed <- (fun _ -> ())
let init () =
if !Clflags.option_g && Configuration.advanced_debug then
diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml
index aaf2d53f..8f71d487 100644
--- a/debug/Dwarfgen.ml
+++ b/debug/Dwarfgen.ml
@@ -284,13 +284,17 @@ let gen_types sec needed =
acc) types [])
let global_variable_to_entry sec acc id v =
+ let loc = match v.gvar_atom with
+ | Some a when StringSet.mem (extern_atom a) !printed_vars ->
+ Some (LocSymbol a)
+ | _ -> None in
let var = {
variable_file_loc = translate_file_loc sec v.gvar_file_loc;
variable_declaration = Some v.gvar_declaration;
variable_external = Some v.gvar_external;
variable_name = v.gvar_name;
variable_type = v.gvar_type;
- variable_location = match v.gvar_atom with Some a -> Some (LocSymbol a) | None -> None;
+ variable_location = loc;
} in
new_entry id (DW_TAG_variable var),IntSet.add v.gvar_type acc