aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-06-02 14:20:34 +0200
committerGitHub <[email protected]>2017-06-02 14:20:34 +0200
commitff09499cff15aaa5be025321cbb3f11a1e2a0ea1 (patch)
tree577cee414cf9a2ac43778cb306bcbe48e54415c9 /erts
parente8a89afac4c3ae0003c8ec67fa27acd8b9e23fa9 (diff)
parentd3bbb08de56ee4d0093fd6a5da4e45b0b0a9741c (diff)
downloadotp-ff09499cff15aaa5be025321cbb3f11a1e2a0ea1.tar.gz
otp-ff09499cff15aaa5be025321cbb3f11a1e2a0ea1.tar.bz2
otp-ff09499cff15aaa5be025321cbb3f11a1e2a0ea1.zip
Merge pull request #1471 from gomoripeti/fix_erl_tracer_example
Update erl_msg_tracer example
Diffstat (limited to 'erts')
-rw-r--r--erts/doc/src/erl_tracer.xml13
1 files changed, 8 insertions, 5 deletions
diff --git a/erts/doc/src/erl_tracer.xml b/erts/doc/src/erl_tracer.xml
index 63feebb0b5..fd3c17f337 100644
--- a/erts/doc/src/erl_tracer.xml
+++ b/erts/doc/src/erl_tracer.xml
@@ -653,7 +653,7 @@ ok
&lt;0.37.0&gt;
3&gt; erlang:trace(new, true, [send,{tracer, erl_msg_tracer, Tracer}]).
0
-{&lt;0.39.0&gt;,&lt;0.27.0&gt;}
+{trace,&lt;0.39.0&gt;,&lt;0.27.0&gt;}
4&gt; {ok, D} = file:open("/tmp/tmp.data",[write]).
{trace,#Port&lt;0.486&gt;,&lt;0.40.0&gt;}
{trace,&lt;0.40.0&gt;,&lt;0.21.0&gt;}
@@ -758,18 +758,21 @@ static ERL_NIF_TERM enabled(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
/*
* argv[0]: TraceTag, should only be 'send'
- * argv[1]: TracerState, process to send {argv[2], argv[4]} to
+ * argv[1]: TracerState, process to send {Tracee, Recipient} to
* argv[2]: Tracee
- * argv[3]: Recipient
- * argv[4]: Options, ignored
+ * argv[3]: Message
+ * argv[4]: Options, map containing Recipient
*/
static ERL_NIF_TERM trace(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
ErlNifPid to_pid;
+ ERL_NIF_TERM recipient, msg;
if (enif_get_local_pid(env, argv[1], &amp;to_pid)) {
- ERL_NIF_TERM msg = enif_make_tuple3(env, enif_make_atom(env, "trace"), argv[2], argv[4]);
+ if (enif_get_map_value(env, argv[4], enif_make_atom(env, "extra"), &amp;recipient)) {
+ msg = enif_make_tuple3(env, enif_make_atom(env, "trace"), argv[2], recipient);
enif_send(env, &amp;to_pid, NULL, msg);
+ }
}
return enif_make_atom(env, "ok");