Closed eilvelia closed 5 years ago
Does ocamldebug works on these code?
Yes.
It also works with this extension https://github.com/hackwaly/vscode-ocaml.
ocamldebug doesn't work well too. It will crash when you try to eval the variables at the breakpoint.
➜ debug-ocaml ocamldebug ./_build/default/main.bc
OCaml Debugger version 4.06.1
(ocd) break @Main 1
Loading program... done.
Breakpoint 1 at 194920: file main.ml, line 4, characters 3-8
(ocd) run
Time: 61 - pc: 194920 - module Main
Breakpoint: 1
4 <|b|>b + 3
(ocd) print b
Removed breakpoint 1 at 194920: file main.ml, line 4, characters 3-8
Uncaught exception: Not_found
The bytecode doesn't have cstruct module as dependency. It might be optimized out. Thus, the search path of cmi file of cstruct module is not loaded from bytecode. This caused envaux raise exception.
I'm planning to use .merlin
file to recover (source or compiled) search path to fix this issue.
An option "dotMerlins" was added to debug launch configuration. See https://github.com/hackwaly/ocamlearlybird#example-launch-configuration
If you passed "dotMerlins", then the build path specified by B
directive in .merlin
files will be added to search path. This solve your issue.
Track progress: https://github.com/ocaml/opam-repository/pull/13153
Thanks for your work.
(btw in new version ocamlearlybird --version
just prints %%VERSION%%
)
Do you know how to get %% VERSION%% interpolated? I use dune-release for publishing.
It seems, your source contains ~version:"%<U+200C>%VERSION%%"
instead of ~version:"%%VERSION%%"
. I sent you pull request with patch.
Merged, will be published with next release.
Callstack:
Files:
dune
:main.ml
:.vscode/launch.json
:Steps to reproduce:
opam install cstruct
dune build main.bc --profile debug
.ocamlearlybird --server --port=4711
.main.ml
file (b + 3
).It works correctly without
open Cstruct
.