I’m pleased to annonce that ocamlearlybird 1.0.0~beta1 just released. Will soon be available on opam.
ocamlearlybird is a debug adapter for OCaml language. It can let you debug your ocaml program in vscode like debugging javascript.
This is a big step that we toward 1.0.0. We solved lots of issues and tested with realy ocaml projects such as utop, ocamlformat, and so on. And certainly, it can debug ocamlearlybird itself.
I’m so sorry. Because of my network issue. I can’t upload screen record video to demo it. So, try yourself!
NOTES.
New version only support OCaml 4.11. If you need other versions support, please let me know.
Dune-release do not support 1.0.0~beta1 version string. So we released 1.0.0 as 1.0.0~beta1 on opam.
KNOWN ISSUES:
Continue run command may hit on last removed breakpoint once when debug utop.
This looks outstanding! Will definitely reach for it next time I need a stepping debugger and will report on how I get on.
Hopefully some dune integration/visibility will come along eventually so that e.g. one can just pick a debug target from the set of executables described in a project’s dune files?
And just out of curiosity, what is the meaning of the “earlybird” naming?
I have one question: is it possible to change the way variables are displayed in the inspector by providing some custom printing functions? Right now, instances of my custom datatypes are just rendered as <<opaque>>. Also, I cannot see the elements within a list of strings (with type Base.String.t list):
There’s no way to use custom printers for now. But it’s in plan. And I wonder why it’s shown as <<opaque>>. If the underlying string type isn’t hidden. It should shown as string. Could you please paste the .mli of your custom datatypes here?
Regarding the rendering of string lists, I think the problem happens when I am using the JaneStreet standard library and the type inferred by merlin is Base.String.t instead of just string. For example, in the snippet below:
open Base
let () =
let list1 = [String.make 3 'a'] in
let list2 = ["aaa"] in
let array = [|"aaa"|] in
()
list1 is not inspectable but list2 is. Coincidentally, merlin displays the type of list1 as Base.String.t and the type of list2 as string.
Also, as revealed by this screenshot, inspecting arrays does not work. When I try to expand it, the debugger freezes (see the icon with circling dots). I also replicated the problem with other types of arrays.
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.
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.
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)
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.