OCaml相关

1、open Core.Std 时报Unbound module Core
先安装库

$ opam init
$ opam install core
$ opam install utop

在~/.ocamlinit头部添加下面代码

#use "topfind"
#camlp4o
#thread
#require "core.top"
#require "core.syntax"

到这里后还是不行,后来想起系统很久没关机了,重启了一下系统就一切OK了

2、调试
ocamlopt编译的是native程序,ocamlc -g编译出的是带调试信息的字节码程序,使用ocamldebug可以调试它
调试命令

命令 说明
run 运行
reverse 反向运行 ....
step [count] 单步,进入函数调用
backstep [count] 回退一步,进入函数调用
next [count] 单步,跳过函数调用
previous [count] 回退,跳过函数调用
finish 运行直到当前函数返回
start 反向运行直到函数开始位置
kill 结束程序执行
break function
break @main 94 在main.ml的94行下断点
break @ [module] # character
info breakpoints 显示所有断点
delete [breakpoint-numbers] 删除断点。注意:如果没有参数,所有断点都被删除
backtrace [count], bt [count] 栈回溯
frame 当前栈
print variables
display variables

命令可以只写一部分,比如s代表step,n代表next
更多命令请看:
https://caml.inria.fr/pub/docs/manual-ocaml/debugger.html#sec388

posted on 2018-03-13 20:52  woswod  阅读(228)  评论(0编辑  收藏  举报

导航