如何一步步调试/执行Ocaml程序?
我想知道是否可以逐步调试/执行 Ocaml 程序,例如在 Visual Studio 中调试 C++ 程序。换句话说,我想逐行运行一个Ocaml程序,如果我们能够“观察”一些变量的值那就太好了。
顺便说一下,我使用 Emacs 作为编辑器。
有人可以帮忙吗?非常感谢
Edit-1:正如 sepp2k 所建议的,我正在尝试在 Emacs 下运行 camldebug。我一开始就遇到问题:网页提到“Caml 调试器在 Emacs 下通过命令 Mx camldebug
启动,参数为可执行文件的名称 progname
调试。”实际上我只有 3 个选择:
M-x camldebug
M-x camldebug-mode
M-x camldebug-step
Edit-2: 当我输入 Mx camldebug
时,回车,它显示 Symbol's value as variable is void: caml-mode-map
这并不让我输入可执行文件。
有人可以帮忙吗?谢谢你!
I am wondering if it is possible to debug/execute a Ocaml program step by step, for instance like debugging C++ programs in Visual Studio. In other words, I would like to run a Ocaml program line by line, also it would be great if we could "watch" the value of some variables.
By the way, I am using Emacs as editor.
Could anyone help? Thank you very much
Edit-1: As sepp2k suggested, I am trying to run camldebug under Emacs. I have a problem in the beginning: the web page mentions "The Caml debugger is started under Emacs by the command M-x camldebug
, with argument the name of the executable file progname
to debug." Actually I have only 3 choices:
M-x camldebug
M-x camldebug-mode
M-x camldebug-step
Edit-2: When I type M-x camldebug
, enter, it shows Symbol's value as variable is void: caml-mode-map
which does not allow me to enter the executable file.
Could anyone help? Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用调试器 ocamldebug 单步调试代码,可以运行emacs。
You can step through the code using the debugger ocamldebug, which can be run in emacs.
该文档告诉您将可执行文件的名称提供给
camldebug
。您可以通过 Mx camldebug 来完成此操作,然后按 Enter 键,然后在 emacs 提示您输入可执行文件的路径时键入该路径。The documentation is telling you to supply the executable file's name to
camldebug
. You can do this byM-x camldebug
, then press enter, and then type in the path of the executable when emacs prompts you for it.