[gdb/testsuite] Remove inferior output in gdb.base/foll-vfork.exp
[binutils-gdb.git] / gdb / testsuite / gdb.base / foll-vfork-exit.c
index 74082e356c093ba19f8dbc45bca3cb31bef1c51c..a0509d57991f6371aa16d37c7c1bce9b5b5244e5 100644 (file)
@@ -1,6 +1,6 @@
 /* This testcase is part of GDB, the GNU debugger.
 
-   Copyright 1997-2013 Free Software Foundation, Inc.
+   Copyright 1997-2021 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,15 +23,18 @@ main ()
 {
   int pid;
 
-  pid = vfork ();
+  /* A statement before vfork to make sure a breakpoint on main isn't
+     set on vfork below.  */
+  pid = 1;
+  pid = vfork (); /* VFORK */
   if (pid == 0)
     {
-      printf ("I'm the child!\n");
+      const char *volatile s = "I'm the child!";
       _exit (0);
     }
   else
     {
-      printf ("I'm the proud parent of child #%d!\n", pid);
+      const char *volatile s = "I'm the proud parent of child";
     }
 
   return 0;