How to trace for all functions in an Erlang module except for one?
I wanted to trace for all functions in an erlang module, with dbg:tpl
, but one of the internal functions took up 95% of the trace file. I then wanted to exclude only that single function and found that it was not as easy as I thought it would be.
I know there are great pattern matching possibilities for开发者_Go百科 arguments when tracing.
Is there a similar possibility to apply pattern matching for functions?
eg.: {'=/=', '$2', function_name}
I am open for outside-the-box solutions as well!
Thank You!
It can be achieved as one statement with a list comprehension:
[dbg:tpl(Mod, F, []) || {F, _Ar} <- Mod:module_info(functions), not lists:member(F, DontTrace)].
Where Mod
is the module you want to trace on, and DontTrace
is a list of functions names that should not be traced on.
dbg:tpl(mod,[]).
dbg:ctpl(mod,notthisfunction).
Haven't tested this but shouldn't this do the trick? Don't know of a way to do it in one line.
精彩评论