ocamlearlybird icon indicating copy to clipboard operation
ocamlearlybird copied to clipboard

lang dune 2.x won't hit breakpoints

Open victorvianna opened this issue 5 years ago • 2 comments
trafficstars

After quite some investigation, I've tracked down the reason my vscode wouldn't stop on breakpoints. If your dune-project file uses (lang dune $VERSION) where VERSION >= 2.0, it won't work, and the server won't display any errors.

victorvianna avatar Feb 14 '20 22:02 victorvianna

@victorvianna did you had any progress here?

EduardoRFS avatar Nov 25 '20 04:11 EduardoRFS

@EduardoRFS I downgrade dune version to 1.11.4, OCaml version 4.07.1, it works

ialak avatar Nov 25 '20 14:11 ialak

I'm not hitting any breakpoints either. I tried downgrading the dune language version which didn't help. Downgrading dune is kind of impossible. Does anyone have any insights on this?

vthemelis avatar Jul 22 '23 12:07 vthemelis

I think I found the issue on my side. I had to set

(map_workspace_root false)

to my dune-project file. This was while using version 3.9 of the dune language.

Now I can hit the breakpoints no problem.

vthemelis avatar Jul 22 '23 12:07 vthemelis

I haven't encountered the issue (nor have tried to reproduce it yet), but there's this commit on a fork: https://github.com/tizoc/ocamlearlybird/commit/8afcce83ff7a8e7800d45f75b06f335d790a29e1. Maybe that's trying to fix this issue?

sim642 avatar Jul 22 '23 13:07 sim642

@victorvianna Thank you, this saved my day!

I think I found the issue on my side. I had to set

(map_workspace_root false)

to my dune-project file. This was while using version 3.9 of the dune language.

Now I can hit the breakpoints no problem.

According to the docs, the default (map_workspace_root true) breaks the debug info. This unfortunate situation is explained here. Perhaps this issue should be more visible or documented somewhere, as people using recent versions of dune will likely encounter this issue.

Zeta611 avatar Jul 31 '23 11:07 Zeta611

I added a hint about map_workspace_root to the README: https://github.com/hackwaly/ocamlearlybird#breakpoints-not-hit-with-lang-dune-30-and-above. Thanks to @vthemelis for suggesting it to be added to https://github.com/ocamllabs/vscode-ocaml-platform/pull/1192 as well.

This fix is for (lang dune 3.0) though, not (lang dune 2.0) like the original issue which I couldn't reproduce. Nevertheless, I'm closing this issue for now. If it's still an issue for 2.x for someone, feel free to reopen/leave a comment.

sim642 avatar Aug 01 '23 16:08 sim642