Fri Dec 1 22:15:17 2017 UTC ()
get the debugging registers for the specific thread.


(christos)
diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c

cvs diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c 2017/11/28 22:04:53 1.2
+++ src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c 2017/12/01 22:15:17 1.3
@@ -72,41 +72,41 @@ x86bsd_dr_get (ptid_t ptid, int regnum) @@ -72,41 +72,41 @@ x86bsd_dr_get (ptid_t ptid, int regnum)
72 (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) 72 (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
73 perror_with_name (_("Couldn't read debug registers")); 73 perror_with_name (_("Couldn't read debug registers"));
74 74
75 return DBREG_DRX ((&dbregs), regnum); 75 return DBREG_DRX ((&dbregs), regnum);
76} 76}
77 77
78static void 78static void
79x86bsd_dr_set (int regnum, unsigned long value) 79x86bsd_dr_set (int regnum, unsigned long value)
80{ 80{
81 struct thread_info *thread; 81 struct thread_info *thread;
82 struct dbreg dbregs; 82 struct dbreg dbregs;
83 83
84 if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), 84 if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid),
85 (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) 85 (PTRACE_TYPE_ARG3) &dbregs, ptid_get_lwp (inferior_ptid)) == -1)
86 perror_with_name (_("Couldn't get debug registers")); 86 perror_with_name (_("Couldn't get debug registers"));
87 87
88 /* For some mysterious reason, some of the reserved bits in the 88 /* For some mysterious reason, some of the reserved bits in the
89 debug control register get set. Mask these off, otherwise the 89 debug control register get set. Mask these off, otherwise the
90 ptrace call below will fail. */ 90 ptrace call below will fail. */
91 DBREG_DRX ((&dbregs), 7) &= ~(0xffffffff0000fc00); 91 DBREG_DRX ((&dbregs), 7) &= ~(0xffffffff0000fc00);
92 92
93 DBREG_DRX ((&dbregs), regnum) = value; 93 DBREG_DRX ((&dbregs), regnum) = value;
94 94
95 ALL_NON_EXITED_THREADS (thread) 95 ALL_NON_EXITED_THREADS (thread)
96 if (thread->inf == current_inferior ()) 96 if (thread->inf == current_inferior ())
97 { 97 {
98 if (ptrace (PT_SETDBREGS, get_ptrace_pid (thread->ptid), 98 if (ptrace (PT_SETDBREGS, get_ptrace_pid (thread->ptid),
99 (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) 99 (PTRACE_TYPE_ARG3) &dbregs, ptid_get_lwp (inferior_ptid)) == -1)
100 perror_with_name (_("Couldn't write debug registers")); 100 perror_with_name (_("Couldn't write debug registers"));
101 } 101 }
102} 102}
103 103
104static void 104static void
105x86bsd_dr_set_control (unsigned long control) 105x86bsd_dr_set_control (unsigned long control)
106{ 106{
107 x86bsd_dr_set (7, control); 107 x86bsd_dr_set (7, control);
108} 108}
109 109
110static void 110static void
111x86bsd_dr_set_addr (int regnum, CORE_ADDR addr) 111x86bsd_dr_set_addr (int regnum, CORE_ADDR addr)
112{ 112{