hackwaly / ocamlearlybird

OCaml debug adapter
MIT License
208 stars 23 forks source link

how to use this in Visual Styduo Code? #26

Closed PavelKotov1 closed 3 years ago

PavelKotov1 commented 3 years ago

Hello dear friends! I have installed this new extension in VS Code on Debian 9.x (ocaml version 4.11.1) and can see it in a terminal. But VS Code complains about not having "type": "ocaml": "debug type is not recognised". It also says that it can be used to debug bytecode file (with extension .bc?). After doing ocaml -g main.ml all I have is a.out, main.cmo, main. cmi but nothing with extension ".bc"... And cannot see context menu "Start an OCaml Debug Session" to start an debug session.

Could you be so kind and explain in detail, maybe with an example, how use this tool for debugging ocaml code in VS Code? Thanks in advance!

hackwaly commented 3 years ago

Sorry the Readme is outdated. I will update it soon. Should use ocamlearlybird as type instead of ocaml

PavelKotov1 commented 3 years ago

Hello dear friends! I am following your .gif example and everything seems to be going well up until 0:42. After I right click on "test_program.bc" file and select "Start Ocaml Debug Session", I do not see in my terminal what I see in yours, namely this line: /usr/bin/env CAML_DEBUG_SOCKET=127.0.0.1:50960 .../utop/_build/default/examples/interact/test_program.bc Did you type it in? Because is seems to appear by itself.... If I type this line in the terminal, I get an error message: "Fatal error: cannot connect to debugger at 127.0.0.1" Error: Connection refused. Aborted. Did I us the wrong port? Some extra info: I have added launch.json file from your example

"{ .... "configurations": [ { "name": "test_program", "type": "ocamlearlybird", "request": "launch", "stopOnEntry": true, "console": "integratedTerminal", "program": "${workspaceRoot}/_build/default/examples/interact/test_program.bc", "onlyDebugGlob": "<${workspaceRoot}/_build/default/*/>", "yieldSteps": 1024, "cwd": "${workspaceRoot}" } ] } but I am not sure if it was the right thing to do. I have installed ocamllsp server version 1.4.0. The Ocaml Top level 4.11.1 Dune 2.8.2 Merlin 3.4.2

Thanks in advance for your help!

hackwaly commented 3 years ago

Have you installed the earlybird package?

PavelKotov1 commented 3 years ago

yes, i have installed it through Extension Marketplace in Visual Studio Code version 1.0.3 but when it try to run earlybird --version, it says "command not found". I ran eval $(opam config env) just in case, the result is still the same. What is the best way to make sure it is installed and is in the right place? Do i need to do anything special with the PATH? My OS is Debian 9.x.

hackwaly commented 3 years ago

opam install earlybird

PavelKotov1 commented 3 years ago

OK, great! Everything seems to be working just fine! Thanks a lot for your help and an excellent tool!

PS. So much for the Market place...