diff options
author | Lukas Larsson <[email protected]> | 2017-06-02 14:20:34 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-06-02 14:20:34 +0200 |
commit | ff09499cff15aaa5be025321cbb3f11a1e2a0ea1 (patch) | |
tree | 577cee414cf9a2ac43778cb306bcbe48e54415c9 | |
parent | e8a89afac4c3ae0003c8ec67fa27acd8b9e23fa9 (diff) | |
parent | d3bbb08de56ee4d0093fd6a5da4e45b0b0a9741c (diff) | |
download | otp-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
-rw-r--r-- | erts/doc/src/erl_tracer.xml | 13 |
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 <0.37.0> 3> erlang:trace(new, true, [send,{tracer, erl_msg_tracer, Tracer}]). 0 -{<0.39.0>,<0.27.0>} +{trace,<0.39.0>,<0.27.0>} 4> {ok, D} = file:open("/tmp/tmp.data",[write]). {trace,#Port<0.486>,<0.40.0>} {trace,<0.40.0>,<0.21.0>} @@ -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], &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"), &recipient)) { + msg = enif_make_tuple3(env, enif_make_atom(env, "trace"), argv[2], recipient); enif_send(env, &to_pid, NULL, msg); + } } return enif_make_atom(env, "ok"); |