vscode-ocaml icon indicating copy to clipboard operation
vscode-ocaml copied to clipboard

"unknown C primitive unix_has_symlink" error in VSCode debugger

Open ewan-delanoy opened this issue 8 years ago • 7 comments

Hello, this example has just one file called debugged.ml with only one breakpoint to set in it, at line 6288. The contents of debugged.ml are available at https://github.com/ewan-delanoy/hello-world/tree/master

Debugging outside VSCode works (terminal output below) but when I try to do it inside VSCode I get a "unknown C primitive unix_has_symlink" error message.

visual

$ ocamlc -g -bin-annot str.cma unix.cma debugged.ml -o debugged.ocaml_debuggable $ ocamldebug debugged.ocaml_debuggable OCaml Debugger version 4.04.1

(ocd) break @debugged 6288 Loading program... done. Breakpoint 1 at 221080: file debugged.ml, line 6288, characters 38-76 (ocd) r Time: 359853 - pc: 221080 - module Debugged Breakpoint: 1 6288 let h2=Sc_option.find_really (fun x-><|b|>x.Sc_beaver_for_statement.name="echo2") (ocd) q Removed breakpoint 1 at 221080: file debugged.ml, line 6288, characters 38-76

ewan-delanoy avatar Jun 23 '17 13:06 ewan-delanoy

I can't reproduce your problem. image

hackwaly avatar Jun 23 '17 13:06 hackwaly

Some more details then : I'm using OCaml 4.04.1 on my Mac 10.11.3. Here is the exact sequence of what I did :

  1. Open the debugged.ml file , using open -a /Applications/Visual Code Studio.app in the terminal.
  2. Inside VScode, open the folder containing the debugged.ml file
  3. Click "Start debugging" in the menu
  4. Check the launch.json file (see image below)
  5. Set the breakpoint by putting a red circle with the mouse, at line 6288 in the debugged.ml file
  6. Launch the debugging process by clicking on the green arrow (as in the image of my first post)

Did you do additional steps or did you some step differently ?

Note : when I set stopOnEntry to true, I get the same error message, "Fatal error: unknown C primitive `unix_has_symlink'" but without the "Lost connection" part.

visual2

ewan-delanoy avatar Jun 23 '17 13:06 ewan-delanoy

No, I do debug as same as you

hackwaly avatar Jun 23 '17 15:06 hackwaly

I can provide my working project to you. Did you need it?

hackwaly avatar Jun 24 '17 01:06 hackwaly

What is your "working project" ? I'm curious to know if I could do some more in-depth debugging about this.

ewan-delanoy avatar Jun 24 '17 09:06 ewan-delanoy

test_vscode.zip

hackwaly avatar Jun 24 '17 10:06 hackwaly

It seems that the problem comes from a version mismatch : see https://discuss.ocaml.org/t/unknown-c-primitive-unix-has-symlink-in-vscode-debugger/415/3

Perhaps the problem will disappear if you upgrade the debugger version inside VSCode

ewan-delanoy avatar Aug 21 '17 15:08 ewan-delanoy