From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47129 invoked by alias); 27 Apr 2017 14:26:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 47001 invoked by uid 89); 27 Apr 2017 14:26:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=H*u:1.2.4, H*UA:1.2.4 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Apr 2017 14:26:31 +0000 Received: by simark.ca (Postfix, from userid 33) id 5FF9C1E48D; Thu, 27 Apr 2017 10:26:32 -0400 (EDT) To: Yao Qi Subject: Re: [PATCH] [MIPS] Use lwpid from lwp_info instead of inferior_ptid X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 27 Apr 2017 14:26:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org, raajeshdasari@gmail.com, macro@imgtec.com In-Reply-To: <1493303002-8056-1-git-send-email-yao.qi@linaro.org> References: <1493303002-8056-1-git-send-email-yao.qi@linaro.org> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.4 X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00738.txt.bz2 On 2017-04-27 10:23, Yao Qi wrote: > RAJESH reported that GDB gets "Couldn't write debug register: No such > process." on mips64 when GDB attaches to a multi threaded application. > > Looks GDB nows PTRACE_GET_WATCH_REGS for inferior_ptid but > PTRACE_SET_WATCH_REGS for lwp->ptid, they may be different. > > gdb: > > 2017-04-27 Yao Qi > > * mips-linux-nat.c (mips_linux_new_thread): Get lwpid from > lwp_info instead of getting from inferior_ptid. > --- > gdb/mips-linux-nat.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c > index 9596b49..c5c18fd 100644 > --- a/gdb/mips-linux-nat.c > +++ b/gdb/mips-linux-nat.c > @@ -624,14 +624,13 @@ write_watchpoint_regs (void) > static void > mips_linux_new_thread (struct lwp_info *lp) > { > - int tid; > + long tid = ptid_get_lwp (lp->ptid); You can replace this with "lp->ptid.lwp ()". Otherwise, LGTM. > > - if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid), > + if (!mips_linux_read_watch_registers (tid, > &watch_readback, > &watch_readback_valid, 0)) > return; > > - tid = ptid_get_lwp (lp->ptid); > if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1) > perror_with_name (_("Couldn't write debug register")); > }