diff --git a/gdb/infrun.c b/gdb/infrun.c
index 728c160..703ebfe 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -401,6 +401,66 @@ show_follow_fork_mode_string (struct ui_file *file,
int from_tty,
 }
 

+/* Print details about attaching to a child process after a fork call.  */
+
+static void
+print_attach_fork_child (pid_t child_pid, pid_t parent_pid, int is_vfork)
+{
+  if (info_verbose || debug_infrun)
+    {
+      target_terminal_ours_for_output ();
+      fprintf_filtered (gdb_stdlog,
+			_("Attaching after process %d %s to child "
+			  "process %d.\n"),
+			parent_pid, is_vfork ? "vfork" : "fork", child_pid);
+    }
+}
+
+/* Print details about detaching from a process after a fork call.
+   VFORK_ACTION must be one of TARGET_WAITKIND_EXECD,
TARGET_WAITKIND_EXITED,
+   or TARGET_WAITKIND_IGNORE.  Here TARGET_WAITKIND_IGNORE is a placeholder
+   for cases where we are detaching a vfork child and the argument is
+   unused.  */
+
+static void
+print_fork_detach (pid_t pid, int is_parent, int is_vfork,
+		   enum target_waitkind vfork_action)
+{
+  if (info_verbose || debug_infrun)
+    {
+      target_terminal_ours_for_output ();
+
+      if (is_parent)
+	{
+	  if (is_vfork)
+	    {
+	      /* Detaching a vfork parent, so print what the child did
+		 that allows the parent to resume.  */
+	      gdb_assert (vfork_action == TARGET_WAITKIND_EXECD
+			  || vfork_action == TARGET_WAITKIND_EXITED);
+	      fprintf_filtered (gdb_stdlog,
+				_("Detaching from vfork parent process %d"
+				  " after child %s.\n"),
+				pid, (vfork_action == TARGET_WAITKIND_EXECD
+				      ? "exec" : "exit"));
+	    }
+	  else
+	    {
+	      /* Detaching fork parent.  */
+	      fprintf_filtered (gdb_stdlog, _("Detaching after fork from "
+					      "parent process %d.\n"), pid);
+	    }
+	}
+      else
+	{
+	  /* Detaching fork or vfork child.  */
+	  fprintf_filtered (gdb_stdlog,
+			    _("Detaching after %s from child process %d.\n"),
+			    is_vfork ? "vfork" : "fork", pid);
+	}
+    }
+}
+
 /* Handle changes to the inferior list based on the type of fork,
    which process is being followed, and whether the other process
    should be detached.  On entry inferior_ptid must be the ptid of
@@ -459,14 +519,8 @@ holding the child stopped.  Try \"set
detach-on-fork\" or \
 	      remove_breakpoints_pid (ptid_get_pid (inferior_ptid));
 	    }

-	  if (info_verbose || debug_infrun)
-	    {
-	      target_terminal_ours ();
-	      fprintf_filtered (gdb_stdlog,
-				"Detaching after fork from "
-				"child process %d.\n",
-				child_pid);
-	    }
+	  print_fork_detach (child_pid, follow_child, has_vforked,
+			     TARGET_WAITKIND_IGNORE);
 	}
       else
 	{
@@ -547,20 +601,7 @@ holding the child stopped.  Try \"set
detach-on-fork\" or \
       struct inferior *parent_inf, *child_inf;
       struct program_space *parent_pspace;

-      if (info_verbose || debug_infrun)
-	{
-	  target_terminal_ours ();
-	  if (has_vforked)
-	    fprintf_filtered (gdb_stdlog,
-			      _("Attaching after process %d "
-				"vfork to child process %d.\n"),
-			      parent_pid, child_pid);
-	  else
-	    fprintf_filtered (gdb_stdlog,
-			      _("Attaching after process %d "
-				"fork to child process %d.\n"),
-			      parent_pid, child_pid);
-	}
+      print_attach_fork_child (child_pid, parent_pid, has_vforked);

       /* Add the new inferior first, so that the target_detach below
 	 doesn't unpush the target.  */
@@ -596,7 +637,11 @@ holding the child stopped.  Try \"set
detach-on-fork\" or \
 	  parent_inf->waiting_for_vfork_done = 0;
 	}
       else if (detach_fork)
-	target_detach (NULL, 0);
+	{
+	  print_fork_detach (parent_pid, follow_child, has_vforked,
+			     TARGET_WAITKIND_IGNORE);
+	  target_detach (NULL, 0);
+	}

       /* Note that the detach above makes PARENT_INF dangling.  */

@@ -928,20 +973,18 @@ handle_vfork_child_exec_or_exit (int exec)
 	  inf->aspace = NULL;
 	  inf->pspace = NULL;

-	  if (debug_infrun || info_verbose)
+	  /* Print verbose/debug info message.  Hardcoded 1's designate
+	     that we are detaching a parent and that it is after a vfork,
+	     respectively.  */
+	  if (exec)
 	    {
-	      target_terminal_ours ();
-
-	      if (exec)
-		fprintf_filtered (gdb_stdlog,
-				  "Detaching vfork parent process "
-				  "%d after child exec.\n",
-				  inf->vfork_parent->pid);
-	      else
-		fprintf_filtered (gdb_stdlog,
-				  "Detaching vfork parent process "
-				  "%d after child exit.\n",
-				  inf->vfork_parent->pid);
+	      print_fork_detach (inf->vfork_parent->pid, 1, 1,
+				 TARGET_WAITKIND_EXECD);
+	    }
+	  else
+	    {
+	      print_fork_detach (inf->vfork_parent->pid, 1, 1,
+				 TARGET_WAITKIND_EXITED);
 	    }

 	  target_detach (NULL, 0);
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp
b/gdb/testsuite/gdb.base/foll-fork.exp
index ad8b750..06ba1b5 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -115,7 +115,11 @@ proc test_follow_fork { who detach cmd } {
 	# Set up the output we expect to see after we run.
 	set expected_re ""
 	if {$who == "child"} {
-	    set expected_re "Attaching after.* fork to.*set breakpoint here.*"
+	    set expected_re "Attaching after.* fork to.*"
+	    if {$detach == "on"} {
+	        append expected_re "Detaching after fork from .*"
+	    }
+	    append expected_re "set breakpoint here.*"
 	} elseif {$who == "parent" && $detach == "on"} {
 	    set expected_re "Detaching after fork from .*set breakpoint here.*"
 	} else {
@@ -218,9 +222,9 @@ proc catch_fork_child_follow {} {
 	"Temporary breakpoint.*, line $bp_after_fork.*" \
 	"set follow-fork child, tbreak"

-    gdb_test "continue" \
-	"Attaching after.* fork to.* at .*$bp_after_fork.*" \
-	"set follow-fork child, hit tbreak"
+    set expected_re "Attaching after.* fork to.*Detaching after fork from"
+    append expected_re " .* at .*$bp_after_fork.*"
+    gdb_test "continue" $expected_re "set follow-fork child, hit tbreak"

     # The parent has been detached; allow time for any output it might
     # generate to arrive, so that output doesn't get confused with
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp
b/gdb/testsuite/gdb.base/foll-vfork.exp
index fe3663c..27ecdbc 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -121,7 +121,7 @@ proc vfork_parent_follow_through_step {} {

    set test "step"
    gdb_test_multiple "next" $test {
-       -re "Detaching after fork from.*if \\(pid == 0\\).*$gdb_prompt " {
+       -re "Detaching after vfork from.*if \\(pid == 0\\).*$gdb_prompt " {
 	   pass $test
        }
    }
@@ -146,7 +146,7 @@ proc vfork_parent_follow_to_bp {} {

    set test "continue to bp"
    gdb_test_multiple "continue" $test {
-       -re ".*Detaching after fork from child
process.*Breakpoint.*${bp_location}.*$gdb_prompt " {
+       -re ".*Detaching after vfork from child
process.*Breakpoint.*${bp_location}.*$gdb_prompt " {
 	   pass $test
