title: Cannot set breakpoint in ocamldebug: "Can't find any event there."
body: <p>I'm using ocamldebug (with OCaml 4.02.1), and I'm trying to set a breakpoint somewhere inside a specific module, but all I get is a mildly useful error message: <code>Can't find any event there.</code></p>
  
  <p>As an example, here's an extract of a function<sup>1</sup> where I'd like to set a breakpoint, as listed by ocamldebug:</p>
  
  <pre><code>(ocd) list Value.Eval_slevel 79 83
  79
  80    let slevel stmt = match slevel with
  81      | Per_stmt_slevel.Global i -&gt; i
  82      | Per_stmt_slevel.PerStmt f -&gt; f stmt
  83
  </code></pre>
  
  <p>I tried several variants of the <code>break</code> command, but I got the same result every time:</p>
  
  <pre><code>(ocd) break @ Value.Eval_slevel 80       // module + line number
  Can't find any event there.
  (ocd) break @ Value.Eval_slevel 80 21    // module + line + column
  Can't find any event there.
  (ocd) break @ Value.Eval_slevel # 3335   // module + character number
  Can't find any event there.
  </code></pre>
  
  <p>I also tried nearby source lines (to check for possible line mismatches), and I also tried using module synonyms (e.g. <code>Eval_slevel</code>, <code>eval_slevel</code>), but to no avail.</p>
  
  <p>Note that, if I manually step the program until it reaches this function, it shows that there is indeed an event at line 80:</p>
  
  <pre><code>Time: 17447400 - pc: 3865360 - module Value.Eval_slevel
  80    let slevel stmt = &lt;|b|&gt;match slevel with
  </code></pre>
  
  <p>And, in this case, I can manually set a local breakpoint:</p>
  
  <pre><code>(ocd) break
  Breakpoint 1 at 3865360: file src/value/eval_slevel.ml, line 80,
    characters 22-119
  </code></pre>
  
  <p>But obviously the idea is to be able to do it without having to manually find it.</p>
  
  <p>If I try setting the breakpoint using the function name, ocamldebug cannot see it. Even after running the program past that event, the identifier does not seem visible to ocamldebug:</p>
  
  <pre><code>(ocd) break Value.Eval_slevel.slevel
  Unbound identifier Value.Eval_slevel.slevel
  </code></pre>
  
  <p>Is that the reason why I cannot set the breakpoint? If so, is there a workaround? Otherwise, is there another way to set these breakpoints?</p>
  
  <p><strong>Notes</strong></p>
  
  <p>Here are some other things I tried doing, and some observations:</p>
  
  <ul>
  <li>Setting breakpoints on similar files and functions: I also obtain <code>Can't find any event there.</code>, but there are files in which it does work.</li>
  <li>The error is not due to an incorrect module name, otherwise ocamldebug responds with <code>No source file for &lt;module&gt;</code>.</li>
  <li>The error is not due to a non-existing line number, otherwise it says <code>Position out of range.</code></li>
  <li>The error is not a module initialization issue, since the message in this case is: <code>The module path &lt;module&gt; is not yet initialized. Please run program forward until its initialization code is executed.</code></li>
  </ul>
  
  <p><sup>1</sup> This example comes from Frama-C and it is reproducible, in case someone would be interested. However I could not produce a minimal example outside of that code base.</p>