summaryrefslogtreecommitdiff
path: root/embedvar.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-10-28 21:59:14 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-12-21 18:09:54 -0800
commitc1cec775e9019cc8ae244d4db239a7ea5c0b343e (patch)
treef2c2393343552b8a6e74bce1257e8770413d1839 /embedvar.h
parentbb02e0c10a57ab28b9ec6ca218c7aa6aac53a90c (diff)
downloadperl-c1cec775e9019cc8ae244d4db239a7ea5c0b343e.tar.gz
[perl #119801] Stop @DB::dbline modifications from crashing
The cop address for each breakable line was being stored in the IVX slot of ${"_<$file"}[$line]. This value itself, writable from Perl space, was being used as the address of the op to be flagged, whenever a breakpoint was set. This meant writing to ${"_<$file"}[$line] and assigning a number (like 42) would cause perl to use 42 as an op address, and crash when trying to flag the op. Furthermore, since the array holding the lines could outlive the ops, setting a breakpoint on the op could write to freed memory or to an unrelated op (even a different type), potentially changing the beha- viour of unrelated code. This commit solves those pitfalls by moving breakpoints into a global breakpoint bitfield. Dbstate ops now have an extra field on the end holding a sequence number, representing which bit holds the breakpoint for that op.
Diffstat (limited to 'embedvar.h')
-rw-r--r--embedvar.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/embedvar.h b/embedvar.h
index 06d4e181a0..f90a19e8a6 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -357,6 +357,12 @@
#define PL_appctx (my_vars->Gappctx)
#define PL_Gappctx (my_vars->Gappctx)
+#define PL_breakpoints (my_vars->Gbreakpoints)
+#define PL_Gbreakpoints (my_vars->Gbreakpoints)
+#define PL_breakpointseq (my_vars->Gbreakpointseq)
+#define PL_Gbreakpointseq (my_vars->Gbreakpointseq)
+#define PL_breakpointslen (my_vars->Gbreakpointslen)
+#define PL_Gbreakpointslen (my_vars->Gbreakpointslen)
#define PL_check (my_vars->Gcheck)
#define PL_Gcheck (my_vars->Gcheck)
#define PL_check_mutex (my_vars->Gcheck_mutex)