Commit | Line | Data |
---|---|---|
74cf1395 JM |
1 | #include <stdio.h> |
2 | #include <unistd.h> | |
b242c3c2 | 3 | #include <stdlib.h> |
74cf1395 | 4 | |
74cf1395 | 5 | void callee (int i) |
74cf1395 | 6 | { |
d7167b4c JK |
7 | /* Any output corrupts GDB CLI expect strings. |
8 | printf("callee: %d\n", i); */ | |
74cf1395 JM |
9 | } |
10 | ||
74cf1395 | 11 | int main (void) |
74cf1395 JM |
12 | { |
13 | int pid; | |
14 | int v = 5; | |
15 | ||
16 | pid = fork (); | |
b242c3c2 | 17 | if (pid == 0) /* set breakpoint here */ |
74cf1395 JM |
18 | { |
19 | v++; | |
20 | /* printf ("I'm the child!\n"); */ | |
b242c3c2 | 21 | callee (getpid ()); |
74cf1395 JM |
22 | } |
23 | else | |
24 | { | |
25 | v--; | |
26 | /* printf ("I'm the proud parent of child #%d!\n", pid); */ | |
b242c3c2 | 27 | callee (getpid ()); |
74cf1395 | 28 | } |
b242c3c2 PA |
29 | |
30 | exit (0); /* at exit */ | |
74cf1395 | 31 | } |