OLD | NEW |
1 /* Native-dependent code for GNU/Linux on MIPS processors. | 1 /* Native-dependent code for GNU/Linux on MIPS processors. |
2 | 2 |
3 Copyright (C) 2001-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2001-2012 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "mips-linux-tdep.h" | 29 #include "mips-linux-tdep.h" |
30 #include "target-descriptions.h" | 30 #include "target-descriptions.h" |
31 | 31 |
32 #include "gdb_proc_service.h" | 32 #include "gdb_proc_service.h" |
33 #include "gregset.h" | 33 #include "gregset.h" |
34 | 34 |
35 #include <sgidefs.h> | 35 #include <sgidefs.h> |
36 #include <sys/ptrace.h> | 36 #include <sys/ptrace.h> |
37 | 37 |
38 #include "features/mips-linux.c" | 38 #include "features/mips-linux.c" |
| 39 #include "features/mips-dsp-linux.c" |
39 #include "features/mips64-linux.c" | 40 #include "features/mips64-linux.c" |
| 41 #include "features/mips64-dsp-linux.c" |
40 | 42 |
41 #ifndef PTRACE_GET_THREAD_AREA | 43 #ifndef PTRACE_GET_THREAD_AREA |
42 #define PTRACE_GET_THREAD_AREA 25 | 44 #define PTRACE_GET_THREAD_AREA 25 |
43 #endif | 45 #endif |
44 | 46 |
45 /* Assume that we have PTRACE_GETREGS et al. support. If we do not, | 47 /* Assume that we have PTRACE_GETREGS et al. support. If we do not, |
46 we'll clear this and use PTRACE_PEEKUSER instead. */ | 48 we'll clear this and use PTRACE_PEEKUSER instead. */ |
47 static int have_ptrace_regsets = 1; | 49 static int have_ptrace_regsets = 1; |
48 | 50 |
49 /* Whether or not to print the mirrored debug registers. */ | 51 /* Whether or not to print the mirrored debug registers. */ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 else if (regno == mips_regnum (gdbarch)->badvaddr) | 89 else if (regno == mips_regnum (gdbarch)->badvaddr) |
88 regaddr = store? (CORE_ADDR) -1 : BADVADDR; | 90 regaddr = store? (CORE_ADDR) -1 : BADVADDR; |
89 else if (regno == mips_regnum (gdbarch)->lo) | 91 else if (regno == mips_regnum (gdbarch)->lo) |
90 regaddr = MMLO; | 92 regaddr = MMLO; |
91 else if (regno == mips_regnum (gdbarch)->hi) | 93 else if (regno == mips_regnum (gdbarch)->hi) |
92 regaddr = MMHI; | 94 regaddr = MMHI; |
93 else if (regno == mips_regnum (gdbarch)->fp_control_status) | 95 else if (regno == mips_regnum (gdbarch)->fp_control_status) |
94 regaddr = FPC_CSR; | 96 regaddr = FPC_CSR; |
95 else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) | 97 else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) |
96 regaddr = store? (CORE_ADDR) -1 : FPC_EIR; | 98 regaddr = store? (CORE_ADDR) -1 : FPC_EIR; |
| 99 else if (mips_regnum (gdbarch)->dspacc != -1 |
| 100 && regno >= mips_regnum (gdbarch)->dspacc |
| 101 && regno < mips_regnum (gdbarch)->dspacc + 6) |
| 102 regaddr = DSP_BASE + (regno - mips_regnum (gdbarch)->dspacc); |
| 103 else if (regno == mips_regnum (gdbarch)->dspctl) |
| 104 regaddr = DSP_CONTROL; |
97 else if (mips_linux_restart_reg_p (gdbarch) && regno == MIPS_RESTART_REGNUM) | 105 else if (mips_linux_restart_reg_p (gdbarch) && regno == MIPS_RESTART_REGNUM) |
98 regaddr = 0; | 106 regaddr = 0; |
99 else | 107 else |
100 regaddr = (CORE_ADDR) -1; | 108 regaddr = (CORE_ADDR) -1; |
101 | 109 |
102 return regaddr; | 110 return regaddr; |
103 } | 111 } |
104 | 112 |
105 static CORE_ADDR | 113 static CORE_ADDR |
106 mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store) | 114 mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store) |
(...skipping 15 matching lines...) Expand all Loading... |
122 else if (regno == mips_regnum (gdbarch)->badvaddr) | 130 else if (regno == mips_regnum (gdbarch)->badvaddr) |
123 regaddr = store? (CORE_ADDR) -1 : MIPS64_BADVADDR; | 131 regaddr = store? (CORE_ADDR) -1 : MIPS64_BADVADDR; |
124 else if (regno == mips_regnum (gdbarch)->lo) | 132 else if (regno == mips_regnum (gdbarch)->lo) |
125 regaddr = MIPS64_MMLO; | 133 regaddr = MIPS64_MMLO; |
126 else if (regno == mips_regnum (gdbarch)->hi) | 134 else if (regno == mips_regnum (gdbarch)->hi) |
127 regaddr = MIPS64_MMHI; | 135 regaddr = MIPS64_MMHI; |
128 else if (regno == mips_regnum (gdbarch)->fp_control_status) | 136 else if (regno == mips_regnum (gdbarch)->fp_control_status) |
129 regaddr = MIPS64_FPC_CSR; | 137 regaddr = MIPS64_FPC_CSR; |
130 else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) | 138 else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) |
131 regaddr = store? (CORE_ADDR) -1 : MIPS64_FPC_EIR; | 139 regaddr = store? (CORE_ADDR) -1 : MIPS64_FPC_EIR; |
| 140 else if (mips_regnum (gdbarch)->dspacc != -1 |
| 141 && regno >= mips_regnum (gdbarch)->dspacc |
| 142 && regno < mips_regnum (gdbarch)->dspacc + 6) |
| 143 regaddr = DSP_BASE + (regno - mips_regnum (gdbarch)->dspacc); |
| 144 else if (regno == mips_regnum (gdbarch)->dspctl) |
| 145 regaddr = DSP_CONTROL; |
132 else if (mips_linux_restart_reg_p (gdbarch) && regno == MIPS_RESTART_REGNUM) | 146 else if (mips_linux_restart_reg_p (gdbarch) && regno == MIPS_RESTART_REGNUM) |
133 regaddr = 0; | 147 regaddr = 0; |
134 else | 148 else |
135 regaddr = (CORE_ADDR) -1; | 149 regaddr = (CORE_ADDR) -1; |
136 | 150 |
137 return regaddr; | 151 return regaddr; |
138 } | 152 } |
139 | 153 |
140 /* Fetch the thread-local storage pointer for libthread_db. */ | 154 /* Fetch the thread-local storage pointer for libthread_db. */ |
141 | 155 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 else | 208 else |
195 mips64_fill_fpregset (regcache, | 209 mips64_fill_fpregset (regcache, |
196 (mips64_elf_fpregset_t *) fpregsetp, regno); | 210 (mips64_elf_fpregset_t *) fpregsetp, regno); |
197 } | 211 } |
198 | 212 |
199 | 213 |
200 /* Fetch REGNO (or all registers if REGNO == -1) from the target | 214 /* Fetch REGNO (or all registers if REGNO == -1) from the target |
201 using PTRACE_GETREGS et al. */ | 215 using PTRACE_GETREGS et al. */ |
202 | 216 |
203 static void | 217 static void |
204 mips64_linux_regsets_fetch_registers (struct regcache *regcache, int regno) | 218 mips64_linux_regsets_fetch_registers (struct target_ops *ops, |
| 219 » » » » struct regcache *regcache, int regno) |
205 { | 220 { |
206 struct gdbarch *gdbarch = get_regcache_arch (regcache); | 221 struct gdbarch *gdbarch = get_regcache_arch (regcache); |
207 int is_fp; | 222 int is_fp, is_dsp; |
| 223 int have_dsp; |
| 224 int regi; |
208 int tid; | 225 int tid; |
209 | 226 |
210 if (regno >= mips_regnum (gdbarch)->fp0 | 227 if (regno >= mips_regnum (gdbarch)->fp0 |
211 && regno <= mips_regnum (gdbarch)->fp0 + 32) | 228 && regno <= mips_regnum (gdbarch)->fp0 + 32) |
212 is_fp = 1; | 229 is_fp = 1; |
213 else if (regno == mips_regnum (gdbarch)->fp_control_status) | 230 else if (regno == mips_regnum (gdbarch)->fp_control_status) |
214 is_fp = 1; | 231 is_fp = 1; |
215 else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) | 232 else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) |
216 is_fp = 1; | 233 is_fp = 1; |
217 else | 234 else |
218 is_fp = 0; | 235 is_fp = 0; |
219 | 236 |
| 237 /* DSP registers are optional and not a part of any set. */ |
| 238 have_dsp = mips_regnum (gdbarch)->dspctl != -1; |
| 239 if (!have_dsp) |
| 240 is_dsp = 0; |
| 241 else if (regno >= mips_regnum (gdbarch)->dspacc |
| 242 && regno < mips_regnum (gdbarch)->dspacc + 6) |
| 243 is_dsp = 1; |
| 244 else if (regno == mips_regnum (gdbarch)->dspctl) |
| 245 is_dsp = 1; |
| 246 else |
| 247 is_dsp = 0; |
| 248 |
220 tid = ptid_get_lwp (inferior_ptid); | 249 tid = ptid_get_lwp (inferior_ptid); |
221 if (tid == 0) | 250 if (tid == 0) |
222 tid = ptid_get_pid (inferior_ptid); | 251 tid = ptid_get_pid (inferior_ptid); |
223 | 252 |
224 if (regno == -1 || !is_fp) | 253 if (regno == -1 || (!is_fp && !is_dsp)) |
225 { | 254 { |
226 mips64_elf_gregset_t regs; | 255 mips64_elf_gregset_t regs; |
227 | 256 |
228 if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1) | 257 if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1) |
229 { | 258 { |
230 if (errno == EIO) | 259 if (errno == EIO) |
231 { | 260 { |
232 have_ptrace_regsets = 0; | 261 have_ptrace_regsets = 0; |
233 return; | 262 return; |
234 } | 263 } |
(...skipping 15 matching lines...) Expand all Loading... |
250 { | 279 { |
251 have_ptrace_regsets = 0; | 280 have_ptrace_regsets = 0; |
252 return; | 281 return; |
253 } | 282 } |
254 perror_with_name (_("Couldn't get FP registers")); | 283 perror_with_name (_("Couldn't get FP registers")); |
255 } | 284 } |
256 | 285 |
257 mips64_supply_fpregset (regcache, | 286 mips64_supply_fpregset (regcache, |
258 (const mips64_elf_fpregset_t *) &fp_regs); | 287 (const mips64_elf_fpregset_t *) &fp_regs); |
259 } | 288 } |
| 289 |
| 290 if (is_dsp) |
| 291 super_fetch_registers (ops, regcache, regno); |
| 292 else if (regno == -1 && have_dsp) |
| 293 { |
| 294 for (regi = mips_regnum (gdbarch)->dspacc; |
| 295 regi < mips_regnum (gdbarch)->dspacc + 6; |
| 296 regi++) |
| 297 super_fetch_registers (ops, regcache, regi); |
| 298 super_fetch_registers (ops, regcache, mips_regnum (gdbarch)->dspctl); |
| 299 } |
260 } | 300 } |
261 | 301 |
262 /* Store REGNO (or all registers if REGNO == -1) to the target | 302 /* Store REGNO (or all registers if REGNO == -1) to the target |
263 using PTRACE_SETREGS et al. */ | 303 using PTRACE_SETREGS et al. */ |
264 | 304 |
265 static void | 305 static void |
266 mips64_linux_regsets_store_registers (const struct regcache *regcache, | 306 mips64_linux_regsets_store_registers (struct target_ops *ops, |
267 » » » » int regno) | 307 » » » » struct regcache *regcache, int regno) |
268 { | 308 { |
269 struct gdbarch *gdbarch = get_regcache_arch (regcache); | 309 struct gdbarch *gdbarch = get_regcache_arch (regcache); |
270 int is_fp; | 310 int is_fp, is_dsp; |
| 311 int have_dsp; |
| 312 int regi; |
271 int tid; | 313 int tid; |
272 | 314 |
273 if (regno >= mips_regnum (gdbarch)->fp0 | 315 if (regno >= mips_regnum (gdbarch)->fp0 |
274 && regno <= mips_regnum (gdbarch)->fp0 + 32) | 316 && regno <= mips_regnum (gdbarch)->fp0 + 32) |
275 is_fp = 1; | 317 is_fp = 1; |
276 else if (regno == mips_regnum (gdbarch)->fp_control_status) | 318 else if (regno == mips_regnum (gdbarch)->fp_control_status) |
277 is_fp = 1; | 319 is_fp = 1; |
278 else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) | 320 else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) |
279 is_fp = 1; | 321 is_fp = 1; |
280 else | 322 else |
281 is_fp = 0; | 323 is_fp = 0; |
282 | 324 |
| 325 /* DSP registers are optional and not a part of any set. */ |
| 326 have_dsp = mips_regnum (gdbarch)->dspctl != -1; |
| 327 if (!have_dsp) |
| 328 is_dsp = 0; |
| 329 if (regno >= mips_regnum (gdbarch)->dspacc |
| 330 && regno < mips_regnum (gdbarch)->dspacc + 6) |
| 331 is_dsp = 1; |
| 332 else if (regno == mips_regnum (gdbarch)->dspctl) |
| 333 is_dsp = 1; |
| 334 else |
| 335 is_dsp = 0; |
| 336 |
283 tid = ptid_get_lwp (inferior_ptid); | 337 tid = ptid_get_lwp (inferior_ptid); |
284 if (tid == 0) | 338 if (tid == 0) |
285 tid = ptid_get_pid (inferior_ptid); | 339 tid = ptid_get_pid (inferior_ptid); |
286 | 340 |
287 if (regno == -1 || !is_fp) | 341 if (regno == -1 || (!is_fp && !is_dsp)) |
288 { | 342 { |
289 mips64_elf_gregset_t regs; | 343 mips64_elf_gregset_t regs; |
290 | 344 |
291 if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1) | 345 if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1) |
292 perror_with_name (_("Couldn't get registers")); | 346 perror_with_name (_("Couldn't get registers")); |
293 | 347 |
294 mips64_fill_gregset (regcache, ®s, regno); | 348 mips64_fill_gregset (regcache, ®s, regno); |
295 | 349 |
296 if (ptrace (PTRACE_SETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1) | 350 if (ptrace (PTRACE_SETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1) |
297 perror_with_name (_("Couldn't set registers")); | 351 perror_with_name (_("Couldn't set registers")); |
298 } | 352 } |
299 | 353 |
300 if (regno == -1 || is_fp) | 354 if (regno == -1 || is_fp) |
301 { | 355 { |
302 mips64_elf_fpregset_t fp_regs; | 356 mips64_elf_fpregset_t fp_regs; |
303 | 357 |
304 if (ptrace (PTRACE_GETFPREGS, tid, 0L, | 358 if (ptrace (PTRACE_GETFPREGS, tid, 0L, |
305 (PTRACE_TYPE_ARG3) &fp_regs) == -1) | 359 (PTRACE_TYPE_ARG3) &fp_regs) == -1) |
306 perror_with_name (_("Couldn't get FP registers")); | 360 perror_with_name (_("Couldn't get FP registers")); |
307 | 361 |
308 mips64_fill_fpregset (regcache, &fp_regs, regno); | 362 mips64_fill_fpregset (regcache, &fp_regs, regno); |
309 | 363 |
310 if (ptrace (PTRACE_SETFPREGS, tid, 0L, | 364 if (ptrace (PTRACE_SETFPREGS, tid, 0L, |
311 (PTRACE_TYPE_ARG3) &fp_regs) == -1) | 365 (PTRACE_TYPE_ARG3) &fp_regs) == -1) |
312 perror_with_name (_("Couldn't set FP registers")); | 366 perror_with_name (_("Couldn't set FP registers")); |
313 } | 367 } |
| 368 |
| 369 if (is_dsp) |
| 370 super_store_registers (ops, regcache, regno); |
| 371 else if (regno == -1 && have_dsp) |
| 372 { |
| 373 for (regi = mips_regnum (gdbarch)->dspacc; |
| 374 regi < mips_regnum (gdbarch)->dspacc + 6; |
| 375 regi++) |
| 376 super_store_registers (ops, regcache, regi); |
| 377 super_store_registers (ops, regcache, mips_regnum (gdbarch)->dspctl); |
| 378 } |
314 } | 379 } |
315 | 380 |
316 /* Fetch REGNO (or all registers if REGNO == -1) from the target | 381 /* Fetch REGNO (or all registers if REGNO == -1) from the target |
317 using any working method. */ | 382 using any working method. */ |
318 | 383 |
319 static void | 384 static void |
320 mips64_linux_fetch_registers (struct target_ops *ops, | 385 mips64_linux_fetch_registers (struct target_ops *ops, |
321 struct regcache *regcache, int regnum) | 386 struct regcache *regcache, int regnum) |
322 { | 387 { |
323 /* Unless we already know that PTRACE_GETREGS does not work, try it. */ | 388 /* Unless we already know that PTRACE_GETREGS does not work, try it. */ |
324 if (have_ptrace_regsets) | 389 if (have_ptrace_regsets) |
325 mips64_linux_regsets_fetch_registers (regcache, regnum); | 390 mips64_linux_regsets_fetch_registers (ops, regcache, regnum); |
326 | 391 |
327 /* If we know, or just found out, that PTRACE_GETREGS does not work, fall | 392 /* If we know, or just found out, that PTRACE_GETREGS does not work, fall |
328 back to PTRACE_PEEKUSER. */ | 393 back to PTRACE_PEEKUSER. */ |
329 if (!have_ptrace_regsets) | 394 if (!have_ptrace_regsets) |
330 super_fetch_registers (ops, regcache, regnum); | 395 super_fetch_registers (ops, regcache, regnum); |
331 } | 396 } |
332 | 397 |
333 /* Store REGNO (or all registers if REGNO == -1) to the target | 398 /* Store REGNO (or all registers if REGNO == -1) to the target |
334 using any working method. */ | 399 using any working method. */ |
335 | 400 |
336 static void | 401 static void |
337 mips64_linux_store_registers (struct target_ops *ops, | 402 mips64_linux_store_registers (struct target_ops *ops, |
338 struct regcache *regcache, int regnum) | 403 struct regcache *regcache, int regnum) |
339 { | 404 { |
340 /* Unless we already know that PTRACE_GETREGS does not work, try it. */ | 405 /* Unless we already know that PTRACE_GETREGS does not work, try it. */ |
341 if (have_ptrace_regsets) | 406 if (have_ptrace_regsets) |
342 mips64_linux_regsets_store_registers (regcache, regnum); | 407 mips64_linux_regsets_store_registers (ops, regcache, regnum); |
343 | 408 |
344 /* If we know, or just found out, that PTRACE_GETREGS does not work, fall | 409 /* If we know, or just found out, that PTRACE_GETREGS does not work, fall |
345 back to PTRACE_PEEKUSER. */ | 410 back to PTRACE_PEEKUSER. */ |
346 if (!have_ptrace_regsets) | 411 if (!have_ptrace_regsets) |
347 super_store_registers (ops, regcache, regnum); | 412 super_store_registers (ops, regcache, regnum); |
348 } | 413 } |
349 | 414 |
350 /* Return the address in the core dump or inferior of register | 415 /* Return the address in the core dump or inferior of register |
351 REGNO. */ | 416 REGNO. */ |
352 | 417 |
353 static CORE_ADDR | 418 static CORE_ADDR |
354 mips_linux_register_u_offset (struct gdbarch *gdbarch, int regno, int store_p) | 419 mips_linux_register_u_offset (struct gdbarch *gdbarch, int regno, int store_p) |
355 { | 420 { |
356 if (mips_abi_regsize (gdbarch) == 8) | 421 if (mips_abi_regsize (gdbarch) == 8) |
357 return mips64_linux_register_addr (gdbarch, regno, store_p); | 422 return mips64_linux_register_addr (gdbarch, regno, store_p); |
358 else | 423 else |
359 return mips_linux_register_addr (gdbarch, regno, store_p); | 424 return mips_linux_register_addr (gdbarch, regno, store_p); |
360 } | 425 } |
361 | 426 |
362 static const struct target_desc * | 427 static const struct target_desc * |
363 mips_linux_read_description (struct target_ops *ops) | 428 mips_linux_read_description (struct target_ops *ops) |
364 { | 429 { |
| 430 static int have_dsp = -1; |
| 431 |
| 432 if (have_dsp < 0) |
| 433 { |
| 434 int tid; |
| 435 |
| 436 tid = ptid_get_lwp (inferior_ptid); |
| 437 if (tid == 0) |
| 438 tid = ptid_get_pid (inferior_ptid); |
| 439 |
| 440 ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0); |
| 441 switch (errno) |
| 442 { |
| 443 case 0: |
| 444 have_dsp = 1; |
| 445 break; |
| 446 case EIO: |
| 447 have_dsp = 0; |
| 448 break; |
| 449 default: |
| 450 perror_with_name (_("Couldn't check DSP support")); |
| 451 break; |
| 452 } |
| 453 } |
| 454 |
365 /* Report that target registers are a size we know for sure | 455 /* Report that target registers are a size we know for sure |
366 that we can get from ptrace. */ | 456 that we can get from ptrace. */ |
367 if (_MIPS_SIM == _ABIO32) | 457 if (_MIPS_SIM == _ABIO32) |
368 return tdesc_mips_linux; | 458 return have_dsp ? tdesc_mips_dsp_linux : tdesc_mips_linux; |
369 else | 459 else |
370 return tdesc_mips64_linux; | 460 return have_dsp ? tdesc_mips64_dsp_linux : tdesc_mips64_linux; |
371 } | 461 } |
372 | 462 |
373 #ifndef PTRACE_GET_WATCH_REGS | 463 #ifndef PTRACE_GET_WATCH_REGS |
374 # define PTRACE_GET_WATCH_REGS 0xd0 | 464 # define PTRACE_GET_WATCH_REGS 0xd0 |
375 #endif | 465 #endif |
376 | 466 |
377 #ifndef PTRACE_SET_WATCH_REGS | 467 #ifndef PTRACE_SET_WATCH_REGS |
378 # define PTRACE_SET_WATCH_REGS 0xd1 | 468 # define PTRACE_SET_WATCH_REGS 0xd1 |
379 #endif | 469 #endif |
380 | 470 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror) == -1) | 968 if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror) == -1) |
879 perror_with_name (_("Couldn't write debug register")); | 969 perror_with_name (_("Couldn't write debug register")); |
880 } | 970 } |
881 return 0; | 971 return 0; |
882 } | 972 } |
883 | 973 |
884 /* linux_nat new_thread implementation. Write the mirrored watch | 974 /* linux_nat new_thread implementation. Write the mirrored watch |
885 register values for the new thread. */ | 975 register values for the new thread. */ |
886 | 976 |
887 static void | 977 static void |
888 mips_linux_new_thread (ptid_t ptid) | 978 mips_linux_new_thread (struct lwp_info *lp) |
889 { | 979 { |
890 int tid; | 980 int tid; |
891 | 981 |
892 if (!mips_linux_read_watch_registers (0)) | 982 if (!mips_linux_read_watch_registers (0)) |
893 return; | 983 return; |
894 | 984 |
895 tid = ptid_get_lwp (ptid); | 985 tid = ptid_get_lwp (lp->ptid); |
896 if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror) == -1) | 986 if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror) == -1) |
897 perror_with_name (_("Couldn't write debug register")); | 987 perror_with_name (_("Couldn't write debug register")); |
898 } | 988 } |
899 | 989 |
900 /* Fill in the watch registers with the currently cached watches. */ | 990 /* Fill in the watch registers with the currently cached watches. */ |
901 | 991 |
902 static void | 992 static void |
903 populate_regs_from_watches (struct pt_watch_regs *regs) | 993 populate_regs_from_watches (struct pt_watch_regs *regs) |
904 { | 994 { |
905 struct mips_watchpoint *w; | 995 struct mips_watchpoint *w; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 t->to_stopped_data_address = mips_linux_stopped_data_address; | 1171 t->to_stopped_data_address = mips_linux_stopped_data_address; |
1082 t->to_region_ok_for_hw_watchpoint = mips_linux_region_ok_for_hw_watchpoint; | 1172 t->to_region_ok_for_hw_watchpoint = mips_linux_region_ok_for_hw_watchpoint; |
1083 | 1173 |
1084 t->to_read_description = mips_linux_read_description; | 1174 t->to_read_description = mips_linux_read_description; |
1085 | 1175 |
1086 linux_nat_add_target (t); | 1176 linux_nat_add_target (t); |
1087 linux_nat_set_new_thread (t, mips_linux_new_thread); | 1177 linux_nat_set_new_thread (t, mips_linux_new_thread); |
1088 | 1178 |
1089 /* Initialize the standard target descriptions. */ | 1179 /* Initialize the standard target descriptions. */ |
1090 initialize_tdesc_mips_linux (); | 1180 initialize_tdesc_mips_linux (); |
| 1181 initialize_tdesc_mips_dsp_linux (); |
1091 initialize_tdesc_mips64_linux (); | 1182 initialize_tdesc_mips64_linux (); |
| 1183 initialize_tdesc_mips64_dsp_linux (); |
1092 } | 1184 } |
OLD | NEW |