2005-09-13 Paul Gilliam <pgilliam@us.ibm.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-syn-frame.c
CommitLineData
075559bc
AC
1#include <signal.h>
2#include <unistd.h>
3#include <stdlib.h>
4
5void foo (void);
6void bar (void);
7
8void subroutine (int);
9void handler (int);
10void have_a_very_merry_interrupt (void);
11
12main ()
13{
14 puts ("Starting up");
15
16 foo (); /* Put a breakpoint on foo() and call it to see a dummy frame */
17
18
19 have_a_very_merry_interrupt ();
20
21 puts ("Shutting down");
22}
23
24void
25foo (void)
26{
27 puts ("hi in foo");
28}
29
30void
31bar (void)
32{
33 char *nuller = 0;
34
35 puts ("hi in bar");
36
37 *nuller = 'a'; /* try to cause a segfault */
38}
39
40void
41handler (int sig)
42{
43 subroutine (sig);
44}
45
c56716b0
JM
46/* The first statement in subroutine () is a place for a breakpoint.
47 Without it, the breakpoint is put on the while comparison and will
48 be hit at each iteration. */
49
075559bc
AC
50void
51subroutine (int in)
52{
5d0331e5
JM
53 int count = in;
54 while (count < 100)
55 count++;
075559bc
AC
56}
57
58void
59have_a_very_merry_interrupt (void)
60{
61 puts ("Waiting to get a signal");
62 signal (SIGALRM, handler);
63 alarm (1);
64 sleep (2); /* We'll receive that signal while sleeping */
65}
66
This page took 0.32172 seconds and 4 git commands to generate.