I spent a full day to read our analysis code, i have to add a lot of ugly print_endline statement in the OCaml code to understand the logic. As a newbee in OCaml, i am stuck at configuring the project to use ocamldebug.
Here is my modified dune file:
(executable
(public_name rescript-editor-analysis)
; (modes byte exe)
(modes byte)
; The main module that will become the binary.
(name Cli)
(flags
(-w "+6+26+27+32+33+39"))
(ocamlc_flags
(:standard "-g"))
; Depends on:
(libraries unix str ext ml jsonlib syntax reanalyze))
Yeah, both me and @cristianoc, who do the bulk of the work with the extension, just use print statements + the tests to work out things. That said, if you get ocamldebug running then that’d be cool to look into too.
Adding breakpoints with using break command, but the entry module name is changed from Cli to Dune__exe__Cli, so if you want to add a breakpoint in the main function, you should use break Dune__exe__Cli.main, this information can be get by running the command ocamlobjinfo /_build/default/src/Cli.bc
Hi @Mng12345, I’m trying to run this as well after the code was moved from rescript-vscode to rescript.
I keep running into:
Loading program... Fatal error: cannot load shared library dllext_stubs
Reason: dlopen(dllext_stubs.so, 0x000A): tried: 'dllext_stubs.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OSdllext_stubs.so' (no such file), '/usr/lib/dllext_stubs.so' (no such file, not in dyld cache), 'dllext_stubs.so' (no such file)
I do find that so file though in
ls _build/default/compiler/ext/*so
_build/default/compiler/ext/dllext_stubs.so
LD_LIBRARY_PATH=/Users/nojaf/Projects/rescript/_build/default/compiler/ext does not seem to work for me on Mac.