summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-05-20 13:48:30 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-05-20 13:48:30 +0000
commitff63a02431cb601eee8987730891ed036517e5a9 (patch)
tree9546aa4ea6aa6df294c218eb12a273c982d3afc1
parentbe4d6e42dfa287b93b1a35ec820ab2a5aaf8c7ec (diff)
powerpc: tentative support for Diab debug info
arm, ia32: reset table of file names at each run git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2261 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
-rw-r--r--arm/PrintAsm.ml1
-rw-r--r--ia32/PrintAsm.ml1
-rw-r--r--powerpc/PrintAsm.ml71
3 files changed, 49 insertions, 24 deletions
diff --git a/arm/PrintAsm.ml b/arm/PrintAsm.ml
index 97ed19a..3740c1f 100644
--- a/arm/PrintAsm.ml
+++ b/arm/PrintAsm.ml
@@ -835,6 +835,7 @@ let print_globdef oc (name, gdef) =
let print_program oc p =
(* fprintf oc " .fpu vfp\n"; *)
+ Hashtbl.clear filename_num;
List.iter (print_globdef oc) p.prog_defs
diff --git a/ia32/PrintAsm.ml b/ia32/PrintAsm.ml
index 8820515..9c8f963 100644
--- a/ia32/PrintAsm.ml
+++ b/ia32/PrintAsm.ml
@@ -855,6 +855,7 @@ let print_globdef oc (name, gdef) =
let print_program oc p =
need_masks := false;
indirect_symbols := StringSet.empty;
+ Hashtbl.clear filename_num;
List.iter (print_globdef oc) p.prog_defs;
if !need_masks then begin
section oc Section_const; (* not Section_literal because not 8-bytes *)
diff --git a/powerpc/PrintAsm.ml b/powerpc/PrintAsm.ml
index 12dd78c..b823268 100644
--- a/powerpc/PrintAsm.ml
+++ b/powerpc/PrintAsm.ml
@@ -202,55 +202,75 @@ let section oc sec =
(* Emit .file / .loc debugging directives *)
-let file_dir =
- match target with Linux -> ".file" | Diab -> ".d2file"
-let loc_dir =
- match target with Linux -> ".loc" | Diab -> ".d2line"
-
-let filename_num : (string, int) Hashtbl.t = Hashtbl.create 7
-
-let print_file_line oc file line =
- if !Clflags.option_g && file <> "" then begin
- let filenum =
- try
- Hashtbl.find filename_num file
- with Not_found ->
- let n = Hashtbl.length filename_num + 1 in
- Hashtbl.add filename_num file n;
- fprintf oc " %s %d %S\n" file_dir n file;
- n
- in fprintf oc " %s %d %s\n" loc_dir filenum line
- end
+module DebugLinux = struct
+ let filename_num : (string, int) Hashtbl.t = Hashtbl.create 7
+ let reset () = Hashtbl.clear filename_num
+ let print_file_line oc file line =
+ if !Clflags.option_g && file <> "" then begin
+ let filenum =
+ try
+ Hashtbl.find filename_num file
+ with Not_found ->
+ let n = Hashtbl.length filename_num + 1 in
+ Hashtbl.add filename_num file n;
+ fprintf oc " .file %d %S\n" n file;
+ n
+ in fprintf oc " .loc %d %s\n" filenum line
+ end
+end
+
+module DebugDiab = struct
+ let last_file = ref ""
+ let reset () = last_file := ""
+ let print_file_line oc file line =
+ if !Clflags.option_g && file <> "" then begin
+ if file <> !last_file then begin
+ fprintf oc " .d1file %S\n" file;
+ last_file := file
+ end;
+ fprintf oc " .d1line %s\n" line
+ end
+end
+
+let print_file_line =
+ match target with
+ | Linux -> DebugLinux.print_file_line
+ | Diab -> DebugDiab.print_file_line
let print_location oc loc =
if loc <> Cutil.no_loc then
print_file_line oc (fst loc) (string_of_int (snd loc))
+let reset_file_line =
+ match target with
+ | Linux -> DebugLinux.reset
+ | Diab -> DebugDiab.reset
+
(* Emit .cfi directives *)
let cfi_startproc oc =
if Configuration.asm_supports_cfi then
match target with
| Linux -> fprintf oc " .cfi_startproc\n"
- | Diab -> assert false
+ | Diab -> ()
let cfi_endproc oc =
if Configuration.asm_supports_cfi then
match target with
| Linux -> fprintf oc " .cfi_endproc\n"
- | Diab -> assert false
+ | Diab -> ()
let cfi_adjust oc delta =
if Configuration.asm_supports_cfi then
match target with
| Linux -> fprintf oc " .cfi_adjust_cfa_offset %ld\n" delta
- | Diab -> assert false
+ | Diab -> ()
let cfi_rel_offset oc reg ofs =
if Configuration.asm_supports_cfi then
match target with
| Linux -> fprintf oc " .cfi_rel_offset %s, %ld\n" reg ofs
- | Diab -> assert false
+ | Diab -> ()
(* Encoding masks for rlwinm instructions *)
@@ -1135,11 +1155,14 @@ let print_prologue oc =
| Linux ->
()
| Diab ->
- fprintf oc " .xopt align-fill-text=0x60000000\n"
+ fprintf oc " .xopt align-fill-text=0x60000000\n";
+ if !Clflags.option_g then
+ fprintf oc " .xopt asm-debug-on\n"
let print_program oc p =
stubbed_functions := IdentSet.empty;
List.iter record_extfun p.prog_defs;
+ reset_file_line();
print_prologue oc;
List.iter (print_globdef oc) p.prog_defs