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

Unified Diff: gdb/testsuite/gdb.base/catch-signal-fork.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 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/catch-signal.exp ('k') | gdb/testsuite/gdb.base/catch-signal-fork.exp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.base/catch-signal-fork.c
diff --git a/gdb/testsuite/gdb.base/signest.c b/gdb/testsuite/gdb.base/catch-signal-fork.c
similarity index 61%
copy from gdb/testsuite/gdb.base/signest.c
copy to gdb/testsuite/gdb.base/catch-signal-fork.c
index 1a9c1cea066cacd4c5e1ff68129f177f6ee0de7f..9c316d3ff6618f3d5e59e5669afd5f6f3e804eb4 100644
--- a/gdb/testsuite/gdb.base/signest.c
+++ b/gdb/testsuite/gdb.base/catch-signal-fork.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2012 Free Software Foundation, Inc.
+ Copyright 2012-2013 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
@@ -14,40 +14,45 @@
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 <string.h>
+#include <signal.h>
#include <unistd.h>
-volatile char *p = NULL;
-
-extern long
-bowler (void)
+void
+do_nothing (void)
{
- return *p;
}
-extern void
-keeper (int sig)
+void
+handle (int sig)
{
- static int recurse = 0;
- if (++recurse < 3)
- bowler ();
-
- _exit (0);
+ do_nothing (); /* handle marker */
}
int
-main (void)
+main ()
{
- struct sigaction act;
- memset (&act, 0, sizeof act);
- act.sa_handler = keeper;
- act.sa_flags = SA_NODEFER;
- sigaction (SIGSEGV, &act, NULL);
- sigaction (SIGBUS, &act, NULL);
-
- bowler ();
- return 0;
+ int i;
+ signal (SIGHUP, handle);
+
+ raise (SIGHUP); /* first HUP */
+
+ signal (SIGCHLD, handle);
+ for (i = 0; i < 3; i++) /* fork loop */
+ {
+ switch (fork())
+ {
+ case -1:
+ perror ("fork");
+ exit (1);
+ case 0:
+ exit (0);
+ }
+ wait (NULL);
+ }
+
+ raise (SIGHUP); /* second HUP */
+
+ raise (SIGHUP); /* third HUP */
}
+
« no previous file with comments | « gdb/testsuite/gdb.base/catch-signal.exp ('k') | gdb/testsuite/gdb.base/catch-signal-fork.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698