Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Unified Diff: gdb/testsuite/gdb.base/stale-infcall.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/gdb.base/stack-checking.exp ('k') | gdb/testsuite/gdb.base/stale-infcall.exp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 */
}
« no previous file with comments | « gdb/testsuite/gdb.base/stack-checking.exp ('k') | gdb/testsuite/gdb.base/stale-infcall.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698