summaryrefslogtreecommitdiff
path: root/devel/gdb/files/commit-5077bff
blob: 4b4f59d67cbfda2a2401c47219a1ab2dd675c133 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
commit 5077bfff905136e9d9a8fdf0886f6217887622ad
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Mon Jun 27 17:44:58 2016 -0700

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

diff --git gdb/x86bsd-nat.c gdb/x86bsd-nat.c
index 0c56848..bde25ab 100644
--- gdb/x86bsd-nat.c
+++ gdb/x86bsd-nat.c
@@ -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