Merge pull request #51 from ferd/evanmcc-trace-fn
Evanmcc trace fn
diff --git a/README.md b/README.md
index aec9c96..09bbbc5 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,8 @@
- Allow the `return_to` option in `recon_trace`
- More efficient sorting function for procs and ports attributes
(thanks to @zhongwencool and @pichi)
+ - Allow the usage of `return_trace` in `recon_trace:calls/2-3` instead
+ of `fun(_) -> return_trace() end`.
- 2.3.1
- Updated `app_deps` script to run with rebar3 dependencies
- Minor docs update
diff --git a/src/recon_trace.erl b/src/recon_trace.erl
index c5339eb..71fd8f1 100644
--- a/src/recon_trace.erl
+++ b/src/recon_trace.erl
@@ -201,7 +201,7 @@
-type mod() :: '_' | module().
-type fn() :: '_' | atom().
--type args() :: '_' | 0..255 | matchspec() | shellfun().
+-type args() :: '_' | 0..255 | return_trace | matchspec() | shellfun().
-type tspec() :: {mod(), fn(), args()}.
-type max() :: max_traces() | max_rate().
-type num_matches() :: non_neg_integer().
@@ -281,7 +281,9 @@
%% or
%% ``recon_trace:calls({Mod,Fun,[{'_', [], [{return_trace}]}]}, Max, Opts)'',
%% the important bit being the `return_trace()' call or the
-%% `{return_trace}' match spec value.</li>
+%% `{return_trace}' match spec value.
+%% A short-hand version for this pattern of 'match anything, trace everything'
+%% for a function is `recon_trace:calls({Mod, Fun, return_trace})'. </li>
%% </ul>
%%
%% There's a few more combination possible, with multiple trace patterns per call, and more
@@ -470,6 +472,9 @@
validate_tspec(Mod, Fun, Args) when is_function(Args) ->
validate_tspec(Mod, Fun, fun_to_ms(Args));
+%% helper to save typing for common actions
+validate_tspec(Mod, Fun, return_trace) ->
+ validate_tspec(Mod, Fun, [{'_', [], [{return_trace}]}]);
validate_tspec(Mod, Fun, Args) ->
BannedMods = ['_', ?MODULE, io, lists],
%% The banned mod check can be bypassed by using