[ANN] ocamlearlybird 1.0.0 beta1

I still wasn’t able to use this. I tried several projects, different systems, but everytime I start a debug session on VSCode nothing happens, the program doesn’t run, the buttons do nothing, no stack variables shown.

Have you installed earlybird on opam? And what will output if you exec ocamlearlybird in your shell?

I have it installed. When I start the debug session it runs the ocamlearlybird command in the integrated terminal but nothing happens and no output is given.

You may installed the old version. Please do opam update and opam upgrade earlybird.

The earlybird version I have installed is the latest one.

OCaml 4.11 is the only supported version. Do you use other versions?

Run ocamlearlybird serve --verbosity=debug --port=4712 on your shell. And add debugServer: 4712 to your launch configration.

Paste logs of ocamlearlybird here, then I can see what happened.

Yes, I’m using 4.11. Here you have the logs ocamlearlybird: [INFO] Debug adapter server listening at port 4712ocamlearlybi - Pastebin.com
It seems that he’s connecting and even pausing at breakpoints, but in the interface nothing happens. It says the call stack is paused on entry, and shows no variables nor call stack.

A stupid guess: there are two “OCaml Debugger” extensions by hackwaly; could it be you have the wrong one? (iiuc, the one with no icon and less downloads is the right one)

1 Like

I see it paused at entry. Do next or run button have no effects? “Stop on entry” is a bit different from other debuggers. It didn’t run any instruction and give you a chance to peek loaded modules and set breakpoints on them. So no callstacks and variables is expected result.

I have the correct version of the plugin installed. Now I got it, I was defining breakpoints on the source code instead of using the loaded scripts. Now I’m able to use everything.

Hi, all. All the issues of beta1 have been fixed. Beta2 will be released soon.



btw is it expected that

  • during debugging the debugger is stepping through _build/default/proj.ml not proj.ml?
  • breakpoints need to be set in _build/default/proj.ml not in proj.ml?

In beta2, you can set breakpoints on proj.ml as well as _build/default/proj.ml.

But indeed the source used by debugger is _build/default/proj.ml. So it is expected that stepping through _build/default/proj.ml.

Indeed I can. But unfortunately for me they don’t quite work… I’m on Ubuntu 20.04 / VSCodium 1.53.2

I’ve executed git pull on my checkout of ocamlearlybird repo from Github. I’m on commit 175eee657085fb89fa683f99c5f4109aba5bc0b2 now. I have updated both opam side and VSCod(e/ium) side from this commit.

Here’s how my testing went:

Scenario 1

  • I double-clicked to the left of my code line in proj.ml
  • I saw a red dot
  • I launched debugging via the following launch.js:
      "version": "0.2.0",
      "configurations": [
              "name": "try debug",
              "type": "ocamlearlybird",
              "request": "launch",
              "program": "${workspaceRoot}/_build/default/proj1.bc",
              "stopOnEntry": false,
              "yieldSteps": 4096,
              "onlyDebugGlob": "<${workspaceRoot}/_build/default/**/*>",
              "cwd": "${workspaceRoot}"
  • what I expect to see: program execution stopped at that line of code
  • what I saw instead: program executed completely to the end

If instead I place the breakpoint in _build/default/proj.ml - on the same line - and launch debugger via the same launch.json program execution indeed does stop on that line of code.

Scenario 2

As an experiment I

  • changed my launch.js like this
    "stopOnEntry": true
  • started the debugger via this launch config
  • observed I’m in PAUSED ON ENTRY state
  • then placed a breakpoint in proj1.ml
  • what I expected to see: I expected a red dot to appear
  • what I saw instead: a grey circle appeared
  • I then pressed the blue arrow pointing right
  • what I expected to see: I expected the debugger to stop on the line I placed the breakpoint into
  • what I saw instead: execution proceeded to the end of the program

If while in PAUSED ON ENTRY state instead of proj1.ml I place that breakpoint in _build/default/proj.ml - on the same line - I do see a red dot (as expected) and after pressing the blue right arrow program execution does stop on that line of code.

You should modify the launch configuration

"onlyDebugGlob": "<${workspaceRoot}/_build/default/**/*>",


"onlyDebugGlob": "<${workspaceRoot}/**/*>",

:+1: it works

It’s probably then a good time now to update the prime example on GitHub - hackwaly/ocamlearlybird: OCaml debug adapter :wink:

Update: thx! It’s up-to-date now :blush:

Could somebody shed some light and explain in more details? I have the same issue but do not know how to use the loaded scrips. Thanks in advance

I think that in the latest version you can define breakpoints in the original file itself. Nevertheless, when you start debuggind you have a section on the debugger called loaded scripts with the source files loaded from your _build directory. You just have to select which one you want to set breakpoint in.

1 Like

Thank a lot for your reply!
Maybe i could ask just one more: once debugging session starts, the execution jumps to system libraries first. Is there a way to make sure that it stops at the entry point of source.ml file and skips the libraries?
Thanks in advance!

There is a config item called onlyDebugGlob.

1 Like