mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
ocamldebug section in the README (#249)
add `ocamldebug` instruction section to the README
This commit is contained in:
parent
d9555ae063
commit
c70825b250
1 changed files with 36 additions and 0 deletions
36
README.md
36
README.md
|
|
@ -112,6 +112,42 @@ See issues
|
|||
[#196](https://github.com/c-cube/ocaml-containers/issues/196),
|
||||
[#197](https://github.com/c-cube/ocaml-containers/issues/197)
|
||||
|
||||
## Debugging with `ocamldebug`
|
||||
|
||||
To print values with types defined in `containers` in the bytecode debugger,
|
||||
you first have to load the appropriate bytecode archives. After starting a
|
||||
session, e.g. `ocamldebug your_program.bc`,
|
||||
|
||||
```
|
||||
# load_printer containers_monomorphic.cma
|
||||
# load_printer containers.cma
|
||||
```
|
||||
|
||||
For these archives to be found, you may have to `run` the program first. Now
|
||||
printing functions that have the appropriate type `Format.formatter -> 'a ->
|
||||
unit` can be installed. For example,
|
||||
|
||||
```
|
||||
# install_printer Containers.Int.pp
|
||||
```
|
||||
|
||||
However, printer combinators are not easily handled by `ocamldebug`. For
|
||||
instance `# install_printer Containers.(List.pp Int.pp)` will *not* work out of
|
||||
the box. You can make this work by writing a short module which defines
|
||||
ready-made combined printing functions, and loading that in ocamldebug. For
|
||||
instance
|
||||
|
||||
```ocaml non-deterministic=command
|
||||
module M = struct
|
||||
let pp_int_list = Containers.(List.pp Int.pp)
|
||||
end
|
||||
```
|
||||
|
||||
loaded via `# load_printer m.cmo` and installed as `# install_printer
|
||||
M.pp_int_list`.
|
||||
|
||||
|
||||
|
||||
## Change Log
|
||||
|
||||
See [this file](./CHANGELOG.adoc).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue