Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
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 14:23:00 -0000	[thread overview]
Message-ID: <1493303002-8056-1-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <CAPXMrf_jyxS1muQ9gUUyiHyEkNUL9-aTw_CjUh7jOCbCKby9TQ@mail.gmail.com>

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  <yao.qi@linaro.org>

	* 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"));
 }
-- 
1.9.1


       reply	other threads:[~2017-04-27 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAPXMrf_jyxS1muQ9gUUyiHyEkNUL9-aTw_CjUh7jOCbCKby9TQ@mail.gmail.com>
2017-04-27 14:23 ` Yao Qi [this message]
2017-04-27 14:26   ` Simon Marchi
2017-04-28  8:55     ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1493303002-8056-1-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@imgtec.com \
    --cc=raajeshdasari@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox