[gdb/testsuite] Reduce errors after gdb exit in default_gdb_start
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / foll-fork.c
index 841258f147ca5c4665b5877cdb6030d9540b5e0e..4d8c138bd614c8536ff7229581d6f8fd64b26b1c 100644 (file)
@@ -1,34 +1,31 @@
 #include <stdio.h>
 #include <unistd.h>
+#include <stdlib.h>
 
-#ifdef PROTOTYPES
 void callee (int i)
-#else
-void callee (i)
-  int  i;
-#endif
 {
-  printf("callee: %d\n", i);
+  /* Any output corrupts GDB CLI expect strings.
+     printf("callee: %d\n", i);  */
 }
 
-#ifdef PROTOTYPES
 int main (void)
-#else
-main ()
-#endif
 {
   int  pid;
   int  v = 5;
 
   pid = fork ();
-  if (pid == 0)
+  if (pid == 0) /* set breakpoint here */
     {
       v++;
       /* printf ("I'm the child!\n"); */
+      callee (getpid ());
     }
   else
     {
       v--;
       /* printf ("I'm the proud parent of child #%d!\n", pid); */
+      callee (getpid ());
     }
+
+  exit (0); /* at exit */
 }
This page took 0.028626 seconds and 4 git commands to generate.