* Introducing codefrag: a new runtime module to work with code fragments
This module collects all the operations on code fragments performed in
various places of the runtime systems. Applies both to bytecode and
to native code.
The implementation is based on skiplists, so that "lookup fragment by
PC" and "lookup fragment by number" are efficient (logarithmic in the
number of code fragments). "Lookup fragment by digest" remains
linear-time.
The new module also improves the handling of digests: now it is
possible to mark a code fragment as "no digest" i.e. not marshal-able.
* Use the new "codefrag" runtime module for marshaling and for the
debugger interface
Replace the previous handling of code fragments with calls to the
functions provided by the "codefrag" runtime module.
The instrumentation code in the instrumented runtime was replaced
with new APIs to gather runtime statistics and output them in a new format
(Common Trace Format).
This commit also exposes new functions in the Gc module to pause or resume
instrumentation during a program execution (Gc.eventlog_pause and
Gc.eventlog_resume).
Process IDs such as returned by `getpid()` are of type `pid_t`,
which can be `int` but can be any other signed integer type.
For example it's `long` in Solaris.
Printing a `pid_t` with a `%d` format is therefore incorrect and
causes an error in Solaris.
This commit casts to type `long long` and prints as `%lld`.
This commit adds dynlink support for ocamldebug. As a side effect, it also:
- factorizes the various functions searching for a code fragment into one,
called [caml_find_code_fragment];
- removes the [caml_register_code_fragment], which does not seem to
be used anywhere, and which clearly should not be used by external code.
This makes it possible to get a core dump in case of a fatal error,
which makes debugging easier.
This also
- turns a use of exit(2) to call to caml_fata_error
- replaces some uses of caml_fatal_error to a call to exit(127), when
the error results in misuse of the runtime
- removes some useless calls to exit(-1)