summaryrefslogtreecommitdiff
path: root/mg_vtable.h
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2014-10-02 15:54:58 +1000
committerTony Cook <tony@develop-help.com>2014-10-09 11:24:50 +1100
commita6d695237c4c14fa287df157c4907e01d4647641 (patch)
tree77c7361b0f9c6d75fc7b703d4cc190cb16b906d3 /mg_vtable.h
parent2c2d7daa95190ae95ae6486d1734a1167ea05966 (diff)
downloadperl-a6d695237c4c14fa287df157c4907e01d4647641.tar.gz
[perl #122445] use magic on $DB::single etc to avoid overload issues
This prevents perl recursing infinitely when an overloaded object is assigned to $DB::single, $DB::trace or $DB::signal This is done by referencing their values as IVs instead of as SVs in dbstate, and by adding magic to those variables so that assignments to the scalars update the PL_DBcontrol array.
Diffstat (limited to 'mg_vtable.h')
-rw-r--r--mg_vtable.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/mg_vtable.h b/mg_vtable.h
index f391713761..104e936cba 100644
--- a/mg_vtable.h
+++ b/mg_vtable.h
@@ -16,6 +16,7 @@
#define PERL_MAGIC_arylen '#' /* Array length ($#ary) */
#define PERL_MAGIC_rhash '%' /* extra data for restricted hashes */
#define PERL_MAGIC_proto '&' /* my sub prototype CV */
+#define PERL_MAGIC_debugvar '*' /* $DB::single, signal, trace vars */
#define PERL_MAGIC_pos '.' /* pos() lvalue */
#define PERL_MAGIC_symtab ':' /* extra data for symbol tables */
#define PERL_MAGIC_backref '<' /* for weak ref data */
@@ -64,6 +65,7 @@ enum { /* pass one of these to get_vtbl */
want_vtbl_checkcall,
want_vtbl_collxfrm,
want_vtbl_dbline,
+ want_vtbl_debugvar,
want_vtbl_defelem,
want_vtbl_env,
want_vtbl_envelem,
@@ -98,6 +100,7 @@ EXTCONST char * const PL_magic_vtable_names[magic_vtable_max] = {
"checkcall",
"collxfrm",
"dbline",
+ "debugvar",
"defelem",
"env",
"envelem",
@@ -155,6 +158,7 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max] = {
{ 0, 0, 0, 0, 0, 0, 0, 0 },
#endif
{ 0, Perl_magic_setdbline, 0, 0, 0, 0, 0, 0 },
+ { Perl_magic_getdebugvar, Perl_magic_setdebugvar, 0, 0, 0, 0, 0, 0 },
{ Perl_magic_getdefelem, Perl_magic_setdefelem, 0, 0, 0, 0, 0, 0 },
{ 0, Perl_magic_set_all_env, 0, Perl_magic_clear_all_env, 0, 0, 0, 0 },
{ 0, Perl_magic_setenv, 0, Perl_magic_clearenv, 0, 0, 0, 0 },
@@ -197,6 +201,7 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max];
#define PL_vtbl_checkcall PL_magic_vtables[want_vtbl_checkcall]
#define PL_vtbl_collxfrm PL_magic_vtables[want_vtbl_collxfrm]
#define PL_vtbl_dbline PL_magic_vtables[want_vtbl_dbline]
+#define PL_vtbl_debugvar PL_magic_vtables[want_vtbl_debugvar]
#define PL_vtbl_defelem PL_magic_vtables[want_vtbl_defelem]
#define PL_vtbl_env PL_magic_vtables[want_vtbl_env]
#define PL_vtbl_envelem PL_magic_vtables[want_vtbl_envelem]