aboutsummaryrefslogtreecommitdiff
path: root/sysinit
diff options
context:
space:
mode:
authorMaxime Dénès2020-10-15 15:31:51 +0200
committerGaëtan Gilbert2021-02-24 15:09:15 +0100
commit068031ff7da092c1e2d35db27d713b9606960c42 (patch)
tree2a3e2ae6a82e60a76ef31659ff305d70a4b2ea39 /sysinit
parent264aba2484312a2172cd36dd9b89ed66e4f38864 (diff)
Infrastructure for fine-grained debug flags
Diffstat (limited to 'sysinit')
-rw-r--r--sysinit/coqargs.ml22
1 files changed, 11 insertions, 11 deletions
diff --git a/sysinit/coqargs.ml b/sysinit/coqargs.ml
index 56d88e6bd6..8be73ca028 100644
--- a/sysinit/coqargs.ml
+++ b/sysinit/coqargs.ml
@@ -22,14 +22,6 @@ let error_missing_arg s =
exit 1
(******************************************************************************)
-(* Imperative effects! This must be fixed at some point. *)
-(******************************************************************************)
-
-let set_debug () =
- let () = Exninfo.record_backtrace true in
- Flags.debug := true
-
-(******************************************************************************)
type native_compiler = Coq_config.native_compiler =
NativeOff | NativeOn of { ondemand : bool }
@@ -168,6 +160,9 @@ let add_load_vernacular opts verb s =
let add_set_option opts opt_name value =
{ opts with pre = { opts.pre with injections = OptionInjection (opt_name, value) :: opts.pre.injections }}
+let add_set_debug opts flags =
+ add_set_option opts ["Debug"] (OptionAppend flags)
+
(** Options for proof general *)
let set_emacs opts =
let opts = add_set_option opts Printer.print_goal_tag_opt_name (OptionSet None) in
@@ -382,10 +377,15 @@ let parse_args ~usage ~init arglist : t * string list =
(* Options with zero arg *)
|"-test-mode" -> Vernacinterp.test_mode := true; oval
|"-beautify" -> Flags.beautify := true; oval
- |"-bt" -> Exninfo.record_backtrace true; oval
+ |"-bt" -> add_set_debug oval "backtrace"
|"-config"|"--config" -> set_query oval PrintConfig
- |"-debug" -> set_debug (); oval
- |"-xml-debug" -> Flags.xml_debug := true; set_debug (); oval
+
+ |"-debug" -> add_set_debug oval "all"
+ |"-d" | "-D" -> add_set_debug oval (next())
+
+ (* -xml-debug implies -debug. TODO don't be imperative here. *)
+ |"-xml-debug" -> Flags.xml_debug := true; add_set_debug oval "all"
+
|"-diffs" ->
add_set_option oval Proof_diffs.opt_name @@ OptionSet (Some (next ()))
|"-emacs" -> set_emacs oval