aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-02-02 11:47:18 +0100
committerSverker Eriksson <[email protected]>2012-02-21 12:23:06 +0100
commite148e9fc3e11eb6e08e2dc94a468dc433864b11b (patch)
tree285b32baaf5cef8c75b2c5331c05d745246740ce
parent9dbd1dbf260c41878704728adc533ace1a27c1ff (diff)
downloadotp-e148e9fc3e11eb6e08e2dc94a468dc433864b11b.tar.gz
otp-e148e9fc3e11eb6e08e2dc94a468dc433864b11b.tar.bz2
otp-e148e9fc3e11eb6e08e2dc94a468dc433864b11b.zip
erts: Fix tracing bug for new non-blocking load
Made on_load-tracing always set after commit on active code_ix when system is still blocked. Bug caused cprof_SUITE:on_load to fail.
-rw-r--r--erts/emulator/beam/beam_bif_load.c13
-rw-r--r--erts/emulator/beam/erl_bif_trace.c7
-rw-r--r--erts/emulator/beam/global.h3
3 files changed, 11 insertions, 12 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 8d41c7499d..d241bec441 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -35,7 +35,7 @@
#include "erl_nif.h"
#include "erl_thr_progress.h"
-static void set_default_trace_pattern(Eterm module, ErtsCodeIndex);
+static void set_default_trace_pattern(Eterm module);
static Eterm check_process_code(Process* rp, Module* modp);
static void delete_code(Module* modp);
static int purge_module(Process*, int module);
@@ -114,8 +114,10 @@ load_module_2(BIF_ALIST_2)
}
res = TUPLE2(hp, am_error, reason);
} else {
- set_default_trace_pattern(BIF_ARG_1, erts_staging_code_ix());
erts_commit_staging_code_ix();
+ if (is_blocking) {
+ set_default_trace_pattern(BIF_ARG_1);
+ }
res = TUPLE2(hp, am_module, BIF_ARG_1);
}
@@ -485,7 +487,7 @@ BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2)
}
}
modp->curr.code[MI_ON_LOAD_FUNCTION_PTR] = 0;
- set_default_trace_pattern(BIF_ARG_1, erts_active_code_ix ());
+ set_default_trace_pattern(BIF_ARG_1);
} else if (BIF_ARG_2 == am_false) {
BeamInstr* code;
BeamInstr* end;
@@ -513,7 +515,7 @@ BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2)
}
static void
-set_default_trace_pattern(Eterm module, ErtsCodeIndex code_ix)
+set_default_trace_pattern(Eterm module)
{
int trace_pattern_is_on;
Binary *match_spec;
@@ -533,8 +535,7 @@ set_default_trace_pattern(Eterm module, ErtsCodeIndex code_ix)
match_spec,
meta_match_spec,
1, trace_pattern_flags,
- meta_tracer_pid,
- code_ix);
+ meta_tracer_pid);
}
}
diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c
index 203ba9004b..c92e0400e0 100644
--- a/erts/emulator/beam/erl_bif_trace.c
+++ b/erts/emulator/beam/erl_bif_trace.c
@@ -333,8 +333,7 @@ trace_pattern(Process* p, Eterm MFA, Eterm Pattern, Eterm flaglist)
matches = erts_set_trace_pattern(mfa, specified,
match_prog_set, match_prog_set,
- on, flags, meta_tracer_pid,
- erts_active_code_ix());
+ on, flags, meta_tracer_pid);
MatchSetUnref(match_prog_set);
done:
@@ -1335,9 +1334,9 @@ int
erts_set_trace_pattern(Eterm* mfa, int specified,
Binary* match_prog_set, Binary *meta_match_prog_set,
int on, struct trace_pattern_flags flags,
- Eterm meta_tracer_pid,
- ErtsCodeIndex code_ix)
+ Eterm meta_tracer_pid)
{
+ const ErtsCodeIndex code_ix = erts_active_code_ix();
int matches = 0;
int i;
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index 580336470c..9a174b1ab1 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -1765,8 +1765,7 @@ extern int erts_call_time_breakpoint_tracing;
int erts_set_trace_pattern(Eterm* mfa, int specified,
Binary* match_prog_set, Binary *meta_match_prog_set,
int on, struct trace_pattern_flags,
- Eterm meta_tracer_pid,
- ErtsCodeIndex);
+ Eterm meta_tracer_pid);
void
erts_get_default_trace_pattern(int *trace_pattern_is_on,
Binary **match_spec,