dbg match spec

Siri Hansen (EAB) <>
Mon Oct 3 13:19:33 CEST 2005


Hi Chandru - Hope you are well!!

I'm sending from an address which is not member of the erlang list, so
this might not come out on the list - but anyway...

You could try


dbg:tpl(dbg_test, test, 1, [{[{'A','_','_'}],[],[]}]).

or

dbg:tpl(dbg_test, test, 1, [{['$1'],[{'==',{element,1,'$1'},'A'}],[]}]).


(But what is the 'call' command you put in the match spec body?)

BR
/siri



chandru wrote:
> Hi,
> 
> If I had code like this:
> 
> -module(dbg_test).
> -export([test/1]).
> 
> test(N) when integer(N) ->
>     io:format("Integer -> ~p~n", [N]);
> test({'A', X, Y}) ->
>     io:format("A: X -> ~p, Y -> ~p~n", [X,Y]);
> test(L) ->
>     io:format("L -> ~p~n", [L]).
> 
> how would I write a dbg command to print out a trace when the second
> clause is matched?
> 
> I've tried: 	
> 
> dbg:tpl(dbg_test, test, 1, [{'$1',[{'==',{element,1,'$$'},'A'}],[call]}]).
> 
> but it doesn't work. whereas this does:
> 
> dbg:tpl(dbg_test, test, 1, [{'_',[],[call]}]).
> 
> but it is not quite what I want...I want to single out the second clause.
> 
> cheers
> Chandru



More information about the erlang-questions mailing list