erlangdbg

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


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


Solution

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

    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.