summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-09-03 16:47:15 +0200
committerNicholas Clark <nick@ccl4.org>2012-09-04 11:08:38 +0200
commit7bbbc3c08a8830fe5d44ce7a6056cfba6fb67c22 (patch)
tree17d3ee1a96dba24e2464607b7075ab64f9701717 /mg.c
parent83519873101c5088b6e33e85da400d6f575c0ceb (diff)
downloadperl-7bbbc3c08a8830fe5d44ce7a6056cfba6fb67c22.tar.gz
Perl_magic_setdbline() should clear and set read-only OP slabs.
The debugger implements breakpoints by setting/clearing OPf_SPECIAL on OP_DBSTATE ops. This means that it is writing to the optree at runtime, and it falls foul of the enforced read-only OP slabs when debugging with -DPERL_DEBUG_READONLY_OPS Avoid this by removing static from Slab_to_rw(), and using it and Slab_to_ro() in Perl_magic_setdbline() to temporarily make the slab re-write whilst changing the breakpoint flag. With this all tests pass with -DPERL_DEBUG_READONLY_OPS (on this system)
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 3dea5c2ba4..1f6d0626a8 100644
--- a/mg.c
+++ b/mg.c
@@ -2020,11 +2020,17 @@ Perl_magic_setdbline(pTHX_ SV *sv, MAGIC *mg)
if (svp && SvIOKp(*svp)) {
OP * const o = INT2PTR(OP*,SvIVX(*svp));
if (o) {
+#ifdef PERL_DEBUG_READONLY_OPS
+ Slab_to_rw(OpSLAB(o));
+#endif
/* set or clear breakpoint in the relevant control op */
if (i)
o->op_flags |= OPf_SPECIAL;
else
o->op_flags &= ~OPf_SPECIAL;
+#ifdef PERL_DEBUG_READONLY_OPS
+ Slab_to_ro(OpSLAB(o));
+#endif
}
}
return 0;