From 8d2e4a51d56b7f4d3673a5132edd1adb37a14295 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 21 Aug 2015 15:21:36 +0200 Subject: Added symbol functions for printing of the location for global variables. --- backend/PrintAsm.ml | 8 ++++++-- backend/PrintAsmaux.ml | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index f3c80f3e..29409b32 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -78,6 +78,7 @@ module Printer(Target:TARGET) = List.iter (Target.print_init oc) id let print_var oc name v = + if !Clflags.option_g && Configuration.advanced_debug then Target.add_var_location name; match v.gvar_init with | [] -> () | _ -> @@ -102,8 +103,7 @@ module Printer(Target:TARGET) = let sz = match v.gvar_init with [Init_space sz] -> sz | _ -> assert false in Target.print_comm_symb oc sz name align - - + let print_globdef oc (name,gdef) = match gdef with | Gfun (Internal code) -> print_function oc name code @@ -120,6 +120,10 @@ module Printer(Target:TARGET) = let get_stmt_list_addr = Target.get_stmt_list_addr let name_of_section = Target.name_of_section let get_fun_addr s = try Some (Hashtbl.find addr_mapping s) with Not_found -> None + let get_location a = try (Target.get_location (stamp_atom a)) with Not_found -> None + let get_segment_location a = try (Target.get_segment_location (stamp_atom a)) with Not_found -> None + let get_frame_base a = None + let symbol = Target.symbol end module DebugPrinter = DwarfPrinter (DwarfTarget) (Target.DwarfAbbrevs) diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index b54188ca..efc8030f 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -51,6 +51,9 @@ module type TARGET = val new_label: unit -> int val label: out_channel -> int -> unit val print_file_loc: out_channel -> file_loc -> unit + val get_location: P.t -> location_value option + val get_segment_location: P.t -> location_value option + val add_var_location: P.t -> unit module DwarfAbbrevs: DWARF_ABBREVS end -- cgit From 861292a6c5e58b4f78bef207c717b801b3fc1fed Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Sun, 6 Sep 2015 20:32:55 +0200 Subject: Startet implementation of new Debug interface. Added a new file debug/Debug.ml which will be the interface between for generating and printing the debuging information. Currently it contains only the code for the line directived. --- backend/PrintAsm.ml | 4 +-- backend/PrintAsmaux.ml | 71 -------------------------------------------------- 2 files changed, 2 insertions(+), 73 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index 29409b32..b88a3d50 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -134,12 +134,12 @@ module Printer(Target:TARGET) = let print_program oc p db = let module Target = (val (sel_target ()):TARGET) in let module Printer = Printer(Target) in - reset_filenames (); + Debug.reset_filenames (); print_version_and_options oc Target.comment; Target.print_prologue oc; List.iter (Printer.print_globdef oc) p.prog_defs; Target.print_epilogue oc; - close_filenames (); + Debug.close_filenames (); if !Clflags.option_g && Configuration.advanced_debug then begin match db with diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index 324e7e66..441f8251 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -142,77 +142,6 @@ let cfi_rel_offset = let coqint oc n = fprintf oc "%ld" (camlint_of_coqint n) -(* Printing annotations in asm syntax *) -(** 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 - - -let filename_info : (string, int * Printlines.filebuf option) Hashtbl.t - = Hashtbl.create 7 - -let last_file = ref "" - -let reset_filenames () = - Hashtbl.clear filename_info; last_file := "" - -let close_filenames () = - Hashtbl.iter - (fun file (num, fb) -> - match fb with Some b -> Printlines.close b | None -> ()) - filename_info; - reset_filenames() - -let enter_filename f = - let num = Hashtbl.length filename_info + 1 in - let filebuf = - if !Clflags.option_S || !Clflags.option_dasm then begin - try Some (Printlines.openfile f) - with Sys_error _ -> None - end else None in - Hashtbl.add filename_info f (num, filebuf); - (num, filebuf) - -(* Add file and line debug location, using GNU assembler-style DWARF2 - directives *) - -let print_file_line oc pref file line = - if !Clflags.option_g && file <> "" then begin - let (filenum, filebuf) = - try - Hashtbl.find filename_info file - with Not_found -> - let (filenum, filebuf as res) = enter_filename file in - fprintf oc " .file %d %S\n" filenum file; - res in - fprintf oc " .loc %d %d\n" filenum line; - match filebuf with - | None -> () - | Some fb -> Printlines.copy oc pref fb line line - end - -(* Add file and line debug location, using DWARF2 directives in the style - of Diab C 5 *) - -let print_file_line_d2 oc pref file line = - if !Clflags.option_g && file <> "" then begin - let (_, filebuf) = - try - Hashtbl.find filename_info file - with Not_found -> - enter_filename file in - if file <> !last_file then begin - fprintf oc " .d2file %S\n" file; - last_file := file - end; - fprintf oc " .d2line %d\n" line; - match filebuf with - | None -> () - | Some fb -> Printlines.copy oc pref fb line line - end - (** Programmer-supplied annotations (__builtin_annot). *) let re_annot_param = Str.regexp "%%\\|%[1-9][0-9]*" -- cgit From cc6ce2bf9b8be54375ea3285ea2fa658bc108df0 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 10 Sep 2015 13:42:43 +0200 Subject: Revert "Startet implementation of new Debug interface." This reverts commit 861292a6c5e58b4f78bef207c717b801b3fc1fed. --- backend/PrintAsm.ml | 4 +-- backend/PrintAsmaux.ml | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index b88a3d50..29409b32 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -134,12 +134,12 @@ module Printer(Target:TARGET) = let print_program oc p db = let module Target = (val (sel_target ()):TARGET) in let module Printer = Printer(Target) in - Debug.reset_filenames (); + reset_filenames (); print_version_and_options oc Target.comment; Target.print_prologue oc; List.iter (Printer.print_globdef oc) p.prog_defs; Target.print_epilogue oc; - Debug.close_filenames (); + close_filenames (); if !Clflags.option_g && Configuration.advanced_debug then begin match db with diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index 441f8251..324e7e66 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -142,6 +142,77 @@ let cfi_rel_offset = let coqint oc n = fprintf oc "%ld" (camlint_of_coqint n) +(* Printing annotations in asm syntax *) +(** 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 + + +let filename_info : (string, int * Printlines.filebuf option) Hashtbl.t + = Hashtbl.create 7 + +let last_file = ref "" + +let reset_filenames () = + Hashtbl.clear filename_info; last_file := "" + +let close_filenames () = + Hashtbl.iter + (fun file (num, fb) -> + match fb with Some b -> Printlines.close b | None -> ()) + filename_info; + reset_filenames() + +let enter_filename f = + let num = Hashtbl.length filename_info + 1 in + let filebuf = + if !Clflags.option_S || !Clflags.option_dasm then begin + try Some (Printlines.openfile f) + with Sys_error _ -> None + end else None in + Hashtbl.add filename_info f (num, filebuf); + (num, filebuf) + +(* Add file and line debug location, using GNU assembler-style DWARF2 + directives *) + +let print_file_line oc pref file line = + if !Clflags.option_g && file <> "" then begin + let (filenum, filebuf) = + try + Hashtbl.find filename_info file + with Not_found -> + let (filenum, filebuf as res) = enter_filename file in + fprintf oc " .file %d %S\n" filenum file; + res in + fprintf oc " .loc %d %d\n" filenum line; + match filebuf with + | None -> () + | Some fb -> Printlines.copy oc pref fb line line + end + +(* Add file and line debug location, using DWARF2 directives in the style + of Diab C 5 *) + +let print_file_line_d2 oc pref file line = + if !Clflags.option_g && file <> "" then begin + let (_, filebuf) = + try + Hashtbl.find filename_info file + with Not_found -> + enter_filename file in + if file <> !last_file then begin + fprintf oc " .d2file %S\n" file; + last_file := file + end; + fprintf oc " .d2line %d\n" line; + match filebuf with + | None -> () + | Some fb -> Printlines.copy oc pref fb line line + end + (** Programmer-supplied annotations (__builtin_annot). *) let re_annot_param = Str.regexp "%%\\|%[1-9][0-9]*" -- cgit From de40fce9c16ced8d23389cbcfc55ef6d99466fe8 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 15 Sep 2015 14:26:42 +0200 Subject: Issue with ignoring the result of non-void builtin functions. In RTL and beyond, the result of a builtin function that has return type different from "void" must be BR, never BR_none. Otherwise, we get compile-time fatal errors, either in Asmexpand or in Lineartyping. --- backend/RTLgen.v | 13 +++++++------ backend/RTLgenproof.v | 1 + backend/RTLgenspec.v | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 12 deletions(-) (limited to 'backend') diff --git a/backend/RTLgen.v b/backend/RTLgen.v index d818de58..3da961c6 100644 --- a/backend/RTLgen.v +++ b/backend/RTLgen.v @@ -415,11 +415,12 @@ Fixpoint convert_builtin_args {A: Type} (al: list (builtin_arg expr)) (rl: list a1' :: convert_builtin_args al rl1 end. -Definition convert_builtin_res (map: mapping) (r: builtin_res ident) : mon (builtin_res reg) := - match r with - | BR id => do r <- find_var map id; ret (BR r) - | BR_none => ret BR_none - | _ => error (Errors.msg "RTLgen: bad builtin_res") +Definition convert_builtin_res (map: mapping) (oty: option typ) (r: builtin_res ident) : mon (builtin_res reg) := + match r, oty with + | BR id, _ => do r <- find_var map id; ret (BR r) + | BR_none, None => ret BR_none + | BR_none, Some _ => do r <- new_reg; ret (BR r) + | _, _ => error (Errors.msg "RTLgen: bad builtin_res") end. (** Translation of an expression. [transl_expr map a rd nd] @@ -598,7 +599,7 @@ Fixpoint transl_stmt (map: mapping) (s: stmt) (nd: node) let al := exprlist_of_expr_list (params_of_builtin_args args) in do rargs <- alloc_regs map al; let args' := convert_builtin_args args rargs in - do res' <- convert_builtin_res map res; + do res' <- convert_builtin_res map (sig_res (ef_sig ef)) res; do n1 <- add_instr (Ibuiltin ef args' res' nd); transl_exprlist map al rargs n1 | Sseq s1 s2 => diff --git a/backend/RTLgenproof.v b/backend/RTLgenproof.v index 559ab3a2..19f6f1f4 100644 --- a/backend/RTLgenproof.v +++ b/backend/RTLgenproof.v @@ -234,6 +234,7 @@ Proof. intros. inv H1; simpl. - eapply match_env_update_var; eauto. - auto. +- eapply match_env_update_temp; eauto. Qed. (** Matching and [let]-bound variables. *) diff --git a/backend/RTLgenspec.v b/backend/RTLgenspec.v index 41b5016f..1e665002 100644 --- a/backend/RTLgenspec.v +++ b/backend/RTLgenspec.v @@ -814,7 +814,10 @@ Inductive tr_builtin_res: mapping -> builtin_res ident -> builtin_res reg -> Pro map.(map_vars)!id = Some r -> tr_builtin_res map (BR id) (BR r) | tr_builtin_res_none: forall map, - tr_builtin_res map BR_none BR_none. + tr_builtin_res map BR_none BR_none + | tr_builtin_res_fresh: forall map r, + ~reg_in_map map r -> + tr_builtin_res map BR_none (BR r). (** [tr_stmt c map stmt ns ncont nexits nret rret] holds if the graph [c], starting at node [ns], contains instructions that perform the Cminor @@ -1214,14 +1217,17 @@ Proof. Qed. Lemma convert_builtin_res_charact: - forall map res s res' s' INCR - (TR: convert_builtin_res map res s = OK res' s' INCR) + forall map oty res s res' s' INCR + (TR: convert_builtin_res map oty res s = OK res' s' INCR) (WF: map_valid map s), tr_builtin_res map res res'. Proof. - destruct res; simpl; intros; monadInv TR. -- constructor. unfold find_var in EQ. destruct (map_vars map)!x; inv EQ; auto. -- constructor. + destruct res; simpl; intros. +- monadInv TR. constructor. unfold find_var in EQ. destruct (map_vars map)!x; inv EQ; auto. +- destruct oty; monadInv TR. ++ constructor. eauto with rtlg. ++ constructor. +- monadInv TR. Qed. Lemma transl_stmt_charact: -- cgit From d35426083623b2cb659d977f3c7f73dd6de4e383 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 15 Sep 2015 17:31:31 +0200 Subject: Isuue #50: outdated comment on type RTL.function. --- backend/RTL.v | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'backend') diff --git a/backend/RTL.v b/backend/RTL.v index 56a5efeb..3cd4335d 100644 --- a/backend/RTL.v +++ b/backend/RTL.v @@ -104,8 +104,7 @@ Record function: Type := mkfunction { for its stack-allocated activation record. [fn_params] is the list of registers that are bound to the values of arguments at call time. [fn_entrypoint] is the node of the first instruction of the function - in the CFG. [fn_code_wf] asserts that all instructions of the function - have nodes no greater than [fn_nextpc]. *) + in the CFG. *) Definition fundef := AST.fundef function. -- cgit From 98cddc7ba45b34fbd71d9a80c27a8e5ec6b311b0 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 16 Sep 2015 19:43:35 +0200 Subject: Move more functionality in the new interface. Added functions to add more information to the debuging interface, like the struct layout with offsets, bitifiled layout and removed the no longer needed mapping from stamp to atom. --- backend/PrintAsm.ml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index 29409b32..ea3d985a 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -27,11 +27,10 @@ module Printer(Target:TARGET) = let addr_mapping: (string, (int * int)) Hashtbl.t = Hashtbl.create 7 let get_fun_addr name = - let name = extern_atom name in - let start_addr = new_label () - and end_addr = new_label () in - Hashtbl.add addr_mapping name (start_addr,end_addr); - start_addr,end_addr + let s = new_label () + and e = new_label () in + Debug.add_fun_addr name (s,e); + s,e let print_debug_label oc l = if !Clflags.option_g && Configuration.advanced_debug then @@ -120,8 +119,7 @@ module Printer(Target:TARGET) = let get_stmt_list_addr = Target.get_stmt_list_addr let name_of_section = Target.name_of_section let get_fun_addr s = try Some (Hashtbl.find addr_mapping s) with Not_found -> None - let get_location a = try (Target.get_location (stamp_atom a)) with Not_found -> None - let get_segment_location a = try (Target.get_segment_location (stamp_atom a)) with Not_found -> None + let get_location a = None let get_frame_base a = None let symbol = Target.symbol end -- cgit From c8a0b76c6b9c3eb004a7fccdd2ad15cc8615ef93 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 17 Sep 2015 18:19:37 +0200 Subject: First version with computation of dwarf info from debug info. Introduced a new dwarf generation from the information collected in the DebugInformation and removed the old CtODwarf translation. --- backend/PrintAsm.ml | 9 ++++----- backend/PrintAsmaux.ml | 6 ------ 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index ea3d985a..9ffe3aa5 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -27,9 +27,9 @@ module Printer(Target:TARGET) = let addr_mapping: (string, (int * int)) Hashtbl.t = Hashtbl.create 7 let get_fun_addr name = - let s = new_label () - and e = new_label () in - Debug.add_fun_addr name (s,e); + let s = Target.new_label () + and e = Target.new_label () in + Debug.add_fun_addr name (e,s); s,e let print_debug_label oc l = @@ -118,7 +118,6 @@ module Printer(Target:TARGET) = let get_end_addr = Target.get_end_addr let get_stmt_list_addr = Target.get_stmt_list_addr let name_of_section = Target.name_of_section - let get_fun_addr s = try Some (Hashtbl.find addr_mapping s) with Not_found -> None let get_location a = None let get_frame_base a = None let symbol = Target.symbol @@ -140,7 +139,7 @@ let print_program oc p db = close_filenames (); if !Clflags.option_g && Configuration.advanced_debug then begin - match db with + match Debug.generate_debug_info () with | None -> () | Some db -> Printer.DebugPrinter.print_debug oc db diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index 324e7e66..2daa2d56 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -143,12 +143,6 @@ let coqint oc n = fprintf oc "%ld" (camlint_of_coqint n) (* Printing annotations in asm syntax *) -(** 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 - let filename_info : (string, int * Printlines.filebuf option) Hashtbl.t = Hashtbl.create 7 -- cgit From 9147350fdb47f3471ce6d9202b7c996f79ffab2d Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sun, 20 Sep 2015 15:23:38 +0200 Subject: Experiment: track the scopes of local variables via __builtin_debug. C2C: the code that insert debug builtins with the line numbers is now in Unblock. Handle calls to __builtin_debug. Unblock: generate __builtin_debug(1) for line numbers, carrying the list of active scopes as extra arguments. Generate __builtin_debug(6) for local variable declarations, carrying the corresponding scope number as extra argument. Constprop: avoid duplicating debug arguments that are constants already. PrintAsmaux: show this extra debug info as comments. --- backend/Constprop.v | 6 +++--- backend/Constpropproof.v | 6 +++++- backend/PrintAsmaux.ml | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'backend') diff --git a/backend/Constprop.v b/backend/Constprop.v index cd844d30..8f4cb76d 100644 --- a/backend/Constprop.v +++ b/backend/Constprop.v @@ -144,9 +144,9 @@ Fixpoint debug_strength_reduction (ae: AE.t) (al: list (builtin_arg reg)) := | a :: al => let a' := builtin_arg_reduction ae a in let al' := a :: debug_strength_reduction ae al in - match a' with - | BA_int _ | BA_long _ | BA_float _ | BA_single _ => a' :: al' - | _ => al' + match a, a' with + | BA _, (BA_int _ | BA_long _ | BA_float _ | BA_single _) => a' :: al' + | _, _ => al' end end. diff --git a/backend/Constpropproof.v b/backend/Constpropproof.v index d9005f5e..eafefed5 100644 --- a/backend/Constpropproof.v +++ b/backend/Constpropproof.v @@ -243,7 +243,11 @@ Proof. induction 2; simpl. - exists (@nil val); constructor. - destruct IHlist_forall2 as (vl' & A). - destruct (builtin_arg_reduction ae a1); repeat (eauto; econstructor). + assert (eval_builtin_args ge (fun r => rs#r) sp m + (a1 :: debug_strength_reduction ae al) (b1 :: vl')) + by (constructor; eauto). + destruct a1; try (econstructor; eassumption). + destruct (builtin_arg_reduction ae (BA x)); repeat (eauto; econstructor). Qed. Lemma builtin_strength_reduction_correct: diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index 67e53aea..13daa644 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -269,6 +269,8 @@ let print_debug_info comment print_line print_preg sp_name oc kind txt args = args in match kind with | 1 -> (* line number *) + fprintf oc "%s debug: current scopes%a\n" + comment print_debug_args args; if Str.string_match re_file_line txt 0 then print_line oc (Str.matched_group 1 txt) (int_of_string (Str.matched_group 2 txt)) @@ -283,6 +285,9 @@ let print_debug_info comment print_line print_preg sp_name oc kind txt args = | 5 -> (* local variable preallocated in stack *) fprintf oc "%s debug: %s resides at%a\n" comment txt print_debug_args args + | 6 -> (* declaration of a local variable *) + fprintf oc "%s debug: %s declared in scope%a\n" + comment txt print_debug_args args | _ -> () -- cgit From d8aac95c8d1767bf3b10990599b0f32687994182 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 21 Sep 2015 14:45:28 +0200 Subject: Continuing experiment: track the scopes of local variables via __builtin_debug As observed by B. Schommer, it is not enough to track scopes for every source line, as blocks can occur on a single line (think macros). Hence: - Revert debug annotations of kind 1 to contain only line number info. Generate them only when the line number changes. - Use debug annotations of kind 6 to record the list of active scopes (as BA_int integer arguments to __builtin_annot). Generate them before every nontrivial statement, even if on the same line as others. - Remove the generation of "variable x is declared in scope N" debug annotations. This can be tracked separately and more efficiently. --- backend/PrintAsmaux.ml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index 13daa644..a67c85d2 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -269,8 +269,6 @@ let print_debug_info comment print_line print_preg sp_name oc kind txt args = args in match kind with | 1 -> (* line number *) - fprintf oc "%s debug: current scopes%a\n" - comment print_debug_args args; if Str.string_match re_file_line txt 0 then print_line oc (Str.matched_group 1 txt) (int_of_string (Str.matched_group 2 txt)) @@ -285,9 +283,9 @@ let print_debug_info comment print_line print_preg sp_name oc kind txt args = | 5 -> (* local variable preallocated in stack *) fprintf oc "%s debug: %s resides at%a\n" comment txt print_debug_args args - | 6 -> (* declaration of a local variable *) - fprintf oc "%s debug: %s declared in scope%a\n" - comment txt print_debug_args args + | 6 -> (* scope annotations *) + fprintf oc "%s debug: current scopes%a\n" + comment print_debug_args args; | _ -> () -- cgit From d7f75509c290d871cb8cd8aa11a0be2923c9ef17 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 22 Sep 2015 19:44:47 +0200 Subject: Record the scope structure during unblocking. Instead of creating separate annotations for the local variables we call the Debug.add_lvar_scope and we construct a mapping from function id + scope id to scope information. --- backend/PrintAsmaux.ml | 1 + 1 file changed, 1 insertion(+) (limited to 'backend') diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index ed0fe524..a0474003 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -48,6 +48,7 @@ module type TARGET = val get_start_addr: unit -> int val get_end_addr: unit -> int val get_stmt_list_addr: unit -> int + val get_debug_start_addr: unit -> int val new_label: unit -> int val label: out_channel -> int -> unit val print_file_loc: out_channel -> file_loc -> unit -- cgit From aff813685455559f6d6a88158dd3d605893ba3a3 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 25 Sep 2015 16:43:18 +0200 Subject: Added support for the locations of stack allocated local variables. This commit adds furher support for location information for local variables and starts with the implementation of the debug_loc section. --- backend/PrintAsm.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index 9ffe3aa5..104440c6 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -66,7 +66,9 @@ module Printer(Target:TARGET) = print_debug_label oc e; Target.print_fun_info oc name; Target.emit_constants oc lit; - Target.print_jumptable oc jmptbl + Target.print_jumptable oc jmptbl; + if !Clflags.option_g then + Hashtbl.iter (fun p i -> Debug.add_label name p i) current_function_labels let print_init_data oc name id = if Str.string_match PrintCsyntax.re_string_literal (extern_atom name) 0 @@ -141,6 +143,6 @@ let print_program oc p db = begin match Debug.generate_debug_info () with | None -> () - | Some db -> - Printer.DebugPrinter.print_debug oc db + | Some (db,loc) -> + Printer.DebugPrinter.print_debug oc db loc end -- cgit From 91ed1b752d2661478840e40a0d977b068d99490d Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Sun, 27 Sep 2015 20:13:19 +0200 Subject: Added printing the reference address for the LocRef and started refactoring old Debuging code. The old functions to store the symbol for the Global variables and retrive this is no longer needed since the atom is stored in DebugInformation. Also the Debug.Abbrev module is no longer needed. --- backend/PrintAsm.ml | 7 +------ backend/PrintAsmaux.ml | 4 ---- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index 104440c6..59570957 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -79,7 +79,6 @@ module Printer(Target:TARGET) = List.iter (Target.print_init oc) id let print_var oc name v = - if !Clflags.option_g && Configuration.advanced_debug then Target.add_var_location name; match v.gvar_init with | [] -> () | _ -> @@ -120,14 +119,10 @@ module Printer(Target:TARGET) = let get_end_addr = Target.get_end_addr let get_stmt_list_addr = Target.get_stmt_list_addr let name_of_section = Target.name_of_section - let get_location a = None - let get_frame_base a = None let symbol = Target.symbol end - module DebugPrinter = DwarfPrinter (DwarfTarget) (Target.DwarfAbbrevs) - - + module DebugPrinter = DwarfPrinter (DwarfTarget) end let print_program oc p db = diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index 3f0b3ea3..1c3b47b5 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -52,10 +52,6 @@ module type TARGET = val new_label: unit -> int val label: out_channel -> int -> unit val print_file_loc: out_channel -> file_loc -> unit - val get_location: P.t -> location_value option - val get_segment_location: P.t -> location_value option - val add_var_location: P.t -> unit - module DwarfAbbrevs: DWARF_ABBREVS end (* On-the-fly label renaming *) -- cgit From 68ad5472a78d12e0e4fd4eae422122185403d678 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 28 Sep 2015 18:39:43 +0200 Subject: Change the way the debug sections are printed. If a user uses the #pragma use_section for functions the diab linker requires a separate debug_info section for each entry. This commit adds functionality to emulate this behavior. --- backend/PrintAsm.ml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index 59570957..a152e3c2 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -24,8 +24,6 @@ open TargetPrinter module Printer(Target:TARGET) = struct - let addr_mapping: (string, (int * int)) Hashtbl.t = Hashtbl.create 7 - let get_fun_addr name = let s = Target.new_label () and e = Target.new_label () in @@ -38,7 +36,6 @@ module Printer(Target:TARGET) = else () - let print_location oc loc = if loc <> Cutil.no_loc then Target.print_file_line oc (fst loc) (snd loc) @@ -113,11 +110,8 @@ module Printer(Target:TARGET) = module DwarfTarget: DwarfTypes.DWARF_TARGET = struct let label = Target.label - let name_of_section = Target.name_of_section + let section = Target.section let print_file_loc = Target.print_file_loc - let get_start_addr = Target.get_start_addr - let get_end_addr = Target.get_end_addr - let get_stmt_list_addr = Target.get_stmt_list_addr let name_of_section = Target.name_of_section let symbol = Target.symbol end @@ -136,8 +130,15 @@ let print_program oc p db = close_filenames (); if !Clflags.option_g && Configuration.advanced_debug then begin - match Debug.generate_debug_info () with + let atom_to_s s = + let s = C2C.atom_sections s in + match s with + | [] -> Target.name_of_section Section_text + | (Section_user (n,_,_))::_ -> n + | a::_ -> + Target.name_of_section a in + match Debug.generate_debug_info atom_to_s (Target.name_of_section Section_text) with | None -> () - | Some (db,loc) -> - Printer.DebugPrinter.print_debug oc db loc + | Some db -> + Printer.DebugPrinter.print_debug oc db end -- cgit From a4edc066cf42af9e86643d9ddfe815c42798d4c7 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 30 Sep 2015 14:38:58 +0200 Subject: Add the version string to the printed asm. --- backend/PrintAsmaux.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'backend') diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index 1c3b47b5..c0ab3134 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -327,7 +327,12 @@ let print_inline_asm print_preg oc txt sg args res = (** Print CompCert version and command-line as asm comment *) let print_version_and_options oc comment = - fprintf oc "%s File generated by CompCert %s\n" comment Version.version; + let version_string = + if Version.buildnr <> "" && Version.tag <> "" then + sprintf "%s, Build: %s, Tag: %s\n" Version.version Version.buildnr Version.tag + else + Version.version in + fprintf oc "%s File generated by CompCert %s\n" comment version_string; fprintf oc "%s Command line:" comment; for i = 1 to Array.length Sys.argv - 1 do fprintf oc " %s" Sys.argv.(i) -- cgit From 6f1a2438a1c9598eab26e0cf43375a83fd547d35 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 30 Sep 2015 15:05:11 +0200 Subject: Removed newline in version string and add buildnr and tag if existing to Producer as well as target system. --- backend/PrintAsmaux.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backend') diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index c0ab3134..079aa6fd 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -329,7 +329,7 @@ let print_inline_asm print_preg oc txt sg args res = let print_version_and_options oc comment = let version_string = if Version.buildnr <> "" && Version.tag <> "" then - sprintf "%s, Build: %s, Tag: %s\n" Version.version Version.buildnr Version.tag + sprintf "%s, Build: %s, Tag: %s" Version.version Version.buildnr Version.tag else Version.version in fprintf oc "%s File generated by CompCert %s\n" comment version_string; -- cgit From eaf4bab84af4b3db1ca9c6785ed803bbbd61b9a7 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 1 Oct 2015 12:19:16 +0200 Subject: Only print locations for symbols that are present in the assembler. --- backend/PrintAsm.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index a152e3c2..45b1e878 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -79,10 +79,11 @@ module Printer(Target:TARGET) = match v.gvar_init with | [] -> () | _ -> + Debug.variable_printed (extern_atom name); let sec = match C2C.atom_sections name with | [s] -> s - | _ -> Section_data true + | _ -> Section_data true and align = match C2C.atom_alignof name with | Some a -> a -- cgit From bc894f212d478b422f17ca0a0a207833838f173c Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 1 Oct 2015 18:39:37 +0200 Subject: Cleanup of now no longer needed functions. --- backend/PrintAsm.ml | 1 - backend/PrintAsmaux.ml | 5 ----- 2 files changed, 6 deletions(-) (limited to 'backend') diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index 45b1e878..dba578b9 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -112,7 +112,6 @@ module Printer(Target:TARGET) = struct let label = Target.label let section = Target.section - let print_file_loc = Target.print_file_loc let name_of_section = Target.name_of_section let symbol = Target.symbol end diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index 079aa6fd..b18481da 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -45,13 +45,8 @@ module type TARGET = val comment: string val symbol: out_channel -> P.t -> unit val default_falignment: int - val get_start_addr: unit -> int - val get_end_addr: unit -> int - val get_stmt_list_addr: unit -> int - val get_debug_start_addr: unit -> int val new_label: unit -> int val label: out_channel -> int -> unit - val print_file_loc: out_channel -> file_loc -> unit end (* On-the-fly label renaming *) -- cgit From 2bfa77d9eb3940b9b46865f7ebe760365164d312 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 2 Oct 2015 16:24:01 +0200 Subject: First try of debug information for gcc. --- backend/Fileinfo.ml | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++ backend/PrintAsm.ml | 6 ++-- backend/PrintAsmaux.ml | 66 ----------------------------------------- 3 files changed, 82 insertions(+), 69 deletions(-) create mode 100644 backend/Fileinfo.ml (limited to 'backend') diff --git a/backend/Fileinfo.ml b/backend/Fileinfo.ml new file mode 100644 index 00000000..afdea382 --- /dev/null +++ b/backend/Fileinfo.ml @@ -0,0 +1,79 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* Bernhard Schommer, AbsInt Angewandte Informatik GmbH *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +open Printf + +(* Printing annotations in asm syntax *) + +let filename_info : (string, int * Printlines.filebuf option) Hashtbl.t + = Hashtbl.create 7 + +let last_file = ref "" + +let reset_filenames () = + Hashtbl.clear filename_info; last_file := "" + +let close_filenames () = + Hashtbl.iter + (fun file (num, fb) -> + match fb with Some b -> Printlines.close b | None -> ()) + filename_info; + reset_filenames() + +let enter_filename f = + let num = Hashtbl.length filename_info + 1 in + let filebuf = + if !Clflags.option_S || !Clflags.option_dasm then begin + try Some (Printlines.openfile f) + with Sys_error _ -> None + end else None in + Hashtbl.add filename_info f (num, filebuf); + (num, filebuf) + +(* Add file and line debug location, using GNU assembler-style DWARF2 + directives *) + +let print_file_line oc pref file line = + if !Clflags.option_g && file <> "" then begin + let (filenum, filebuf) = + try + Hashtbl.find filename_info file + with Not_found -> + let (filenum, filebuf as res) = enter_filename file in + fprintf oc " .file %d %S\n" filenum file; + res in + fprintf oc " .loc %d %d\n" filenum line; + match filebuf with + | None -> () + | Some fb -> Printlines.copy oc pref fb line line + end + +(* Add file and line debug location, using DWARF2 directives in the style + of Diab C 5 *) + +let print_file_line_d2 oc pref file line = + if !Clflags.option_g && file <> "" then begin + let (_, filebuf) = + try + Hashtbl.find filename_info file + with Not_found -> + enter_filename file in + if file <> !last_file then begin + fprintf oc " .d2file %S\n" file; + last_file := file + end; + fprintf oc " .d2line %d\n" line; + match filebuf with + | None -> () + | Some fb -> Printlines.copy oc pref fb line line + end diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml index dba578b9..594b43b7 100644 --- a/backend/PrintAsm.ml +++ b/backend/PrintAsm.ml @@ -122,12 +122,11 @@ module Printer(Target:TARGET) = let print_program oc p db = let module Target = (val (sel_target ()):TARGET) in let module Printer = Printer(Target) in - reset_filenames (); + Fileinfo.reset_filenames (); print_version_and_options oc Target.comment; Target.print_prologue oc; List.iter (Printer.print_globdef oc) p.prog_defs; Target.print_epilogue oc; - close_filenames (); if !Clflags.option_g && Configuration.advanced_debug then begin let atom_to_s s = @@ -141,4 +140,5 @@ let print_program oc p db = | None -> () | Some db -> Printer.DebugPrinter.print_debug oc db - end + end; + Fileinfo.close_filenames () diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index b18481da..78399c04 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -14,7 +14,6 @@ open AST open Asm open Camlcoq -open DwarfTypes open Datatypes open Memdata open Printf @@ -134,71 +133,6 @@ let cfi_rel_offset = let coqint oc n = fprintf oc "%ld" (camlint_of_coqint n) -(* Printing annotations in asm syntax *) - -let filename_info : (string, int * Printlines.filebuf option) Hashtbl.t - = Hashtbl.create 7 - -let last_file = ref "" - -let reset_filenames () = - Hashtbl.clear filename_info; last_file := "" - -let close_filenames () = - Hashtbl.iter - (fun file (num, fb) -> - match fb with Some b -> Printlines.close b | None -> ()) - filename_info; - reset_filenames() - -let enter_filename f = - let num = Hashtbl.length filename_info + 1 in - let filebuf = - if !Clflags.option_S || !Clflags.option_dasm then begin - try Some (Printlines.openfile f) - with Sys_error _ -> None - end else None in - Hashtbl.add filename_info f (num, filebuf); - (num, filebuf) - -(* Add file and line debug location, using GNU assembler-style DWARF2 - directives *) - -let print_file_line oc pref file line = - if !Clflags.option_g && file <> "" then begin - let (filenum, filebuf) = - try - Hashtbl.find filename_info file - with Not_found -> - let (filenum, filebuf as res) = enter_filename file in - fprintf oc " .file %d %S\n" filenum file; - res in - fprintf oc " .loc %d %d\n" filenum line; - match filebuf with - | None -> () - | Some fb -> Printlines.copy oc pref fb line line - end - -(* Add file and line debug location, using DWARF2 directives in the style - of Diab C 5 *) - -let print_file_line_d2 oc pref file line = - if !Clflags.option_g && file <> "" then begin - let (_, filebuf) = - try - Hashtbl.find filename_info file - with Not_found -> - enter_filename file in - if file <> !last_file then begin - fprintf oc " .d2file %S\n" file; - last_file := file - end; - fprintf oc " .d2line %d\n" line; - match filebuf with - | None -> () - | Some fb -> Printlines.copy oc pref fb line line - end - (** Programmer-supplied annotations (__builtin_annot). *) let re_annot_param = Str.regexp "%%\\|%[1-9][0-9]*" -- cgit From 34cc6a603f34a430fc3b9a7071dcc1e19b2b7250 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Sun, 4 Oct 2015 22:15:20 +0200 Subject: Ensure that there are file directives for all files used in the debug information. --- backend/Fileinfo.ml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'backend') diff --git a/backend/Fileinfo.ml b/backend/Fileinfo.ml index afdea382..0490def0 100644 --- a/backend/Fileinfo.ml +++ b/backend/Fileinfo.ml @@ -42,16 +42,17 @@ let enter_filename f = (* Add file and line debug location, using GNU assembler-style DWARF2 directives *) +let print_file oc file = + try + Hashtbl.find filename_info file + with Not_found -> + let (filenum, filebuf as res) = enter_filename file in + fprintf oc " .file %d %S\n" filenum file; + res let print_file_line oc pref file line = if !Clflags.option_g && file <> "" then begin - let (filenum, filebuf) = - try - Hashtbl.find filename_info file - with Not_found -> - let (filenum, filebuf as res) = enter_filename file in - fprintf oc " .file %d %S\n" filenum file; - res in + let (filenum, filebuf) = print_file oc file in fprintf oc " .loc %d %d\n" filenum line; match filebuf with | None -> () -- cgit From ed1f32134283d3cd4f939a26dfd99992ec48da86 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 8 Oct 2015 13:27:50 +0200 Subject: Moved expandation of debug information to Asmexpandaux. The function is generalized to work for all backends and takes as additional arguments functions for the printing of the simple instructions and the translation function for the arguments. --- backend/Asmexpandaux.ml | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'backend') diff --git a/backend/Asmexpandaux.ml b/backend/Asmexpandaux.ml index 6ce6c005..5c3ac381 100644 --- a/backend/Asmexpandaux.ml +++ b/backend/Asmexpandaux.ml @@ -55,3 +55,72 @@ let get_current_function () = let fn = !current_function in set_current_function dummy_function; {fn with fn_code = c} + +(* Expand function for debug information *) + +let expand_scope id lbl oldscopes newscopes = + let opening = List.filter (fun a -> not (List.mem a oldscopes)) newscopes + and closing = List.filter (fun a -> not (List.mem a newscopes)) oldscopes in + List.iter (fun i -> Debug.open_scope id i lbl) opening; + List.iter (fun i -> Debug.close_scope id i lbl) closing + + +let expand_debug id annot simple l = + let get_lbl = function + | None -> + let lbl = new_label () in + emit (Plabel lbl); + lbl + | Some lbl -> lbl in + let rec aux lbl scopes = function + | [] -> let lbl = get_lbl lbl in + Debug.function_end id lbl + | (Pbuiltin(EF_debug (kind,txt,_x),args,_) as i)::rest -> + let kind = (P.to_int kind) in + begin + match kind with + | 1-> + emit i;aux lbl scopes rest + | 2 -> + aux lbl scopes rest + | 3 -> + begin + match annot args with + | Some a -> + let lbl = get_lbl lbl in + Debug.start_live_range (id,txt) lbl a; + aux (Some lbl) scopes rest + | None -> aux lbl scopes rest + end + | 4 -> + let lbl = get_lbl lbl in + Debug.end_live_range (id,txt) lbl; + aux (Some lbl) scopes rest + | 5 -> + begin + match annot args with + | Some a-> + Debug.stack_variable (id,txt) a; + aux lbl scopes rest + | _ -> aux lbl scopes rest + end + | 6 -> + let lbl = get_lbl lbl in + let scopes' = List.map (function BA_int x -> Int32.to_int (camlint_of_coqint x) | _ -> assert false) args in + expand_scope id lbl scopes scopes'; + aux (Some lbl) scopes' rest + | _ -> + aux None scopes rest + end + | i::rest -> simple i; aux None scopes rest in + (* We need to move all closing debug annotations before the last real statement *) + let rec move_debug acc bcc = function + | (Pbuiltin(EF_debug (kind,_,_),_,_) as i)::rest -> + let kind = (P.to_int kind) in + if kind = 1 then + move_debug acc (i::bcc) rest (* Do not move debug line *) + else + move_debug (i::acc) bcc rest (* Move the debug annotations forward *) + | b::rest -> List.rev ((List.rev (b::bcc)@List.rev acc)@rest) (* We found the first non debug location *) + | [] -> List.rev acc (* This actually can never happen *) in + aux None [] (move_debug [] [] (List.rev l)) -- cgit From b0c47e12f2bbff0905ad853b90169df16d87f6be Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 9 Oct 2015 16:36:16 +0200 Subject: Filled in missing functions for debug information on ia32. Like for arm and ppc the functions for section names and start and end addresses of compilation units are defined and the print_annot function is moved to Asmexpandaux.ml. --- backend/Asmexpandaux.ml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'backend') diff --git a/backend/Asmexpandaux.ml b/backend/Asmexpandaux.ml index 5c3ac381..25be9be3 100644 --- a/backend/Asmexpandaux.ml +++ b/backend/Asmexpandaux.ml @@ -63,9 +63,30 @@ let expand_scope id lbl oldscopes newscopes = and closing = List.filter (fun a -> not (List.mem a newscopes)) oldscopes in List.iter (fun i -> Debug.open_scope id i lbl) opening; List.iter (fun i -> Debug.close_scope id i lbl) closing + +let translate_annot sp preg_to_dwarf annot = + let rec aux = function + | BA x -> Some (sp,BA (preg_to_dwarf x)) + | BA_int _ + | BA_long _ + | BA_float _ + | BA_single _ + | BA_loadglobal _ + | BA_addrglobal _ + | BA_loadstack _ -> None + | BA_addrstack ofs -> Some (sp,BA_addrstack ofs) + | BA_splitlong (hi,lo) -> + begin + match (aux hi,aux lo) with + | Some (_,hi) ,Some (_,lo) -> Some (sp,BA_splitlong (hi,lo)) + | _,_ -> None + end in + (match annot with + | [] -> None + | a::_ -> aux a) -let expand_debug id annot simple l = +let expand_debug id sp preg simple l = let get_lbl = function | None -> let lbl = new_label () in @@ -85,7 +106,7 @@ let expand_debug id annot simple l = aux lbl scopes rest | 3 -> begin - match annot args with + match translate_annot sp preg args with | Some a -> let lbl = get_lbl lbl in Debug.start_live_range (id,txt) lbl a; @@ -98,7 +119,7 @@ let expand_debug id annot simple l = aux (Some lbl) scopes rest | 5 -> begin - match annot args with + match translate_annot sp preg args with | Some a-> Debug.stack_variable (id,txt) a; aux lbl scopes rest -- cgit