This commit was generated by cvs2svn to track changes on a CVS vendor
[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
5 #ifdef __sh__
6 #define signal(a,b)     /* Signals not supported on this target - make them go away */
7 #define alarm(a)        /* Ditto for alarm() */
8 #endif
9
10 static int count = 0;
11
12 static void
13 handler (sig)
14      int sig;
15 {
16   signal (sig, handler);
17   ++count;
18 }
19
20 static void
21 func1 ()
22 {
23   ++count;
24 }
25
26 static void
27 func2 ()
28 {
29   ++count;
30 }
31
32 int
33 main ()
34 {
35 #ifdef usestubs
36   set_debug_traps();
37   breakpoint();
38 #endif
39 #ifdef SIGALRM
40   signal (SIGALRM, handler);
41 #endif
42 #ifdef SIGUSR1
43   signal (SIGUSR1, handler);
44 #endif
45   alarm (1);
46   ++count; /* first */
47   alarm (1);
48   ++count; /* second */
49   func1 ();
50   alarm (1);
51   func2 ();
52   return count;
53 }