开发者

How can ocamldebug be used with a Batteries Included project?

开发者 https://www.devze.com 2023-03-10 05:18 出处:网络
I have a simple ocamlbuild project which uses Batteries, including syntax extensions. _tags: <*>: pkg_batteries,pkg_threads,pkg_batteries.syntax,syntax_camlp4o

I have a simple ocamlbuild project which uses Batteries, including syntax extensions.

_tags:

<*>: pkg_batteries,pkg_threads,pkg_batteries.syntax,syntax_camlp4o

something.ml:

open Batteries
…
let () = …

It is built for debugging with:

$ ocamlbuild something.d.byte
$ ocamldebug something.d.byte

Attempting to use t开发者_如何学Che print command in ocamldebug, however, gives the following error:

(ocd) print x
Cannot find module Batteries.

This only seems to occur when debugging in a scope where Batteries is opened.

What is the cause of this error? How is it possible to work around?


You have to make the Batteries includes available to the debugger; the dir command and the -I command line options enable this. Unfortunately, this is harder than it should be because ocamlfind does not support ocamldebug. But you can do this:

$ ocamldebug `ocamlfind query -recursive -i-format batteries` -I _build something.d.byte

This will pass a sequence of -I options to ocamldebug to provide the include paths to locate the relevant modules.

0

精彩评论

暂无评论...
验证码 换一张
取 消