Skip to content
This repository
tag: v266
Fetching contributors…

Cannot retrieve contributors at this time

file 953 lines (786 sloc) 27.295 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)

(**
Debug Variables Management for the MLstate debug preprocessor (ppdebug)

@see "opalang/utils/ppdebug.pl" the script which implement the preprocess
@author Louis Gesbert
@author Mathieu Barbin
*)

(** {6 Template} *)

(**
Template for a module name [MyId]
{[
#<Debugvar:MY_VAR>
let debug fmt =
OManager.printf ("@{<cyan>[MyId]@}@ @[<2>"^^fmt^^"@]@.")

(* utilisation *)
...
let _ =
#<If:MY_VAR $minlevel 4>
debug "do some %s of level %d@\n" "debug" 4
#<End>
in
...
]}
*)

(** {6 Static Debug Preprocessor -- Syntax Documentation} *)

(**
The preprocessor {b ppdebug} is used whenever you want to add logs or computation
in your application (assert, etc...), but you do not want the code to be embedded in release mode.

{[
let g =
#<Debug>
print_endline "this is a log" ;
#<End>
5
]}

will be either
{[
let g =
(* #<Debug> *)
print_endline "this is a log" ;
(* #<End> *)
5
]}
or
{[
let g =
(* #<Debug> *)(*
print_endline "this is a log" ;
*)(* #<End> *)
5
]}
depending of the env var {b MLSTATE_PPDEBUG}, or on the tag used with ocamlbuild.

Note that you can also have a different code instead of nothing, using [#else]
{[
let g =
#<Debug>
print_endline "this is BIG BIG LOG" ;
print_endline "with so many details that I'd like to keep it only in debug mode" ;
#<Else>
print_endline "short log" ;
#<End>
5
]}

<!> The code should be totally recompiled with/without option PPDEBUG to make changes be taken in consideration.
For dynamic toggle behavior, cf the next part.

For other compile-time checks (eg. target-dependent code), you can use the directive [#<Ifstatic:VAR REGEXP>].
A check will be done by the preprocessor on environment variable [VAR] with the regexp [REGEXP], and comment
the unappropriate code:

{[
let build_arch =
#<Ifstatic:ARCH Win.*> "Windows" #<Else> "Other" #<End>
]}

will define [build_arch] to be ["Windows"] whenever a variable [ARCH] is defined with a value beginning with
["Win"]
*)

(** {6 Dynamic Debug Preprocessor -- Syntax Documentation} *)

(**
This preprocessor allows you to do some extra logs and computation without recompiling
everything with a different preprocess configuration, but assures you that your code will
not be embeded in release mode.

{[
let g =
#<If:MY_SPLENDID_VARIABLE>
print_endline "this is a log"
#<End> ;
5
]}

will be transformed in :
{[
let g =
(* #<If> *) if (DebugVariables.default) DebugVariables.my_splendid_variable then begin
print_endline "this is a log"
(* #<End> *) end else begin () end ;
5
]}
or if release-mode is activated :
{[
let g =
(* #<If> *)(* if (DebugVariables.default) DebugVariables.my_splendid_variable then begin
print_endline "this is a log"
(* #<End> *) end else *) begin () end ;
5
]}

Note that the [;] at the end is kept: the ppdebug-[#<If>] should be an ocaml expression.

You can find in this file all documented variables available.
You should add your variables there, and documenting it following the guidelines.

Extension of the test condition :

By default, we check that the env var is defined and doesn't have value ["0"] (test is [DebugVariables.default]).
You can use a different test using the following syntax :

{[
let g =
#<If:MY_SPLENDID_VARIABLE $equals "MY_SPLENDID_VALUE">
print_endline "this is a log"
#<End> ;
5
]}

processed as :

{[
let =
(* #<If> *) if (DebugVariables.equals "MY_SPLENDID_VALUE") DebugVariables.my_splendid_variable then begin
print_endline "this is a log"
(* #<End> *) end else begin () end ;
5
]}

Matching on debug variables :

If you have a multi-state debug variable, you can add a runtime-match as long as it's enclosed
in a [#<If$defined>] :

{[
let verb x =
#<If:MY_VERBOSE$defined> match DebugVariables.my_verbose with
| Some "quite verbose" -> print_debug x
| Some "very verbose" -> print_debug_very_verbose x
| _ -> failwith "Bad value for debug variable MY_VERBOSE"
#<End>
]}

Warnings :
+ <!> This preprocessor should not be used for top-level definitions.
+ <!> Such a preprocessed part is a Ocaml.expr, necessary of type [unit] if there is no [#<Else>]
+ <!> Remember that in release, you're always in the Else case. Keep this for debug !

You can find some tester available in this module.
You can add any tester you want editing this module, and following guidelines.
*)


(** {6 Variables} *)

(**
When you do lots of tests on the same debug-variable, you can use the shortcut:

{[
#<Debugvar:VAR>
]}

The [:VAR] in subsequent uses of [#<If>] can be omitted.

Guidelines :
+ all variables are documented in alphabetic order !!
+ all variable begin with {e MLSTATE_} when you export it in shell
+ all variable are UPPERCASED
+ all corresponding variable name in this file are lowercased and does not contains MLSTATE_
*)

(**
The type of all debug_var.
[None] if the variable is not defined, [Some value] if there is a value.

<!> Env variables are checked only once, when this module is loaded.
*)
type debug_var = string option

(**
{b MLSTATE_ADD_STDLIB}
Be verbose to explain what files are added, and what files are rejected
during the pass [AddStdlibFiles], in presence and in absence of option
[--no-embedded-stdlib]

Level 1: print only rejected files
Level 2: print only keeped files
Level 3: print both
*)
val add_stdlib : debug_var

(**
{b BADOP_DEBUG}
Adds some experimental options to servers related to badop modes.
*)
val badop_debug : debug_var

(**
{b MLSTATE_BSL_LOADING}
Use with level.
Be more verbose during loading.
1: plugins
*: undocumented
*)
val bsl_loading : debug_var

(**
{b MLSTATE_BSL_NO_RESTRICTION}
When set, disables restriction checks on bypasses.
Useful when recompiling printed code containing
such bypasses.
*)
val bsl_no_restriction : debug_var

(**
{b MLSTATE_BSL_PROJECTION}
Use with level, print some debug logs about external bypass
projection. (libbsl, backend, qmltop, etc...)
*)
val bsl_projection : debug_var

(**
{b MLSTATE_BSL_REGISTER}
Use with level. Be more verbose during building maps, and dealing
with keys. Used during bslregister.
*)
val bsl_register : debug_var

(**
{b MLSTATE_BSL_SL}
Use with level. Be more verbose during some operations implemented
in the ServerLib.
This happens at runtime, during projections.
*)
val bsl_sl : debug_var

(**
{b MLSTATE_BYPASS_HOISTING}
insert debug message during the bypass hoisting pass. Works with level.
Level 1 :
Level 2 :
*)
val bypass_hoisting : debug_var

(**
One variable to check them all !

If you dont spell correctly a debug variable by exporting it before running your application,
you may be surprised that the execution has not the expected behavior, and you may loose time until
you notice that it is because of a variable not correctly defined.

If (and only if) ["MLSTATE_CHECK_VARS"] is set with a value different than ["0"],
this module will do a check on the global process environment.
For each env variable starting with ["MLSTATE_"] which are not defined (and documented :))
in this module, a warning will be printed on the standard error.

Strong mode : [MLSTATE_CHECK_VARS="s"] will make an error rather than a warning, stopping the execution.
*)
val check_vars : debug_var

(** {9 Closure} *)

(**
{b MLSTATE_CLOSURE_DEBUG}
Works only for caml bypasses (with qmlflat only, but this could be fixed)
Level 0 : runtime assertions were typing is not possible
- qml closures actually have a compatible structure
- imported functions must be exported closures
Level 1 : previous +
tells when applying and receiving magic arguments (to check bsl projections)
Level 2 : previous +
tells when applying closures to arguments and show the resulting value (very verbose)
*)
val closure_debug : debug_var
val closure_opt : debug_var (** generate optimized applyX functions *)
val closure_stat : debug_var (** display a few statistics in the passes uncurry/closure *)

(** {9 Constant Sharing} *)

(**
Debug vars used for activating/desactivating some sharing during the passes client/server
constant sharing. Variable are read only if the pass is activated.
*)

val const_sharing_client_float : debug_var
val const_sharing_client_record : debug_var
val const_sharing_client_remove_coerce : debug_var
val const_sharing_client_string : debug_var

val const_sharing_server_float : debug_var
val const_sharing_server_record : debug_var
val const_sharing_server_remove_coerce : debug_var
val const_sharing_server_string : debug_var

(** {9 Cps} *)

(**
{b MLSTATE_CPS_DEBUG} :
insert debug introspection message to trace the execution flow of continuations.

<!> Note that CPS_DEBUG env var should also be set at runtime of the compiled
application for logs to be produced, with a given level.

<!> At compile time, the level is not read, everything is generated.

{[
export MLSTATE_CPS_DEBUG=1
// compile
// run
unset MLSTATE_CPS_DEBUG
// run without debug logs
// compile
// run without debug logs
export MLSTATE_CPS_DEBUG=1
// run without debug logs (need a recompilation)
]}

This var is used with increasing levels from 1 to 100 :
+ 1 : print a few things
+ 10 : cont tracer (print every cont application)
+ 100: backtraces display function arguments (WIP)
*)
val cps_debug : debug_var

(**
{b MLSTATE_CPS_KEEP_LETCONT} :
do not remove continuation directly applied. Used just for benchmark purpose.
*)
val cps_keep_letcont : debug_var

(**
{b MLSTATE_CPS_NOSKIP} :
do not use the skip optimisation. Used just for benchmark and tracability purpose.
*)
val cps_noskip : debug_var

(**
{b MLSTATE_STACK_TRACE}
When set, activates the printing of backtraces
If it contains "tr", then transaction contexts are printed
If it contains "th", then thread contexts are printed
If it contains "args", then fonction arguments are printed
*)
val cps_stack_trace : debug_var

(**
{b MLSTATE_CPS_VERBOSE} :
compile time only : let the cps rewriting pass be more verbose. Used with level.
No changes to the generated code, affect only the transformation pass.
+ Level 1 :
+ print some timing
+ Level 2 :
+ previous
+ print optimisation logs
*)
val cps_verbose : debug_var

(**
{b MLSTATE_CPS_BLOCKING_WAIT} :
Print blocking stack
*)
val cps_blocking_wait : debug_var

(** {b MLSTATE_DATABASE_RECONNECT}
Set up a delay in seconds for automatic reconnection when a database server is lost.
(if unset, never reconnect automatically)
*)
val database_reconnect : debug_var

(**
{b MLSTATE_DB3_NO_FINAL_SNAPSHOT}
When activated, when the database is closed, we do not make a snapshot of the current revision,
meaning that the transaction file will not be empty, and pending transaction reapplied at
reopen time.
This is used for debugging the binary format of transaction (or queries) because if we
always use a snapshot when we close the database, the transaction binary file is always empty.
*)
val db3_no_final_snapshot : debug_var

(**
{b MLSTATE_DB3_TRANSACTION_LIMIT}
Defines a limit of operations within a transaction, after which it is automatically aborted.
Default is 10000. This is a safeguard against exploding the memory by spamming a
transaction with too many writes. 0 disables the limit.
*)
val db3_transaction_limit : debug_var

(**
{b DbGen obscure toggles}
*)
(** run-time *)
val dbgen_always_upgrade : debug_var (** Force upgrade of incompatible databases when they are opened *)
val dbgen_butcher : debug_var (** When updating a field from an old db is not possible, remove and re-create *)

val dbgen_debug : debug_var (** Enables some compile-time debug messages, adds debug prints in the
generated code and, at run-time, dbGen-related debug messages *)
(** compile-time only: *)
val dbgen_flags : debug_var
  (** comma-separated list of flags for DbGen, compile-time:
- 'fullcoerce': put coerces almost everywhere. Useful for checks
- 'source': instead of normal fresh identifiers, insert "source" textual ones in
AST. Useful to manual checks from toplevel.
- 'nodefault': don't complain about missing default values, use by-default defaults.
- 'nolazy': disable lazy records
- 'sharing': enable full-sharing in the DB (enabled in db tests, temporary
disabled for now to workaround a bug in the low-level implementation
of copy-on-write)
- 'noflatten': don't flatten recursive types, store them as deep trees
- 'copylink': when flattening recursive types, link them with internal copy-nodes instead of link-nodes
*)


(**
{b MLSTATE_DEBUG_DB}
Enables debug messages from the low-level database
You can specify :
- a debug level (int): to display low level db debug
- 'migration': to display only migration debug
- 'io': to display only io debug

*)
val debug_db : debug_var

(**
{b MLSTATE_DEBUG_DB_INDEX}
Enables debug messages from the index handling in the database
*)
val debug_db_index : debug_var

(**
{b MLSTATE_DEBUG_DB_MAX_DELTA}
How many delta nodes are permitted between full nodes; 0 means all are full.
*)
val debug_db_max_delta : debug_var

(**
{b MLSTATE_DEBUG_PAXOS}
Enables debug messages for the Paxos algorithm (including leader election)
*)
val libnet_cluster : debug_var
val debug_paxos : debug_var
val debug_paxos_le : debug_var
val debug_paxos_rbr : debug_var
val debug_paxos_consensus : debug_var
val debug_paxos_sched : debug_var


(**
{b MLSTATE_DEBUG_XML}
Enables debug messages for Xml module (libbase)
*)
val debug_xml: debug_var

(**
{b MLSTATE_DIFFING}
Try to remove as much as possible any diff not due to the input of the compiler,
such as date, git sha, etc... for comparing the output of the compiler using
2 branches.

<!> This variable is also used in [generated_buildinfos.sh]
*)
val diffing : debug_var

(**
{b MLSTATE_EFFECTS_SHOW}
Show the types and effects as they are being inferred by QmlEffects
*)
val effects_show : debug_var

(**
{b Explicit Instantiation debug}
*)
val expl_inst_opt_debug : debug_var
 (** print debug info when inserting ExplInst directives *)
val expl_inst_debug : debug_var
 (** print debug info when eliminating ExplInst directives *)
val expl_inst_no_memo : debug_var
 (** deactive sharing of types and typeschemes generated by ty_to_opaty and tsc_to_opatsc *)
val expl_inst_normalize : debug_var
 (** 0: no normalization of type variables in types and typeschemes
1: no normalization of unbound type variables
other: full normalization
*)

(**
print debug info when generating and inserting typename (type_def_map registration).
*)
val expl_inst_typename : debug_var

(**
{b MLSTATE_HLNET_DEBUG}
*)
val hlnet_debug : debug_var
val hldir_debug : debug_var

(**
{b MLSTATE_HTTP_DEBUG}
*)
val http_debug : debug_var

(**
{b MLSTATE_HTTP_NO_COOKIE}
*)
val http_no_cookie : debug_var


(**
{b Javascript Compilation}
*)

(**
General debug information about the qmljsimp compiler
*)
val js_imp : debug_var

(**
Works with function name, and contains checker.
*)
val js_match_compilation : debug_var

(**
Do not apply the 'split' pass of JsPasses.
*)
val js_no_split : debug_var

(**
Do not optimize the call with the tailcall manager.
Used for debuging only, and getting a correct stack trace
with firebug.
The generated code will stack overflow in practice.
*)
val js_no_tailcall : debug_var

(**
Debug for the local renaming of qmljsimp only
*)
val js_renaming : debug_var

(**
Debuging the serialization of javascript from compiler to runtime.
*)
val js_serialize : debug_var

(**
{b Lambda lifting toggles}
*)
val lambda_debug : debug_var (** random stuff toggle *)
val lambda_coerce : debug_var (** adds explicit coercions in the code to check
the well-typedness of the code *)
val lambda_correct : debug_var (** check that the code is well lambda lifted
this is not really a postcondition since nobody cares if
[val f(x) = let g(y) = y in g] is transformed as
[val g(x,y) = y val f(x) = g(x)] but the lambda lifting
is not correct anyway
*)

(**
{b MLSTATE_LOW_LEVEL_DB_LOG}
When activated, the low level database will print disk writing related log in
'low_level_db.log' file.
*)
val low_level_db_log : debug_var

(**
{b MLSTATE_NO_ACCESS_LOG}
*)
val no_access_log : debug_var

(**
{b MLSTATE_NO_DATABASE_UPGRADE}
disables the database migration engine altogether,
_assuming the db has been generated with the exact same database definition_
*)
val no_database_upgrade : debug_var

(**
{b MLSTATE_NO_FLOOD_PREVENTION}
*)
val no_flood_prevention : debug_var

(**
{b MLSTATE_NO_SERVER_INFO}
Disable "starting" and "terminating" message
when using the scheduler.
*)
val no_server_info : debug_var

(**
{b MLSTATE_NO_FLOOD_PREVENTION}
*)
val no_flood_prevention : debug_var

(**
{b MLSTATE_NOCACHE}
Changes the HTTP header of responses to clients to prevent caching. Useful
when you debug your server and re-run it often
*)
val nocache : debug_var

(**
{b MLSTATE_OBJECT_DEBUG}
Various printing while loading/managing object files
*)
val object_debug : debug_var

(**
{b MLSTATE_OCAMLDEP_SHOW_LOGS}
Do not logs the ocamldep output in a file, but print it on
the console instead
*)
val ocamldep_show_logs : debug_var

(**
{b MLSTATE_OMANAGER_debug}
Replaces ansi escape by xml-like tags
*)
val omanager_debug : debug_var

(**
{b MLSTATE_OPACAPI_LOOSE}
Do not fail if somewhere during the compilation a lookup is done via [OpaMapToIdent]
on an ident which is not defined in opacapi.
*)
val opacapi_loose : debug_var

(**
{b MLSTATE_OPADOC}
Prints some information while generating opa documentation
*)
val opadoc : debug_var

(**
{b MLSTATE_OPATOP_ANNOT}
Combined with MLSTATE_OPATOP_EXPR:
will use the annotation printer for
printing expressions before evaluation.
Usefull in case of annot not found.
*)
val opatop_annot : debug_var

(**
{b MLSTATE_OPATOP_EXPR}
Print expressions before evaluation.
Usefull for using it in case of a segfault for example.
*)
val opatop_expr : debug_var

(**
{b MLSTATE_OPATOP_HOOK}
Print hook from the source code for tracing the flow of execution.
This variable is meant to be used for a better comprehension of the interpreter
*)
val opatop_hook : debug_var

(**
{b MLSTATE_OPATOP_UNVALREC}
Print the unvalrec used for evaluation.
*)
val opatop_unvalrec : debug_var


(**
{b MLSTATE_PARSER_CACHE_DEBUG}
Outputs whether there are cache hits or cache misses in the opa parser
*)
val parser_cache_debug : debug_var

(**
{b MLSTATE_PATTERNS_NORMALIZE}
Activating the pattern normalization.
*)
val patterns_normalize : debug_var

(**
{b MLSTATE_PATTERNS_REAL_PATAS}
Traduces opa patas into qml patas instead
of performing a duplication of code.

This will of course be the final behavior of the compiler,
but currently, the PatAs is still not implemented everywhere
in qml, so we can play with this debug var for debuging,
and completing the implementation of patas in qml.
*)
val patterns_real_patas : debug_var

(**
{b MLSTATE_PING_DEBUG}
Debug printing on ping loop system
*)
val ping_debug : debug_var

(**
The env var {b MLSTATE_PPDEBUG}
*)
val ppdebug : debug_var

(**
{b MLSTATE_PROTOCOL_DEBUG} Debug statements from DSL-generated code.
*)
val protocol_debug : debug_var

(**
{b MLSTATE_QMLC_NO_MAGIC} : during the cps-pass, do not insert magic functions.
The code may then not type check during ocaml compilation.
This env var is also used by the standard ML-back-ends.

This var is used essentially for debugging, to help to track
runtime seg-fault, because in some case it may come from a
bug introduced by a pass, and can be detected by the ocaml type
checker, but not in presence of too much magie.
*)
val qmlc_no_magic : debug_var

(**
{b MLSTATE_QMLTOP_TIME} : in qmltop, print the timing for each top level value
computation (typing and eval)
*)
val qmltop_time : debug_var

(**
{b MLSTATE_REDUNDANCY}
Sets the redundancy parameter of the distributed database
*)
val redundancy : debug_var

(**
{b MLSTATE_REORDER}
Debug QmlDependencies module (reorder passes)
*)
val reorder : debug_var

(**
{b MLSTATE_RPC_DEBUG}
[rpc_debug] Debug the Opa_InsertRemote module (ResolveRemoteCalls pass)
[rpc_alt_skeleton] Alternative implementation of skeletons
Activating this flag factorises the code produced
and should improve compilation time with neglectable
runtime hit
*)
val rpc_debug : debug_var
val rpc_alt_skeleton : debug_var

(**
{b Debug on SurfaceAst passes}
*)
val sa_dependencies : debug_var (** for the debug of the reordering algorithm *)
val sa_printer_annot : debug_var (** to print the annotations while printing asts *)
val sa_printer_ty : debug_var (** to print the directive types while printing asts *)
val sa_trx : debug_var (** print the code of the parsers after they were rewritten *)
val sa_xml_pattern : debug_var (** print the ast of the xml patterns that is being rewritten *)

(**
{b MLSTATE_SESSION_DEBUG}
*)
val session_debug : debug_var

(**
{b MLSTATE_SCHEDULER_DEBUG}
*)
val scheduler_debug : debug_var

(**
{b MLSTATE_SERVER_SERIALIZE}
*)
val server_serialize : debug_var

(**
{b MLSTATE_SERVER_STATS}
Controls whether to (collect and) print server statistics upon
server termination.
*)
val server_stats : debug_var

(**
{b MLSTATE_SHOW_LOGS}
If set, all Logger logs will be output on stderr
Consequently, no logs will be output in files
*)
val show_logs : debug_var (** show all logs on stderr *)

(**
{b Pass_SimplifyMagic}
*)
val simplifymagic_disable : debug_var (** don't specialize any identifier *)
val simplifymagic_failures : debug_var (** show specializable identifiers that weren't specialized *)

(**
{b Slicer debug}
*)
val slicer_cond : debug_var (** checks slicer precondition and postcondition *)
val slicer_debug : debug_var (** ?? *)
val slicer_time : debug_var (** shows where the time of the slicing pass is spent *)

(**
{b MLSTATE_SSL_DEBUG}
*)
val ssl_debug : debug_var

(**
{b MLSTATE_TESTING}
This is set by the reftester. Only use to disable the printing of some
messages that are normally useful but very troublesome for the stability
of refs (eg. database locations...).
*)
val testing : debug_var

(**
{b MLSTATE_TYPER}
Works with level.
Debugging the type checker.
*)
val typer : debug_var

(**
{b MLSTATE_RESOURCE_TRACKER_DEBUG}
*)
val resource_tracker_debug : debug_var


(**
{b MLSTATE_WEBLIB_DEBUG}
*)
val weblib_debug : debug_var (** takes a level *)

(**
{b BADOP_XML_IMPORT_COMMIT_TRANSACTION_STEP}
Only used by db3/Xml_import, to decide the frequency of commits.
*)
val badop_xml_import_commit_transaction_step : debug_var


(** {6 Variables Testers} *)

(**
Variables tester are used to extend the macro [#<If>] of the ppdebug.
You can acces them by using the following syntax :
[#<If:MYVAR $tester args>]
where args is some optional arguments.

The meaning of this is that the corresponding tester is applied to all the
given arguments, and finally to the value of the debug_var,
returning a bool indicating what part of the control structure should
be executed.

Note :
You can also used inline tester in your code, but it is not recommanded (remember,
that must fit on the same line)
*)

(**
The type of all testers
*)
type debug_tester = debug_var -> bool

(** the default tester.
[#<If:MYVAR>] : returns [true] if and only if the variable is defined and doesn't have value "0" *)
val default : debug_tester

(**
the negation of the default tester.
[#<If:MYVAR $null>] : returns [true] if and only if the variable is undefined or have value "0"
*)
val null : debug_tester

(** the defined tester.
[#<If:MYVAR$defined>] : returns [true] if and only if the variable is defined *)
val defined : debug_tester

(**
the undefined tester.
[#<If:MYVAR $undefined>] : returns [true] if and only if the variable is undefined
*)
val undefined : debug_tester

(** the toggle tester.
[#<If:MYVAR$toggle>] : returns [true] if and only if the variable is set to ["1"] *)
val toggle : debug_tester

(** the equals tester.
[#<If:MYVAR $equals "VALUE">] : returns [true] if and only if the variable is set to ["VALUE"] *)
val equals : string -> debug_tester

(** the level tester :
[#<If:MYVAR $level fct>] : returns [true] if and only if the variable is set to an int
value [n], and [fct n] returns [true] *)
val level : (int -> bool) -> debug_tester

(**
A specific level.
[#<If:MYVAR $islevel 42>] : returns [true] if and only if the variable is set to "42"
*)
val islevel : int -> debug_tester

(** the maxlevel tester :
[#<If:MYVAR $maxlevel n>] : like [#<If: MYVAR $level (fun i -> i <= n)>] *)
val maxlevel : int -> debug_tester

(** the minlevel tester :
[#<If:MYVAR $minlevel n>] : like [#<If: MYVAR $level (fun i -> i >= n)>] *)
val minlevel : int -> debug_tester

(** the contains tester :
checks that the given string is included in the environment variable *)
val contains : string -> debug_tester

(**
free debug_tester, for complex conditions
*)
val cont : debug_tester -> debug_tester

(** checks that the environment variable is included in the given string *)
val is_contained : string -> debug_tester

(** contents of the variable is taken as a comma-separated list; checks if
the given flag exists in this list *)
val flag : string -> debug_tester
Something went wrong with that request. Please try again.