xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.base/attach.c (revision 82650ea59673ac1511a0f5b008a97de18ced4707)
1 /* This program is intended to be started outside of gdb, and then
2    attached to by gdb.  Thus, it simply spins in a loop.  The loop
3    is exited when & if the variable 'should_exit' is non-zero.  (It
4    is initialized to zero in this program, so the loop will never
5    exit unless/until gdb sets the variable to non-zero.)
6    */
7 #include <stdio.h>
8 #include <unistd.h>
9 
10 int  bidule = 0;
11 volatile int  should_exit = 0;
12 
main()13 int main ()
14 {
15   int  local_i = 0;
16 
17   alarm (60);
18 
19   while (! should_exit)
20     {
21       local_i++;
22     }
23   return 0; /* postloop */
24 }
25