-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
duplicate stack extend reporting for xsubs #16126
Comments
From @tonycozCreated by @tonycozThis is just an RFC for the attached patch, which I'll apply on no Dave's patches to Perl_runops_debug() have been great for reporting XS Unfortunately tracking down the location of the fault in complex code The attacked patch adds a similar check to pp_entersub when calling Perl Info
|
From @tonycoz0001-add-a-stack-extend-check-to-pp_entersub-for-XS-subs.patchFrom d24e1a34cefd083ce0626044b19113376659f06a Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 28 Aug 2017 13:49:35 +1000
Subject: [PATCH] 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) in the likely case that it was an XSUB that failed to
extend the stack.
---
pp_hot.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/pp_hot.c b/pp_hot.c
index 528817f..c6aad16 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -4423,6 +4423,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;
--
2.1.4
|
From @cpansproutOn Sun, 27 Aug 2017 20:58:48 -0700, tonyc wrote:
I think that patch needs help!
I think DEBUGGING_RE_ONLY only applies to headers. It’s redundant here. -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Mon, 28 Aug 2017 13:19:26 -0700, sprout wrote:
It's based on Dave's changes which use the same condition. Especially: #if defined DEBUGGING && !defined DEBUGGING_RE_ONLY Perhaps they all should only be checking DEBUGGING. Tony |
From @tonycozOn Sun, 27 Aug 2017 20:58:48 -0700, tonyc wrote:
This was applied as cfbdacd. Tony |
@tonycoz - Status changed from 'open' to 'pending release' |
From @iabynOn Sun, Sep 03, 2017 at 06:32:12PM -0700, Tony Cook via RT wrote:
Thanks for this! -- |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#131975 (status was 'resolved')
Searchable as RT131975$
The text was updated successfully, but these errors were encountered: