hackwaly / vscode-ocaml-debugger

OCaml debugger for VS Code
14 stars 4 forks source link

Cannot get it to work #12

Open PurePureMilk opened 4 years ago

PurePureMilk commented 4 years ago

The regular "ocamldebug" works, but how come I can't get this ocaml-debugger to work following the information on this page https://marketplace.visualstudio.com/items?itemName=hackwaly.ocaml-debugger. Does it need to recognize the correct path to earlybird or something?

hackwaly commented 4 years ago

Yes. It need earlybird in PATH that vscode can find.

PurePureMilk commented 4 years ago

In the settings.json, what should the configuration be? The suggestions, don't come up with anything related to earlybird. Annotation 2020-02-23 113303 { "name": "OCaml Debug", "type": "ocaml-debugger", "request": "launch", "program": "${workspaceFolder}/a.out" } Also, I just use this configuration

hackwaly commented 4 years ago

There's no configuration item for now. Maybe you forgot to restart vscode after earlybird installed. Or you didn't configure correctly opam. Doies earlybird works in terminal?

PurePureMilk commented 4 years ago

Okay I will assume that there's configuration in the settings. Also, I am using WSL btw. I assume opam is working correctly because merlin works. Also, when I try to install earlybird using opam again I get this: pure@Sophie:~/wsl-stuff/ocaml$ opam install earlybird [NOTE] Package earlybird is already installed (current version is 0.1.4). What do you mean using earlybird in the terminal? Is it like using gdb or rlwrap?

hackwaly commented 4 years ago

WSL is not tested. I suggest you to use VS Remote to use WSL or docker to use this plugin

PurePureMilk commented 4 years ago

Kind of unsure what using VS Remote means, but I never had experience with docker or know what it is, here is a video of what I tried to do. Not sure most of the time:

https://youtu.be/YHeXJpG2iPc

Additionally what I was told by an instructor or TA was "this extension works on binary Ocaml files like using gcc for C files. Apparently, this is a 'different' build process than 'we use in class' (not sure what they mean). The two compilers for .ml files are ocamlc (byte code), like ocamlc -g src/main.ml (assuming what this debugger uses), and ocamlopt (machine code (assuming maybe they mostly compile with ocamlopt in class)). We would want to use the 2nd one for 'this case': ocamlopt f1.ml f2.ml f3.ml, which are files used in the projects we are trying to debug. This can be a bit complicated where the file has to be in a sequence where no file is before in the sequence that depends on a file later in the sequence. It also gets complicated when using external libraries, which are used in some of our projects. (as of now, not sure how the class compiles but they just use dune utop src and dune runtest to unit test code). When we assume things compile correctly, and a.out file is made and be used by this debugger extension. However, we just recommend using dune utop src (I don't really have a clue how this is useful and just assume that this is just for unit testing) and incrementally test pieces of your code instead of using a native Ocaml debugger, which would be less useful in the long run than testing your code in either of these advised way (assuming the ways are oUnit tests or dune utop src)

hackwaly commented 4 years ago

We would want to use the 2nd one for 'this case': ocamlopt f1.ml f2.ml f3.ml, which are files used in the projects we are trying to debug.

I'm sorry, but this extension only works for bytecode. Debug native build should waiting official ocaml team to support.

hackwaly commented 4 years ago

Could you please open terminal in WSL:ubuntu vscode instance then run "earlybird --help" to check is it right?

NamPNQ commented 4 years ago

Could you please open terminal in WSL:ubuntu vscode instance then run "earlybird --help" to check is it right?

Do you mean ocamlearlybird --help?

hackwaly commented 4 years ago

Could you please open terminal in WSL:ubuntu vscode instance then run "earlybird --help" to check is it right?

Do you mean ocamlearlybird --help?

Yes

PurePureMilk commented 4 years ago

image

hackwaly commented 4 years ago

So you should make it available for that then this extension should works

NamPNQ commented 4 years ago

@PurePureMilk This maybe you have installed earlybird in project level, it's should installed on global, or we need a config for ocamlearlybird path? @hackwaly

hackwaly commented 4 years ago

Pull requests are welcome. I haven't use ocaml a long time

PurePureMilk commented 4 years ago

Okay, I installed it in my root directory and it works, thanks :^) image image