From patchwork Thu Apr 27 14:23:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 20183 Received: (qmail 93047 invoked by alias); 27 Apr 2017 14:23:28 -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 92015 invoked by uid 89); 27 Apr 2017 14:23:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*macro X-HELO: mail-wm0-f68.google.com Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Apr 2017 14:23:26 +0000 Received: by mail-wm0-f68.google.com with SMTP id d79so4928637wmi.2 for ; Thu, 27 Apr 2017 07:23:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WWu39DICHZJwxol6kmvB2q8mhWQGbpnT3Nh9xDOcZF4=; b=JRPX/zrsa1vbTXmRcj8FEMaP3Fq4vtWby6RW/m4PB9pjVTVF1En7XEKOelFgaiVoYb hBDj10x7q+ik+aevuswdIfXRfxvrwnxT7pXpixHC/x3gWBmoa9pfmaYi9BnWoYo1bCVD tdgd+5rtYWHS0TpEfhlx9tRLQWLmlUExfwtiCvxk/OelhipG6pW3LtvSzeXYM8AaXPg7 0DT+3LF2Z/r9Gv2RXTuCF+4aZReeu6UGIoOOVWyWy13O6m8FnPn/P95GmI3cxpUEmruD 0V9UTU6h0qChBHI4zpFj2WbhHSgOoIyUkpo+MaHPHrYBCT1Wj1PKrKyl1D22Q6JXfRUZ z/iQ== X-Gm-Message-State: AN3rC/5EiVvIa/a4QCoH3GuBFwZLlHzIplShbgfi/TH0L5KsLJXHiOAF /0fy9skTiHdcIA== X-Received: by 10.28.166.143 with SMTP id p137mr2468033wme.113.1493303004952; Thu, 27 Apr 2017 07:23:24 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com ([194.214.185.158]) by smtp.gmail.com with ESMTPSA id t30sm2628260wrc.24.2017.04.27.07.23.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Apr 2017 07:23:24 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Cc: raajeshdasari@gmail.com, macro@imgtec.com Subject: [PATCH] [MIPS] Use lwpid from lwp_info instead of inferior_ptid Date: Thu, 27 Apr 2017 15:23:22 +0100 Message-Id: <1493303002-8056-1-git-send-email-yao.qi@linaro.org> In-Reply-To: References: X-IsSubscribed: yes 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); - 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")); }