GDB (xrefs)
/tmp/gdb-8.1/gdb/mips-linux-nat.c
Go to the documentation of this file.
1 /* Native-dependent code for GNU/Linux on MIPS processors.
2 
3  Copyright (C) 2001-2018 Free Software Foundation, Inc.
4 
5  This file is part of GDB.
6 
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
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 
20 #include "defs.h"
21 #include "command.h"
22 #include "gdbcmd.h"
23 #include "inferior.h"
24 #include "mips-tdep.h"
25 #include "target.h"
26 #include "regcache.h"
27 #include "linux-nat.h"
28 #include "mips-linux-tdep.h"
29 #include "target-descriptions.h"
30 
31 #include "gdb_proc_service.h"
32 #include "gregset.h"
33 
34 #include <sgidefs.h>
35 #include "nat/gdb_ptrace.h"
36 #include <asm/ptrace.h>
37 #include "inf-ptrace.h"
38 
39 #include "nat/mips-linux-watch.h"
40 
41 #ifndef PTRACE_GET_THREAD_AREA
42 #define PTRACE_GET_THREAD_AREA 25
43 #endif
44 
45 /* Assume that we have PTRACE_GETREGS et al. support. If we do not,
46  we'll clear this and use PTRACE_PEEKUSER instead. */
47 static int have_ptrace_regsets = 1;
48 
49 /* Saved function pointers to fetch and store a single register using
50  PTRACE_PEEKUSER and PTRACE_POKEUSER. */
51 
52 static void (*super_fetch_registers) (struct target_ops *,
53  struct regcache *, int);
54 static void (*super_store_registers) (struct target_ops *,
55  struct regcache *, int);
56 
57 static void (*super_close) (struct target_ops *);
58 
59 /* Map gdb internal register number to ptrace ``address''.
60  These ``addresses'' are normally defined in <asm/ptrace.h>.
61 
62  ptrace does not provide a way to read (or set) MIPS_PS_REGNUM,
63  and there's no point in reading or setting MIPS_ZERO_REGNUM.
64  We also can not set BADVADDR, CAUSE, or FCRIR via ptrace(). */
65 
66 static CORE_ADDR
67 mips_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
68 {
69  CORE_ADDR regaddr;
70 
71  if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
72  error (_("Bogon register number %d."), regno);
73 
74  if (regno > MIPS_ZERO_REGNUM && regno < MIPS_ZERO_REGNUM + 32)
75  regaddr = regno;
76  else if ((regno >= mips_regnum (gdbarch)->fp0)
77  && (regno < mips_regnum (gdbarch)->fp0 + 32))
78  regaddr = FPR_BASE + (regno - mips_regnum (gdbarch)->fp0);
79  else if (regno == mips_regnum (gdbarch)->pc)
80  regaddr = PC;
81  else if (regno == mips_regnum (gdbarch)->cause)
82  regaddr = store? (CORE_ADDR) -1 : CAUSE;
83  else if (regno == mips_regnum (gdbarch)->badvaddr)
84  regaddr = store? (CORE_ADDR) -1 : BADVADDR;
85  else if (regno == mips_regnum (gdbarch)->lo)
86  regaddr = MMLO;
87  else if (regno == mips_regnum (gdbarch)->hi)
88  regaddr = MMHI;
89  else if (regno == mips_regnum (gdbarch)->fp_control_status)
90  regaddr = FPC_CSR;
91  else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
92  regaddr = store? (CORE_ADDR) -1 : FPC_EIR;
93  else if (mips_regnum (gdbarch)->dspacc != -1
94  && regno >= mips_regnum (gdbarch)->dspacc
95  && regno < mips_regnum (gdbarch)->dspacc + 6)
96  regaddr = DSP_BASE + (regno - mips_regnum (gdbarch)->dspacc);
97  else if (regno == mips_regnum (gdbarch)->dspctl)
98  regaddr = DSP_CONTROL;
100  regaddr = 0;
101  else
102  regaddr = (CORE_ADDR) -1;
103 
104  return regaddr;
105 }
106 
107 static CORE_ADDR
108 mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
109 {
110  CORE_ADDR regaddr;
111 
112  if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
113  error (_("Bogon register number %d."), regno);
114 
115  if (regno > MIPS_ZERO_REGNUM && regno < MIPS_ZERO_REGNUM + 32)
116  regaddr = regno;
117  else if ((regno >= mips_regnum (gdbarch)->fp0)
118  && (regno < mips_regnum (gdbarch)->fp0 + 32))
119  regaddr = MIPS64_FPR_BASE + (regno - gdbarch_fp0_regnum (gdbarch));
120  else if (regno == mips_regnum (gdbarch)->pc)
121  regaddr = MIPS64_PC;
122  else if (regno == mips_regnum (gdbarch)->cause)
123  regaddr = store? (CORE_ADDR) -1 : MIPS64_CAUSE;
124  else if (regno == mips_regnum (gdbarch)->badvaddr)
125  regaddr = store? (CORE_ADDR) -1 : MIPS64_BADVADDR;
126  else if (regno == mips_regnum (gdbarch)->lo)
127  regaddr = MIPS64_MMLO;
128  else if (regno == mips_regnum (gdbarch)->hi)
129  regaddr = MIPS64_MMHI;
130  else if (regno == mips_regnum (gdbarch)->fp_control_status)
131  regaddr = MIPS64_FPC_CSR;
132  else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
133  regaddr = store? (CORE_ADDR) -1 : MIPS64_FPC_EIR;
134  else if (mips_regnum (gdbarch)->dspacc != -1
135  && regno >= mips_regnum (gdbarch)->dspacc
136  && regno < mips_regnum (gdbarch)->dspacc + 6)
137  regaddr = DSP_BASE + (regno - mips_regnum (gdbarch)->dspacc);
138  else if (regno == mips_regnum (gdbarch)->dspctl)
139  regaddr = DSP_CONTROL;
141  regaddr = 0;
142  else
143  regaddr = (CORE_ADDR) -1;
144 
145  return regaddr;
146 }
147 
148 /* Fetch the thread-local storage pointer for libthread_db. */
149 
150 ps_err_e
152  lwpid_t lwpid, int idx, void **base)
153 {
154  if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
155  return PS_ERR;
156 
157  /* IDX is the bias from the thread pointer to the beginning of the
158  thread descriptor. It has to be subtracted due to implementation
159  quirks in libthread_db. */
160  *base = (void *) ((char *)*base - idx);
161 
162  return PS_OK;
163 }
164 
165 /* Wrapper functions. These are only used by libthread_db. */
166 
167 void
168 supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
169 {
170  if (mips_isa_regsize (regcache->arch ()) == 4)
171  mips_supply_gregset (regcache, (const mips_elf_gregset_t *) gregsetp);
172  else
174 }
175 
176 void
178  gdb_gregset_t *gregsetp, int regno)
179 {
180  if (mips_isa_regsize (regcache->arch ()) == 4)
181  mips_fill_gregset (regcache, (mips_elf_gregset_t *) gregsetp, regno);
182  else
183  mips64_fill_gregset (regcache, (mips64_elf_gregset_t *) gregsetp, regno);
184 }
185 
186 void
187 supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
188 {
189  if (mips_isa_regsize (regcache->arch ()) == 4)
190  mips_supply_fpregset (regcache, (const mips_elf_fpregset_t *) fpregsetp);
191  else
193  (const mips64_elf_fpregset_t *) fpregsetp);
194 }
195 
196 void
198  gdb_fpregset_t *fpregsetp, int regno)
199 {
200  if (mips_isa_regsize (regcache->arch ()) == 4)
201  mips_fill_fpregset (regcache, (mips_elf_fpregset_t *) fpregsetp, regno);
202  else
204  (mips64_elf_fpregset_t *) fpregsetp, regno);
205 }
206 
207 
208 /* Fetch REGNO (or all registers if REGNO == -1) from the target
209  using PTRACE_GETREGS et al. */
210 
211 static void
213  struct regcache *regcache, int regno)
214 {
215  struct gdbarch *gdbarch = regcache->arch ();
216  int is_fp, is_dsp;
217  int have_dsp;
218  int regi;
219  int tid;
220 
221  if (regno >= mips_regnum (gdbarch)->fp0
222  && regno <= mips_regnum (gdbarch)->fp0 + 32)
223  is_fp = 1;
224  else if (regno == mips_regnum (gdbarch)->fp_control_status)
225  is_fp = 1;
226  else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
227  is_fp = 1;
228  else
229  is_fp = 0;
230 
231  /* DSP registers are optional and not a part of any set. */
232  have_dsp = mips_regnum (gdbarch)->dspctl != -1;
233  if (!have_dsp)
234  is_dsp = 0;
235  else if (regno >= mips_regnum (gdbarch)->dspacc
236  && regno < mips_regnum (gdbarch)->dspacc + 6)
237  is_dsp = 1;
238  else if (regno == mips_regnum (gdbarch)->dspctl)
239  is_dsp = 1;
240  else
241  is_dsp = 0;
242 
244 
245  if (regno == -1 || (!is_fp && !is_dsp))
246  {
248 
249  if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) &regs) == -1)
250  {
251  if (errno == EIO)
252  {
254  return;
255  }
256  perror_with_name (_("Couldn't get registers"));
257  }
258 
260  (const mips64_elf_gregset_t *) &regs);
261  }
262 
263  if (regno == -1 || is_fp)
264  {
265  mips64_elf_fpregset_t fp_regs;
266 
267  if (ptrace (PTRACE_GETFPREGS, tid, 0L,
268  (PTRACE_TYPE_ARG3) &fp_regs) == -1)
269  {
270  if (errno == EIO)
271  {
273  return;
274  }
275  perror_with_name (_("Couldn't get FP registers"));
276  }
277 
279  (const mips64_elf_fpregset_t *) &fp_regs);
280  }
281 
282  if (is_dsp)
283  super_fetch_registers (ops, regcache, regno);
284  else if (regno == -1 && have_dsp)
285  {
286  for (regi = mips_regnum (gdbarch)->dspacc;
287  regi < mips_regnum (gdbarch)->dspacc + 6;
288  regi++)
289  super_fetch_registers (ops, regcache, regi);
291  }
292 }
293 
294 /* Store REGNO (or all registers if REGNO == -1) to the target
295  using PTRACE_SETREGS et al. */
296 
297 static void
299  struct regcache *regcache, int regno)
300 {
301  struct gdbarch *gdbarch = regcache->arch ();
302  int is_fp, is_dsp;
303  int have_dsp;
304  int regi;
305  int tid;
306 
307  if (regno >= mips_regnum (gdbarch)->fp0
308  && regno <= mips_regnum (gdbarch)->fp0 + 32)
309  is_fp = 1;
310  else if (regno == mips_regnum (gdbarch)->fp_control_status)
311  is_fp = 1;
312  else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
313  is_fp = 1;
314  else
315  is_fp = 0;
316 
317  /* DSP registers are optional and not a part of any set. */
318  have_dsp = mips_regnum (gdbarch)->dspctl != -1;
319  if (!have_dsp)
320  is_dsp = 0;
321  else if (regno >= mips_regnum (gdbarch)->dspacc
322  && regno < mips_regnum (gdbarch)->dspacc + 6)
323  is_dsp = 1;
324  else if (regno == mips_regnum (gdbarch)->dspctl)
325  is_dsp = 1;
326  else
327  is_dsp = 0;
328 
330 
331  if (regno == -1 || (!is_fp && !is_dsp))
332  {
334 
335  if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) &regs) == -1)
336  perror_with_name (_("Couldn't get registers"));
337 
338  mips64_fill_gregset (regcache, &regs, regno);
339 
340  if (ptrace (PTRACE_SETREGS, tid, 0L, (PTRACE_TYPE_ARG3) &regs) == -1)
341  perror_with_name (_("Couldn't set registers"));
342  }
343 
344  if (regno == -1 || is_fp)
345  {
346  mips64_elf_fpregset_t fp_regs;
347 
348  if (ptrace (PTRACE_GETFPREGS, tid, 0L,
349  (PTRACE_TYPE_ARG3) &fp_regs) == -1)
350  perror_with_name (_("Couldn't get FP registers"));
351 
352  mips64_fill_fpregset (regcache, &fp_regs, regno);
353 
354  if (ptrace (PTRACE_SETFPREGS, tid, 0L,
355  (PTRACE_TYPE_ARG3) &fp_regs) == -1)
356  perror_with_name (_("Couldn't set FP registers"));
357  }
358 
359  if (is_dsp)
360  super_store_registers (ops, regcache, regno);
361  else if (regno == -1 && have_dsp)
362  {
363  for (regi = mips_regnum (gdbarch)->dspacc;
364  regi < mips_regnum (gdbarch)->dspacc + 6;
365  regi++)
366  super_store_registers (ops, regcache, regi);
368  }
369 }
370 
371 /* Fetch REGNO (or all registers if REGNO == -1) from the target
372  using any working method. */
373 
374 static void
376  struct regcache *regcache, int regnum)
377 {
378  /* Unless we already know that PTRACE_GETREGS does not work, try it. */
381 
382  /* If we know, or just found out, that PTRACE_GETREGS does not work, fall
383  back to PTRACE_PEEKUSER. */
384  if (!have_ptrace_regsets)
386 }
387 
388 /* Store REGNO (or all registers if REGNO == -1) to the target
389  using any working method. */
390 
391 static void
393  struct regcache *regcache, int regnum)
394 {
395  /* Unless we already know that PTRACE_GETREGS does not work, try it. */
398 
399  /* If we know, or just found out, that PTRACE_GETREGS does not work, fall
400  back to PTRACE_PEEKUSER. */
401  if (!have_ptrace_regsets)
403 }
404 
405 /* Return the address in the core dump or inferior of register
406  REGNO. */
407 
408 static CORE_ADDR
409 mips_linux_register_u_offset (struct gdbarch *gdbarch, int regno, int store_p)
410 {
411  if (mips_abi_regsize (gdbarch) == 8)
412  return mips64_linux_register_addr (gdbarch, regno, store_p);
413  else
414  return mips_linux_register_addr (gdbarch, regno, store_p);
415 }
416 
417 static const struct target_desc *
419 {
420  static int have_dsp = -1;
421 
422  if (have_dsp < 0)
423  {
424  int tid;
425 
427  if (tid == 0)
429 
430  errno = 0;
431  ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0);
432  switch (errno)
433  {
434  case 0:
435  have_dsp = 1;
436  break;
437  case EIO:
438  have_dsp = 0;
439  break;
440  default:
441  perror_with_name (_("Couldn't check DSP support"));
442  break;
443  }
444  }
445 
446  /* Report that target registers are a size we know for sure
447  that we can get from ptrace. */
448  if (_MIPS_SIM == _ABIO32)
449  return have_dsp ? tdesc_mips_dsp_linux : tdesc_mips_linux;
450  else
451  return have_dsp ? tdesc_mips64_dsp_linux : tdesc_mips64_linux;
452 }
453 
454 /* -1 if the kernel and/or CPU do not support watch registers.
455  1 if watch_readback is valid and we can read style, num_valid
456  and the masks.
457  0 if we need to read the watch_readback. */
458 
460 
461 /* Cached watch register read values. */
462 
464 
466 
467 /* The current set of watch register values for writing the
468  registers. */
469 
471 
472 static void
473 mips_show_dr (const char *func, CORE_ADDR addr,
474  int len, enum target_hw_bp_type type)
475 {
476  int i;
477 
479  if (addr || len)
480  printf_unfiltered (" (addr=%s, len=%d, type=%s)",
481  paddress (target_gdbarch (), addr), len,
482  type == hw_write ? "data-write"
483  : (type == hw_read ? "data-read"
484  : (type == hw_access ? "data-read/write"
485  : (type == hw_execute ? "instruction-execute"
486  : "??unknown??"))));
487  puts_unfiltered (":\n");
488 
489  for (i = 0; i < MAX_DEBUG_REGISTER; i++)
490  printf_unfiltered ("\tDR%d: lo=%s, hi=%s\n", i,
493  i)),
496  i)));
497 }
498 
499 /* Target to_can_use_hw_breakpoint implementation. Return 1 if we can
500  handle the specified watch type. */
501 
502 static int
504  enum bptype type,
505  int cnt, int ot)
506 {
507  int i;
508  uint32_t wanted_mask, irw_mask;
509 
513  return 0;
514 
515  switch (type)
516  {
518  wanted_mask = W_MASK;
519  break;
520  case bp_read_watchpoint:
521  wanted_mask = R_MASK;
522  break;
524  wanted_mask = R_MASK | W_MASK;
525  break;
526  default:
527  return 0;
528  }
529 
530  for (i = 0;
532  i++)
533  {
535  if ((irw_mask & wanted_mask) == wanted_mask)
536  cnt--;
537  }
538  return (cnt == 0) ? 1 : 0;
539 }
540 
541 /* Target to_stopped_by_watchpoint implementation. Return 1 if
542  stopped by watchpoint. The watchhi R and W bits indicate the watch
543  register triggered. */
544 
545 static int
547 {
548  int n;
549  int num_valid;
550 
554  return 0;
555 
557 
558  for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
560  return 1;
561 
562  return 0;
563 }
564 
565 /* Target to_stopped_data_address implementation. Set the address
566  where the watch triggered (if known). Return 1 if the address was
567  known. */
568 
569 static int
571 {
572  /* On mips we don't know the low order 3 bits of the data address,
573  so we must return false. */
574  return 0;
575 }
576 
577 /* Target to_region_ok_for_hw_watchpoint implementation. Return 1 if
578  the specified region can be covered by the watch registers. */
579 
580 static int
582  CORE_ADDR addr, int len)
583 {
584  struct pt_watch_regs dummy_regs;
585  int i;
586 
590  return 0;
591 
592  dummy_regs = watch_readback;
593  /* Clear them out. */
594  for (i = 0; i < mips_linux_watch_get_num_valid (&dummy_regs); i++)
595  mips_linux_watch_set_watchlo (&dummy_regs, i, 0);
596  return mips_linux_watch_try_one_watch (&dummy_regs, addr, len, 0);
597 }
598 
599 /* Write the mirrored watch register values for each thread. */
600 
601 static int
603 {
604  struct lwp_info *lp;
605  int tid;
606 
607  ALL_LWPS (lp)
608  {
609  tid = ptid_get_lwp (lp->ptid);
610  if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
611  perror_with_name (_("Couldn't write debug register"));
612  }
613  return 0;
614 }
615 
616 /* linux_nat new_thread implementation. Write the mirrored watch
617  register values for the new thread. */
618 
619 static void
621 {
622  long tid = lp->ptid.lwp ();
623 
627  return;
628 
629  if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
630  perror_with_name (_("Couldn't write debug register"));
631 }
632 
633 /* Target to_insert_watchpoint implementation. Try to insert a new
634  watch. Return zero on success. */
635 
636 static int
638  CORE_ADDR addr, int len,
639  enum target_hw_bp_type type,
640  struct expression *cond)
641 {
642  struct pt_watch_regs regs;
643  struct mips_watchpoint *new_watch;
644  struct mips_watchpoint **pw;
645 
646  int i;
647  int retval;
648 
652  return -1;
653 
654  if (len <= 0)
655  return -1;
656 
657  regs = watch_readback;
658  /* Add the current watches. */
660 
661  /* Now try to add the new watch. */
664  return -1;
665 
666  /* It fit. Stick it on the end of the list. */
667  new_watch = XNEW (struct mips_watchpoint);
668  new_watch->addr = addr;
669  new_watch->len = len;
670  new_watch->type = type;
671  new_watch->next = NULL;
672 
673  pw = &current_watches;
674  while (*pw != NULL)
675  pw = &(*pw)->next;
676  *pw = new_watch;
677 
678  watch_mirror = regs;
679  retval = write_watchpoint_regs ();
680 
681  if (show_debug_regs)
682  mips_show_dr ("insert_watchpoint", addr, len, type);
683 
684  return retval;
685 }
686 
687 /* Target to_remove_watchpoint implementation. Try to remove a watch.
688  Return zero on success. */
689 
690 static int
692  CORE_ADDR addr, int len,
693  enum target_hw_bp_type type,
694  struct expression *cond)
695 {
696  int retval;
697  int deleted_one;
698 
699  struct mips_watchpoint **pw;
700  struct mips_watchpoint *w;
701 
702  /* Search for a known watch that matches. Then unlink and free
703  it. */
704  deleted_one = 0;
705  pw = &current_watches;
706  while ((w = *pw))
707  {
708  if (w->addr == addr && w->len == len && w->type == type)
709  {
710  *pw = w->next;
711  xfree (w);
712  deleted_one = 1;
713  break;
714  }
715  pw = &(w->next);
716  }
717 
718  if (!deleted_one)
719  return -1; /* We don't know about it, fail doing nothing. */
720 
721  /* At this point watch_readback is known to be valid because we
722  could not have added the watch without reading it. */
724 
727 
728  retval = write_watchpoint_regs ();
729 
730  if (show_debug_regs)
731  mips_show_dr ("remove_watchpoint", addr, len, type);
732 
733  return retval;
734 }
735 
736 /* Target to_close implementation. Free any watches and call the
737  super implementation. */
738 
739 static void
741 {
742  struct mips_watchpoint *w;
743  struct mips_watchpoint *nw;
744 
745  /* Clean out the current_watches list. */
746  w = current_watches;
747  while (w)
748  {
749  nw = w->next;
750  xfree (w);
751  w = nw;
752  }
753  current_watches = NULL;
754 
755  if (super_close)
756  super_close (self);
757 }
758 
759 void
761 {
762  struct target_ops *t;
763 
764  add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
765  &show_debug_regs, _("\
766 Set whether to show variables that mirror the mips debug registers."), _("\
767 Show whether to show variables that mirror the mips debug registers."), _("\
768 Use \"on\" to enable, \"off\" to disable.\n\
769 If enabled, the debug registers values are shown when GDB inserts\n\
770 or removes a hardware breakpoint or watchpoint, and when the inferior\n\
771 triggers a breakpoint or watchpoint."),
772  NULL,
773  NULL,
776 
778 
779  super_close = t->to_close;
781 
784 
787 
794 
796 
799 }
unsigned int lwpid_t
struct gdbarch * target_gdbarch(void)
Definition: gdbarch.c:5467
constexpr long lwp() const
Definition: ptid.h:63
static constexpr ptid_t tid
#define PC
const struct target_desc *(* to_read_description)(struct target_ops *ops) TARGET_DEFAULT_RETURN(NULL)
Definition: target.h:790
static void mips64_linux_regsets_fetch_registers(struct target_ops *ops, struct regcache *regcache, int regno)
bfd_vma CORE_ADDR
Definition: common-types.h:41
void _initialize_mips_linux_nat(void)
#define MMLO
int ptid_get_pid(const ptid_t &ptid)
Definition: ptid.c:47
void xfree(void *)
#define W_MASK
enum target_hw_bp_type type
#define BADVADDR
#define ALL_LWPS(LP)
Definition: linux-nat.h:119
#define MIPS64_FPC_CSR
void(* func)(char *)
void linux_nat_set_new_thread(struct target_ops *t, void(*new_thread)(struct lwp_info *))
Definition: linux-nat.c:4873
struct mips_watchpoint * next
struct target_desc * tdesc_mips_linux
Definition: mips-linux.c:8
static int mips_linux_stopped_by_watchpoint(struct target_ops *ops)
CORE_ADDR mips_linux_watch_get_watchlo(struct pt_watch_regs *regs, int n)
ptid_t ptid
Definition: linux-nat.h:34
static CORE_ADDR mips64_linux_register_addr(struct gdbarch *gdbarch, int regno, int store)
ptid_t regcache_get_ptid(const struct regcache *regcache)
Definition: regcache.c:229
int mips_isa_regsize(struct gdbarch *gdbarch)
Definition: mips-tdep.c:261
static void(* super_store_registers)(struct target_ops *, struct regcache *, int)
int mips_linux_watch_try_one_watch(struct pt_watch_regs *regs, CORE_ADDR addr, int len, uint32_t irw)
void(* to_close)(struct target_ops *)
Definition: target.h:431
static void mips_linux_close(struct target_ops *self)
#define MIPS64_CAUSE
void fill_gregset(const struct regcache *regcache, gdb_gregset_t *gregsetp, int regno)
ps_err_e
void mips64_fill_gregset(const struct regcache *regcache, mips64_elf_gregset_t *gregsetp, int regno)
#define DSP_CONTROL
int(* to_remove_watchpoint)(struct target_ops *, CORE_ADDR, int, enum target_hw_bp_type, struct expression *) TARGET_DEFAULT_RETURN(-1)
Definition: target.h:516
int(* to_region_ok_for_hw_watchpoint)(struct target_ops *, CORE_ADDR, int) TARGET_DEFAULT_FUNC(default_region_ok_for_hw_watchpoint)
Definition: target.h:543
int gdbarch_num_regs(struct gdbarch *gdbarch)
Definition: gdbarch.c:2039
#define PTRACE_SETFPREGS
int(* to_can_use_hw_breakpoint)(struct target_ops *, enum bptype, int, int) TARGET_DEFAULT_RETURN(0)
Definition: target.h:502
#define _(String)
Definition: gdb_locale.h:35
uint32_t mips_linux_watch_type_to_irw(enum target_hw_bp_type type)
static int mips_linux_can_use_hw_breakpoint(struct target_ops *self, enum bptype type, int cnt, int ot)
#define DSP_BASE
#define R_MASK
const struct mips_regnum * mips_regnum(struct gdbarch *gdbarch)
Definition: mips-tdep.c:218
static struct mips_watchpoint * current_watches
#define PTRACE_GET_THREAD_AREA
struct cmd_list_element * maintenance_set_cmdlist
Definition: maint.c:634
PTRACE_TYPE_RET ptrace()
struct target_desc * tdesc_mips64_dsp_linux
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
Definition: utils.c:2745
#define XNEW(T)
Definition: poison.h:109
unsigned int mips_abi_regsize(struct gdbarch *gdbarch)
Definition: mips-tdep.c:280
static const struct target_desc * mips_linux_read_description(struct target_ops *ops)
#define MIPS64_PC
static void mips64_linux_store_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
void mips_fill_gregset(const struct regcache *regcache, mips_elf_gregset_t *gregsetp, int regno)
static int mips_linux_stopped_data_address(struct target_ops *t, CORE_ADDR *paddr)
static int have_ptrace_regsets
#define PTRACE_GETFPREGS
mips64_elf_greg_t mips64_elf_gregset_t[MIPS64_ELF_NGREG]
#define MIPS64_BADVADDR
uint32_t mips_linux_watch_get_irw_mask(struct pt_watch_regs *regs, int n)
struct target_desc * tdesc_mips_dsp_linux
Definition: mips-dsp-linux.c:8
GDB_GREGSET_T gdb_gregset_t
Definition: gregset.h:34
#define MMHI
#define MIPS64_MMLO
int show_debug_regs
Definition: common-debug.c:25
GDB_FPREGSET_T gdb_fpregset_t
Definition: gregset.h:35
static CORE_ADDR mips_linux_register_u_offset(struct gdbarch *gdbarch, int regno, int store_p)
int badvaddr
Definition: mips-tdep.h:66
Definition: gdbtypes.h:749
int mips_linux_restart_reg_p(struct gdbarch *gdbarch)
static int watch_readback_valid
void supply_gregset(struct regcache *regcache, const gdb_gregset_t *gregsetp)
static const char * type
Definition: language.c:113
void mips64_supply_gregset(struct regcache *regcache, const mips64_elf_gregset_t *gregsetp)
void linux_nat_add_target(struct target_ops *t)
Definition: linux-nat.c:4804
int(* to_insert_watchpoint)(struct target_ops *, CORE_ADDR, int, enum target_hw_bp_type, struct expression *) TARGET_DEFAULT_RETURN(-1)
Definition: target.h:519
static void mips_linux_new_thread(struct lwp_info *lp)
static int mips_linux_region_ok_for_hw_watchpoint(struct target_ops *self, CORE_ADDR addr, int len)
#define MIPS64_FPC_EIR
int fp_implementation_revision
Definition: mips-tdep.h:64
int regnum
Definition: aarch64-tdep.c:77
void printf_unfiltered(const char *format,...)
Definition: utils.c:2056
uint32_t num_valid
#define FPC_CSR
int mips_linux_read_watch_registers(long lwpid, struct pt_watch_regs *watch_readback, int *watch_readback_valid, int force)
long ptid_get_lwp(const ptid_t &ptid)
Definition: ptid.c:55
void mips64_fill_fpregset(const struct regcache *regcache, mips64_elf_fpregset_t *fpregsetp, int regno)
ps_err_e ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
bptype
Definition: breakpoint.h:67
#define gdb_assert(expr)
Definition: gdb_assert.h:32
static void mips_show_dr(const char *func, CORE_ADDR addr, int len, enum target_hw_bp_type type)
static int write_watchpoint_regs(void)
static struct pt_watch_regs watch_mirror
static int mips_linux_insert_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond)
#define FPC_EIR
#define FPR_BASE
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
Definition: target.h:457
void puts_unfiltered(const char *string)
Definition: utils.c:2091
struct target_desc * tdesc_mips64_linux
Definition: mips64-linux.c:8
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
Definition: utils.c:692
void fill_fpregset(const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regno)
int gdbarch_fp0_regnum(struct gdbarch *gdbarch)
Definition: gdbarch.c:2197
static CORE_ADDR mips_linux_register_addr(struct gdbarch *gdbarch, int regno, int store)
uint32_t mips_linux_watch_get_watchhi(struct pt_watch_regs *regs, int n)
#define MAX_DEBUG_REGISTER
ptid_t inferior_ptid
Definition: infcmd.c:94
mips_elf_fpreg_t mips_elf_fpregset_t[ELF_NFPREG]
void mips_supply_fpregset(struct regcache *regcache, const mips_elf_fpregset_t *fpregsetp)
int dspctl
Definition: mips-tdep.h:71
static int mips_linux_remove_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
Definition: cli-decode.c:569
static void mips64_linux_regsets_store_registers(struct target_ops *ops, struct regcache *regcache, int regno)
#define PTRACE_SET_WATCH_REGS
gdbarch * arch() const
Definition: regcache.c:221
#define PTRACE_SETREGS
#define CAUSE
void mips_linux_watch_set_watchlo(struct pt_watch_regs *regs, int n, CORE_ADDR value)
int(* to_stopped_by_watchpoint)(struct target_ops *) TARGET_DEFAULT_RETURN(0)
Definition: target.h:531
void mips_supply_gregset(struct regcache *regcache, const mips_elf_gregset_t *gregsetp)
target_hw_bp_type
Definition: break-common.h:22
static void(* super_fetch_registers)(struct target_ops *, struct regcache *, int)
#define MIPS64_FPR_BASE
void mips_linux_watch_populate_regs(struct mips_watchpoint *current_watches, struct pt_watch_regs *regs)
void mips64_supply_fpregset(struct regcache *regcache, const mips64_elf_fpregset_t *fpregsetp)
#define MIPS64_MMHI
Definition: ia64-tdep.c:84
static void(* super_close)(struct target_ops *)
#define PTRACE_TYPE_ARG3
Definition: config.h:642
uint32_t mips_linux_watch_get_num_valid(struct pt_watch_regs *regs)
pid_t get_ptrace_pid(ptid_t ptid)
Definition: inf-ptrace.c:320
void mips_fill_fpregset(const struct regcache *regcache, mips_elf_fpregset_t *fpregsetp, int regno)
mips_elf_greg_t mips_elf_gregset_t[ELF_NGREG]
int(* to_stopped_data_address)(struct target_ops *, CORE_ADDR *) TARGET_DEFAULT_RETURN(0)
Definition: target.h:535
int fp_control_status
Definition: mips-tdep.h:65
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
Definition: target.h:459
mips64_elf_fpreg_t mips64_elf_fpregset_t[MIPS64_ELF_NFPREG]
struct cmd_list_element * maintenance_show_cmdlist
Definition: maint.c:635
int dspacc
Definition: mips-tdep.h:70
void error(const char *fmt,...)
Definition: errors.c:38
static struct pt_watch_regs watch_readback
void supply_fpregset(struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
static void mips64_linux_fetch_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
#define PTRACE_GETREGS
struct target_ops * linux_trad_target(CORE_ADDR(*register_u_offset)(struct gdbarch *, int, int))
Definition: linux-nat.c:4388