Load the debug information during runtime startup if OCAMLRUNPARAM=b=2.
This guards against the specific case of running out of fds, since the
debug information can't then be loaded.
Printexc.uncaught_exception_handler ceases to be an option ref and becomes
a ref to the handler function initialized to
Printexc.default_uncaught_exception_handler.
fixes#7156
Two new functions exposed:
```ocaml
val to_string_default: exn -> string
(** [Printexc.to_string_default e] returns a string representation of the
exception [e], ignoring all registered exception printers.
@since 4.09
*)
val use_printers: exn -> string option
(** [Printexc.use_printers e] returns [None] if there are no registered
printers and [Some s] with else as the resulting string otherwise.
@since 4.09
*)
```
* Add an Extension_constructor submodule to Obj.
Deprecate top-level functions extension_constructor / extension_name /
extension_id.
* Add 'true' and 'false' to the definition of Bool.t
* Add aliases for the built-in 'list' and 'array' types.
* Add an alias for 'exn' to Printexc.
* Changes entry: built-in type aliases
* Add a Unit module.
* Add paths for built-in exceptions.
- inline Pervasives in Stdlib and re-add Pervasives as a deprecated
module that aliases all elements of Stdlib except the stdlib modules.
- remove special case for Stdlib.Pervasives in printtyp.ml
This reverts commit 5adf895aac, reversing
changes made to 38c3db40c7.
The reason for the revert is a continuous integration failure on 32bit
arm machines. I don't have the time (or capabilities) to investigate
it right now, and we need functional continuous testing for other
upcoming merges, so the safest choice is to revert -- and hopefully
merge back after the issue is fixed.
It reraises an exception just after copying the given backtrace to the
backtrace buffer. The C primitive `caml_restore_raw_backtrace` only does
the copying part, the compiler adds the reraise.
- The internal [backtrace_slot] type is not exposed anymore, instead
accessors function return orthogonal information
(is_raise, location). This is both more extensible and more
user-friendly.
- The [raw_backtrace_slot] is exposed separately as a low-level type
that most users should never use. The unsafety of marshalling is
documented. Instead of defining
[raw_backtrace = raw_backtrace_slot array], I kept [raw_backtrace]
an abstract type with [length] and [get] functions for
random-access. This should allow us to change the implementation in
the future to be more robust wrt. marshalling (boxing the trace in
a Custom block, or even possibly the raw slots at access time).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14784 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Patch by Jacques-Henri Jourdan)
There are several changes:
- `raw_backtrace` is no longer an abstract type, but rather an
`raw_backtrace_slot array`, where `raw_backtrace_slot` is a new
abstract type. `raw_backtrace_slot` elements are hashable and
comparable. At runtime, values of this type contain either
a bytecode pointer or a frame_descr pointer. In order to prevent the
GC from walking through this pointer, the low-order bit is set to
1 when stored in the array.
- The old `loc_info` type is know public, renamed into `backtrace_slot`:
type backtrace_slot =
| Known_location of bool (* is_raise *)
* string (* filename *)
* int (* line number *)
* int (* start char *)
* int (* end char *)
| Unknown_location of bool (*is_raise*)
- new primitive :
val convert_raw_backtrace_slot: raw_backtrace_slot -> backtrace_slot
Rather than returning an option, it raises Failure when it is not
possible to get the debugging information. It seems more idiomatic,
especially because the exceptional case cannot appear only for a part
of the executable.
- the caml_convert_raw_backtrace primitive is removed; it is more
difficult to implement in the C side because of the new exception
interface described above.
- In the bytecode runtime, the events are no longer deserialized once
for each conversion, but once and for all at the first conversion,
and stored in a global array (*outside* the OCaml heap), sorted by
program counter value. I believe this information should not take
much memory in practice (it uses the same order of magnitude memory
as the bytecode executable). It also makes location lookup much more
efficient, as a dichomoty is used instead of linear search as
previously.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14776 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
of size 2, with tag = Object_tag, the first field being the pointer to the string, and second one being a unique id, generated
from the same sequence as for object values. Special case for predefined exceptions, represented with a negative id.
The unique id generator is moved from camlinternalOO to the C runtime system.
Also fix some bugs.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14239 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02