aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/sigbpt.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-07-06 15:08:54 +0000
committerAndrew Cagney <cagney@redhat.com>2004-07-06 15:08:54 +0000
commit45a83408cd75e6572cc3bc432ac33a8989d8f663 (patch)
treefb1afb624169568450a7809cb7b757946f45e9d4 /gdb/testsuite/gdb.base/sigbpt.c
parentee28ca0fd66a9752c9dbf8717ab425cabb9a8aa3 (diff)
downloadgdb-45a83408cd75e6572cc3bc432ac33a8989d8f663.zip
gdb-45a83408cd75e6572cc3bc432ac33a8989d8f663.tar.gz
gdb-45a83408cd75e6572cc3bc432ac33a8989d8f663.tar.bz2
2004-07-06 Andrew Cagney <cagney@gnu.org>
* gdb.base/sigbpt.exp, gdb.base/sigbpt.c: New test.
Diffstat (limited to 'gdb/testsuite/gdb.base/sigbpt.c')
-rw-r--r--gdb/testsuite/gdb.base/sigbpt.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/sigbpt.c b/gdb/testsuite/gdb.base/sigbpt.c
new file mode 100644
index 0000000..b189f6d
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigbpt.c
@@ -0,0 +1,53 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern void
+keeper (int sig)
+{
+}
+
+volatile long v1 = 0;
+volatile long v2 = 0;
+volatile long v3 = 0;
+
+extern long
+bowler (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);
+}
+
+int
+main ()
+{
+ static volatile int i;
+
+ struct sigaction act;
+ memset (&act, 0, sizeof act);
+ act.sa_handler = keeper;
+ sigaction (SIGSEGV, &act, NULL);
+
+ bowler ();
+ return 0;
+}