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)

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

clean:
	@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.

If you found this post helpful, please consider sharing to your network. I'm also available to help you be successful with your distributed systems! Please reach out if you're interested in working with me, and I'll be happy to schedule a free one-hour consultation.