| 1 | Debugging from Rocq toplevel using OCaml toplevel |
| 2 | ====================================================== |
| 3 | |
| 4 | 1. Launch bytecode version of Rocq (`dune exec -- rocq repl-with-drop`) |
| 5 | 2. Access OCaml toplevel using vernacular command `Drop.` |
| 6 | 3. Use `#trace` to tell which function(s) to trace, |
| 7 | or type any other OCaml toplevel commands or OCaml expressions |
| 8 | 4. Go back to Rocq toplevel with `#quit;;` or `#go;;` |
| 9 | 5. Test your Rocq command and observe the result of tracing your functions |
| 10 | 6. Freely switch from Rocq to OCaml toplevels with `Drop.` and `#quit;;`/`#go;;` |
| 11 | |
| 12 | > [!NOTE] |
| 13 | > To access plugin modules in the OCaml toplevel, you have to |
| 14 | > use names such as `Ltac_plugin__Tacinterp`. |
| 15 | |
| 16 | > [!TIP] |
| 17 | > To remove high-level pretty-printing features (coercions, |
| 18 | > notations, ...), use `Set Printing All`. It will affect the `#trace` |
| 19 | > printers too. |
| 20 | |
| 21 | |
| 22 | Debugging with ocamldebug from Emacs or command line |
| 23 | ==================================================== |
| 24 | |
| 25 | See [build-system.dune.md#ocamldebug](build-system.dune.md#ocamldebug) |
| 26 | |
| 27 | Global gprof-based profiling |
| 28 | ============================ |
| 29 | |
| 30 | Rocq must be configured with option `-profile`. |
| 31 | |
| 32 | 1. Run native Rocq which must end normally (use `Quit` or option `-batch`) |
| 33 | 2. `gprof ./coqtop gmon.out` |
| 34 | |
| 35 | Per function profiling |
| 36 | ====================== |
| 37 | |
| 38 | See the documentation in `lib/newProfile.mli`. |