]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-syn-frame.c
opcodes: bfin: simplify field width processing and fix build warnings
[thirdparty/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{
075559bc
AC
14 foo (); /* Put a breakpoint on foo() and call it to see a dummy frame */
15
16
17 have_a_very_merry_interrupt ();
075559bc
AC
18}
19
20void
21foo (void)
22{
075559bc
AC
23}
24
25void
26bar (void)
27{
d93f7b5c
YQ
28 *(char *)0 = 0; /* try to cause a segfault */
29
30 /* On MMU-less system, previous memory access to address zero doesn't
31 trigger a SIGSEGV. Trigger a SIGILL. Each arch should define its
32 own illegal instruction here. */
33#if defined(__arm__)
34 asm(".word 0xf8f00000");
35#elif defined(__TMS320C6X__)
36 asm(".word 0x56454313");
37#else
38#endif
075559bc 39
075559bc
AC
40}
41
42void
43handler (int sig)
44{
45 subroutine (sig);
46}
47
c56716b0
JM
48/* The first statement in subroutine () is a place for a breakpoint.
49 Without it, the breakpoint is put on the while comparison and will
50 be hit at each iteration. */
51
075559bc
AC
52void
53subroutine (int in)
54{
5d0331e5
JM
55 int count = in;
56 while (count < 100)
57 count++;
075559bc
AC
58}
59
60void
61have_a_very_merry_interrupt (void)
62{
075559bc
AC
63 signal (SIGALRM, handler);
64 alarm (1);
65 sleep (2); /* We'll receive that signal while sleeping */
66}
67