aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-04-01 12:17:20 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-04-01 12:17:20 +0200
commit8fa20fb6701a380835eed29770aafd3f087ebad8 (patch)
tree7629aa3b8721835b298f2aa998dbab9e49171b4e
parent035047ca6c4f62c8481ffa9e4cc0783ea6a1b784 (diff)
downloadcompcert-8fa20fb6701a380835eed29770aafd3f087ebad8.tar.gz
compcert-8fa20fb6701a380835eed29770aafd3f087ebad8.zip
Print all files ever encountered in the filenum.
-rw-r--r--backend/PrintAnnot.ml7
-rw-r--r--debug/CtoDwarf.ml1
-rw-r--r--powerpc/TargetPrinter.ml7
3 files changed, 11 insertions, 4 deletions
diff --git a/backend/PrintAnnot.ml b/backend/PrintAnnot.ml
index 26f96370..7b0c1083 100644
--- a/backend/PrintAnnot.ml
+++ b/backend/PrintAnnot.ml
@@ -21,6 +21,13 @@ open AST
open Memdata
open Asm
+(** All files used in the debug entries *)
+module StringSet = Set.Make(String)
+let all_files : StringSet.t ref = ref StringSet.empty
+let add_file file =
+ all_files := StringSet.add file !all_files
+
+
(** Line number annotations *)
let filename_info : (string, int * Printlines.filebuf option) Hashtbl.t
diff --git a/debug/CtoDwarf.ml b/debug/CtoDwarf.ml
index b723a559..b1eea8f3 100644
--- a/debug/CtoDwarf.ml
+++ b/debug/CtoDwarf.ml
@@ -459,6 +459,7 @@ let union_to_dwarf (n,at,m) env gloc =
(* Translate global declarations to there dwarf representation *)
let globdecl_to_dwarf env (typs,decls) decl =
+ PrintAnnot.add_file (fst decl.gloc);
match decl.gdesc with
| Gtypedef (n,t) -> let ret = typedef_to_dwarf (n,t) decl.gloc in
typs@ret,decls
diff --git a/powerpc/TargetPrinter.ml b/powerpc/TargetPrinter.ml
index 50a00b9e..013eefc2 100644
--- a/powerpc/TargetPrinter.ml
+++ b/powerpc/TargetPrinter.ml
@@ -240,17 +240,16 @@ module Diab_System : SYSTEM =
end_addr := label_end;
fprintf oc "%a:\n" label label_end;
fprintf oc " .text\n";
- Hashtbl.iter (fun file _ ->
+ PrintAnnot.StringSet.iter (fun file ->
let label = new_label () in
Hashtbl.add filenum file label;
- fprintf oc ".L%d: .d2filenum \"%s\"\n" label file) PrintAnnot.filename_info;
+ fprintf oc ".L%d: .d2filenum \"%s\"\n" label file) !PrintAnnot.all_files;
fprintf oc " .d2_line_end\n"
end
- let print_file_loc oc (file,col) =
+ let print_file_loc oc (file,col) =
fprintf oc " .4byte %a\n" label (Hashtbl.find filenum file);
fprintf oc " .uleb128 %d\n" col
-
end
module Target (System : SYSTEM):TARGET =