This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit, testsuite] Fix many-threads crashes on s390x-linux
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Sun, 27 Sep 2009 22:56:20 +0200 (CEST)
- Subject: [commit, testsuite] Fix many-threads crashes on s390x-linux
Hello,
on s390x-linux, the manythreads.exp and multi-create.exp test cases
fail with segmentation faults. This turns out to be causes by stack
overflow: it seems that on this platform, even a plain "printf" call
consumes more stack than what is available as PTHREAD_STACK_MIN.
Fixed by doubling the thread stack sizes.
Tested on s390(x)-linux and ppc(64)-linux with no regressions.
Committed to mainline.
Bye,
Ulrich
ChangeLog:
* gdb.threads/manythreads.c (main): Increase thread stack size
to 2*PTHREAD_STACK_MIN.
* gdb.threads/multi-create.c (main): Likewise.
(create_function): Likewise.
Index: gdb/testsuite/gdb.threads/manythreads.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/manythreads.c,v
retrieving revision 1.9
diff -c -p -r1.9 manythreads.c
*** gdb/testsuite/gdb.threads/manythreads.c 7 Jun 2009 19:50:52 -0000 1.9
--- gdb/testsuite/gdb.threads/manythreads.c 26 Sep 2009 01:48:54 -0000
*************** main (int argc, char **argv)
*** 44,50 ****
pthread_attr_init (&attr);
#ifdef PTHREAD_STACK_MIN
! pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
#endif
/* Create a ton of quick-executing threads, then wait for them to
--- 44,50 ----
pthread_attr_init (&attr);
#ifdef PTHREAD_STACK_MIN
! pthread_attr_setstacksize (&attr, 2*PTHREAD_STACK_MIN);
#endif
/* Create a ton of quick-executing threads, then wait for them to
Index: gdb/testsuite/gdb.threads/multi-create.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/multi-create.c,v
retrieving revision 1.3
diff -c -p -r1.3 multi-create.c
*** gdb/testsuite/gdb.threads/multi-create.c 3 Jan 2009 05:58:07 -0000 1.3
--- gdb/testsuite/gdb.threads/multi-create.c 26 Sep 2009 01:48:54 -0000
*************** create_function (void *arg)
*** 43,49 ****
int j;
pthread_attr_init (&attr); /* set breakpoint 1 here. */
! pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
/* Create a ton of quick-executing threads, then wait for them to
complete. */
--- 43,49 ----
int j;
pthread_attr_init (&attr); /* set breakpoint 1 here. */
! pthread_attr_setstacksize (&attr, 2*PTHREAD_STACK_MIN);
/* Create a ton of quick-executing threads, then wait for them to
complete. */
*************** main (int argc, char **argv)
*** 70,76 ****
int n, i;
pthread_attr_init (&attr);
! pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
for (n = 0; n < 100; ++n)
{
--- 70,76 ----
int n, i;
pthread_attr_init (&attr);
! pthread_attr_setstacksize (&attr, 2*PTHREAD_STACK_MIN);
for (n = 0; n < 100; ++n)
{
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com