aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_bif_trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam/erl_bif_trace.c')
-rw-r--r--erts/emulator/beam/erl_bif_trace.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c
index 6515eafbd5..06cec1795d 100644
--- a/erts/emulator/beam/erl_bif_trace.c
+++ b/erts/emulator/beam/erl_bif_trace.c
@@ -1369,12 +1369,8 @@ erts_set_trace_pattern(Process*p, Eterm* mfa, int specified,
BeamInstr* pc = fp[i].pc;
Export* ep = (Export *)(((char *)(pc-3)) - offsetof(Export, code));
- if (!on || flags.breakpoint) {
- erts_clear_call_trace_bif(pc, 0);
- if (pc[0] == (BeamInstr) BeamOp(op_i_generic_breakpoint)) {
- pc[0] = (BeamInstr) BeamOp(op_jump_f);
- }
- } else {
+ if (on && !flags.breakpoint) {
+ /* Turn on global call tracing */
if (ep->addressv[code_ix] != pc) {
fp[i].mod->curr.num_traced_exports++;
#ifdef DEBUG
@@ -1387,6 +1383,17 @@ erts_set_trace_pattern(Process*p, Eterm* mfa, int specified,
if (ep->addressv[code_ix] != pc) {
pc[0] = (BeamInstr) BeamOp(op_i_generic_breakpoint);
}
+ } else if (!on && flags.breakpoint) {
+ /* Turn off breakpoint tracing -- nothing to do here. */
+ } else {
+ /*
+ * Turn off global tracing, either explicitly or implicitly
+ * before turning on breakpoint tracing.
+ */
+ erts_clear_call_trace_bif(pc, 0);
+ if (pc[0] == (BeamInstr) BeamOp(op_i_generic_breakpoint)) {
+ pc[0] = (BeamInstr) BeamOp(op_jump_f);
+ }
}
}