Module redbug

Function Index

dtop/0Equivalent to dtop(#{}).
dtop/1 Starts/stops (toggles) dtop.
help/0Prints help.
start/1Equivalent to start(RTPs, []).
start/2 Starts a trace.
stop/0 Stops a trace.

Function Details

dtop/0

dtop() -> any()

Equivalent to dtop(#{}).

dtop/1

dtop(Cfg) -> any()

Starts/stops (toggles) dtop.

Cfg is a map. The allowd tags are max_procs and sort.

If the number of processes is larger than max_procs, dtop will not print any process info, just the header. This is to avoid oveloading the VM. It defaults to 1500.

sort can be msgs, cpu, or mem, It defaults to cpu.

help/0

help() -> any()

Prints help.

start/1

start(RTPs) -> any()

Equivalent to start(RTPs, []).

start/2

start(RTPs::list(), Opts::map()) -> {Procs::integer(), Functions::integer()}

Starts a trace.

RTPs (Redbug Trace Patterns)

       list('send'|'receive'|string(RTP))

where RTP has the form:

       "MFA when GUARDS -> ACTIONS"

where MFA can be;

       "mod", "mod:fun", "mod:fun/3" or "mod:fun('_',atom,X)"

GUARD is something like;

       "X==1" or "is_atom(A)"

and ACTION is;

       "return" and/or "stack" (separated by ",")

So, an RTP looks something like this;

       "ets:lookup(T,hostname) when is_integer(T) -> stack"

Note that bindings (like we're binding 'T' above) works as expected. So this RTP;

       "maps:to_list(#{a:=T,c:=#{d:=T}})"

will not trigger on this call;

      maps:to_list(#{a=>b,c=>#{d=>e,f=>g}}).

but will trigger on this;

       maps:to_list(#{a=>b,c=>#{d=>b,f=>g}}).

Options

   Opts: list({Opt,Val}) | #{Opt => Val}

general opts:

    time         (15000)       stop trace after this many milliseconds
    msgs         (10)          stop trace after this many messages
    target       (node())      node to trace on
    cookie       ('')          target node cookie
    blocking     (false)       block start/2, return a list of messages
    procs        (all)         atom(all|new|running) | list(Proc)
                               where Proc is pid() | atom(RegName) | {pid,I2,I3}
    max_queue    (5000)        exit if redbug-internal queue gets this long
    max_msg_size (50000)       exit if seeing a message bigger than this
    debug        (false)       bigger error messages
    trace_child  (false)       children gets traced (set_on_spawn)
    arity        (false)       arity instead of args
    discard      (false)       discard messages (when counting)

print-related opts

    arity        (false)       print arity instead of argument list
    buffered     (no)          buffer messages till end of trace
    print_calls  (true)        print calls
    print_file   (standard_io) print to this file
    print_msec   (true)        print milliseconds on time stamps
    print_depth  (999999)      formatting depth for "~P"
    print_re     ("")          print only strings that match this regexp
    print_return (true)        print return value
    print_fun    ('')          custom print fun. gets called once for each trace
                               message. It can be a fun/1, (called as F(Msg),
                               return value is ignored), or a fun/2 (called as
                               F(Msg,Acc), return is next Acc)

trc file related opts

    file         (none)        use a trc file based on this name
    file_size    (1)           size of each trc file
    file_count   (8)           number of trc files

stop/0

stop() -> any()

Stops a trace.


Generated by EDoc