# Interrupting and debugging an OCaml process

**URL:** <https://discuss.ocaml.org/t/interrupting-and-debugging-an-ocaml-process/15523>\
**Category:** Learning\
**Created:** [October 29, 2024, 7:38am UTC](https://discuss.ocaml.org/t/interrupting-and-debugging-an-ocaml-process/15523 "2024-10-29T07:38:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrianGMilnes](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@BrianGMilnes](https://discuss.ocaml.org/u/BrianGMilnes)\
**Post date:** [October 29, 2024, 7:38am UTC](https://discuss.ocaml.org/t/interrupting-and-debugging-an-ocaml-process/15523/1 "2024-10-29T07:38:06Z")

</div>

Occasionally an OCaml process in our use runs away. I can hit both  
a byte compiled and a native compiled version of it with a signal and get a core dump (on Ubuntu 22+).

But I can’t read anything from a byte compiled core file in ocamldebug nor a native in gdb.

Is this possible and if so how?

---

<div class="post-metadata">

**Author:** ![lambda\_foo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/lambda_foo/32/275_2.png) [@lambda\_foo](https://discuss.ocaml.org/u/lambda_foo)\
**Post date:** [October 30, 2024, 12:46am UTC](https://discuss.ocaml.org/t/interrupting-and-debugging-an-ocaml-process/15523/2 "2024-10-30T00:46:17Z")

</div>

I’d be surprised if there is a tool to reconstruct the bytecode compiled core dump. Essentially you’re running the bytecode machine (written in C) interpreting the OCaml bytecode. To use the bytecode debugger `ocamldebug` you’d need to launch your process from within the debugger.

For GDB it should be possible to work with a native compiled program. It would need to be compiled with `-g` to include debug information. Which version of OCaml are you using?

Another option would be using `perf` CPU profiling to see where it’s spending all its time. A busy loop would turn up in the flame graph of time spent.
