Thu Nov 30 00:13:29 2017 UTC ()
Fix 'last argument of ptrace is the thread id' on NetBSD.


(christos)
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/m88k-bsd-nat.c
diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c

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

--- src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c 2017/11/28 18:18:06 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c 2017/11/30 00:13:29 1.2
@@ -39,113 +39,113 @@ @@ -39,113 +39,113 @@
39 for all registers (including the floating-point registers). */ 39 for all registers (including the floating-point registers). */
40 40
41static void 41static void
42amd64bsd_fetch_inferior_registers (struct target_ops *ops, 42amd64bsd_fetch_inferior_registers (struct target_ops *ops,
43 struct regcache *regcache, int regnum) 43 struct regcache *regcache, int regnum)
44{ 44{
45 struct gdbarch *gdbarch = get_regcache_arch (regcache); 45 struct gdbarch *gdbarch = get_regcache_arch (regcache);
46 pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); 46 pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
47 47
48 if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) 48 if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
49 { 49 {
50 struct reg regs; 50 struct reg regs;
51 51
52 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 52 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
53 perror_with_name (_("Couldn't get registers")); 53 perror_with_name (_("Couldn't get registers"));
54 54
55 amd64_supply_native_gregset (regcache, &regs, -1); 55 amd64_supply_native_gregset (regcache, &regs, -1);
56 if (regnum != -1) 56 if (regnum != -1)
57 return; 57 return;
58 } 58 }
59 59
60 if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum)) 60 if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum))
61 { 61 {
62 struct fpreg fpregs; 62 struct fpreg fpregs;
63#ifdef PT_GETXSTATE_INFO 63#ifdef PT_GETXSTATE_INFO
64 void *xstateregs; 64 void *xstateregs;
65 65
66 if (x86bsd_xsave_len != 0) 66 if (x86bsd_xsave_len != 0)
67 { 67 {
68 xstateregs = alloca (x86bsd_xsave_len); 68 xstateregs = alloca (x86bsd_xsave_len);
69 if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0) 69 if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid))
70 == -1) 70 == -1)
71 perror_with_name (_("Couldn't get extended state status")); 71 perror_with_name (_("Couldn't get extended state status"));
72 72
73 amd64_supply_xsave (regcache, -1, xstateregs); 73 amd64_supply_xsave (regcache, -1, xstateregs);
74 return; 74 return;
75 } 75 }
76#endif 76#endif
77 77
78 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 78 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
79 perror_with_name (_("Couldn't get floating point status")); 79 perror_with_name (_("Couldn't get floating point status"));
80 80
81 amd64_supply_fxsave (regcache, -1, &fpregs); 81 amd64_supply_fxsave (regcache, -1, &fpregs);
82 } 82 }
83} 83}
84 84
85/* Store register REGNUM back into the inferior. If REGNUM is -1, do 85/* Store register REGNUM back into the inferior. If REGNUM is -1, do
86 this for all registers (including the floating-point registers). */ 86 this for all registers (including the floating-point registers). */
87 87
88static void 88static void
89amd64bsd_store_inferior_registers (struct target_ops *ops, 89amd64bsd_store_inferior_registers (struct target_ops *ops,
90 struct regcache *regcache, int regnum) 90 struct regcache *regcache, int regnum)
91{ 91{
92 struct gdbarch *gdbarch = get_regcache_arch (regcache); 92 struct gdbarch *gdbarch = get_regcache_arch (regcache);
93 pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); 93 pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
94 94
95 if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) 95 if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
96 { 96 {
97 struct reg regs; 97 struct reg regs;
98 98
99 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 99 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
100 perror_with_name (_("Couldn't get registers")); 100 perror_with_name (_("Couldn't get registers"));
101 101
102 amd64_collect_native_gregset (regcache, &regs, regnum); 102 amd64_collect_native_gregset (regcache, &regs, regnum);
103 103
104 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 104 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
105 perror_with_name (_("Couldn't write registers")); 105 perror_with_name (_("Couldn't write registers"));
106 106
107 if (regnum != -1) 107 if (regnum != -1)
108 return; 108 return;
109 } 109 }
110 110
111 if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum)) 111 if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum))
112 { 112 {
113 struct fpreg fpregs; 113 struct fpreg fpregs;
114#ifdef PT_GETXSTATE_INFO 114#ifdef PT_GETXSTATE_INFO
115 void *xstateregs; 115 void *xstateregs;
116 116
117 if (x86bsd_xsave_len != 0) 117 if (x86bsd_xsave_len != 0)
118 { 118 {
119 xstateregs = alloca (x86bsd_xsave_len); 119 xstateregs = alloca (x86bsd_xsave_len);
120 if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0) 120 if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid))
121 == -1) 121 == -1)
122 perror_with_name (_("Couldn't get extended state status")); 122 perror_with_name (_("Couldn't get extended state status"));
123 123
124 amd64_collect_xsave (regcache, regnum, xstateregs, 0); 124 amd64_collect_xsave (regcache, regnum, xstateregs, ptid_get_lwp (inferior_ptid));
125 125
126 if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 126 if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs,
127 x86bsd_xsave_len) == -1) 127 x86bsd_xsave_len) == -1)
128 perror_with_name (_("Couldn't write extended state status")); 128 perror_with_name (_("Couldn't write extended state status"));
129 return; 129 return;
130 } 130 }
131#endif 131#endif
132 132
133 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 133 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
134 perror_with_name (_("Couldn't get floating point status")); 134 perror_with_name (_("Couldn't get floating point status"));
135 135
136 amd64_collect_fxsave (regcache, regnum, &fpregs); 136 amd64_collect_fxsave (regcache, regnum, &fpregs);
137 137
138 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 138 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
139 perror_with_name (_("Couldn't write floating point status")); 139 perror_with_name (_("Couldn't write floating point status"));
140 } 140 }
141} 141}
142 142
143/* Create a prototype *BSD/amd64 target. The client can override it 143/* Create a prototype *BSD/amd64 target. The client can override it
144 with local methods. */ 144 with local methods. */
145 145
146struct target_ops * 146struct target_ops *
147amd64bsd_target (void) 147amd64bsd_target (void)
148{ 148{
149 struct target_ops *t; 149 struct target_ops *t;
150 150
151 t = x86bsd_target (); 151 t = x86bsd_target ();

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

--- src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c 2017/11/28 18:18:07 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c 2017/11/30 00:13:29 1.2
@@ -127,149 +127,149 @@ i386bsd_collect_gregset (const struct re @@ -127,149 +127,149 @@ i386bsd_collect_gregset (const struct re
127/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this 127/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
128 for all registers (including the floating point registers). */ 128 for all registers (including the floating point registers). */
129 129
130static void 130static void
131i386bsd_fetch_inferior_registers (struct target_ops *ops, 131i386bsd_fetch_inferior_registers (struct target_ops *ops,
132 struct regcache *regcache, int regnum) 132 struct regcache *regcache, int regnum)
133{ 133{
134 pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); 134 pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
135 135
136 if (regnum == -1 || GETREGS_SUPPLIES (regnum)) 136 if (regnum == -1 || GETREGS_SUPPLIES (regnum))
137 { 137 {
138 struct reg regs; 138 struct reg regs;
139 139
140 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 140 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
141 perror_with_name (_("Couldn't get registers")); 141 perror_with_name (_("Couldn't get registers"));
142 142
143 i386bsd_supply_gregset (regcache, &regs); 143 i386bsd_supply_gregset (regcache, &regs);
144 if (regnum != -1) 144 if (regnum != -1)
145 return; 145 return;
146 } 146 }
147 147
148 if (regnum == -1 || regnum >= I386_ST0_REGNUM) 148 if (regnum == -1 || regnum >= I386_ST0_REGNUM)
149 { 149 {
150 struct fpreg fpregs; 150 struct fpreg fpregs;
151#ifdef HAVE_PT_GETXMMREGS 151#ifdef HAVE_PT_GETXMMREGS
152 char xmmregs[512]; 152 char xmmregs[512];
153#endif 153#endif
154 154
155#ifdef PT_GETXSTATE_INFO 155#ifdef PT_GETXSTATE_INFO
156 if (x86bsd_xsave_len != 0) 156 if (x86bsd_xsave_len != 0)
157 { 157 {
158 void *xstateregs; 158 void *xstateregs;
159 159
160 xstateregs = alloca (x86bsd_xsave_len); 160 xstateregs = alloca (x86bsd_xsave_len);
161 if (ptrace (PT_GETXSTATE, pid, 161 if (ptrace (PT_GETXSTATE, pid,
162 (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) 162 (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid)) == -1)
163 perror_with_name (_("Couldn't get extended state status")); 163 perror_with_name (_("Couldn't get extended state status"));
164 164
165 i387_supply_xsave (regcache, -1, xstateregs); 165 i387_supply_xsave (regcache, -1, xstateregs);
166 return; 166 return;
167 } 167 }
168#endif 168#endif
169  169
170#ifdef HAVE_PT_GETXMMREGS 170#ifdef HAVE_PT_GETXMMREGS
171 if (have_ptrace_xmmregs != 0 171 if (have_ptrace_xmmregs != 0
172 && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0) 172 && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == 0)
173 { 173 {
174 have_ptrace_xmmregs = 1; 174 have_ptrace_xmmregs = 1;
175 i387_supply_fxsave (regcache, -1, xmmregs); 175 i387_supply_fxsave (regcache, -1, xmmregs);
176 } 176 }
177 else 177 else
178 { 178 {
179 have_ptrace_xmmregs = 0; 179 have_ptrace_xmmregs = 0;
180#endif 180#endif
181 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 181 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
182 perror_with_name (_("Couldn't get floating point status")); 182 perror_with_name (_("Couldn't get floating point status"));
183 183
184 i387_supply_fsave (regcache, -1, &fpregs); 184 i387_supply_fsave (regcache, -1, &fpregs);
185#ifdef HAVE_PT_GETXMMREGS 185#ifdef HAVE_PT_GETXMMREGS
186 } 186 }
187#endif 187#endif
188 } 188 }
189} 189}
190 190
191/* Store register REGNUM back into the inferior. If REGNUM is -1, do 191/* Store register REGNUM back into the inferior. If REGNUM is -1, do
192 this for all registers (including the floating point registers). */ 192 this for all registers (including the floating point registers). */
193 193
194static void 194static void
195i386bsd_store_inferior_registers (struct target_ops *ops, 195i386bsd_store_inferior_registers (struct target_ops *ops,
196 struct regcache *regcache, int regnum) 196 struct regcache *regcache, int regnum)
197{ 197{
198 pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); 198 pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
199 199
200 if (regnum == -1 || GETREGS_SUPPLIES (regnum)) 200 if (regnum == -1 || GETREGS_SUPPLIES (regnum))
201 { 201 {
202 struct reg regs; 202 struct reg regs;
203 203
204 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 204 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
205 perror_with_name (_("Couldn't get registers")); 205 perror_with_name (_("Couldn't get registers"));
206 206
207 i386bsd_collect_gregset (regcache, &regs, regnum); 207 i386bsd_collect_gregset (regcache, &regs, regnum);
208 208
209 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 209 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
210 perror_with_name (_("Couldn't write registers")); 210 perror_with_name (_("Couldn't write registers"));
211 211
212 if (regnum != -1) 212 if (regnum != -1)
213 return; 213 return;
214 } 214 }
215 215
216 if (regnum == -1 || regnum >= I386_ST0_REGNUM) 216 if (regnum == -1 || regnum >= I386_ST0_REGNUM)
217 { 217 {
218 struct fpreg fpregs; 218 struct fpreg fpregs;
219#ifdef HAVE_PT_GETXMMREGS 219#ifdef HAVE_PT_GETXMMREGS
220 char xmmregs[512]; 220 char xmmregs[512];
221#endif 221#endif
222 222
223#ifdef PT_GETXSTATE_INFO 223#ifdef PT_GETXSTATE_INFO
224 if (x86bsd_xsave_len != 0) 224 if (x86bsd_xsave_len != 0)
225 { 225 {
226 void *xstateregs; 226 void *xstateregs;
227 227
228 xstateregs = alloca (x86bsd_xsave_len); 228 xstateregs = alloca (x86bsd_xsave_len);
229 if (ptrace (PT_GETXSTATE, pid, 229 if (ptrace (PT_GETXSTATE, pid,
230 (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) 230 (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid)) == -1)
231 perror_with_name (_("Couldn't get extended state status")); 231 perror_with_name (_("Couldn't get extended state status"));
232 232
233 i387_collect_xsave (regcache, -1, xstateregs, 0); 233 i387_collect_xsave (regcache, -1, xstateregs, ptid_get_lwp (inferior_ptid));
234 234
235 if (ptrace (PT_SETXSTATE, pid, 235 if (ptrace (PT_SETXSTATE, pid,
236 (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1) 236 (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1)
237 perror_with_name (_("Couldn't write extended state status")); 237 perror_with_name (_("Couldn't write extended state status"));
238 return; 238 return;
239 } 239 }
240#endif 240#endif
241 241
242#ifdef HAVE_PT_GETXMMREGS 242#ifdef HAVE_PT_GETXMMREGS
243 if (have_ptrace_xmmregs != 0 243 if (have_ptrace_xmmregs != 0
244 && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0) 244 && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == 0)
245 { 245 {
246 have_ptrace_xmmregs = 1; 246 have_ptrace_xmmregs = 1;
247 247
248 i387_collect_fxsave (regcache, regnum, xmmregs); 248 i387_collect_fxsave (regcache, regnum, xmmregs);
249 249
250 if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1) 250 if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == -1)
251 perror_with_name (_("Couldn't write XMM registers")); 251 perror_with_name (_("Couldn't write XMM registers"));
252 } 252 }
253 else 253 else
254 { 254 {
255 have_ptrace_xmmregs = 0; 255 have_ptrace_xmmregs = 0;
256#endif 256#endif
257 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 257 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
258 perror_with_name (_("Couldn't get floating point status")); 258 perror_with_name (_("Couldn't get floating point status"));
259 259
260 i387_collect_fsave (regcache, regnum, &fpregs); 260 i387_collect_fsave (regcache, regnum, &fpregs);
261 261
262 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 262 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
263 perror_with_name (_("Couldn't write floating point status")); 263 perror_with_name (_("Couldn't write floating point status"));
264#ifdef HAVE_PT_GETXMMREGS 264#ifdef HAVE_PT_GETXMMREGS
265 } 265 }
266#endif 266#endif
267 } 267 }
268} 268}
269 269
270/* Create a prototype *BSD/i386 target. The client can override it 270/* Create a prototype *BSD/i386 target. The client can override it
271 with local methods. */ 271 with local methods. */
272 272
273struct target_ops * 273struct target_ops *
274i386bsd_target (void) 274i386bsd_target (void)
275{ 275{

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

--- src/external/gpl3/gdb/dist/gdb/Attic/m88k-bsd-nat.c 2017/11/28 18:18:03 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/Attic/m88k-bsd-nat.c 2017/11/30 00:13:29 1.2
@@ -59,49 +59,49 @@ m88kbsd_collect_gregset (const struct re @@ -59,49 +59,49 @@ m88kbsd_collect_gregset (const struct re
59} 59}
60  60
61 61
62/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this 62/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
63 for all registers. */ 63 for all registers. */
64 64
65static void 65static void
66m88kbsd_fetch_inferior_registers (struct target_ops *ops, 66m88kbsd_fetch_inferior_registers (struct target_ops *ops,
67 struct regcache *regcache, int regnum) 67 struct regcache *regcache, int regnum)
68{ 68{
69 struct reg regs; 69 struct reg regs;
70 70
71 if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), 71 if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
72 (PTRACE_TYPE_ARG3) &regs, 0) == -1) 72 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
73 perror_with_name (_("Couldn't get registers")); 73 perror_with_name (_("Couldn't get registers"));
74 74
75 m88kbsd_supply_gregset (regcache, &regs); 75 m88kbsd_supply_gregset (regcache, &regs);
76} 76}
77 77
78/* Store register REGNUM back into the inferior. If REGNUM is -1, do 78/* Store register REGNUM back into the inferior. If REGNUM is -1, do
79 this for all registers. */ 79 this for all registers. */
80 80
81static void 81static void
82m88kbsd_store_inferior_registers (struct target_ops *ops, 82m88kbsd_store_inferior_registers (struct target_ops *ops,
83 struct regcache *regcache, int regnum) 83 struct regcache *regcache, int regnum)
84{ 84{
85 struct reg regs; 85 struct reg regs;
86 86
87 if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), 87 if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
88 (PTRACE_TYPE_ARG3) &regs, 0) == -1) 88 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
89 perror_with_name (_("Couldn't get registers")); 89 perror_with_name (_("Couldn't get registers"));
90 90
91 m88kbsd_collect_gregset (regcache, &regs, regnum); 91 m88kbsd_collect_gregset (regcache, &regs, regnum);
92 92
93 if (ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)), 93 if (ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
94 (PTRACE_TYPE_ARG3) &regs, 0) == -1) 94 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
95 perror_with_name (_("Couldn't write registers")); 95 perror_with_name (_("Couldn't write registers"));
96} 96}
97  97
98 98
99/* Provide a prototype to silence -Wmissing-prototypes. */ 99/* Provide a prototype to silence -Wmissing-prototypes. */
100void _initialize_m88kbsd_nat (void); 100void _initialize_m88kbsd_nat (void);
101 101
102void 102void
103_initialize_m88kbsd_nat (void) 103_initialize_m88kbsd_nat (void)
104{ 104{
105 struct target_ops *t; 105 struct target_ops *t;
106 106
107 t = inf_ptrace_target (); 107 t = inf_ptrace_target ();

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

--- src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c 2017/11/29 18:15:29 1.2
+++ src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c 2017/11/30 00:13:29 1.3
@@ -107,75 +107,75 @@ m68kbsd_collect_fpregset (struct regcach @@ -107,75 +107,75 @@ m68kbsd_collect_fpregset (struct regcach
107/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this 107/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
108 for all registers (including the floating-point registers). */ 108 for all registers (including the floating-point registers). */
109 109
110static void 110static void
111m68kbsd_fetch_inferior_registers (struct target_ops *ops, 111m68kbsd_fetch_inferior_registers (struct target_ops *ops,
112 struct regcache *regcache, int regnum) 112 struct regcache *regcache, int regnum)
113{ 113{
114 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 114 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
115 115
116 if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum)) 116 if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
117 { 117 {
118 struct reg regs; 118 struct reg regs;
119 119
120 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 120 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
121 perror_with_name (_("Couldn't get registers")); 121 perror_with_name (_("Couldn't get registers"));
122 122
123 m68kbsd_supply_gregset (regcache, &regs); 123 m68kbsd_supply_gregset (regcache, &regs);
124 } 124 }
125 125
126 if (regnum == -1 || m68kbsd_fpregset_supplies_p (regnum)) 126 if (regnum == -1 || m68kbsd_fpregset_supplies_p (regnum))
127 { 127 {
128 struct fpreg fpregs; 128 struct fpreg fpregs;
129 129
130 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 130 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
131 perror_with_name (_("Couldn't get floating point status")); 131 perror_with_name (_("Couldn't get floating point status"));
132 132
133 m68kbsd_supply_fpregset (regcache, &fpregs); 133 m68kbsd_supply_fpregset (regcache, &fpregs);
134 } 134 }
135} 135}
136 136
137/* Store register REGNUM back into the inferior. If REGNUM is -1, do 137/* Store register REGNUM back into the inferior. If REGNUM is -1, do
138 this for all registers (including the floating-point registers). */ 138 this for all registers (including the floating-point registers). */
139 139
140static void 140static void
141m68kbsd_store_inferior_registers (struct target_ops *ops, 141m68kbsd_store_inferior_registers (struct target_ops *ops,
142 struct regcache *regcache, int regnum) 142 struct regcache *regcache, int regnum)
143{ 143{
144 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 144 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
145 145
146 if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum)) 146 if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
147 { 147 {
148 struct reg regs; 148 struct reg regs;
149 149
150 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 150 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
151 perror_with_name (_("Couldn't get registers")); 151 perror_with_name (_("Couldn't get registers"));
152 152
153 m68kbsd_collect_gregset (regcache, &regs, regnum); 153 m68kbsd_collect_gregset (regcache, &regs, regnum);
154 154
155 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 155 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
156 perror_with_name (_("Couldn't write registers")); 156 perror_with_name (_("Couldn't write registers"));
157 } 157 }
158 158
159 if (regnum == -1 || m68kbsd_fpregset_supplies_p (regnum)) 159 if (regnum == -1 || m68kbsd_fpregset_supplies_p (regnum))
160 { 160 {
161 struct fpreg fpregs; 161 struct fpreg fpregs;
162 162
163 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 163 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
164 perror_with_name (_("Couldn't get floating point status")); 164 perror_with_name (_("Couldn't get floating point status"));
165 165
166 m68kbsd_collect_fpregset (regcache, &fpregs, regnum); 166 m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
167 167
168 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 168 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
169 perror_with_name (_("Couldn't write floating point status")); 169 perror_with_name (_("Couldn't write floating point status"));
170 } 170 }
171} 171}
172  172
173 173
174/* Support for debugging kernel virtual memory images. */ 174/* Support for debugging kernel virtual memory images. */
175 175
176#include <machine/pcb.h> 176#include <machine/pcb.h>
177 177
178#include "bsd-kvm.h" 178#include "bsd-kvm.h"
179 179
180/* OpenBSD doesn't have these. */ 180/* OpenBSD doesn't have these. */
181#ifndef PCB_REGS_FP 181#ifndef PCB_REGS_FP

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

--- src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c 2017/11/29 21:35:26 1.3
+++ src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c 2017/11/30 00:13:29 1.4
@@ -62,48 +62,48 @@ vaxbsd_collect_gregset (const struct reg @@ -62,48 +62,48 @@ vaxbsd_collect_gregset (const struct reg
62} 62}
63  63
64 64
65/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this 65/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
66 for all registers. */ 66 for all registers. */
67 67
68static void 68static void
69vaxbsd_fetch_inferior_registers (struct target_ops *ops, 69vaxbsd_fetch_inferior_registers (struct target_ops *ops,
70 struct regcache *regcache, int regnum) 70 struct regcache *regcache, int regnum)
71{ 71{
72 struct reg regs; 72 struct reg regs;
73 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 73 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
74 74
75 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 75 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
76 perror_with_name (_("Couldn't get registers")); 76 perror_with_name (_("Couldn't get registers"));
77 77
78 vaxbsd_supply_gregset (regcache, &regs); 78 vaxbsd_supply_gregset (regcache, &regs);
79} 79}
80 80
81/* Store register REGNUM back into the inferior. If REGNUM is -1, do 81/* Store register REGNUM back into the inferior. If REGNUM is -1, do
82 this for all registers. */ 82 this for all registers. */
83 83
84static void 84static void
85vaxbsd_store_inferior_registers (struct target_ops *ops, 85vaxbsd_store_inferior_registers (struct target_ops *ops,
86 struct regcache *regcache, int regnum) 86 struct regcache *regcache, int regnum)
87{ 87{
88 struct reg regs; 88 struct reg regs;
89 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 89 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
90 90
91 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 91 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
92 perror_with_name (_("Couldn't get registers")); 92 perror_with_name (_("Couldn't get registers"));
93 93
94 vaxbsd_collect_gregset (regcache, &regs, regnum); 94 vaxbsd_collect_gregset (regcache, &regs, regnum);
95 95
96 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 96 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
97 perror_with_name (_("Couldn't write registers")); 97 perror_with_name (_("Couldn't write registers"));
98} 98}
99  99
100 100
101/* Support for debugging kernel virtual memory images. */ 101/* Support for debugging kernel virtual memory images. */
102 102
103#include <machine/pcb.h> 103#include <machine/pcb.h>
104 104
105#include "bsd-kvm.h" 105#include "bsd-kvm.h"
106 106
107static int 107static int
108vaxbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) 108vaxbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
109{ 109{