trace and match_spec

Fredrik Linder <>
Mon Feb 18 15:55:35 CET 2002


Hi

I am having problems understanding the erlang:trace and
erlang:trace_pattern.

What I am after is getting a call-tree trace with return values. In the
documentation of erlang:trace[_pattern] is {return_trace} mentioned to give
me my return values, which I assume comes from match_spec in ERTS.

According to the description of match_spec will a badarg EXIT occurr if ther
is something wrong with the match condition, but I cannot find the fault.

Could someone please help me understand what I am doing wrong?

---[Working, but no return tracing]---
erlang:trace(Pid1, true, [call, 'receive', return_to]),
erlang:trace_pattern({'_', '_', '_'}, true, [local]),

---[Working, but too much tracing]---
erlang:trace(Pid1, true, all),
erlang:trace_pattern({'_', '_', '_'}, true, [local]),

---[Not Working]---
erlang:trace(Pid1, true, [call, 'receive', return_to]),
MatchHead = '_',    % Any arguments
MatchCond = [],    % Always
MatchBody = [{return, trace}],    % Trace return values (disables tail
recursion)
erlang:trace_pattern({Mod, '_', '_'}, [{MatchHead, MatchCond, MatchBody}],
[local]),

=ERROR REPORT==== 18-Feb-2002::15:42:17 ===
Error in process <0.292.0> with exit value:
{badarg,[{erlang,trace_pattern,[{'_','_','_'},[{'_',[],[{return,trace}]}]]},
{t,tracer_init,1}]}

/Fredrik





More information about the erlang-questions mailing list