Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (77 sloc) 3.69 KB
redbug - restricted debugging utility
redbug:start(Time,Msgs,Trc[,Proc[,Where[,Target]]]) -> pid()|EXIT
redbug:stop([Target]) -> atom()
An interface to the Erlang trace mechanism, safer (hopefully) than
dbg. Disallows some of the more dangerous traces and exits if it
gets flooded by trace messages. It runs in the background,
collecting trace messages, until it reaches one of it's termination
criteria (number of messages/file size or elapsed time). Upon termination,
it will send the atom 'stop' to the process that started it.
Time - integer() number of milliseconds to run for
Msgs - integer() number of messages to collect
Trc - list('send'|'receive'|RTP).
RTP - tuple {Module, Function}|{Module, Function, list(RMS)}
RMS - 'stack'|'return'|ALD. Restricted Match Spec. Using 'stack'
will include the call return stack, 'return' will include the return
value of the call.
ALD - tuple(). Argument List Description. Tuple with the same arity
as the traced function. It can contain constants (atoms and numbers)
and the wildcard; '_'. E.g. the ALD; {1,'_',x} would match if the
arity of the called function is 3, the first argument is 1 and the
third argument is 'x'. There can only be one ALD per RTP.
Proc - 'all'|atom(RegisteredName),pid(),{pid,I1,I2} (which specifies
the pid <0.I1.I2>).
Where - 'screen'|'term'|{'file',Filename}|{'ip',Port}
If Where is 'screen, trace messages will be printed like this;
Tag - call|return|send|receive
Data - term(). If Tag is
call; the called MFA
send; {DestinationProcess,Message}
receive; Message
return; {CalledMFA, ReturnValue} (Process and Timestamp is not shown)
Process is the registered name, if any, or else the initital call {M,F,A}.
Timestamp is {Hour, Minute, Second, Microsecond}
if Where is 'term', a list of all the messages will be sent to the process
that started the trace.
If Where is {'file',Filename}, trace messages are written to a wrap
file. Filename must be absolute, i.e. start with a "/". In this
case, the Msgs argument will be interpreted as the maximum file size
(in MB). There will be at most 3 wrap files, named Filename0.trc,
Filename1.trc and Filename2.trc.
If Where is {'ip',Port}, trace messages will be sent to that trace port
Target - the Erlang node on which to start the trace
**redbug stopped - 3 msgs**
**redbug stopped - 3 msgs**
**redbug stopped - 1 msgs**
**redbug stopped - 2 msgs**
**redbug stopped - 2 msgs**
(erl@foo)1> ets:tab2list(inet_db).
(erl@foo)2> ets:tab2list(ac_tab).
**redbug stopped - 1 msgs**
Jump to Line
Something went wrong with that request. Please try again.