Match Specifications

Siri Hansen (ETO) Siri.Hansen@REDACTED
Wed Oct 24 13:11:11 CEST 2001


I don't think the parameter to enable_trace should be a list, it should rather be {enable_trace,procs} (but I didn't try).

Also, you should be aware that by specifying the MatchHead as [] you implicitly say that the match spec is true only for functions with zero arguments. If you mean to hit all functions i your module ping your MatchHead should be '_'.

Good luck!

/siri

-----Original Message-----
From: Francesco Cesarini [mailto:francesco@REDACTED]
Sent: Wednesday, October 24, 2001 12:37 PM
To: erlang-questions@REDACTED
Subject: Match Specifications


Hi!
I got stuck with match specifications and wonder if anyone can find the
error or confirm if it is a bug.. When the match specification is
successful, I want to enable the tracing of all process related
activities, but the flags do not seem to get activated. Other actions
(Even if I have not tried all) seem to work ok. Here is the problem
stripped to a bare minimum:

3> P = ping:start().
<0.37.0>
4> erlang:trace(P, true, [call]).
1
5> erlang:trace_pattern({ping,'_','_'}, [{[],[],[{enable_trace,
[procs]}]}],[local]).
5
6> ping:send(P).
pong
7> flush().
Shell got {trace,<0.37.0>,call,{ping,loop,[]}}
ok
8> erlang:trace_info(P, flags).
{flags,[call]}
9> ping:send(P).
pong
10> flush().
Shell got {trace,<0.37.0>,call,{ping,loop,[]}}
ok

-module(ping).
-export([start/0, send/1, loop/0]).

start() ->
    spawn(ping, loop, []).

send(Pid) ->
    Pid ! {self(), ping},
    receive
        pong -> pong
    end.

loop() ->
    receive
        {Pid, ping} ->
             spawn(crash, do_not_exist, []),
             Pid ! pong,
             loop()
      end.

Thanks!
Francesco
--
http://www.erlang-consulting.com




More information about the erlang-questions mailing list