Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Don Breazeal <donb@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [commit][PATCH 1/3] Make remote follow fork 'Detaching' message match native
Date: Thu, 28 May 2015 22:12:00 -0000	[thread overview]
Message-ID: <1432851155-24563-1-git-send-email-donb@codesourcery.com> (raw)
In-Reply-To: <1432320931-1550-1-git-send-email-donb@codesourcery.com>

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 |  6 ++++++
 gdb/infrun.c  | 10 ++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bd0292b..ab10166 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2f6bc41..d8eb0b0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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);
-- 
1.8.1.1


  parent reply	other threads:[~2015-05-28 22:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 18:55 [PATCH 0/3] Extended-remote follow-fork cleanups Don Breazeal
2015-05-22 18:55 ` [PATCH 2/3] Initialize last_resume_kind for remote fork child Don Breazeal
2015-05-23 12:05   ` Pedro Alves
2015-05-22 18:55 ` [PATCH 1/3] Make remote follow fork 'Detaching' message match native Don Breazeal
2015-05-23 11:18   ` Pedro Alves
2015-05-22 18:56 ` [PATCH 3/3] Disable exec-dependent follow fork tests for remote Don Breazeal
2015-05-23 12:11   ` Pedro Alves
2015-05-23 12:14     ` Pedro Alves
2015-05-28 22:12 ` Don Breazeal [this message]
2015-05-28 22:13   ` [commit][PATCH 3/3] Disable exec-dependent follow vfork " Don Breazeal
2015-05-28 22:13   ` [commit][PATCH 2/3] Initialize last_resume_kind for remote fork child Don Breazeal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432851155-24563-1-git-send-email-donb@codesourcery.com \
    --to=donb@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox