[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] c-stack: fix regression on cygwin when libsigsegv is present
From: |
Eric Blake |
Subject: |
[PATCH] c-stack: fix regression on cygwin when libsigsegv is present |
Date: |
Tue, 25 Jan 2011 15:26:39 -0700 |
* lib/c-stack.c (die): Don't flatten error if sigsegv is present.
Signed-off-by: Eric Blake <address@hidden>
---
The patch for Haiku regressed on Cygwin. This fixes things.
(It's a shame that Haiku has no way to tell which address caused a
segv, which makes porting libsigsegv to Haiku almost impossible - I
confirmed that it is possible to reliably catch SIGSEGV in the
alternate stack, and that you can determine vma regions in the same
manner as on BeOS with a minor tweak to libsigsegv's configure.ac.
But within a handler, you have access to the former %esp value, but no
mention of %cr2, so you only can tell the former stack pointer, and
not which address faulted. Further, the former stack pointer was 3
pages away from the boundary of the 10M stack and thus failed the
libsigsegv hueristic of treating segv within 1 page of the boundary as
stack overflow.)
ChangeLog | 5 +++++
lib/c-stack.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ab1ad1e..5f8c93e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-25 Eric Blake <address@hidden>
+
+ c-stack: fix regression on cygwin when libsigsegv is present
+ * lib/c-stack.c (die): Don't flatten error if sigsegv is present.
+
2011-01-24 Bruno Haible <address@hidden>
vma-iter: Avoid empty intervals.
diff --git a/lib/c-stack.c b/lib/c-stack.c
index bff346b..7f0f488 100644
--- a/lib/c-stack.c
+++ b/lib/c-stack.c
@@ -109,12 +109,12 @@ static void
die (int signo)
{
char const *message;
-#if !SIGINFO_WORKS
+#if !SIGINFO_WORKS && !HAVE_LIBSIGSEGV
/* We can't easily determine whether it is a stack overflow; so
assume that the rest of our program is perfect (!) and that
this segmentation violation is a stack overflow. */
signo = 0;
-#endif /* !SIGINFO_WORKS */
+#endif /* !SIGINFO_WORKS && !HAVE_LIBSIGSEGV */
segv_action (signo);
message = signo ? program_error_message : stack_overflow_message;
ignore_value (write (STDERR_FILENO, program_name, strlen (program_name)));
--
1.7.3.5