一个非常直接的问题是,是否可以跟踪到达Process/GenServer(邮箱)的消息?注意,这与跟踪received(一旦消息离开邮箱并被处理)的消息是不同的。直到现在,我还没有找到这样做的方法。
Process
GenServer
received
mum43rcc1#
在erlang语言中,dbg:p/2中有它的标志,s表示发送,r表示接收:
s
r
1> dbg:tracer(). {ok,<0.82.0>} 2> dbg:p(self(), r). (<0.80.0>) << {dbg,{ok,[{matched,nonode@nohost,1}]}} (<0.80.0>) << {io_reply,#Ref<0.2586582558.1779957764.183997>,319} {ok,[{matched,nonode@nohost,1}]} (<0.80.0>) << {io_reply,#Ref<0.2586582558.1779957764.184000>, [{expand_fun,#Fun<group.0.82824323>}, {echo,true}, {binary,false}, {encoding,latin1}]} (<0.80.0>) << {io_reply,#Ref<0.2586582558.1779957764.184002>,ok} 3> self() ! trace_me. (<0.80.0>) << {shell_cmd,<0.73.0>, {eval,[{op,{1,8}, '!', {call,{1,1},{atom,{1,1},self},[]}, {atom,{1,10},trace_me}}]}, cmd} (<0.80.0>) << trace_me (<0.80.0>) << {io_reply,#Ref<0.2586582558.1779957764.184006>,319} trace_me (<0.80.0>) << {io_reply,#Ref<0.2586582558.1779957764.184008>, [{expand_fun,#Fun<group.0.82824323>}, {echo,true}, {binary,false}, {encoding,latin1}]} (<0.80.0>) << {io_reply,#Ref<0.2586582558.1779957764.184011>,ok}
1条答案
按热度按时间mum43rcc1#
在erlang语言中,dbg:p/2中有它的标志,
s
表示发送,r
表示接收: