Up

Module Debug = Core_kernel.Debug

Signature

val eprint : string -> unit

eprint message prints to stderr message, followed by a newline and flush. This is the same as prerr_endline.

val eprints : string -> 'a -> ('a -> Sexplib.Sexp.t) -> unit

eprints message a sexp_of_a prints to stderr message and a as a sexp, followed by a newline and flush.

val eprint_s : Sexplib.Sexp.t -> unit

eprint_s sexp prints sexp to stderr, followed by a newline and a flush.

val eprintf : ('r, unit, string, unit) Pervasives.format4 -> 'r

eprintf message arg1 ... argn prints to stderr message, with sprintf-style format characters instantiated, followed by a newline and flush.

module Make () : sig .. end
Debug.Make produces a debug function used to wrap a function to display arguments before calling and display results after returning.

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.Source_code_position.t -> string -> 'a -> ('a -> Sexplib.Sexp.t) -> unit
val amf : Core_kernel.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.