Breakpoints do not work in some cases
hello,
I installed vscode, ocaml extension with merlin on ubuntu 16.10, and all works great (merlin features) but I can't get the debugging. I followed the little video given in your readme.md file, but it doesn't apparently suffice :-( here is my launch.json file: { "version": "0.2.0", "configurations": [
{
"name": "OCaml",
"type": "ocamldebug",
"request": "launch",
"program": "/home/lowley/Documents/ocaml/01test/a.out",
"stopOnEntry": false
}
]
}
...and my tasks.json file: { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "0.1.0", "command": "ocamlc", "isShellCommand": true, "args": ["-g", "essai1.ml"], "showOutput": "always" } when I hit F5, the program runs the a.out file, and don't stop at the unconditional breakpoint I put in its middle. In the debug console, the result shows the end of the program has been reached.
What did I miss?
thank you lowley
Doest stopOnEntry option works?
hello
thank you for your reply. I set "stopOnEntry" to true, and now I partially manage to debug my program. But there's still some caveats :
- I set a breakpoint at line 3. if I hit F5 to start the debugging, the debugging toolbar is displayed, but the breakpoint line is not displayed in a particular color, and the variable spies contain the value "Canceled". so I think the debugging has begun but there could be a bug... if I hit F10(next statement) a yellow line is displayed but in the pervasive file. A few more F10 hits bring me back to my program, with the debugging line in yellow and the spies containing correct values.
- 2ndly, after having stopped the debugging, I changed the breakpoint line from the 3rd line to the first. I hit F5 and the debugging toolbar is displayed but the breakpoint is automatically changed and moved to the 3rd line! still, the current debugging line is not displayed in yellow. sorry for my scholar english!
The problems seem ocamldebug's. Ocamldebug has many small issues like those. I can help you less.
Can you paste your ocaml source here? Maybe your breakpoint hasn't been hit.
yes, here it is:
let year = 20126
let leap = (year mod 4 = 0 && year mod 100 <> 0) || year mod 400 = 0
let msg = if leap then "is" else "is not"
let () = Printf.printf "%d %s a leap year\n" year msg
do you think it could works better on windows than on ubuntu?
let () =
let year = 20126 in
let leap = (year mod 4 = 0 && year mod 100 <> 0) || year mod 400 = 0 in
let msg = if leap then "is" else "is not" in
let () = Printf.printf "%d %s a leap year\n" year msg
This can be debugged well.