Byte target can't be debugged with ocamldebug
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 1.9k
- Forks
- 500
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 277
Description
Expected Behavior
dune build should produce a byte target for https://github.com/disposedtrolley/hello_ocaml which is able to be debugged with ocamldebug. A breakpoint should be able to be set on line 2 of the helloworld module.
Actual Behavior
While dune build is able to build a .bc file, it seems to be missing debug symbols. For example, attempting to set a breakpoint on line 2 of helloworld.ml results in:
hello_ocaml · (main) ⟩ ocamldebug _build/default/helloworld.bc ~/p/o/hello_ocaml 2
OCaml Debugger version 4.12.0
(ocd) break @helloworld 2
Loading program... done.
Can't find any event there.
(ocd)
When the project is built with ocamlc -g helloworld.ml, the resulting a.out file can be debugged with ocamldebug correctly.
Reproduction
- PR with a reproducing test:
- Clone https://github.com/disposedtrolley/hello_ocaml
- Run
dune build - Run
ocamldebug _build/default/helloworld.bc - Type
break @helloworld 2 - Observe that the debugger outputs "Can't find any event there."
Specifications
- Version of
dune(output ofdune --version): 2.8.4 - Version of
ocaml(output ofocamlc --version) 4.12.0 - Operating system (distribution and version): Fedora 33 (x86), macOS 11.2 (arm64)
Additional information
I've tried this with OCaml 4.12 (on macOS with Apple Silicon) and 4.10.2 (on macOS with Apple Silicon and Fedora 33 x86).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the hello_ocaml project using dune build, then run ocamldebug _build/default/helloworld.bc and the breakpoint command against helloworld.ml. Compare this with the ocamlc -g helloworld.ml result; done means a breakpoint can be set on line 2 of the helloworld module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100