]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[MIPS] Use lwpid from lwp_info instead of inferior_ptid
authorYao Qi <yao.qi@linaro.org>
Fri, 28 Apr 2017 08:33:16 +0000 (09:33 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 28 Apr 2017 08:33:16 +0000 (09:33 +0100)
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-28  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/ChangeLog
gdb/mips-linux-nat.c

index 88b44f94d12c99808c6fc8274e973da7edeb669c..9abf2766e3109741d4730a277f0f02bc86339ce7 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-28  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.
+
 2017-04-27  Keith Seitz  <keiths@redhat.com>
 
        * gdbtypes.c (LVALUE_REFERENCE_TO_RVALUE_BINDING_BADNESS)
index 9596b49099b5f6b0190c343cf2166ac493381085..c5c18fdc6211c4504c59e2c94fb30c945d3da711 100644 (file)
@@ -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"));
 }