gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / foll-fork.c
CommitLineData
74cf1395
JM
1#include <stdio.h>
2#include <unistd.h>
b242c3c2 3#include <stdlib.h>
74cf1395
JM
4
5#ifdef PROTOTYPES
6void callee (int i)
7#else
8void callee (i)
9 int i;
10#endif
11{
d7167b4c
JK
12 /* Any output corrupts GDB CLI expect strings.
13 printf("callee: %d\n", i); */
74cf1395
JM
14}
15
16#ifdef PROTOTYPES
17int main (void)
18#else
19main ()
20#endif
21{
22 int pid;
23 int v = 5;
24
25 pid = fork ();
b242c3c2 26 if (pid == 0) /* set breakpoint here */
74cf1395
JM
27 {
28 v++;
29 /* printf ("I'm the child!\n"); */
b242c3c2 30 callee (getpid ());
74cf1395
JM
31 }
32 else
33 {
34 v--;
35 /* printf ("I'm the proud parent of child #%d!\n", pid); */
b242c3c2 36 callee (getpid ());
74cf1395 37 }
b242c3c2
PA
38
39 exit (0); /* at exit */
74cf1395 40}
This page took 1.090184 seconds and 4 git commands to generate.