Refactor reading of commands
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-syn-frame.c
1 #include <signal.h>
2 #include <unistd.h>
3 #include <stdlib.h>
4
5 void foo (void);
6 void bar (void);
7
8 void subroutine (int);
9 void handler (int);
10 void have_a_very_merry_interrupt (void);
11
12 main ()
13 {
14 foo (); /* Put a breakpoint on foo() and call it to see a dummy frame */
15
16
17 have_a_very_merry_interrupt ();
18 }
19
20 void
21 foo (void)
22 {
23 }
24
25 void
26 bar (void)
27 {
28 char *nuller = 0;
29
30 *nuller = 'a'; /* try to cause a segfault */
31 }
32
33 void
34 handler (int sig)
35 {
36 subroutine (sig);
37 }
38
39 /* The first statement in subroutine () is a place for a breakpoint.
40 Without it, the breakpoint is put on the while comparison and will
41 be hit at each iteration. */
42
43 void
44 subroutine (int in)
45 {
46 int count = in;
47 while (count < 100)
48 count++;
49 }
50
51 void
52 have_a_very_merry_interrupt (void)
53 {
54 signal (SIGALRM, handler);
55 alarm (1);
56 sleep (2); /* We'll receive that signal while sleeping */
57 }
58
This page took 0.029466 seconds and 4 git commands to generate.