]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/attach2.c
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / attach2.c
CommitLineData
74cf1395
JM
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
b1468492 11float bidule = 0.0;
48e9cc84 12volatile int should_exit = 0;
74cf1395
JM
13
14int main ()
15{
16 int local_i = 0;
17
48e9cc84
PW
18 /* Cannot sleep a very long time, as attach.exp assumes the
19 process will exit before the standard GDB timeout. */
74cf1395
JM
20 sleep( 10 ); /* System call causes register fetch to fail */
21 /* This is a known HPUX "feature" */
22 while (! should_exit)
23 {
24 local_i++;
25 }
26 return (0);
27}