Can't enable 'receive' trace for specific process using meta tracer and new trace API
isvilen opened this issue · comments
Svilen Ivanov commented
With the old trace API, I can use meta tracing and 'trace' function in match specification body to enable 'receive' trace for a specific process:
Tracer = spawn(fun F() -> receive M -> io:format("~p~n",[M]), F() end end),
erlang:trace_pattern({lists, seq, 2},
[{'_', [], [{trace, [], ['receive', timestamp, {const, {tracer, Tracer}}]}]}],
[{meta, Tracer}]),
spawn(fun () ->
lists:seq(1,10),
self() ! message,
receive
message -> ok
end
end).
{trace_ts,<0.89.0>,call,{lists,seq,[1,10]},{1720,685691,308331}}
<0.89.0>
{trace_ts,<0.89.0>,'receive',message,{1720,685691,308357}}
Trying the same thing with new API doesn't work:
Tracer = spawn(fun F() -> receive M -> io:format("~p~n",[M]), F() end end),
Session = trace:session_create(my_session, Tracer, []),
trace:function(Session,
{lists, seq, 2},
[{'_', [], [{trace, [], ['receive', timestamp]}]}],
[meta]),
spawn(fun () ->
lists:seq(1,10),
self() ! message,
receive
message -> ok
end
end).
{trace_ts,<0.89.0>,call,{lists,seq,[1,10]},{1720,685744,543604}}
<0.89.0>
John Högberg commented
Thanks for your report! Unfortunately most of us are on vacation right now, we'll revisit this once we're back. :-)