Up

Module Low_level_debug

Signature

val stop_upon_sigbus : unit -> unit
val stop_upon_sigsegv : unit -> unit
val stop_upon_sigpipe : unit -> unit
val stop_upon_exit : unit -> unit
val stop_me_now : unit -> unit
val segfault_me_now : unit -> unit
val start_canary_thread : max_wait:Core.Std.Time.Span.t -> check_interval:Core.Std.Time.Span.t -> unit

A canary thread starts two threads, one in caml and one in C. The caml thread tries to take the caml lock every check_interval, and immediately releases it once it succeeds. The C thread checks that your thread is getting the caml lock within max_wait, and if it isn't it stops the program (see stop_me_now). You can then inspect your program with gdb and hopefully determine what caused it to block. It is safe to continue a program stopped by the canary thread, though there is no special handling in the canary thread to support this, so it may stop your program again. If you do manage to continue, the canary thread should continue to work.

It is not safe to call this function more than once, in a given program an exception will be raised if you do (but a second canary will not be started).

val obj_to_sexp : 'a -> Core.Std.Sexp.t

Obtain a sexp representation of any type. Note that this will likely infinite-loop and overflow the stack for any value whose structure is circularly recursive.

val obj_to_string : 'a -> string

Obtain a string representation of any type. Note that this will likely infinite-loop and overflow the stack for any value whose structure is circularly recursive.