From 96175f1ebfd109f1268898d68a735ec5a16e9933 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 20 Apr 2016 11:43:08 +0200 Subject: [ttb] Set trace patterns on messages Functions ttb:tpe/2 and ttb:ctpe/1 are added. --- lib/observer/doc/src/ttb.xml | 28 +++++++++++++++++++--------- lib/observer/src/ttb.erl | 12 +++++++++++- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/lib/observer/doc/src/ttb.xml b/lib/observer/doc/src/ttb.xml index 2b637551db..76bbc777e8 100644 --- a/lib/observer/doc/src/ttb.xml +++ b/lib/observer/doc/src/ttb.xml @@ -257,17 +257,23 @@ ttb:p(all, call). - tp, tpl, ctp, ctpl, ctpg + tp, tpl, tpe, ctp, ctpl, ctpg, ctpe Set and clear trace patterns. -

These functions are to be used with - trace flag call for setting and clearing trace - patterns. When trace flag call is set on a process, +

These functions are to be used with trace + flag call, send, and 'receive' for + setting and clearing trace patterns.

+

When trace flag call is set on a process, function calls are traced on that process if a trace - pattern is set for the called function. Trace patterns - specify how to trace a function by using match - specifications. Match specifications are described in the - ERTS User's Guide. + pattern is set for the called function.

+

The send and 'receive' flags enable tracing + of all messages sent and received by the process. Trace + patterns set with tpe may limit traced messages based + on the message content, the sender, and/or the receiver.

+

Trace patterns specify how to trace a function or a message + by using match specifications. Match specifications are + described in the + ERTS User's Guide.

These functions are equivalent to the corresponding functions in module @@ -284,6 +290,8 @@ ttb:p(all, call).

Sets trace patterns on global function calls.

tpl

Sets trace patterns on local and global function calls.

+ tpe +

Sets trace patterns on messages.

ctp

Clears trace patterns on local and global function calls.

@@ -291,13 +299,15 @@ ttb:p(all, call).

Clears trace patterns on local function calls.

ctpg

Clears trace patterns on global function calls.

+ ctpe +

Clears trace patterns on messages.

With tp and tpl, one of the match specification shortcuts can be used (for example, ttb:tp(foo_module, caller)).

The shortcuts are as follows:

return - for [{'_',[],[{return_trace}]}] - (report the return value) + (report the return value from a traced function) caller - for [{'_',[],[{message,{caller}}]}] (report the calling function) {codestr, Str} - for dbg:fun2ms/1 arguments diff --git a/lib/observer/src/ttb.erl b/lib/observer/src/ttb.erl index 4d6eb3ba8d..32c2fad775 100644 --- a/lib/observer/src/ttb.erl +++ b/lib/observer/src/ttb.erl @@ -25,7 +25,8 @@ -export([tracer/0,tracer/1,tracer/2,p/2,stop/0,stop/1,start_trace/4]). -export([get_et_handler/0]). -export([tp/2, tp/3, tp/4, ctp/0, ctp/1, ctp/2, ctp/3, tpl/2, tpl/3, tpl/4, - ctpl/0, ctpl/1, ctpl/2, ctpl/3, ctpg/0, ctpg/1, ctpg/2, ctpg/3]). + ctpl/0, ctpl/1, ctpl/2, ctpl/3, ctpg/0, ctpg/1, ctpg/2, ctpg/3, + tpe/2, ctpe/1]). -export([seq_trigger_ms/0,seq_trigger_ms/1]). -export([write_trace_info/2]). -export([write_config/2,write_config/3,run_config/1,run_config/2,list_config/1]). @@ -479,6 +480,11 @@ tpl(A,B,C,D) -> store(tpl,[A,B,C,ms(D)]), dbg:tpl(A,B,C,ms(D)). +tpe(A,B) -> + ensure_no_overloaded_nodes(), + store(tpe,[A,ms(B)]), + dbg:tpe(A,ms(B)). + ctp() -> store(ctp,[]), dbg:ctp(). @@ -518,6 +524,10 @@ ctpg(A,B,C) -> store(ctpg,[A,B,C]), dbg:ctpg(A,B,C). +ctpe(A) -> + store(ctpe,[A]), + dbg:ctpe(A). + ms(return) -> [{'_',[],[{return_trace}]}]; ms(caller) -> -- cgit v1.2.3