GDB (xrefs)
/tmp/gdb-8.1/gdb/aarch64-linux-nat.c
Go to the documentation of this file.
1 /* Native-dependent code for GNU/Linux AArch64.
2 
3  Copyright (C) 2011-2018 Free Software Foundation, Inc.
4  Contributed by ARM Ltd.
5 
6  This file is part of GDB.
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 
21 #include "defs.h"
22 
23 #include "inferior.h"
24 #include "gdbcore.h"
25 #include "regcache.h"
26 #include "linux-nat.h"
27 #include "target-descriptions.h"
28 #include "auxv.h"
29 #include "gdbcmd.h"
30 #include "aarch64-tdep.h"
31 #include "aarch64-linux-tdep.h"
32 #include "aarch32-linux-nat.h"
33 #include "nat/aarch64-linux.h"
35 
36 #include "elf/external.h"
37 #include "elf/common.h"
38 
39 #include "nat/gdb_ptrace.h"
40 #include <sys/utsname.h>
41 #include <asm/ptrace.h>
42 
43 #include "gregset.h"
44 
45 /* Defines ps_err_e, struct ps_prochandle. */
46 #include "gdb_proc_service.h"
47 
48 #ifndef TRAP_HWBKPT
49 #define TRAP_HWBKPT 0x0004
50 #endif
51 
52 /* Per-process data. We don't bind this to a per-inferior registry
53  because of targets like x86 GNU/Linux that need to keep track of
54  processes that aren't bound to any inferior (e.g., fork children,
55  checkpoints). */
56 
58 {
59  /* Linked list. */
61 
62  /* The process identifier. */
63  pid_t pid;
64 
65  /* Copy of aarch64 hardware debug registers. */
67 };
68 
70 
71 /* Find process data for process PID. */
72 
73 static struct aarch64_process_info *
75 {
76  struct aarch64_process_info *proc;
77 
79  if (proc->pid == pid)
80  return proc;
81 
82  return NULL;
83 }
84 
85 /* Add process data for process PID. Returns newly allocated info
86  object. */
87 
88 static struct aarch64_process_info *
90 {
91  struct aarch64_process_info *proc;
92 
93  proc = XCNEW (struct aarch64_process_info);
94  proc->pid = pid;
95 
98 
99  return proc;
100 }
101 
102 /* Get data specific info for process PID, creating it if necessary.
103  Never returns NULL. */
104 
105 static struct aarch64_process_info *
107 {
108  struct aarch64_process_info *proc;
109 
111  if (proc == NULL)
113 
114  return proc;
115 }
116 
117 /* Called whenever GDB is no longer debugging process PID. It deletes
118  data structures that keep track of debug register state. */
119 
120 static void
122 {
123  struct aarch64_process_info *proc, **proc_link;
124 
126  proc_link = &aarch64_process_list;
127 
128  while (proc != NULL)
129  {
130  if (proc->pid == pid)
131  {
132  *proc_link = proc->next;
133 
134  xfree (proc);
135  return;
136  }
137 
138  proc_link = &proc->next;
139  proc = *proc_link;
140  }
141 }
142 
143 /* Get debug registers state for process PID. */
144 
147 {
149 }
150 
151 /* Fill GDB's register array with the general-purpose register values
152  from the current thread. */
153 
154 static void
156 {
157  int ret, tid;
158  struct gdbarch *gdbarch = regcache->arch ();
159  elf_gregset_t regs;
160  struct iovec iovec;
161 
162  /* Make sure REGS can hold all registers contents on both aarch64
163  and arm. */
164  gdb_static_assert (sizeof (regs) >= 18 * 4);
165 
167 
168  iovec.iov_base = &regs;
169  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
170  iovec.iov_len = 18 * 4;
171  else
172  iovec.iov_len = sizeof (regs);
173 
174  ret = ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec);
175  if (ret < 0)
176  perror_with_name (_("Unable to fetch general registers."));
177 
178  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
179  aarch32_gp_regcache_supply (regcache, (uint32_t *) regs, 1);
180  else
181  {
182  int regno;
183 
184  for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_CPSR_REGNUM; regno++)
185  regcache_raw_supply (regcache, regno, &regs[regno - AARCH64_X0_REGNUM]);
186  }
187 }
188 
189 /* Store to the current thread the valid general-purpose register
190  values in the GDB's register array. */
191 
192 static void
194 {
195  int ret, tid;
196  elf_gregset_t regs;
197  struct iovec iovec;
198  struct gdbarch *gdbarch = regcache->arch ();
199 
200  /* Make sure REGS can hold all registers contents on both aarch64
201  and arm. */
202  gdb_static_assert (sizeof (regs) >= 18 * 4);
204 
205  iovec.iov_base = &regs;
206  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
207  iovec.iov_len = 18 * 4;
208  else
209  iovec.iov_len = sizeof (regs);
210 
211  ret = ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec);
212  if (ret < 0)
213  perror_with_name (_("Unable to fetch general registers."));
214 
215  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
216  aarch32_gp_regcache_collect (regcache, (uint32_t *) regs, 1);
217  else
218  {
219  int regno;
220 
221  for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_CPSR_REGNUM; regno++)
224  &regs[regno - AARCH64_X0_REGNUM]);
225  }
226 
227  ret = ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, &iovec);
228  if (ret < 0)
229  perror_with_name (_("Unable to store general registers."));
230 }
231 
232 /* Fill GDB's register array with the fp/simd register values
233  from the current thread. */
234 
235 static void
237 {
238  int ret, tid;
239  elf_fpregset_t regs;
240  struct iovec iovec;
241  struct gdbarch *gdbarch = regcache->arch ();
242 
243  /* Make sure REGS can hold all VFP registers contents on both aarch64
244  and arm. */
245  gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
246 
248 
249  iovec.iov_base = &regs;
250 
251  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
252  {
253  iovec.iov_len = VFP_REGS_SIZE;
254 
255  ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
256  if (ret < 0)
257  perror_with_name (_("Unable to fetch VFP registers."));
258 
260  }
261  else
262  {
263  int regno;
264 
265  iovec.iov_len = sizeof (regs);
266 
267  ret = ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec);
268  if (ret < 0)
269  perror_with_name (_("Unable to fetch vFP/SIMD registers."));
270 
271  for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
273  &regs.vregs[regno - AARCH64_V0_REGNUM]);
274 
277  }
278 }
279 
280 /* Store to the current thread the valid fp/simd register
281  values in the GDB's register array. */
282 
283 static void
285 {
286  int ret, tid;
287  elf_fpregset_t regs;
288  struct iovec iovec;
289  struct gdbarch *gdbarch = regcache->arch ();
290 
291  /* Make sure REGS can hold all VFP registers contents on both aarch64
292  and arm. */
293  gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
295 
296  iovec.iov_base = &regs;
297 
298  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
299  {
300  iovec.iov_len = VFP_REGS_SIZE;
301 
302  ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
303  if (ret < 0)
304  perror_with_name (_("Unable to fetch VFP registers."));
305 
307  }
308  else
309  {
310  int regno;
311 
312  iovec.iov_len = sizeof (regs);
313 
314  ret = ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec);
315  if (ret < 0)
316  perror_with_name (_("Unable to fetch FP/SIMD registers."));
317 
318  for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
321  (char *) &regs.vregs[regno - AARCH64_V0_REGNUM]);
322 
325  (char *) &regs.fpsr);
328  (char *) &regs.fpcr);
329  }
330 
331  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
332  {
333  ret = ptrace (PTRACE_SETREGSET, tid, NT_ARM_VFP, &iovec);
334  if (ret < 0)
335  perror_with_name (_("Unable to store VFP registers."));
336  }
337  else
338  {
339  ret = ptrace (PTRACE_SETREGSET, tid, NT_FPREGSET, &iovec);
340  if (ret < 0)
341  perror_with_name (_("Unable to store FP/SIMD registers."));
342  }
343 }
344 
345 /* Implement the "to_fetch_register" target_ops method. */
346 
347 static void
349  struct regcache *regcache,
350  int regno)
351 {
352  if (regno == -1)
353  {
356  }
357  else if (regno < AARCH64_V0_REGNUM)
359  else
361 }
362 
363 /* Implement the "to_store_register" target_ops method. */
364 
365 static void
367  struct regcache *regcache,
368  int regno)
369 {
370  if (regno == -1)
371  {
374  }
375  else if (regno < AARCH64_V0_REGNUM)
377  else
379 }
380 
381 /* Fill register REGNO (if it is a general-purpose register) in
382  *GREGSETPS with the value in GDB's register array. If REGNO is -1,
383  do this for all registers. */
384 
385 void
387  gdb_gregset_t *gregsetp, int regno)
388 {
390  regno, (gdb_byte *) gregsetp,
392 }
393 
394 /* Fill GDB's register array with the general-purpose register values
395  in *GREGSETP. */
396 
397 void
398 supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
399 {
401  (const gdb_byte *) gregsetp,
403 }
404 
405 /* Fill register REGNO (if it is a floating-point register) in
406  *FPREGSETP with the value in GDB's register array. If REGNO is -1,
407  do this for all registers. */
408 
409 void
411  gdb_fpregset_t *fpregsetp, int regno)
412 {
414  regno, (gdb_byte *) fpregsetp,
416 }
417 
418 /* Fill GDB's register array with the floating-point register values
419  in *FPREGSETP. */
420 
421 void
422 supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
423 {
425  (const gdb_byte *) fpregsetp,
427 }
428 
429 /* linux_nat_new_fork hook. */
430 
431 static void
432 aarch64_linux_new_fork (struct lwp_info *parent, pid_t child_pid)
433 {
434  pid_t parent_pid;
435  struct aarch64_debug_reg_state *parent_state;
436  struct aarch64_debug_reg_state *child_state;
437 
438  /* NULL means no watchpoint has ever been set in the parent. In
439  that case, there's nothing to do. */
440  if (parent->arch_private == NULL)
441  return;
442 
443  /* GDB core assumes the child inherits the watchpoints/hw
444  breakpoints of the parent, and will remove them all from the
445  forked off process. Copy the debug registers mirrors into the
446  new process so that all breakpoints and watchpoints can be
447  removed together. */
448 
449  parent_pid = ptid_get_pid (parent->ptid);
450  parent_state = aarch64_get_debug_reg_state (parent_pid);
451  child_state = aarch64_get_debug_reg_state (child_pid);
452  *child_state = *parent_state;
453 }
454 
455 
456 /* Called by libthread_db. Returns a pointer to the thread local
457  storage (or its descriptor). */
458 
459 ps_err_e
461  lwpid_t lwpid, int idx, void **base)
462 {
463  int is_64bit_p
464  = (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 64);
465 
466  return aarch64_ps_get_thread_area (ph, lwpid, idx, base, is_64bit_p);
467 }
468 
469 
470 static void (*super_post_startup_inferior) (struct target_ops *self,
471  ptid_t ptid);
472 
473 /* Implement the "to_post_startup_inferior" target_ops method. */
474 
475 static void
477  ptid_t ptid)
478 {
481  super_post_startup_inferior (self, ptid);
482 }
483 
484 extern struct target_desc *tdesc_arm_with_neon;
485 
486 /* Implement the "to_read_description" target_ops method. */
487 
488 static const struct target_desc *
490 {
491  int ret, tid;
492  gdb_byte regbuf[VFP_REGS_SIZE];
493  struct iovec iovec;
494 
496 
497  iovec.iov_base = regbuf;
498  iovec.iov_len = VFP_REGS_SIZE;
499 
500  ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
501  if (ret == 0)
502  return tdesc_arm_with_neon;
503  else
504  return aarch64_read_description ();
505 }
506 
507 /* Convert a native/host siginfo object, into/from the siginfo in the
508  layout of the inferiors' architecture. Returns true if any
509  conversion was done; false otherwise. If DIRECTION is 1, then copy
510  from INF to NATIVE. If DIRECTION is 0, copy from NATIVE to
511  INF. */
512 
513 static int
514 aarch64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
515 {
517 
518  /* Is the inferior 32-bit? If so, then do fixup the siginfo
519  object. */
520  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
521  {
522  if (direction == 0)
524  native);
525  else
527  (struct compat_siginfo *) inf);
528 
529  return 1;
530  }
531 
532  return 0;
533 }
534 
535 /* Returns the number of hardware watchpoints of type TYPE that we can
536  set. Value is positive if we can set CNT watchpoints, zero if
537  setting watchpoints of type TYPE is not supported, and negative if
538  CNT is more than the maximum number of watchpoints of type TYPE
539  that we can support. TYPE is one of bp_hardware_watchpoint,
540  bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
541  CNT is the number of such watchpoints used so far (including this
542  one). OTHERTYPE is non-zero if other types of watchpoints are
543  currently enabled. */
544 
545 static int
547  enum bptype type,
548  int cnt, int othertype)
549 {
552  {
553  if (aarch64_num_wp_regs == 0)
554  return 0;
555  }
556  else if (type == bp_hardware_breakpoint)
557  {
558  if (aarch64_num_bp_regs == 0)
559  return 0;
560  }
561  else
562  gdb_assert_not_reached ("unexpected breakpoint type");
563 
564  /* We always return 1 here because we don't have enough information
565  about possible overlap of addresses that they want to watch. As an
566  extreme example, consider the case where all the watchpoints watch
567  the same address and the same region length: then we can handle a
568  virtually unlimited number of watchpoints, due to debug register
569  sharing implemented via reference counts. */
570  return 1;
571 }
572 
573 /* Insert a hardware-assisted breakpoint at BP_TGT->reqstd_address.
574  Return 0 on success, -1 on failure. */
575 
576 static int
578  struct gdbarch *gdbarch,
579  struct bp_target_info *bp_tgt)
580 {
581  int ret;
582  CORE_ADDR addr = bp_tgt->placed_address = bp_tgt->reqstd_address;
583  int len;
584  const enum target_hw_bp_type type = hw_execute;
585  struct aarch64_debug_reg_state *state
587 
588  gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
589 
590  if (show_debug_regs)
592  (gdb_stdlog,
593  "insert_hw_breakpoint on entry (addr=0x%08lx, len=%d))\n",
594  (unsigned long) addr, len);
595 
596  ret = aarch64_handle_breakpoint (type, addr, len, 1 /* is_insert */, state);
597 
598  if (show_debug_regs)
599  {
601  "insert_hw_breakpoint", addr, len, type);
602  }
603 
604  return ret;
605 }
606 
607 /* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
608  Return 0 on success, -1 on failure. */
609 
610 static int
612  struct gdbarch *gdbarch,
613  struct bp_target_info *bp_tgt)
614 {
615  int ret;
616  CORE_ADDR addr = bp_tgt->placed_address;
617  int len = 4;
618  const enum target_hw_bp_type type = hw_execute;
619  struct aarch64_debug_reg_state *state
621 
622  gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
623 
624  if (show_debug_regs)
626  (gdb_stdlog, "remove_hw_breakpoint on entry (addr=0x%08lx, len=%d))\n",
627  (unsigned long) addr, len);
628 
629  ret = aarch64_handle_breakpoint (type, addr, len, 0 /* is_insert */, state);
630 
631  if (show_debug_regs)
632  {
634  "remove_hw_watchpoint", addr, len, type);
635  }
636 
637  return ret;
638 }
639 
640 /* Implement the "to_insert_watchpoint" target_ops method.
641 
642  Insert a watchpoint to watch a memory region which starts at
643  address ADDR and whose length is LEN bytes. Watch memory accesses
644  of the type TYPE. Return 0 on success, -1 on failure. */
645 
646 static int
648  CORE_ADDR addr, int len,
649  enum target_hw_bp_type type,
650  struct expression *cond)
651 {
652  int ret;
653  struct aarch64_debug_reg_state *state
655 
656  if (show_debug_regs)
658  "insert_watchpoint on entry (addr=0x%08lx, len=%d)\n",
659  (unsigned long) addr, len);
660 
662 
663  ret = aarch64_handle_watchpoint (type, addr, len, 1 /* is_insert */, state);
664 
665  if (show_debug_regs)
666  {
668  "insert_watchpoint", addr, len, type);
669  }
670 
671  return ret;
672 }
673 
674 /* Implement the "to_remove_watchpoint" target_ops method.
675  Remove a watchpoint that watched the memory region which starts at
676  address ADDR, whose length is LEN bytes, and for accesses of the
677  type TYPE. Return 0 on success, -1 on failure. */
678 
679 static int
681  CORE_ADDR addr, int len,
682  enum target_hw_bp_type type,
683  struct expression *cond)
684 {
685  int ret;
686  struct aarch64_debug_reg_state *state
688 
689  if (show_debug_regs)
691  "remove_watchpoint on entry (addr=0x%08lx, len=%d)\n",
692  (unsigned long) addr, len);
693 
695 
696  ret = aarch64_handle_watchpoint (type, addr, len, 0 /* is_insert */, state);
697 
698  if (show_debug_regs)
699  {
701  "remove_watchpoint", addr, len, type);
702  }
703 
704  return ret;
705 }
706 
707 /* Implement the "to_region_ok_for_hw_watchpoint" target_ops method. */
708 
709 static int
711  CORE_ADDR addr, int len)
712 {
713  return aarch64_linux_region_ok_for_watchpoint (addr, len);
714 }
715 
716 /* Implement the "to_stopped_data_address" target_ops method. */
717 
718 static int
720  CORE_ADDR *addr_p)
721 {
722  siginfo_t siginfo;
723  int i, tid;
724  struct aarch64_debug_reg_state *state;
725 
726  if (!linux_nat_get_siginfo (inferior_ptid, &siginfo))
727  return 0;
728 
729  /* This must be a hardware breakpoint. */
730  if (siginfo.si_signo != SIGTRAP
731  || (siginfo.si_code & 0xffff) != TRAP_HWBKPT)
732  return 0;
733 
734  /* Check if the address matches any watched address. */
736  for (i = aarch64_num_wp_regs - 1; i >= 0; --i)
737  {
738  const unsigned int len = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
739  const CORE_ADDR addr_trap = (CORE_ADDR) siginfo.si_addr;
740  const CORE_ADDR addr_watch = state->dr_addr_wp[i];
741 
742  if (state->dr_ref_count_wp[i]
743  && DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])
744  && addr_trap >= addr_watch
745  && addr_trap < addr_watch + len)
746  {
747  *addr_p = addr_trap;
748  return 1;
749  }
750  }
751 
752  return 0;
753 }
754 
755 /* Implement the "to_stopped_by_watchpoint" target_ops method. */
756 
757 static int
759 {
760  CORE_ADDR addr;
761 
762  return aarch64_linux_stopped_data_address (ops, &addr);
763 }
764 
765 /* Implement the "to_watchpoint_addr_within_range" target_ops method. */
766 
767 static int
769  CORE_ADDR addr,
770  CORE_ADDR start, int length)
771 {
772  return start <= addr && start + length - 1 >= addr;
773 }
774 
775 /* Implement the "to_can_do_single_step" target_ops method. */
776 
777 static int
779 {
780  return 1;
781 }
782 
783 /* Define AArch64 maintenance commands. */
784 
785 static void
787 {
788  /* A maintenance command to enable printing the internal DRi mirror
789  variables. */
790  add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
791  &show_debug_regs, _("\
792 Set whether to show variables that mirror the AArch64 debug registers."), _("\
793 Show whether to show variables that mirror the AArch64 debug registers."), _("\
794 Use \"on\" to enable, \"off\" to disable.\n\
795 If enabled, the debug registers values are shown when GDB inserts\n\
796 or removes a hardware breakpoint or watchpoint, and when the inferior\n\
797 triggers a breakpoint or watchpoint."),
798  NULL,
799  NULL,
802 }
803 
804 void
806 {
807  struct target_ops *t;
808 
809  /* Fill in the generic GNU/Linux methods. */
810  t = linux_target ();
811 
813 
814  /* Add our register access methods. */
817 
819 
832 
833  /* Override the GNU/Linux inferior startup hook. */
836 
837  /* Register the target. */
844 
845  /* Add our siginfo layout converter. */
847 }
unsigned int lwpid_t
struct gdbarch * target_gdbarch(void)
Definition: gdbarch.c:5467
static const struct target_desc * aarch64_linux_read_description(struct target_ops *ops)
struct arch_lwp_info * arch_private
Definition: linux-nat.h:102
CORE_ADDR reqstd_address
Definition: breakpoint.h:251
void aarch64_linux_new_thread(struct lwp_info *lwp)
Definition: aarch64-linux.c:74
static constexpr ptid_t tid
const struct target_desc *(* to_read_description)(struct target_ops *ops) TARGET_DEFAULT_RETURN(NULL)
Definition: target.h:790
static int aarch64_linux_siginfo_fixup(siginfo_t *native, gdb_byte *inf, int direction)
int aarch64_handle_breakpoint(enum target_hw_bp_type type, CORE_ADDR addr, int len, int is_insert, struct aarch64_debug_reg_state *state)
struct frame_info * get_current_frame(void)
Definition: frame.c:1563
int aarch64_num_wp_regs
bfd_vma CORE_ADDR
Definition: common-types.h:41
static void fetch_fpregs_from_thread(struct regcache *regcache)
const target_desc * aarch64_read_description()
static void store_gregs_to_thread(const struct regcache *regcache)
ps_err_e ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
int ptid_get_pid(const ptid_t &ptid)
Definition: ptid.c:47
void fill_gregset(const struct regcache *regcache, gdb_gregset_t *gregsetp, int regno)
void xfree(void *)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
Definition: gnu-nat.c:1824
#define TRAP_HWBKPT
if(!(yy_init))
Definition: ada-lex.c:1075
void linux_nat_set_new_thread(struct target_ops *t, void(*new_thread)(struct lwp_info *))
Definition: linux-nat.c:4873
static int aarch64_linux_remove_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond)
int aarch64_handle_watchpoint(enum target_hw_bp_type type, CORE_ADDR addr, int len, int is_insert, struct aarch64_debug_reg_state *state)
void aarch32_gp_regcache_collect(const struct regcache *regcache, uint32_t *regs, int arm_apcs_32)
int aarch64_num_bp_regs
unsigned int dr_ref_count_wp[AARCH64_HWP_MAX_NUM]
ptid_t ptid
Definition: linux-nat.h:34
static void aarch64_linux_child_post_startup_inferior(struct target_ops *self, ptid_t ptid)
ptid_t regcache_get_ptid(const struct regcache *regcache)
Definition: regcache.c:229
static int aarch64_linux_can_use_hw_breakpoint(struct target_ops *self, enum bptype type, int cnt, int othertype)
void regcache_supply_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
Definition: regcache.c:1192
static void add_show_debug_regs_command(void)
struct target_desc * tdesc_arm_with_neon
Definition: arm-with-neon.c:8
void aarch64_linux_delete_thread(struct arch_lwp_info *arch_lwp)
Definition: aarch64-linux.c:90
ps_err_e
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(* 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
int linux_nat_get_siginfo(ptid_t ptid, siginfo_t *siginfo)
Definition: linux-nat.c:4948
void linux_nat_set_new_fork(struct target_ops *t, linux_nat_new_fork_ftype *new_fork)
Definition: linux-nat.c:4896
void fill_fpregset(const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regno)
struct cmd_list_element * maintenance_set_cmdlist
Definition: maint.c:634
PTRACE_TYPE_RET ptrace()
static int aarch64_linux_stopped_data_address(struct target_ops *target, CORE_ADDR *addr_p)
int(* to_can_do_single_step)(struct target_ops *) TARGET_DEFAULT_RETURN(-1)
Definition: target.h:557
unsigned int aarch64_watchpoint_length(unsigned int ctrl)
static int aarch64_linux_region_ok_for_hw_watchpoint(struct target_ops *self, CORE_ADDR addr, int len)
void aarch64_linux_get_debug_reg_capacity(int tid)
Definition: gnu-nat.h:42
void aarch32_vfp_regcache_supply(struct regcache *regcache, gdb_byte *regs, const int vfp_register_count)
int(* to_watchpoint_addr_within_range)(struct target_ops *, CORE_ADDR, CORE_ADDR, int) TARGET_DEFAULT_FUNC(default_watchpoint_addr_within_range)
Definition: target.h:537
static int aarch64_linux_insert_hw_breakpoint(struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
GDB_GREGSET_T gdb_gregset_t
Definition: gregset.h:34
void aarch64_compat_siginfo_from_siginfo(compat_siginfo_t *to, siginfo_t *from)
Definition: aarch64-linux.c:99
static struct aarch64_process_info * aarch64_add_process(pid_t pid)
static int aarch64_linux_can_do_single_step(struct target_ops *target)
static void store_fpregs_to_thread(const struct regcache *regcache)
Definition: ptid.h:35
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
Definition: utils.c:2018
static int aarch64_linux_insert_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond)
int show_debug_regs
Definition: common-debug.c:25
#define gdb_assert_not_reached(message)
Definition: gdb_assert.h:55
GDB_FPREGSET_T gdb_fpregset_t
Definition: gregset.h:35
void aarch64_linux_prepare_to_resume(struct lwp_info *lwp)
Definition: aarch64-linux.c:34
void supply_gregset(struct regcache *regcache, const gdb_gregset_t *gregsetp)
void linux_nat_set_prepare_to_resume(struct target_ops *t, void(*prepare_to_resume)(struct lwp_info *))
Definition: linux-nat.c:4938
Definition: gdbtypes.h:749
void regcache_collect_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
Definition: regcache.c:1211
struct proc * next
Definition: gnu-nat.h:73
Definition: gnu-nat.c:174
static void aarch64_linux_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
#define VFP_REGS_SIZE
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
#define PTRACE_SETREGSET
Definition: linux-ptrace.h:51
static int aarch64_linux_watchpoint_addr_within_range(struct target_ops *target, CORE_ADDR addr, CORE_ADDR start, int length)
void _initialize_aarch64_linux_nat(void)
struct aarch64_process_info * next
CORE_ADDR placed_address
Definition: breakpoint.h:248
struct target_ops * linux_target(void)
Definition: linux-nat.c:4377
long ptid_get_lwp(const ptid_t &ptid)
Definition: ptid.c:55
int(* to_insert_hw_breakpoint)(struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_RETURN(-1)
Definition: target.h:507
bptype
Definition: breakpoint.h:67
static void aarch64_forget_process(pid_t pid)
void linux_nat_set_siginfo_fixup(struct target_ops *t, int(*siginfo_fixup)(siginfo_t *, gdb_byte *, int))
Definition: linux-nat.c:4926
#define PTRACE_GETREGSET
Definition: linux-ptrace.h:47
#define gdb_assert(expr)
Definition: gdb_assert.h:32
static struct aarch64_process_info * aarch64_process_info_get(pid_t pid)
const struct regset aarch64_linux_gregset
#define gdb_static_assert(expr)
Definition: gdb_assert.h:25
struct aarch64_debug_reg_state * aarch64_get_debug_reg_state(pid_t pid)
int(* to_remove_hw_breakpoint)(struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_RETURN(-1)
Definition: target.h:510
bfd_byte gdb_byte
Definition: common-types.h:38
static struct aarch64_process_info * aarch64_process_list
ps_err_e aarch64_ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base, int is_64bit_p)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
Definition: target.h:457
static void fetch_gregs_from_thread(struct regcache *regcache)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
Definition: utils.c:692
enum register_status regcache_register_status(const struct regcache *regcache, int regnum)
Definition: regcache.c:359
static void aarch64_linux_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
#define XCNEW(T)
Definition: poison.h:121
#define AARCH64_LINUX_SIZEOF_FPREGSET
const gdb_byte * gdbarch_breakpoint_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
Definition: gdbarch.c:2844
ptid_t inferior_ptid
Definition: infcmd.c:94
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
gdbarch * arch() const
Definition: regcache.c:221
static struct aarch64_process_info * aarch64_find_process_pid(pid_t pid)
int(* to_stopped_by_watchpoint)(struct target_ops *) TARGET_DEFAULT_RETURN(0)
Definition: target.h:531
int aarch64_linux_region_ok_for_watchpoint(CORE_ADDR addr, int len)
#define AARCH64_LINUX_SIZEOF_GREGSET
target_hw_bp_type
Definition: break-common.h:22
unsigned int dr_ctrl_wp[AARCH64_HWP_MAX_NUM]
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
Definition: regcache.c:1004
#define DR_CONTROL_ENABLED(ctrl)
void aarch32_vfp_regcache_collect(const struct regcache *regcache, gdb_byte *regs, const int vfp_register_count)
#define gdb_stdlog
Definition: utils.h:349
void aarch32_gp_regcache_supply(struct regcache *regcache, uint32_t *regs, int arm_apcs_32)
const struct bfd_arch_info * gdbarch_bfd_arch_info(struct gdbarch *gdbarch)
Definition: gdbarch.c:1500
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
Definition: regcache.c:1085
struct aarch64_debug_reg_state state
static int aarch64_linux_stopped_by_watchpoint(struct target_ops *ops)
void linux_nat_set_forget_process(struct target_ops *t, linux_nat_forget_process_ftype *fn)
Definition: linux-nat.c:4906
static int aarch64_linux_remove_hw_breakpoint(struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
int(* to_stopped_data_address)(struct target_ops *, CORE_ADDR *) TARGET_DEFAULT_RETURN(0)
Definition: target.h:535
static void(* super_post_startup_inferior)(struct target_ops *self, ptid_t ptid)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
Definition: target.h:459
struct cmd_list_element * maintenance_show_cmdlist
Definition: maint.c:635
void linux_nat_set_delete_thread(struct target_ops *t, void(*delete_thread)(struct arch_lwp_info *))
Definition: linux-nat.c:4884
static void aarch64_linux_new_fork(struct lwp_info *parent, pid_t child_pid)
void aarch64_show_debug_reg_state(struct aarch64_debug_reg_state *state, const char *func, CORE_ADDR addr, int len, enum target_hw_bp_type type)
const struct regset aarch64_linux_fpregset
void aarch64_siginfo_from_compat_siginfo(siginfo_t *to, compat_siginfo_t *from)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
Definition: frame.c:2691
void(* to_post_startup_inferior)(struct target_ops *, ptid_t) TARGET_DEFAULT_IGNORE()
Definition: target.h:582
void supply_fpregset(struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
CORE_ADDR dr_addr_wp[AARCH64_HWP_MAX_NUM]