From e089274d63aff0a5fa01b956cc5671d1b1f1a772 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Thu, 15 Sep 2005 09:26:45 +0000 Subject: [PATCH] added -debug flag which avoid catching top-level exception (usefule for stack backtrace) --- helm/matita/matitacLib.ml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/helm/matita/matitacLib.ml b/helm/matita/matitacLib.ml index 9cc063271..f7855ac8c 100644 --- a/helm/matita/matitacLib.ml +++ b/helm/matita/matitacLib.ml @@ -27,6 +27,11 @@ open Printf open MatitaTypes + (** If set to true matitac wont catch top level exception, so that backtrace + * could be inspected setting OCAMLRUNPARAM=b. + * This flag could be enabled passing -debug *) +let debug = ref false + (** {2 Initialization} *) let paths_to_search_in = ref [];; @@ -34,14 +39,15 @@ let quiet_compilation = ref false;; let dont_delete_baseuri = ref false;; let add_l l = fun s -> l := s :: !l ;; -let set_b b = fun () -> b := true;; let arg_spec = [ "-I", Arg.String (add_l paths_to_search_in), " Adds path to the list of searched paths for the include command"; - "-q", Arg.Unit (set_b quiet_compilation), "Turn off verbose compilation"; - "-preserve", Arg.Unit (set_b dont_delete_baseuri), - "Turns off automatic baseuri cleaning" + "-q", Arg.Set quiet_compilation, "Turn off verbose compilation"; + "-preserve", Arg.Set dont_delete_baseuri, + "Turns off automatic baseuri cleaning"; + "-debug", Arg.Set debug, + "Do not catch top-level exception (useful for backtrace inspection)"; ] let usage = sprintf "MatitaC v%s\nUsage: matitac [option ...] file\nOptions:" @@ -238,8 +244,10 @@ let main ~mode = clean_exit (Some 1) else pp_ocaml_mode () - | _ -> - if mode = `COMPILER then - clean_exit (Some 3) - else - pp_ocaml_mode () + | exn -> + if !debug then raise exn; + if mode = `COMPILER then + clean_exit (Some 3) + else + pp_ocaml_mode () + -- 2.39.2