diff options
author | Péter Gömöri <[email protected]> | 2017-05-21 02:17:35 +0200 |
---|---|---|
committer | Péter Gömöri <[email protected]> | 2017-05-21 02:30:28 +0200 |
commit | d3bbb08de56ee4d0093fd6a5da4e45b0b0a9741c (patch) | |
tree | 45c07e3c021d47a74e8ca68c2b0fab4f9c16a4b8 | |
parent | 7e78ec47ef00f2f7837c7a65056cf2162e0ef7e0 (diff) | |
download | otp-d3bbb08de56ee4d0093fd6a5da4e45b0b0a9741c.tar.gz otp-d3bbb08de56ee4d0093fd6a5da4e45b0b0a9741c.tar.bz2 otp-d3bbb08de56ee4d0093fd6a5da4e45b0b0a9741c.zip |
Update erl_msg_tracer example
After "Move tracer SecondTraceTerm to Opts map" in commit 115f0ba7
getting the receipient has to be done on a bit different way.
-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"); |