Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug/execute a Ocaml program step by step?

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!

like image 432
SoftTimur Avatar asked Jun 23 '11 00:06

SoftTimur


1 Answers

You can step through the code using the debugger ocamldebug, which can be run in emacs.

like image 79
sepp2k Avatar answered Sep 22 '22 17:09

sepp2k