Why pid returned by dbg:tracer() differs from dbg:get_tracer()

192 Views Asked by At
1> dbg:get_tracer().
{error,{no_tracer_on_node,nonode@nohost}}
2> dbg:tracer().
{ok,<0.33.0>}
3> dbg:get_tracer().
{ok,<0.35.0>}

The document tells: get_tracer returns the process or port to which all trace messages are sent.

But it doesn't tells clearly what pid returned by dbg:tracer

1

There are 1 best solutions below

1
On BEST ANSWER

As you can see in pman, there are indeed two processes:

  • <0.33.0> sits in dbg:loop/2
  • <0.35.0> sits in dbg:tracer_loop/2

You can see what they are doing here: https://github.com/erlang/otp/blob/maint/lib/runtime_tools/src/dbg.erl

I haven't dug too deep into this, but at a glance it looks like the former is doing more manager-like job and the latter actually processes traces.