Make remote follow fork 'Detaching' message match native
authorDon Breazeal <donb@codesourcery.com>
Thu, 28 May 2015 21:26:03 +0000 (14:26 -0700)
committerDon Breazeal <donb@codesourcery.com>
Thu, 28 May 2015 21:37:56 +0000 (14:37 -0700)
This patch fixes a couple of failures in gdb.base/foll-vfork.exp for
extended-remote targets.  The failures were the result of the
verbose/debug "Detaching..." messages in infrun.c:follow_fork_inferior
not matching what was expected in the extended-remote case.

The path modifies the ptids used in the messages to ensure that they
print "process nnn" instead of (possibly) "Thread nnn.nnn".  The
detach is a process-wide operation, so we need to use a process-
style ptid regardless of what type of ptid target_pid_to_str returns.

Tested on x86_64 GNU/Linux, native, remote, extended-remote.

gdb/

* infrun.c (follow_fork_inferior): Ensure the use of
process-style ptids (pid,0,0) in verbose/debug "Detaching"
messages.

gdb/ChangeLog
gdb/infrun.c

index bd0292bec53fac40fdc984e58288b416057500d2..ab10166a27d579fcb6eb16a11a0527c0b31f65bc 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-28  Don Breazeal  <donb@codesourcery.com>
+
+       * infrun.c (follow_fork_inferior): Ensure the use of
+       process-style ptids (pid,0,0) in verbose/debug "Detaching"
+       messages.
+
 2015-05-28  Doug Evans  <dje@google.com>
 
        * dwarf2read.c (record_line_ftype): Remove, duplicate.
index 2f6bc41d0b70b6479bdd1c7669c8321c230e45f4..d8eb0b0f34b1fed92dfb1fdca2ab80baa469100a 100644 (file)
@@ -445,11 +445,14 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 
          if (info_verbose || debug_infrun)
            {
+             /* Ensure that we have a process ptid.  */
+             ptid_t process_ptid = pid_to_ptid (ptid_get_pid (child_ptid));
+
              target_terminal_ours_for_output ();
              fprintf_filtered (gdb_stdlog,
                                _("Detaching after %s from child %s.\n"),
                                has_vforked ? "vfork" : "fork",
-                               target_pid_to_str (child_ptid));
+                               target_pid_to_str (process_ptid));
            }
        }
       else
@@ -578,11 +581,14 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
        {
          if (info_verbose || debug_infrun)
            {
+             /* Ensure that we have a process ptid.  */
+             ptid_t process_ptid = pid_to_ptid (ptid_get_pid (child_ptid));
+
              target_terminal_ours_for_output ();
              fprintf_filtered (gdb_stdlog,
                                _("Detaching after fork from "
                                  "child %s.\n"),
-                               target_pid_to_str (child_ptid));
+                               target_pid_to_str (process_ptid));
            }
 
          target_detach (NULL, 0);