From patchwork Fri May 22 18:55:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Breazeal X-Patchwork-Id: 6894 Received: (qmail 93553 invoked by alias); 22 May 2015 18:55:52 -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 93341 invoked by uid 89); 22 May 2015 18:55:48 -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; Fri, 22 May 2015 18:55:46 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1Yvs6h-0003gq-IE from Don_Breazeal@mentor.com for gdb-patches@sourceware.org; Fri, 22 May 2015 11:55:43 -0700 Received: from build4-lucid-cs (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.224.2; Fri, 22 May 2015 11:55:43 -0700 Received: by build4-lucid-cs (Postfix, from userid 1905) id 2D1E140E8F; Fri, 22 May 2015 11:55:43 -0700 (PDT) From: Don Breazeal To: Subject: [PATCH 1/3] Make remote follow fork 'Detaching' message match native Date: Fri, 22 May 2015 11:55:29 -0700 Message-ID: <1432320931-1550-2-git-send-email-donb@codesourcery.com> In-Reply-To: <1432320931-1550-1-git-send-email-donb@codesourcery.com> References: <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 ptids for the native case are already in this form, so there the change has no effect. The ptids in the extended-remote case must be reported by gdbserver in the (pid,pid,0) form in order to later identify and remove new fork children that are reported prematurely by remote_update_thread_list. So here we generate process-style ptids to get identical messages in both native and extended-remote cases. OK? thanks --Don gdb/ 2015-05-22 Don Breazeal * infrun.c (follow_fork_inferior): Ensure the use of process-style ptids (pid,0,0) in verbose/debug "Detaching" messages. --- gdb/infrun.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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);