gdb/testsuite/
[external/binutils.git] / gdb / testsuite / gdb.base / signals.c
1 /* Test GDB dealing with stuff like stepping into sigtramp.  */
2
3 #include <signal.h>
4 #include <unistd.h>
5
6
7 static int count = 0;
8
9 #ifdef PROTOTYPES
10 static void
11 handler (int sig)
12 #else
13 static void
14 handler (sig)
15      int sig;
16 #endif
17 {
18   signal (sig, handler);
19   ++count;
20 }
21
22 static void
23 func1 ()
24 {
25   ++count;
26 }
27
28 static void
29 func2 ()
30 {
31   ++count;
32 }
33
34 int
35 main ()
36 {
37 #ifdef SIGALRM
38   signal (SIGALRM, handler);
39 #endif
40 #ifdef SIGUSR1
41   signal (SIGUSR1, handler);
42 #endif
43   alarm (1);
44   ++count; /* first */
45   alarm (1);
46   ++count; /* second */
47   func1 ();
48   alarm (1);
49   func2 ();
50   return count;
51 }