Up

module Debug

: sig
include module type of Core_kernel.Debug
#
val am : Core_kernel.Std.Source_code_position.t -> unit

am, ams, and amf output a source code position and backtrace to stderr. amf accepts a printf-style format string. ams accepts a message, value, and sexp converter for that value. Typical usage looks like:

      ...;
      Debug.am _here_;
      ...;
      Debug.amf _here_ "hello (%s, %s)" (X.to_string x) (Y.to_string y);
      ...;
      Debug.ams _here_ "hello" (x, y) <:sexp_of< X.t * Y.t >>;
      ...;

The am* functions output source code positions in the standard format "FILE:LINE:COL", which means that one can use a tool like emacs grep-mode on a buffer containing debug messages to step through one's code by stepping through the messages.

#
val ams : Core_kernel.Std.Source_code_position.t -> string -> 'a -> ('a -> Core_kernel.Std.Sexp.t) -> unit
#
val amf : Core_kernel.Std.Source_code_position.t -> ('r, unit, string, unit) Pervasives.format4 -> 'r
#
val should_print_backtrace : bool Pervasives.ref

should_print_backtrace governs whether the am* functions print a backtrace.

end