dbg match spec

chandru <>
Mon Oct 3 12:18:53 CEST 2005


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