tracing

Serge Aleynikov serge@REDACTED
Fri Sep 9 21:23:26 CEST 2005


When a tracing process is setup with dbg:tracer/2 it accepts a function 
that can accumulate traces in a custom accumulator, such as this:

foo_trace(Args) ->
     dbg:tracer(process, {fun trace_handler/2, []}),
     dbg:p(self(), call),
     dbg:tpl(?MODULE, [{'_',[],[{return_trace}]}]),
     R = foo(Args),
     dbg:stop(),
     R.

trace_handler(Msg, Acc) ->
     [Msg | Acc].

Is there a way to retrieve the content of this accumulator before 
calling dbg:stop()?

I know that in case of a tracer port, one can store trace messages to a 
file and read them later with tracer_client, but I would like to know if 
it is possible enable/disable tracing and return the trace messages 
along with the function's result.

Serge



More information about the erlang-questions mailing list