libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH 2/3] Increase alternate signal stack size.


From: Ken Werner
Subject: [Libunwind-devel] [PATCH 2/3] Increase alternate signal stack size.
Date: Mon, 4 Apr 2011 16:11:03 +0200

Creating an alternate signal stack with a size of SIGSTKSZ (usually 8k) is
not enough on some targets because unw_cursor_t is bigger than that already.
Since the size of unw_cursor_t is part of the ABI the UNW_TDEP_CURSOR_LEN
can't be changed without breaking existent code. Therefore size of the
alternate signal stack has been increased to 1 MiB.

Signed-off-by: Ken Werner <address@hidden>
---
 tests/Gtest-bt.c    |    8 +++++---
 tests/Gtest-trace.c |    8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/tests/Gtest-bt.c b/tests/Gtest-bt.c
index 152e2af..1a40496 100644
--- a/tests/Gtest-bt.c
+++ b/tests/Gtest-bt.c
@@ -45,6 +45,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 typedef RETSIGTYPE (*sighandler_t) (int);
 #endif
 
+#define SIG_STACK_SIZE 0x100000
+
 int verbose;
 int num_errors;
 
@@ -226,10 +228,10 @@ main (int argc, char **argv)
 
   if (verbose)
     printf ("\nBacktrace across signal handler on alternate stack:\n");
-  stk.ss_sp = malloc (SIGSTKSZ);
+  stk.ss_sp = malloc (SIG_STACK_SIZE);
   if (!stk.ss_sp)
-    panic ("failed to allocate SIGSTKSZ (%u) bytes\n", SIGSTKSZ);
-  stk.ss_size = SIGSTKSZ;
+    panic ("failed to allocate %u bytes\n", SIG_STACK_SIZE);
+  stk.ss_size = SIG_STACK_SIZE;
   stk.ss_flags = 0;
   if (sigaltstack (&stk, NULL) < 0)
     panic ("sigaltstack: %s\n", strerror (errno));
diff --git a/tests/Gtest-trace.c b/tests/Gtest-trace.c
index 1e966b2..311848f 100644
--- a/tests/Gtest-trace.c
+++ b/tests/Gtest-trace.c
@@ -44,6 +44,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 typedef RETSIGTYPE (*sighandler_t) (int);
 #endif
 
+#define SIG_STACK_SIZE 0x100000
+
 int verbose;
 int num_errors;
 
@@ -240,10 +242,10 @@ main (int argc, char **argv)
 
   if (verbose)
     printf ("\nBacktrace across signal handler on alternate stack:\n");
-  stk.ss_sp = malloc (SIGSTKSZ);
+  stk.ss_sp = malloc (SIG_STACK_SIZE);
   if (!stk.ss_sp)
-    panic ("failed to allocate SIGSTKSZ (%u) bytes\n", SIGSTKSZ);
-  stk.ss_size = SIGSTKSZ;
+    panic ("failed to allocate %u bytes\n", SIG_STACK_SIZE);
+  stk.ss_size = SIG_STACK_SIZE;
   stk.ss_flags = 0;
   if (sigaltstack (&stk, NULL) < 0)
     panic ("sigaltstack: %s\n", strerror (errno));
-- 
1.7.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]