Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 57 lines (36 sloc) 1.859 kb
38e0c5f oops
Jake Donham authored
1 # OCaml backtrace patch 0.5
35f005a edits
Jake Donham authored
2
3 This is a patch to OCaml to show backtraces in the toplevel and from
8fc53b1 edits
Jake Donham authored
4 dynamically loaded code. For OCaml 3.10.x, it adds `Printexc`
5 functions for recording backtraces which are similar to the 3.11.x
6 ones.
fc04d89 install / use instructions
Jake Donham authored
7
8 Debugging information is loaded when code is loaded (stock OCaml loads
9 it only when a backtrace is generated), so the memory footprint may be
10 bigger. However it is allocated outside the heap so won't be copied
11 after a fork.
12
13 This doesn't work with dynamically loaded native code or the native
14 code toplevel.
15
16
38e0c5f oops
Jake Donham authored
17 ## To install:
fc04d89 install / use instructions
Jake Donham authored
18
8fc53b1 edits
Jake Donham authored
19 1. unpack your OCaml tree and `cd` into it
fc04d89 install / use instructions
Jake Donham authored
20
21 2. from there, run `$PATCH/patch.sh` where `$PATCH` is the path where
22 you unpacked the patch code
23
24 3. build OCaml as usual
25
26
38e0c5f oops
Jake Donham authored
27 ## To use (OCaml 3.11.x):
fc04d89 install / use instructions
Jake Donham authored
28
35f005a edits
Jake Donham authored
29 1. Call `Printexc.record_backtrace true` (or pass `-b` or
30 `OCAMLRUNPARAM=b` to ocamlrun) to start recording backtraces.
fc04d89 install / use instructions
Jake Donham authored
31
32 2. Call `Printexc.get_backtrace ()` to get a backtrace, before
33 another exception is raised.
34
35 3. From the toplevel, you can say `#record_backtrace true` (which
8fc53b1 edits
Jake Donham authored
36 calls `Printexc.record_backtrace`).
fc04d89 install / use instructions
Jake Donham authored
37
38 4. From the toplevel, you can say `#debug true` to get backtraces for
39 code typed at the prompt or run with `#use`. Code typed at the
40 prompt doesn't have useful line numbers though.
41
42
38e0c5f oops
Jake Donham authored
43 ## To use (OCaml 3.10.x):
fc04d89 install / use instructions
Jake Donham authored
44
35f005a edits
Jake Donham authored
45 1. Call `Printexc.capture_backtrace true` (or pass `-b` or
46 `OCAMLRUNPARAM=b` to ocamlrun) to start recording backtraces.
fc04d89 install / use instructions
Jake Donham authored
47
48 2. Call `Printexc.sprint_backtrace buf` to print a backtrace into a
49 buffer, before another exception is raised.
50
51 3. From the toplevel, you can say `#capture_backtrace true` (which
8fc53b1 edits
Jake Donham authored
52 calls `Printexc.capture_backtrace`).
fc04d89 install / use instructions
Jake Donham authored
53
54 4. From the toplevel, you can say `#debug true` to get backtraces for
55 code typed at the prompt or run with `#use`. Code typed at the
56 prompt doesn't have useful line numbers though.
Something went wrong with that request. Please try again.