Getting Started with GDB on OCaml

A number of folks who regularly use OCaml were surprised to learn that you can reasonably debug OCaml programs using gdb. The aim of the post is to show the first steps in using gdb on OCaml programs. Let’s consider the following program: ( fib.ml ) let rec fib n = if n = 0 then 0 else if n = 1 then 1 else fib ( n - 1 ) + fib ( n - 2 ) let main () = let r = fib 20 in Printf . printf "fib(20) = %d" r let _ = main () Let’s compile this program. I’m using OCaml version 5.1.1. $ ocamlopt --version 5.1.1

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论