From 875fd93c65810378dd377604bea67c4c1f933b87 Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Wed, 3 Aug 2011 15:40:07 +0200
Subject: Add two additional built-in trace patterns, c and cx
c means [{'_',[],[{message,{caller}}]}]
cx means [{'_',[],[{exception_trace},{message,{caller}}]}]
---
lib/runtime_tools/doc/src/dbg.xml | 4 ++++
lib/runtime_tools/src/dbg.erl | 13 +++++++++++++
2 files changed, 17 insertions(+)
(limited to 'lib')
diff --git a/lib/runtime_tools/doc/src/dbg.xml b/lib/runtime_tools/doc/src/dbg.xml
index 0e63649c09..df4cdf7cab 100644
--- a/lib/runtime_tools/doc/src/dbg.xml
+++ b/lib/runtime_tools/doc/src/dbg.xml
@@ -528,6 +528,10 @@ Error: fun containing local erlang function calls ('is_atomm' called in guard) c
Match specifications used can be saved in a file (if a
read-write file system is present) for use in later
debugging sessions, see wtp/1 and rtp/1
+
There are three built-in trace patterns:
+ x, c and cx. They represent an
+ exception trace, caller trace and a caller and exception trace
+ respectively.
diff --git a/lib/runtime_tools/src/dbg.erl b/lib/runtime_tools/src/dbg.erl
index 56283f4d3d..446de63064 100644
--- a/lib/runtime_tools/src/dbg.erl
+++ b/lib/runtime_tools/src/dbg.erl
@@ -1449,6 +1449,19 @@ new_pattern_table() ->
ets:insert(PT,
{exception_trace,
term_to_binary(x)}),
+ ets:insert(PT,
+ {c,
+ term_to_binary([{'_',[],[{message,{caller}}]}])}),
+ ets:insert(PT,
+ {caller_trace,
+ term_to_binary(c)}),
+ ets:insert(PT,
+ {cx,
+ term_to_binary([{'_',[],[{exception_trace},
+ {message,{caller}}]}])}),
+ ets:insert(PT,
+ {caller_exception_trace,
+ term_to_binary(cx)}),
PT.
--
cgit v1.2.3
From 6d8ad1f5636b25c0e344ef5eb673612b835a3ef9 Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Tue, 9 Aug 2011 17:04:09 +0200
Subject: Expand documenation about built-in aliases for tracing patterns
---
lib/runtime_tools/doc/src/dbg.xml | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
(limited to 'lib')
diff --git a/lib/runtime_tools/doc/src/dbg.xml b/lib/runtime_tools/doc/src/dbg.xml
index df4cdf7cab..a17896e4ff 100644
--- a/lib/runtime_tools/doc/src/dbg.xml
+++ b/lib/runtime_tools/doc/src/dbg.xml
@@ -4,7 +4,7 @@
- 19962009
+ 19962011Ericsson AB. All Rights Reserved.
@@ -316,7 +316,8 @@ Error: fun containing local erlang function calls ('is_atomm' called in guard) c
Module = atom() | '_'Function = atom() | '_'Arity = integer() |'_'
- MatchSpec = integer() | atom() | [] | match_spec()
+ MatchSpec = integer() | Built-inAlias | [] | match_spec()
+ Built-inAlias = x | c | cxMatchDesc = [MatchInfo]MatchInfo = {saved, integer()} | MatchNumMatchNum = {matched, node(), integer()} | {matched, node(), 0, RPCError}
@@ -349,8 +350,9 @@ Error: fun containing local erlang function calls ('is_atomm' called in guard) c
if the MatchSpec is other
than []. The integer N may then be used in
subsequent calls to this function and will stand as an
- "alias" for the given expression. There are also built-in
- aliases named with atoms (see also ltp/0 below).
+ "alias" for the given expression. There are also a couple of
+ built-in aliases for common expressions, see ltp/0 below
+ for details.
If an error is returned, it can be due to errors in
compilation of the match specification. Such errors are
presented as a list of tuples {error, string()} where
@@ -528,10 +530,21 @@ Error: fun containing local erlang function calls ('is_atomm' called in guard) c
Match specifications used can be saved in a file (if a
read-write file system is present) for use in later
debugging sessions, see wtp/1 and rtp/1
-
There are three built-in trace patterns:
- x, c and cx. They represent an
- exception trace, caller trace and a caller and exception trace
- respectively.
+
There are three built-in trace patterns:
+ exception_trace, caller_trace
+ and caller_exception_trace (or x, c and
+ cx respectively).
+ Exception trace sets a trace which will show function names,
+ parameters, return values and exceptions thrown from functions.
+ Caller traces display function names, parameters and information
+ about which function called it. An example using a built-in alias:
+
+(x@y)4> dbg:tp(lists,sort,cx).
+{ok,[{matched,nonode@nohost,2},{saved,cx}]}
+(x@y)4> lists:sort([2,1]).
+(<0.32.0>) call lists:sort([2,1]) ({erl_eval,do_apply,5})
+(<0.32.0>) returned from lists:sort/1 -> [1,2]
+[1,2]