diff options
author | Sverker Eriksson <[email protected]> | 2019-05-27 20:44:54 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2019-05-28 17:34:52 +0200 |
commit | 240acb9617f54761c820bb9a296a2e0256ed83a9 (patch) | |
tree | 47c5b27de58684db5a06a5bcc3b67b9408072ca6 | |
parent | 1b306c8a0755aca9de55fee2b02e38d17b696dfd (diff) | |
download | otp-240acb9617f54761c820bb9a296a2e0256ed83a9.tar.gz otp-240acb9617f54761c820bb9a296a2e0256ed83a9.tar.bz2 otp-240acb9617f54761c820bb9a296a2e0256ed83a9.zip |
erts: Fix seq_trace:print/2 for arbitrary labels
Would raise badarg if Label was not atom or small integer.
-rw-r--r-- | erts/emulator/beam/erl_bif_trace.c | 5 | ||||
-rw-r--r-- | lib/kernel/test/seq_trace_SUITE.erl | 12 |
2 files changed, 8 insertions, 9 deletions
diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c index 97e869f5a3..8a4f744b2c 100644 --- a/erts/emulator/beam/erl_bif_trace.c +++ b/erts/emulator/beam/erl_bif_trace.c @@ -2060,10 +2060,7 @@ BIF_RETTYPE seq_trace_print_2(BIF_ALIST_2) if (have_no_seqtrace(SEQ_TRACE_TOKEN(BIF_P))) { BIF_RET(am_false); } - if (!(is_atom(BIF_ARG_1) || is_small(BIF_ARG_1))) { - BIF_ERROR(BIF_P, BADARG); - } - if (SEQ_TRACE_TOKEN_LABEL(BIF_P) != BIF_ARG_1) + if (!EQ(BIF_ARG_1, SEQ_TRACE_TOKEN_LABEL(BIF_P))) BIF_RET(am_false); seq_trace_update_send(BIF_P); seq_trace_output(SEQ_TRACE_TOKEN(BIF_P), BIF_ARG_2, diff --git a/lib/kernel/test/seq_trace_SUITE.erl b/lib/kernel/test/seq_trace_SUITE.erl index 7c1413287c..9d97254dc0 100644 --- a/lib/kernel/test/seq_trace_SUITE.erl +++ b/lib/kernel/test/seq_trace_SUITE.erl @@ -147,17 +147,19 @@ tracer_set_get(Config) when is_list(Config) -> ok. print(Config) when is_list(Config) -> - lists:foreach(fun do_print/1, ?TIMESTAMP_MODES). + [do_print(TsType, Label) || TsType <- ?TIMESTAMP_MODES, + Label <- [17, "label"]]. -do_print(TsType) -> +do_print(TsType, Label) -> start_tracer(), + seq_trace:set_token(label, Label), set_token_flags([print, TsType]), - seq_trace:print(0,print1), + seq_trace:print(Label,print1), seq_trace:print(1,print2), seq_trace:print(print3), seq_trace:reset_trace(), - [{0,{print,_,_,[],print1}, Ts0}, - {0,{print,_,_,[],print3}, Ts1}] = stop_tracer(2), + [{Label,{print,_,_,[],print1}, Ts0}, + {Label,{print,_,_,[],print3}, Ts1}] = stop_tracer(2), check_ts(TsType, Ts0), check_ts(TsType, Ts1). |