xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.base/attach3.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
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 <stdlib.h>
9 #include <unistd.h>
10 
11 double  bidule = 0.0;
12 volatile int  should_exit = 0;
13 
main()14 int main ()
15 {
16   int  local_i = 0;
17 
18   sleep( 60 ); /* System call causes register fetch to fail */
19                /* This is a known HPUX "feature"            */
20   while (! should_exit)
21     {
22       local_i++;
23     }
24   return (0);
25 }
26