Set debug registers on all threads belonging to the current inferior.
authorJohn Baldwin <jhb@FreeBSD.org>
Tue, 28 Jun 2016 00:44:58 +0000 (17:44 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 1 Jul 2016 14:01:05 +0000 (07:01 -0700)
gdb/ChangeLog:

* x86bsd-nat.c: Include 'gdbthread.h'.
(x86bsd_dr_set): Set debug registers on all threads belonging to
the current inferior.

gdb/ChangeLog
gdb/x86bsd-nat.c

index 0089d6804a2e85815808dffb9d024f7f065bb83a..e4f7e3ae52081abd4f3b1f683eb0d7e3e3c7c791 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-01  John Baldwin  <jhb@FreeBSD.org>
+
+       * x86bsd-nat.c: Include 'gdbthread.h'.
+       (x86bsd_dr_set): Set debug registers on all threads belonging to
+       the current inferior.
+
 2016-07-01  John Baldwin  <jhb@FreeBSD.org>
 
        * Makefile.in [HFILES_NO_SRCDIR]: Replace 'amd64bsd-nat.h' with
index 0c568487f6d8304689337a0b1be0e8d951213bd0..bde25ab77242f6992aa0175bb1435cb406badd5c 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "defs.h"
 #include "inferior.h"
+#include "gdbthread.h"
 
 /* We include <signal.h> to make sure `struct fxsave64' is defined on
    NetBSD, since NetBSD's <machine/reg.h> needs it.  */
@@ -71,6 +72,7 @@ x86bsd_dr_get (ptid_t ptid, int regnum)
 static void
 x86bsd_dr_set (int regnum, unsigned long value)
 {
+  struct thread_info *thread;
   struct dbreg dbregs;
 
   if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid),
@@ -84,9 +86,13 @@ x86bsd_dr_set (int regnum, unsigned long value)
 
   DBREG_DRX ((&dbregs), regnum) = value;
 
-  if (ptrace (PT_SETDBREGS, get_ptrace_pid (inferior_ptid),
-              (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
-    perror_with_name (_("Couldn't write debug registers"));
+  ALL_NON_EXITED_THREADS (thread)
+    if (thread->inf == current_inferior ())
+      {
+       if (ptrace (PT_SETDBREGS, get_ptrace_pid (thread->ptid),
+                   (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
+         perror_with_name (_("Couldn't write debug registers"));
+      }
 }
 
 static void
This page took 0.029786 seconds and 4 git commands to generate.