Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide BUILD_PATH_PREFIX_MAP support for ocamldebug #7414

Open
richardlford opened this issue Mar 26, 2023 · 3 comments · May be fixed by #7750
Open

Provide BUILD_PATH_PREFIX_MAP support for ocamldebug #7414

richardlford opened this issue Mar 26, 2023 · 3 comments · May be fixed by #7750

Comments

@richardlford
Copy link
Contributor

Desired Behavior

Unless inhibited, Dune currently uses a BUILD_PATH_PREFIX_MAP to map build-time absolute paths to reproducible paths, starting with /workspace_root. The result is that the ocamldebug debugger cannot find the sources.

This is a request for Dune to produce a feature to enable starting ocamldebug with a BUILD_PATH_PREFIX_MAP that will perform the logical inverse of the other mapping, so that /workspace_root is mapped in a way to enable the debugger to find the sources, and perhaps other installed artifacts. (ocamldebug is in the process of being modified to honor BUILD_PATH_PREFIX_MAP, see ocaml/ocaml#12126)

Example

One possible interface example is to just add an --ocamldebug option to dune exec. So a command like

dune exec --ocamldebug ./bin/main.bc

would start to execute that program in the ocamldebug debugger.

I'm currently experimenting with implementing such a feature.

@Alizter
Copy link
Collaborator

Alizter commented Mar 26, 2023

Another option might be to have a dune ocaml debug command.

@richardlford
Copy link
Contributor Author

richardlford commented Mar 26, 2023

Another option might be to have a dune ocaml debug command.

That is also being considered. Since debugging is also executing the program, whatever benefit dune exec brings over directly invoking the program, we would want to bring those same benefits to dune debug.

Besides setting a map and invoking the debugger, we would want an option to just print out the maps, both the build-time map and the deployment-time map.

We would also want to support other debuggers, e.g. the earlybird debuggers (if it gets updated for the latest ocaml).

@nojb
Copy link
Collaborator

nojb commented Mar 27, 2023

In terms of UI I think a first implementation should use dune debug or dune ocaml debug. The implementation can share as much code as needed from dune exec of course. If support for other debuggers comes around, the CLI can be rediscussed, but it is unlikely that ocamlearlybird would be wholly supported from Dune, as it needs editor integration, it looks more like a job for ocaml-lsp (with some help of Dune, but what form this help should take is not known at this point.)

@richardlford richardlford linked a pull request May 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants