From patchwork Tue Mar 3 16:34:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 5438 Received: (qmail 22269 invoked by alias); 3 Mar 2015 16:34:56 -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 22248 invoked by uid 89); 3 Mar 2015 16:34:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 03 Mar 2015 16:34:53 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t23GYp8U032767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 3 Mar 2015 11:34:52 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t23GYnJB029358; Tue, 3 Mar 2015 11:34:50 -0500 Message-ID: <54F5E2A9.2080501@redhat.com> Date: Tue, 03 Mar 2015 16:34:49 +0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Mark Kettenis CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Linux/ptrace: don't convert ptids when asking inf-ptrace layer to resume LWP References: <201503031439.t23EdHZv020814@glazunov.sibelius.xs4all.nl> <54F5CF70.2090706@redhat.com> <54F5D488.2060905@redhat.com> In-Reply-To: <54F5D488.2060905@redhat.com> On 03/03/2015 03:34 PM, Pedro Alves wrote: > On 03/03/2015 03:12 PM, Pedro Alves wrote: >> On 03/03/2015 02:39 PM, Mark Kettenis wrote: > >>>> - if (pid == -1) >>>> + if (ptid_equal (minus_one_ptid, ptid)) >>>> /* Resume all threads. Traditionally ptrace() only supports >>>> single-threaded processes, so simply resume the inferior. */ >>>> - pid = ptid_get_pid (inferior_ptid); >>>> + pid = get_ptrace_pid (inferior_ptid); >>> >>> This defenitely should remain ptid_get_pid(); you want to resume the >>> entire process and not an individual thread. > In any case, I agree it's at least clearer. I'm testing this. Alright, pushed as below. I dropped the "clearer" comment, as as discussed, it's a correctness issue. Thanks! --- From c1593e4fa9901c65a32e85c3c5d3ec41598be887 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 3 Mar 2015 16:28:15 +0000 Subject: [PATCH] inf-ptrace.c: use ptid_get_pid when resuming all threads In this case, we want to resume the entire process and not an individual thread. gdb/ 2015-03-03 Pedro Alves * inf-ptrace.c (inf_ptrace_resume): Remove spurious whitespace. Use ptid_get_pid to get the overall process id when resuming all threads. --- gdb/ChangeLog | 6 ++++++ gdb/inf-ptrace.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 31a672e..20250e4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2015-03-03 Pedro Alves + * inf-ptrace.c (inf_ptrace_resume): Remove spurious whitespace. + Use ptid_get_pid to get the overall process id when resuming all + threads. + +2015-03-03 Pedro Alves + * i386-linux-nat.c (i386_linux_resume): Get the ptrace PID out of the lwp field of ptid. Pass the full ptid to get_thread_regcache. * inf-ptrace.c (get_ptrace_pid): New function. diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 606bdb4..3502a12 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -314,13 +314,12 @@ inf_ptrace_resume (struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal signal) { pid_t pid; - int request; if (ptid_equal (minus_one_ptid, ptid)) /* Resume all threads. Traditionally ptrace() only supports single-threaded processes, so simply resume the inferior. */ - pid = get_ptrace_pid (inferior_ptid); + pid = ptid_get_pid (inferior_ptid); else pid = get_ptrace_pid (ptid);