From Using trace and dbg in Erlang, I'm aware that one can trace calls to specified functions from all functions using
1>dbg:p(all, c).
However, how does one trace calls to all functions from all functions? e.g:
1>dbg:foo().
*ALL Erlang function calls will be traced from here on out. Prepare yourself.*
2>lists:append("abc", "def").
*trace*
Tracing all calls to all functions is not something you want to do, as that would easily swamp your output and make your shell unusable. After all, the shell calls functions to perform its duties too, as does
dbg
, so you'd end up seeing endless traces of calls toio
functions involved in generating and displaying the trace.Instead, take a look at the various
dbg:tp
anddbg:tpl
functions. Apply them after your call todbg:p(all, c).
They allow you to trace specific modules and specific functions. Start by tracing a particular function or module, and then based on the trace you see, widen your trace to callers of that function. You can also usedbg:ctp
anddbg:ctpl
to turn off tracing for specific functions or modules once they're no longer relevant to your debugging efforts. With this approach, you can usedbg
to iteratively zero in on whatever it is you're looking for.