From patchwork Thu May 28 22:12:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Breazeal X-Patchwork-Id: 6970 Received: (qmail 63586 invoked by alias); 28 May 2015 22:12:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 63570 invoked by uid 89); 28 May 2015 22:12:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 May 2015 22:12:46 +0000 Received: from svr-orw-fem-02x.mgc.mentorg.com ([147.34.96.206] helo=SVR-ORW-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Yy62c-0005e8-W4 from Don_Breazeal@mentor.com for gdb-patches@sourceware.org; Thu, 28 May 2015 15:12:43 -0700 Received: from build4-lucid-cs (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.3.224.2; Thu, 28 May 2015 15:12:42 -0700 Received: by build4-lucid-cs (Postfix, from userid 1905) id 0C1F340F6C; Thu, 28 May 2015 15:12:41 -0700 (PDT) From: Don Breazeal To: Subject: [commit][PATCH 1/3] Make remote follow fork 'Detaching' message match native Date: Thu, 28 May 2015 15:12:33 -0700 Message-ID: <1432851155-24563-1-git-send-email-donb@codesourcery.com> In-Reply-To: <1432320931-1550-1-git-send-email-donb@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes 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 + + * 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 * 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);