Skip to content

Instantly share code, notes, and snippets.

@reiddraper
Created February 5, 2014 23:47
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save reiddraper/8835750 to your computer and use it in GitHub Desktop.

Debugging Erlang Applications In Real Time

Reid Draper @reiddraper

We'll be using a tool called redbug, which is an abstraction and safety layer of Erlang's built-in dbg tracing facilities. You can follow along at home:

git clone https://github.com/massemanet/eper
cd eper
make

Help

redbug:help().

Basic Example

In one terminal

erl -pa ebin -sname foo@

In another:

erl -pa ebin -sname bar@

In foo:

net_adm:ping('bar@reid-11'). %% replace your node name

Let's start with something fancy, tracing a function:

redbug:start("os:timestamp -> return", [{msgs, 10}, {time, 10 * 1000}, {target, 'bar@reid-11'}]).

In the other console:

os:timestamp().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment