aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-08-30 11:36:46 +0200
committerBjörn Gustavsson <[email protected]>2012-08-30 11:36:46 +0200
commitd03a903f4b671f6d55d5e5be53e302e70cd84ba3 (patch)
tree5b0bf0854f4ce0232e4e8d2365dcfdeb04cea13a /erts/emulator/beam
parentc81e86fdda33f5e4b86fcaf4007ff9e3bec0f3d9 (diff)
parent2848eb10d0c006f4498acddfdf89830ec1040c11 (diff)
downloadotp-d03a903f4b671f6d55d5e5be53e302e70cd84ba3.tar.gz
otp-d03a903f4b671f6d55d5e5be53e302e70cd84ba3.tar.bz2
otp-d03a903f4b671f6d55d5e5be53e302e70cd84ba3.zip
Merge branch 'bjorn/erts/fix-trace-pattern'
* bjorn/erts/fix-trace-pattern: Make sure that turning off local trace does not turn off global trace erl_bif_trace: Remove an unused variable
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_bif_trace.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c
index e88fb8c9f4..06cec1795d 100644
--- a/erts/emulator/beam/erl_bif_trace.c
+++ b/erts/emulator/beam/erl_bif_trace.c
@@ -118,7 +118,6 @@ trace_pattern(Process* p, Eterm MFA, Eterm Pattern, Eterm flaglist)
int is_global;
Process *meta_tracer_proc = p;
Eterm meta_tracer_pid = p->id;
- int is_blocking = 0;
if (!erts_try_seize_code_write_permission(p)) {
ERTS_BIF_YIELD3(bif_export[BIF_trace_pattern_3], p, MFA, Pattern, flaglist);
@@ -1370,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
@@ -1388,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);
+ }
}
}