In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/cfbdacd3fe159abe693ef1eb6fd7460850ef9312?hp=cb87b182a5dce7fcec9a566d505ef08d0e85c813>

- Log -----------------------------------------------------------------
commit cfbdacd3fe159abe693ef1eb6fd7460850ef9312
Author: Tony Cook <t...@develop-help.com>
Date:   Thu Aug 31 14:33:17 2017 +1000

    add a stack extend check to pp_entersub for XS subs
    
    This allows us to report the XSUB involved by name (or at least by
    filename if it's anonymous) in the likely case that it was an XSUB
    that failed to extend the stack.
-----------------------------------------------------------------------

Summary of changes:
 pp_hot.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pp_hot.c b/pp_hot.c
index ee6535ca75..b891d79519 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -4420,6 +4420,21 @@ PP(pp_entersub)
        assert(CvXSUB(cv));
        CvXSUB(cv)(aTHX_ cv);
 
+#if defined DEBUGGING && !defined DEBUGGING_RE_ONLY
+        /* This duplicates the check done in runops_debug(), but provides more
+         * information in the common case of the fault being with an XSUB.
+         *
+         * It should also catch an XSUB pushing more than it extends
+         * in scalar context.
+        */
+        if (PL_curstackinfo->si_stack_hwm < PL_stack_sp - PL_stack_base)
+            Perl_croak_nocontext(
+                "panic: XSUB %s::%s (%s) failed to extend arg stack: "
+                "base=%p, sp=%p, hwm=%p\n",
+                    HvNAME(GvSTASH(CvGV(cv))), GvNAME(CvGV(cv)), CvFILE(cv),
+                    PL_stack_base, PL_stack_sp,
+                    PL_stack_base + PL_curstackinfo->si_stack_hwm);
+#endif
        /* Enforce some sanity in scalar context. */
        if (is_scalar) {
             SV **svp = PL_stack_base + markix + 1;

--
Perl5 Master Repository

Reply via email to