Skip to content

Byte target can't be debugged with ocamldebug #4347

@disposedtrolley

Description

@disposedtrolley

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:
  1. Clone https://github.com/disposedtrolley/hello_ocaml
  2. Run dune build
  3. Run ocamldebug _build/default/helloworld.bc
  4. Type break @helloworld 2
  5. Observe that the debugger outputs "Can't find any event there."

Specifications

  • Version of dune (output of dune --version): 2.8.4
  • Version of ocaml (output of ocamlc --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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions