ocamldebug 如何与包含电池的项目一起使用?
我有一个简单的 ocamlbuild 项目,它使用电池,包括语法扩展。
_tags
:
<*>: pkg_batteries,pkg_threads,pkg_batteries.syntax,syntax_camlp4o
something.ml
:
open Batteries
…
let () = …
它是为调试而构建的:
$ ocamlbuild something.d.byte
$ ocamldebug something.d.byte
尝试在ocamldebug
中使用print
命令,但是,会出现以下错误:
(ocd) print x
Cannot find module Batteries.
这似乎仅在 Batteries
打开的范围内进行调试时才会发生。
出现这个错误的原因是什么?怎么可能解决呢?
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 the 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 open
ed.
What is the cause of this error? How is it possible to work around?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使调试器可以使用电池;
dir
命令和-I
命令行选项可启用此功能。不幸的是,这比应有的困难,因为ocamlfind
不支持ocamldebug
。但您可以这样做:这会将一系列
-I
选项传递给ocamldebug
以提供包含路径来定位相关模块。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 becauseocamlfind
does not supportocamldebug
. But you can do this:This will pass a sequence of
-I
options toocamldebug
to provide the include paths to locate the relevant modules.