Debugging With Erlang

First, make sure you have the compile flag (+debug_info) set when compiling your source, then fire up the debugger:

1> i:im().

My Erlang Makefile:

EBIN_DIR := ebin
SRC_DIR := src
EXAMPLES_DIR := examples
INCLUDE_DIR := include
ERLC := erlc
ERLC_FLAGS := +debug_info +native -W -I $(INCLUDE_DIR) -o $(EBIN_DIR)

	@mkdir -p $(EBIN_DIR)
	$(ERLC) $(ERLC_FLAGS) $(SRC_DIR)/*.erl

	@rm -rf $(EBIN_DIR)/*
	@rm -f erl_crash.dump

Read up on the Erlang docs.

The debugger can be a bit weird in that it doesn’t always find your ebin directory (if you’re compiling to a separate ebin dir)… it took me a bit to figure out. Also on the Mac it seems to either crash or not launch timetimes.