1 #include <stdio.h> 2 #include <unistd.h> 3 #include <stdlib.h> 4 5 #ifdef PROTOTYPES callee(int i)6void callee (int i) 7 #else 8 void callee (i) 9 int i; 10 #endif 11 { 12 /* Any output corrupts GDB CLI expect strings. 13 printf("callee: %d\n", i); */ 14 } 15 16 #ifdef PROTOTYPES main(void)17int main (void) 18 #else 19 main () 20 #endif 21 { 22 int pid; 23 int v = 5; 24 25 pid = fork (); 26 if (pid == 0) /* set breakpoint here */ 27 { 28 v++; 29 /* printf ("I'm the child!\n"); */ 30 callee (getpid ()); 31 } 32 else 33 { 34 v--; 35 /* printf ("I'm the proud parent of child #%d!\n", pid); */ 36 callee (getpid ()); 37 } 38 39 exit (0); /* at exit */ 40 } 41