SV: dbg match spec

Lennart Öhman <>
Mon Oct 3 13:44:25 CEST 2005


Hi, but are you allowed to have a '$1' variable to match the
entire list of arguments?
And if you are, then '$$' must expand to a list of a list
('$$' means a list of all $variable bindings). Hence it must
be [[{'A',foo,bar}]] of which then element 1 will not be
applicable!?
>[{'$1',[{'==',{element,1,'$$'},'A'}],[call]}]).
Best Regards,
Lennart
-------------------------------------------------------------
Lennart Ohman                   phone   : +46-8-587 623 27
Sjöland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : 

________________________________

Från:  genom Ulf Wiger (AL/EAB)
Skickat: må 2005-10-03 13:09
Till: chandru; 
Ämne: RE: dbg match spec




Sorry Chandru, I can't figure it out either.

/Uffe

> -----Original Message-----
> From: 
> [mailto:]On Behalf Of chandru
> Sent: den 3 oktober 2005 12:19
> To: 
> Subject: dbg match spec
>
>
> 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
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20051003/392b88e7/attachment.html>


More information about the erlang-questions mailing list