aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-01-23 11:17:46 +0100
committerSverker Eriksson <[email protected]>2012-02-21 12:23:01 +0100
commit2a04e25043753d1e9de617e85b27b64781b683cb (patch)
treed3067f72290e10337e6783f5906630e82f368bf7 /erts/emulator/beam
parent8e75055985dfd1ae3c07c6a551359e2aa600a882 (diff)
downloadotp-2a04e25043753d1e9de617e85b27b64781b683cb.tar.gz
otp-2a04e25043753d1e9de617e85b27b64781b683cb.tar.bz2
otp-2a04e25043753d1e9de617e85b27b64781b683cb.zip
erts: Fix case of breakpoint when deleting module
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/beam_bif_load.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 7c09ef7083..7a65552d76 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -37,6 +37,7 @@
static void set_default_trace_pattern(Eterm module, ErtsCodeIndex);
static Eterm check_process_code(Process* rp, Module* modp);
+static void ensure_no_breakpoints(Process *, ErtsProcLocks, Eterm module);
static void delete_code(Process *c_p, ErtsProcLocks c_p_locks, Module* modp);
static void delete_export_references(Eterm module);
static int purge_module(int module);
@@ -85,6 +86,8 @@ load_module_2(BIF_ALIST_2)
erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
erts_smp_thr_progress_block();*/
+ ensure_no_breakpoints(BIF_P, 0, BIF_ARG_1);
+
erts_lock_code_ix();
erts_start_loader_code_ix();
@@ -168,6 +171,8 @@ BIF_RETTYPE code_make_stub_module_3(BIF_ALIST_3)
erts_export_consolidate(erts_active_code_ix());*/
+ ensure_no_breakpoints(BIF_P, 0, BIF_ARG_1);
+
erts_lock_code_ix();
erts_start_loader_code_ix();
@@ -286,6 +291,8 @@ BIF_RETTYPE delete_module_1(BIF_ALIST_1)
erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
erts_smp_thr_progress_block();*/
+ ensure_no_breakpoints(BIF_P, 0, BIF_ARG_1);
+
erts_lock_code_ix();
erts_start_loader_code_ix();
code_ix = erts_loader_code_ix();
@@ -791,19 +798,18 @@ decrement_refc(BeamInstr* code)
}
}
-
+
/*
- * Move code from current to old.
+ * Clear breakpoints in module if any
*/
-
-static void
-delete_code(Process *c_p, ErtsProcLocks c_p_locks, Module* modp)
+static void ensure_no_breakpoints(Process *c_p, ErtsProcLocks c_p_locks,
+ Eterm module)
{
- /*
- * Clear breakpoints if any
- */
- if (modp->curr.code != NULL && modp->curr.code[MI_NUM_BREAKPOINTS] > 0) {
- ASSERT(!"SVERK What to do here");
+ ErtsCodeIndex code_ix = erts_active_code_ix();
+ Module* modp = erts_get_module(module, code_ix);
+
+ if (modp && modp->curr.code != NULL
+ && modp->curr.code[MI_NUM_BREAKPOINTS] > 0) {
#ifdef ERTS_ENABLE_LOCK_CHECK
#ifdef ERTS_SMP
if (c_p && c_p_locks)
@@ -821,6 +827,16 @@ delete_code(Process *c_p, ErtsProcLocks c_p_locks, Module* modp)
if (c_p && c_p_locks)
erts_smp_proc_lock(c_p, ERTS_PROC_LOCK_MAIN);
}
+}
+
+/*
+ * Move code from current to old.
+ */
+
+static void
+delete_code(Process *c_p, ErtsProcLocks c_p_locks, Module* modp)
+{
+ ASSERT(!(modp->curr.code && modp->curr.code[MI_NUM_BREAKPOINTS] > 0));
modp->old = modp->curr;
modp->curr.code = NULL;
modp->curr.code_length = 0;