PR#4880: document how to get backtraces when embedding Caml native code inside C.

Updates concerning the various ports (no more Alpha, etc).


git-svn-id: http://caml.inria.fr/svn/ocamldoc/trunk@11892 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 2011-12-20 10:44:20 +00:00
parent b6e93568cb
commit 4900e0f585
3 changed files with 22 additions and 20 deletions

View File

@ -1455,15 +1455,23 @@ compilation of OCaml, as the variables "BYTECCLINKOPTS"
-output-obj"). Currently, the only ports that require special
attention are:
\begin{itemize}
\item Alpha under Digital Unix / Tru64 Unix with "gcc":
object files produced by "ocamlc -output-obj" must be linked with the
"gcc" options "-Wl,-T,12000000 -Wl,-D,14000000".
This is not necessary for object files produced by "ocamlopt -output-obj".
\item Windows NT: the object file produced by OCaml have been
compiled with the "/MD" flag, and therefore all other object files
linked with it should also be compiled with "/MD".
\item Windows with the MSVC compiler: the object file produced by
Objective Caml have been compiled with the "/MD" flag, and therefore
all other object files linked with it should also be compiled with
"/MD".
\end{itemize}
\paragraph{Stack backtraces.} When OCaml bytecode produced by
"ocamlc -g" is embedded in a C program, no debugging information is
included, and therefore it is impossible to print stack backtraces on
uncaught exceptions. This is not the case when native code produced
by "ocamlopt -g" is embedded in a C program: stack backtrace
information is available, but the backtrace mechanism needs to be
turned on programmatically. This can be achieved from the OCaml side
by calling "Printexc.record_backtrace true" in the initialization of
one of the Caml modules. This can also be achieved from the C side
by calling "caml_record_backtrace(Val_int(1));" in the Caml-C glue code.
\section{Advanced example with callbacks}
\pdfsection{Advanced example with callbacks}

View File

@ -258,7 +258,7 @@ compile-time and at link-time. Linking object files not compiled with
information about the profiles.
Full support for "gprof" is only available for certain platforms
(currently: Intel x86/Linux and Alpha/Digital Unix).
(currently: Intel x86 32 and 64 bits under Linux, BSD and MacOS X).
On other platforms, the "-p" option will result in a less precise
profile (no call graph information, only a time profile).
\end{unix}
@ -539,17 +539,11 @@ platform used:
(MS Windows 64 bits).
\end{itemize}
\item On IA32 processors only (Intel Pentium, AMD Athlon, etc, in
32-bit mode), some intermediate results in floating-point computations
are kept in extended precision rather than being rounded to double
\item On IA32 processors only (Intel and AMD x86 processors in 32-bit
mode), some intermediate results in floating-point computations are
kept in extended precision rather than being rounded to double
precision like the bytecode compiler always does. Floating-point
results can therefore differ between bytecode and native code; in
general, the results obtained with native code are ``more exact''
(less affected by rounding errors and loss of precision).
\item On the Alpha processor only, floating-point operations involving
infinite or denormalized numbers can abort the program on a
``floating-point exception'' signal.
results can therefore differ slightly between bytecode and native code.
\end{itemize}

View File

@ -146,8 +146,8 @@ The output of "gprof" is described in the Unix manual page for
"gprof(1)". It generally consists of two parts: a ``flat'' profile
showing the time spent in each function and the number of invocation
of each function, and a ``hierarchical'' profile based on the call
graph. Currently, only the Intel x86/Linux and Alpha/Digital Unix
ports of "ocamlopt" support the two profiles. On other platforms,
graph. Currently, only the Intel x86 ports of "ocamlopt" under
Linux, BSD and MacOS X support the two profiles. On other platforms,
"gprof" will report only the ``flat'' profile with just time
information. When reading the output of "gprof", keep in mind that
the accumulated times computed by "gprof" are based on heuristics and