#5899: expose Printexc.get_callstack. (Cherry-picked 13884, 13885 from trunk.)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13886 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2013-07-11 12:37:10 +00:00
parent 2602e82995
commit 7334bb026a
3 changed files with 20 additions and 1 deletions

View File

@ -54,10 +54,13 @@ Compilers:
- PR#5571: incorrect ordinal number in error message
Standard library:
- PR#5899: expose a way to inspect the current call stack
(Printexc.get_callstack)
- PR#5986: new flag Marshal.Compat_32 for the serialization functions
(Marshal.to_*), forcing the output to be readable on 32-bit hosts.
- Add optimized composition operators |> and @@ in Pervasives
Runtime system:
* PR#6019: more efficient implementation of caml_modify() and caml_initialize().
The new implementations are less lenient than the old ones: now,

View File

@ -165,3 +165,6 @@ external backtrace_status: unit -> bool = "caml_backtrace_status"
let register_printer fn =
printers := fn :: !printers
external get_callstack: int -> raw_backtrace = "caml_get_current_callstack"

View File

@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(** Facilities for printing exceptions. *)
(** Facilities for printing exceptions and inspecting current call stack. *)
val to_string: exn -> string
(** [Printexc.to_string e] returns a string representation of
@ -99,3 +99,16 @@ type raw_backtrace
val get_raw_backtrace: unit -> raw_backtrace
val print_raw_backtrace: out_channel -> raw_backtrace -> unit
val raw_backtrace_to_string: raw_backtrace -> string
(** {6 Current call stack} *)
val get_callstack: int -> raw_backtrace
(** [Printexc.get_callstack n] returns a description of the top of the
call stack on the current program point (for the current thread),
with at most [n] entries. (Note: this function is not related to
exceptions at all, despite being part of the [Printexc] module.)
@since 4.01.0
*)