This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_runops_debug(): do FREETMPS
authorDavid Mitchell <davem@iabyn.com>
Mon, 16 Nov 2015 14:40:04 +0000 (14:40 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:18:33 +0000 (09:18 +0000)
In runops_debug() wrap the optional printing of next op, arg stack
etc with ENTER/SAVETMPS, FREETMPS/LEAVE - so that temporaries created by
the dump output are promptly freed, and thus don't alter the tmps stack.

(I'm trying to debug some tmps stack corruption, and running with -Dst
made the problem go away).

dump.c

diff --git a/dump.c b/dump.c
index f7a6380..81b985f 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -2201,6 +2201,8 @@ Perl_runops_debug(pTHX)
         ++PL_op_exec_cnt[PL_op->op_type];
 #endif
        if (PL_debug) {
         ++PL_op_exec_cnt[PL_op->op_type];
 #endif
        if (PL_debug) {
+            ENTER;
+            SAVETMPS;
            if (PL_watchaddr && (*PL_watchaddr != PL_watchok))
                PerlIO_printf(Perl_debug_log,
                              "WARNING: %"UVxf" changed from %"UVxf" to %"UVxf"\n",
            if (PL_watchaddr && (*PL_watchaddr != PL_watchok))
                PerlIO_printf(Perl_debug_log,
                              "WARNING: %"UVxf" changed from %"UVxf" to %"UVxf"\n",
@@ -2218,6 +2220,8 @@ Perl_runops_debug(pTHX)
 
            if (DEBUG_t_TEST_) debop(PL_op);
            if (DEBUG_P_TEST_) debprof(PL_op);
 
            if (DEBUG_t_TEST_) debop(PL_op);
            if (DEBUG_P_TEST_) debprof(PL_op);
+            FREETMPS;
+            LEAVE;
        }
 
         OP_ENTRY_PROBE(OP_NAME(PL_op));
        }
 
         OP_ENTRY_PROBE(OP_NAME(PL_op));