| @@ -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 | |
78 | static void | | 78 | static void |
79 | x86bsd_dr_set (int regnum, unsigned long value) | | 79 | x86bsd_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 | |
104 | static void | | 104 | static void |
105 | x86bsd_dr_set_control (unsigned long control) | | 105 | x86bsd_dr_set_control (unsigned long control) |
106 | { | | 106 | { |
107 | x86bsd_dr_set (7, control); | | 107 | x86bsd_dr_set (7, control); |
108 | } | | 108 | } |
109 | | | 109 | |
110 | static void | | 110 | static void |
111 | x86bsd_dr_set_addr (int regnum, CORE_ADDR addr) | | 111 | x86bsd_dr_set_addr (int regnum, CORE_ADDR addr) |
112 | { | | 112 | { |