[erlang-questions] Tracing a call sequence

Lennart Ohman <>
Sun Jun 10 20:29:44 CEST 2007


Hi, return_trace() can only be used in the fun2ms and that can
only be done in the shell. It is short for the match_spec
[{'_',[],[{return_trace}]}]

> > dbg:tpl( mnesia_meter, dbg:fun2ms(fun(_) -> return_trace() end)).

So if you want to write a program you shall write

dbg:tpl(TheModule,'_','_',[{'_',[],[{return_trace}]}])

Note that this will only give you trace on all functions in
TheModule. If execution takes a detour in another module, you
must add that module too and repeat your test. And to know
which modules you must trace you must read the code.

Best Regards
Lennart

-------------------------------------------------------------
Lennart Ohman                   office  : +46-8-587 623 27
Sjoland & Thyselius Telecom AB  cellular: +46-70-552 67 35
Hälsingegatan 43, 10tr          fax     : +46-8-667 82 30
SE-113 31, STOCKHOLM, SWEDEN    email   : 
> -----Original Message-----
> From:  [mailto:erlang-questions-
> ] On Behalf Of Joel Reymont
> Sent: Sunday, June 10, 2007 8:01 PM
> To: Bengt Kleberg
> Cc: Erlang Questions
> Subject: Re: [erlang-questions] Tracing a call sequence
> 
> Where does return_trace/0 come from?
> 
> It works at the erl prompt but I get an error on return_trace when
> trying to compile my module.
> 
> ./foo.erl:43: function return_trace/0 undefined
> 
>      Thanks, Joel
> 
> On Jun 10, 2007, at 5:21 PM, Bengt Kleberg wrote:
> 
> > dbg:tracer().
> >
> > dbg:p( all, [call] ).
> >
> > dbg:tpl( mnesia_meter, dbg:fun2ms(fun(_) -> return_trace() end)).
> 
> --
> http://topdog.cc      - EasyLanguage to C# translator
> http://wagerlabs.com  - Blog
> 
> 
> 
> 
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions





More information about the erlang-questions mailing list