| Index: gdb/testsuite/gdb.base/stale-infcall.c
|
| diff --git a/gdb/testsuite/gdb.base/sigbpt.c b/gdb/testsuite/gdb.base/stale-infcall.c
|
| similarity index 54%
|
| copy from gdb/testsuite/gdb.base/sigbpt.c
|
| copy to gdb/testsuite/gdb.base/stale-infcall.c
|
| index fb7d4c2cbd5dcb44d490c15ae16deab5ccd8157e..e4f97fa3ab25943c727d31b2798b294cc20b2f4d 100644
|
| --- a/gdb/testsuite/gdb.base/sigbpt.c
|
| +++ b/gdb/testsuite/gdb.base/stale-infcall.c
|
| @@ -1,6 +1,6 @@
|
| /* This testcase is part of GDB, the GNU debugger.
|
|
|
| - Copyright 2004, 2007-2012 Free Software Foundation, Inc.
|
| + Copyright 2012 Free Software Foundation, Inc.
|
|
|
| This program is free software; you can redistribute it and/or modify
|
| it under the terms of the GNU General Public License as published by
|
| @@ -15,38 +15,52 @@
|
| You should have received a copy of the GNU General Public License
|
| along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
| -#include <signal.h>
|
| -#include <stdlib.h>
|
| +#include <setjmp.h>
|
| #include <string.h>
|
| +#include <stdlib.h>
|
| +
|
| +#define BUFSIZE 0x1000
|
| +
|
| +static jmp_buf jmp;
|
| +
|
| +void
|
| +infcall (void)
|
| +{
|
| + longjmp (jmp, 1); /* test-next */
|
| +}
|
|
|
| -extern void
|
| -keeper (int sig)
|
| +static void
|
| +run1 (void)
|
| {
|
| + char buf[BUFSIZE / 2];
|
| + int dummy = 0;
|
| +
|
| + dummy++; /* break-run1 */
|
| }
|
|
|
| -volatile long v1 = 0;
|
| -volatile long v2 = 0;
|
| -volatile long v3 = 0;
|
| +static char buf_zero[BUFSIZE];
|
|
|
| -extern long
|
| -bowler (void)
|
| +static void
|
| +run2 (void)
|
| {
|
| - /* Try to read address zero. Do it in a slightly convoluted way so
|
| - that more than one instruction is used. */
|
| - return *(char *) (v1 + v2 + v3);
|
| + char buf[BUFSIZE];
|
| +
|
| + memset (buf, 0, sizeof (buf));
|
| +
|
| + if (memcmp (buf, buf_zero, sizeof (buf)) != 0) /* break-run2 */
|
| + abort (); /* break-fail */
|
| }
|
|
|
| int
|
| main ()
|
| {
|
| - static volatile int i;
|
| + if (setjmp (jmp) == 0) /* test-pass */
|
| + infcall ();
|
|
|
| - struct sigaction act;
|
| - memset (&act, 0, sizeof act);
|
| - act.sa_handler = keeper;
|
| - sigaction (SIGSEGV, &act, NULL);
|
| - sigaction (SIGBUS, &act, NULL);
|
| + if (setjmp (jmp) == 0) /* test-fail */
|
| + run1 ();
|
| + else
|
| + run2 ();
|
|
|
| - bowler ();
|
| - return 0;
|
| + return 0; /* break-exit */
|
| }
|
|
|