# Function breakpoint in ocamldebug

**URL:** <https://discuss.ocaml.org/t/function-breakpoint-in-ocamldebug/16729>\
**Category:** Learning\
**Tags:** debugging\
**Created:** [May 29, 2025, 6:20am UTC](https://discuss.ocaml.org/t/function-breakpoint-in-ocamldebug/16729 "2025-05-29T06:20:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joelreymont](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/joelreymont/32/5937_2.png) [@joelreymont](https://discuss.ocaml.org/u/joelreymont)\
**Post date:** [May 29, 2025, 6:20am UTC](https://discuss.ocaml.org/t/function-breakpoint-in-ocamldebug/16729/1 "2025-05-29T06:20:45Z")

</div>

I can set a breakpoint in a given module with `break @ Nanocaml__Driver 40`.

How do I set a breakpoint in function in the same module, though?

---

<div class="post-metadata">

**Author:** ![waleedmebane](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/waleedmebane/32/4385_2.png) [@waleedmebane](https://discuss.ocaml.org/u/waleedmebane)\
**Post date:** [May 29, 2025, 6:40am UTC](https://discuss.ocaml.org/t/function-breakpoint-in-ocamldebug/16729/2 "2025-05-29T06:40:47Z")

</div>

AFAIK, one can only set a breakpoint at a function of a module when code is executing in that module already. So, for exanple, if your existing break point is reached, at that time, you can set a breakpoint for any of the other functions in that module using `break <function_name>`.

That’s the only way I’ve gotten it to work. If there is another way, I’m interested in hearing it too.

I just looked at the documentation. It reads (w.r.t. setting a breakpoint at a function), “This works only when the functional value of the identifier function has been computed and assigned to the identifier.”

So, that might imply that what I said works only for functions at global scope (and that my advice is in other ways crude/inaccurate).
