Show Menu
Cheatography

Ocaml debugger Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Running the program

run
Execute the program forward from current time.
reverse
Execute the program backward from current time.
step [count]
Run the program and stop at the next event.
backstep [count]
Run the program backward and stop at the previous event.
next [count]
Run the program and stop at the next event, skipping over function calls.
previous [count]
Run the program backward and stop at the previous event, skipping over function calls.
finish
Run the program until the current function returns.
start
Run the program backward and stop at the first event before the current function invoca­tion.
kill
Kill the program being executed.

The call stack

frame
Describe the currently selected stack frame.
frame frame-­number
Select a stack frame by number and describe it.
up [count]
Select and display the stack frame just “above” the selected frame
down [count]
Select and display the stack frame just “below” the selected frame
backtrace [count]
Print the call stack.

Breakp­oints

break
Set a breakpoint at the current position in the program execution.
break function
Set a breakpoint at the beginning of function.
break @ [module] line column
Set a breakpoint in module module
break @ [module] # character
Set a breakpoint in module module at the event closest to character number character.
break address
Set a breakpoint at the code address address.
delete [numbers]
Delete the specified breakp­oints.
info breakp­oints
Print the list of all breakp­oints.

Miscel­laneous commands

list [module] [begin­ning] [end]
List the source of module module, from line number beginning to line number end.
source filename
Read debugger commands from the script filename.
cd directory
Set the working directory for ocamldebug to directory.
pwd
Print the working directory for ocamld­ebug.
directory direct­ory­names
Add the given direct­ories to the search path.
set arguments arg1 arg2
set variable value
Set the debugger variable variable to the value value.
show variable
Print the value of the debugger variable variable.
info subject
Give inform­ation about the given subject. For instance, info breakp­oints will print the list of all breakp­oints.