Skip to content

Instantly share code, notes, and snippets.

@yowcow
Created January 19, 2021 02:29
Show Gist options
  • Save yowcow/ff55759d129612afb9715a68ac8c5a52 to your computer and use it in GitHub Desktop.
Save yowcow/ff55759d129612afb9715a68ac8c5a52 to your computer and use it in GitHub Desktop.
Debugging Erlang application
%% more information available at:
%% * https://erlang.org/doc/man/dbg.html
%% * https://stackoverflow.com/questions/1954894/using-trace-and-dbg-in-erlang
%% start tracer
dbg:tracer().
%% specify what to trace
dbg:p(all, c). %% calls to any of specified functions
dbg:p(all, [c, m]). %% calls and messages
dbg:p(new, c). %% calls from newly spawned process from now on
dbg:p(Pid, c). %% calls from process ID
%% specify function call to trace
dbg:tp(mymodule, apifun, cx). %% exported fun
dbg:tp(mymodule, apifun, 3, cx). %% exported fun with arity
dbg:tpl(mymodule, localfun, cx). %% local fun
dbg:tpl(mymodule, localfun, 3, cx). %% local fun with arity
%% stop and clear tracer
dbg:stop_clear().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment