GDB (xrefs)
/tmp/gdb-7.10/gdb/aarch64-linux-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for GNU/Linux AArch64.
2 
3  Copyright (C) 2009-2015 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 "gdbarch.h"
24 #include "glibc-tdep.h"
25 #include "linux-tdep.h"
26 #include "aarch64-tdep.h"
27 #include "aarch64-linux-tdep.h"
28 #include "osabi.h"
29 #include "solib-svr4.h"
30 #include "symtab.h"
31 #include "tramp-frame.h"
32 #include "trad-frame.h"
33 
34 #include "inferior.h"
35 #include "regcache.h"
36 #include "regset.h"
37 
38 #include "cli/cli-utils.h"
39 #include "stap-probe.h"
40 #include "parser-defs.h"
41 #include "user-regs.h"
42 #include "xml-syscall.h"
43 #include <ctype.h>
44 
45 #include "record-full.h"
46 #include "linux-record.h"
47 
48 /* Signal frame handling.
49 
50  +------------+ ^
51  | saved lr | |
52  +->| saved fp |--+
53  | | |
54  | | |
55  | +------------+
56  | | saved lr |
57  +--| saved fp |
58  ^ | |
59  | | |
60  | +------------+
61  ^ | |
62  | | signal |
63  | | | SIGTRAMP_FRAME (struct rt_sigframe)
64  | | saved regs |
65  +--| saved sp |--> interrupted_sp
66  | | saved pc |--> interrupted_pc
67  | | |
68  | +------------+
69  | | saved lr |--> default_restorer (movz x8, NR_sys_rt_sigreturn; svc 0)
70  +--| saved fp |<- FP
71  | | NORMAL_FRAME
72  | |<- SP
73  +------------+
74 
75  On signal delivery, the kernel will create a signal handler stack
76  frame and setup the return address in LR to point at restorer stub.
77  The signal stack frame is defined by:
78 
79  struct rt_sigframe
80  {
81  siginfo_t info;
82  struct ucontext uc;
83  };
84 
85  typedef struct
86  {
87  ... 128 bytes
88  } siginfo_t;
89 
90  The ucontext has the following form:
91  struct ucontext
92  {
93  unsigned long uc_flags;
94  struct ucontext *uc_link;
95  stack_t uc_stack;
96  sigset_t uc_sigmask;
97  struct sigcontext uc_mcontext;
98  };
99 
100  typedef struct sigaltstack
101  {
102  void *ss_sp;
103  int ss_flags;
104  size_t ss_size;
105  } stack_t;
106 
107  struct sigcontext
108  {
109  unsigned long fault_address;
110  unsigned long regs[31];
111  unsigned long sp; / * 31 * /
112  unsigned long pc; / * 32 * /
113  unsigned long pstate; / * 33 * /
114  __u8 __reserved[4096]
115  };
116 
117  The restorer stub will always have the form:
118 
119  d28015a8 movz x8, #0xad
120  d4000001 svc #0x0
121 
122  This is a system call sys_rt_sigreturn.
123 
124  We detect signal frames by snooping the return code for the restorer
125  instruction sequence.
126 
127  The handler then needs to recover the saved register set from
128  ucontext.uc_mcontext. */
129 
130 /* These magic numbers need to reflect the layout of the kernel
131  defined struct rt_sigframe and ucontext. */
132 #define AARCH64_SIGCONTEXT_REG_SIZE 8
133 #define AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET 128
134 #define AARCH64_UCONTEXT_SIGCONTEXT_OFFSET 176
135 #define AARCH64_SIGCONTEXT_XO_OFFSET 8
136 
137 /* Implement the "init" method of struct tramp_frame. */
138 
139 static void
141  struct frame_info *this_frame,
142  struct trad_frame_cache *this_cache,
143  CORE_ADDR func)
144 {
145  struct gdbarch *gdbarch = get_frame_arch (this_frame);
147  CORE_ADDR sigcontext_addr =
148  sp
151  int i;
152 
153  for (i = 0; i < 31; i++)
154  {
155  trad_frame_set_reg_addr (this_cache,
156  AARCH64_X0_REGNUM + i,
157  sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
159  }
161  sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
164  sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
166 
167  trad_frame_set_id (this_cache, frame_id_build (sp, func));
168 }
169 
170 static const struct tramp_frame aarch64_linux_rt_sigframe =
171 {
173  4,
174  {
175  /* movz x8, 0x8b (S=1,o=10,h=0,i=0x8b,r=8)
176  Soo1 0010 1hhi iiii iiii iiii iiir rrrr */
177  {0xd2801168, -1},
178 
179  /* svc 0x0 (o=0, l=1)
180  1101 0100 oooi iiii iiii iiii iii0 00ll */
181  {0xd4000001, -1},
182  {TRAMP_SENTINEL_INSN, -1}
183  },
185 };
186 
187 /* Register maps. */
188 
189 static const struct regcache_map_entry aarch64_linux_gregmap[] =
190  {
191  { 31, AARCH64_X0_REGNUM, 8 }, /* x0 ... x30 */
192  { 1, AARCH64_SP_REGNUM, 8 },
193  { 1, AARCH64_PC_REGNUM, 8 },
194  { 1, AARCH64_CPSR_REGNUM, 8 },
195  { 0 }
196  };
197 
198 static const struct regcache_map_entry aarch64_linux_fpregmap[] =
199  {
200  { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
201  { 1, AARCH64_FPSR_REGNUM, 4 },
202  { 1, AARCH64_FPCR_REGNUM, 4 },
203  { 0 }
204  };
205 
206 /* Register set definitions. */
207 
208 const struct regset aarch64_linux_gregset =
209  {
212  };
213 
214 const struct regset aarch64_linux_fpregset =
215  {
218  };
219 
220 /* Implement the "regset_from_core_section" gdbarch method. */
221 
222 static void
225  void *cb_data,
226  const struct regcache *regcache)
227 {
228  cb (".reg", AARCH64_LINUX_SIZEOF_GREGSET, &aarch64_linux_gregset,
229  NULL, cb_data);
230  cb (".reg2", AARCH64_LINUX_SIZEOF_FPREGSET, &aarch64_linux_fpregset,
231  NULL, cb_data);
232 }
233 
234 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
235  gdbarch.h. */
236 
237 static int
239 {
240  return (*s == '#' || isdigit (*s) /* Literal number. */
241  || *s == '[' /* Register indirection. */
242  || isalpha (*s)); /* Register value. */
243 }
244 
245 /* This routine is used to parse a special token in AArch64's assembly.
246 
247  The special tokens parsed by it are:
248 
249  - Register displacement (e.g, [fp, #-8])
250 
251  It returns one if the special token has been parsed successfully,
252  or zero if the current token is not considered special. */
253 
254 static int
256  struct stap_parse_info *p)
257 {
258  if (*p->arg == '[')
259  {
260  /* Temporary holder for lookahead. */
261  const char *tmp = p->arg;
262  char *endp;
263  /* Used to save the register name. */
264  const char *start;
265  char *regname;
266  int len;
267  int got_minus = 0;
268  long displacement;
269  struct stoken str;
270 
271  ++tmp;
272  start = tmp;
273 
274  /* Register name. */
275  while (isalnum (*tmp))
276  ++tmp;
277 
278  if (*tmp != ',')
279  return 0;
280 
281  len = tmp - start;
282  regname = alloca (len + 2);
283 
284  strncpy (regname, start, len);
285  regname[len] = '\0';
286 
287  if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
288  error (_("Invalid register name `%s' on expression `%s'."),
289  regname, p->saved_arg);
290 
291  ++tmp;
292  tmp = skip_spaces_const (tmp);
293  /* Now we expect a number. It can begin with '#' or simply
294  a digit. */
295  if (*tmp == '#')
296  ++tmp;
297 
298  if (*tmp == '-')
299  {
300  ++tmp;
301  got_minus = 1;
302  }
303  else if (*tmp == '+')
304  ++tmp;
305 
306  if (!isdigit (*tmp))
307  return 0;
308 
309  displacement = strtol (tmp, &endp, 10);
310  tmp = endp;
311 
312  /* Skipping last `]'. */
313  if (*tmp++ != ']')
314  return 0;
315 
316  /* The displacement. */
317  write_exp_elt_opcode (&p->pstate, OP_LONG);
318  write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
319  write_exp_elt_longcst (&p->pstate, displacement);
320  write_exp_elt_opcode (&p->pstate, OP_LONG);
321  if (got_minus)
322  write_exp_elt_opcode (&p->pstate, UNOP_NEG);
323 
324  /* The register name. */
325  write_exp_elt_opcode (&p->pstate, OP_REGISTER);
326  str.ptr = regname;
327  str.length = len;
328  write_exp_string (&p->pstate, str);
329  write_exp_elt_opcode (&p->pstate, OP_REGISTER);
330 
331  write_exp_elt_opcode (&p->pstate, BINOP_ADD);
332 
333  /* Casting to the expected type. */
334  write_exp_elt_opcode (&p->pstate, UNOP_CAST);
336  write_exp_elt_opcode (&p->pstate, UNOP_CAST);
337 
338  write_exp_elt_opcode (&p->pstate, UNOP_IND);
339 
340  p->arg = tmp;
341  }
342  else
343  return 0;
344 
345  return 1;
346 }
347 
348 /* Implement the "get_syscall_number" gdbarch method. */
349 
350 static LONGEST
352  ptid_t ptid)
353 {
354  struct regcache *regs = get_thread_regcache (ptid);
355  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
356 
357  /* The content of register x8. */
359  /* The result. */
360  LONGEST ret;
361 
362  /* Getting the system call number from the register x8. */
363  regcache_cooked_read (regs, AARCH64_DWARF_X0 + 8, buf);
364 
365  ret = extract_signed_integer (buf, X_REGISTER_SIZE, byte_order);
366 
367  return ret;
368 }
369 
370 /* AArch64 process record-replay constructs: syscall, signal etc. */
371 
373 
374 /* Enum that defines the AArch64 linux specific syscall identifiers used for
375  process record/replay. */
376 
638 };
639 
640 /* aarch64_canonicalize_syscall maps syscall ids from the native AArch64
641  linux set of syscall ids into a canonical set of syscall ids used by
642  process record. */
643 
644 static enum gdb_syscall
646 {
647 #define SYSCALL_MAP(SYSCALL) case aarch64_sys_##SYSCALL: \
648  return gdb_sys_##SYSCALL
649 
650  switch (syscall_number)
651  {
652  SYSCALL_MAP (io_setup);
653  SYSCALL_MAP (io_destroy);
654  SYSCALL_MAP (io_submit);
655  SYSCALL_MAP (io_cancel);
656  SYSCALL_MAP (io_getevents);
657 
658  SYSCALL_MAP (setxattr);
659  SYSCALL_MAP (lsetxattr);
660  SYSCALL_MAP (fsetxattr);
661  SYSCALL_MAP (getxattr);
662  SYSCALL_MAP (lgetxattr);
663  SYSCALL_MAP (fgetxattr);
664  SYSCALL_MAP (listxattr);
665  SYSCALL_MAP (llistxattr);
666  SYSCALL_MAP (flistxattr);
667  SYSCALL_MAP (removexattr);
668  SYSCALL_MAP (lremovexattr);
669  SYSCALL_MAP (fremovexattr);
670  SYSCALL_MAP (getcwd);
671  SYSCALL_MAP (lookup_dcookie);
672 
674  return gdb_sys_epoll_create;
675 
676  SYSCALL_MAP (epoll_ctl);
677  SYSCALL_MAP (epoll_pwait);
678  SYSCALL_MAP (dup);
679  SYSCALL_MAP (fcntl);
680  SYSCALL_MAP (inotify_add_watch);
681  SYSCALL_MAP (inotify_rm_watch);
682  SYSCALL_MAP (ioctl);
683  SYSCALL_MAP (ioprio_set);
684  SYSCALL_MAP (ioprio_get);
685  SYSCALL_MAP (flock);
686  SYSCALL_MAP (mount);
687  SYSCALL_MAP (nfsservctl);
688  SYSCALL_MAP (statfs);
689  SYSCALL_MAP (truncate);
690  SYSCALL_MAP (ftruncate);
691  SYSCALL_MAP (fchdir);
692  SYSCALL_MAP (chroot);
693  SYSCALL_MAP (fchmod);
694  SYSCALL_MAP (fchmodat);
695  SYSCALL_MAP (fchownat);
696  SYSCALL_MAP (fchown);
697  SYSCALL_MAP (close);
698  SYSCALL_MAP (vhangup);
699  SYSCALL_MAP (quotactl);
700  SYSCALL_MAP (getdents64);
701  SYSCALL_MAP (lseek);
702  SYSCALL_MAP (read);
703  SYSCALL_MAP (write);
704  SYSCALL_MAP (readv);
705  SYSCALL_MAP (writev);
706  SYSCALL_MAP (pread64);
707  SYSCALL_MAP (pwrite64);
708  SYSCALL_MAP (sendfile);
709  SYSCALL_MAP (pselect6);
710  SYSCALL_MAP (ppoll);
711  SYSCALL_MAP (vmsplice);
712  SYSCALL_MAP (splice);
713  SYSCALL_MAP (tee);
714  SYSCALL_MAP (fstat);
715  SYSCALL_MAP (sync);
716  SYSCALL_MAP (fsync);
717  SYSCALL_MAP (fdatasync);
718  SYSCALL_MAP (sync_file_range);
719  SYSCALL_MAP (acct);
720  SYSCALL_MAP (capget);
721  SYSCALL_MAP (capset);
722  SYSCALL_MAP (personality);
723  SYSCALL_MAP (exit);
724  SYSCALL_MAP (exit_group);
725  SYSCALL_MAP (waitid);
726  SYSCALL_MAP (set_tid_address);
727  SYSCALL_MAP (unshare);
728  SYSCALL_MAP (futex);
729  SYSCALL_MAP (set_robust_list);
730  SYSCALL_MAP (get_robust_list);
731  SYSCALL_MAP (nanosleep);
732 
733  SYSCALL_MAP (getitimer);
734  SYSCALL_MAP (setitimer);
735  SYSCALL_MAP (kexec_load);
736  SYSCALL_MAP (init_module);
737  SYSCALL_MAP (delete_module);
738  SYSCALL_MAP (timer_create);
739  SYSCALL_MAP (timer_settime);
740  SYSCALL_MAP (timer_gettime);
741  SYSCALL_MAP (timer_getoverrun);
742  SYSCALL_MAP (timer_delete);
743  SYSCALL_MAP (clock_settime);
744  SYSCALL_MAP (clock_gettime);
745  SYSCALL_MAP (clock_getres);
746  SYSCALL_MAP (clock_nanosleep);
747  SYSCALL_MAP (syslog);
749  SYSCALL_MAP (sched_setparam);
750  SYSCALL_MAP (sched_setscheduler);
751  SYSCALL_MAP (sched_getscheduler);
752  SYSCALL_MAP (sched_getparam);
753  SYSCALL_MAP (sched_setaffinity);
754  SYSCALL_MAP (sched_getaffinity);
755  SYSCALL_MAP (sched_yield);
756  SYSCALL_MAP (sched_get_priority_max);
757  SYSCALL_MAP (sched_get_priority_min);
758  SYSCALL_MAP (sched_rr_get_interval);
759  SYSCALL_MAP (kill);
760  SYSCALL_MAP (tkill);
761  SYSCALL_MAP (tgkill);
762  SYSCALL_MAP (sigaltstack);
763  SYSCALL_MAP (rt_sigsuspend);
764  SYSCALL_MAP (rt_sigaction);
765  SYSCALL_MAP (rt_sigprocmask);
766  SYSCALL_MAP (rt_sigpending);
767  SYSCALL_MAP (rt_sigtimedwait);
768  SYSCALL_MAP (rt_sigqueueinfo);
769  SYSCALL_MAP (rt_sigreturn);
770  SYSCALL_MAP (setpriority);
771  SYSCALL_MAP (getpriority);
772  SYSCALL_MAP (reboot);
773  SYSCALL_MAP (setregid);
774  SYSCALL_MAP (setgid);
775  SYSCALL_MAP (setreuid);
776  SYSCALL_MAP (setuid);
777  SYSCALL_MAP (setresuid);
778  SYSCALL_MAP (getresuid);
779  SYSCALL_MAP (setresgid);
780  SYSCALL_MAP (getresgid);
781  SYSCALL_MAP (setfsuid);
782  SYSCALL_MAP (setfsgid);
783  SYSCALL_MAP (times);
784  SYSCALL_MAP (setpgid);
785  SYSCALL_MAP (getpgid);
786  SYSCALL_MAP (getsid);
787  SYSCALL_MAP (setsid);
788  SYSCALL_MAP (getgroups);
789  SYSCALL_MAP (setgroups);
790  SYSCALL_MAP (uname);
791  SYSCALL_MAP (sethostname);
792  SYSCALL_MAP (setdomainname);
793  SYSCALL_MAP (getrlimit);
794  SYSCALL_MAP (setrlimit);
795  SYSCALL_MAP (getrusage);
796  SYSCALL_MAP (umask);
797  SYSCALL_MAP (prctl);
798  SYSCALL_MAP (gettimeofday);
799  SYSCALL_MAP (settimeofday);
800  SYSCALL_MAP (adjtimex);
801  SYSCALL_MAP (getpid);
802  SYSCALL_MAP (getppid);
803  SYSCALL_MAP (getuid);
804  SYSCALL_MAP (geteuid);
805  SYSCALL_MAP (getgid);
806  SYSCALL_MAP (getegid);
807  SYSCALL_MAP (gettid);
808  SYSCALL_MAP (sysinfo);
809  SYSCALL_MAP (mq_open);
810  SYSCALL_MAP (mq_unlink);
811  SYSCALL_MAP (mq_timedsend);
812  SYSCALL_MAP (mq_timedreceive);
813  SYSCALL_MAP (mq_notify);
814  SYSCALL_MAP (mq_getsetattr);
815  SYSCALL_MAP (msgget);
816  SYSCALL_MAP (msgctl);
817  SYSCALL_MAP (msgrcv);
818  SYSCALL_MAP (msgsnd);
819  SYSCALL_MAP (semget);
820  SYSCALL_MAP (semctl);
821  SYSCALL_MAP (semtimedop);
822  SYSCALL_MAP (semop);
823  SYSCALL_MAP (shmget);
824  SYSCALL_MAP (shmctl);
825  SYSCALL_MAP (shmat);
826  SYSCALL_MAP (shmdt);
827  SYSCALL_MAP (socket);
828  SYSCALL_MAP (socketpair);
829  SYSCALL_MAP (bind);
830  SYSCALL_MAP (listen);
831  SYSCALL_MAP (accept);
832  SYSCALL_MAP (connect);
833  SYSCALL_MAP (getsockname);
834  SYSCALL_MAP (getpeername);
835  SYSCALL_MAP (sendto);
836  SYSCALL_MAP (recvfrom);
837  SYSCALL_MAP (setsockopt);
838  SYSCALL_MAP (getsockopt);
839  SYSCALL_MAP (shutdown);
840  SYSCALL_MAP (sendmsg);
841  SYSCALL_MAP (recvmsg);
842  SYSCALL_MAP (readahead);
843  SYSCALL_MAP (brk);
844  SYSCALL_MAP (munmap);
845  SYSCALL_MAP (mremap);
846  SYSCALL_MAP (add_key);
847  SYSCALL_MAP (request_key);
848  SYSCALL_MAP (keyctl);
849  SYSCALL_MAP (clone);
850  SYSCALL_MAP (execve);
851 
852  case aarch64_sys_mmap:
853  return gdb_sys_mmap2;
854 
855  SYSCALL_MAP (fadvise64);
856  SYSCALL_MAP (swapon);
857  SYSCALL_MAP (swapoff);
858  SYSCALL_MAP (mprotect);
859  SYSCALL_MAP (msync);
860  SYSCALL_MAP (mlock);
861  SYSCALL_MAP (munlock);
862  SYSCALL_MAP (mlockall);
863  SYSCALL_MAP (munlockall);
864  SYSCALL_MAP (mincore);
865  SYSCALL_MAP (madvise);
866  SYSCALL_MAP (remap_file_pages);
867  SYSCALL_MAP (mbind);
868  SYSCALL_MAP (get_mempolicy);
869  SYSCALL_MAP (set_mempolicy);
870  SYSCALL_MAP (migrate_pages);
871  SYSCALL_MAP (move_pages);
872 
873  default:
874  return -1;
875  }
876 }
877 
878 /* Record all registers but PC register for process-record. */
879 
880 static int
882 {
883  int i;
884 
885  for (i = AARCH64_X0_REGNUM; i < AARCH64_PC_REGNUM; i++)
886  if (record_full_arch_list_add_reg (regcache, i))
887  return -1;
888 
890  return -1;
891 
892  return 0;
893 }
894 
895 /* Handler for aarch64 system call instruction recording. */
896 
897 static int
899  unsigned long svc_number)
900 {
901  int ret = 0;
902  enum gdb_syscall syscall_gdb;
903 
904  syscall_gdb = aarch64_canonicalize_syscall (svc_number);
905 
906  if (syscall_gdb < 0)
907  {
908  printf_unfiltered (_("Process record and replay target doesn't "
909  "support syscall number %s\n"),
910  plongest (svc_number));
911  return -1;
912  }
913 
914  if (syscall_gdb == gdb_sys_sigreturn
915  || syscall_gdb == gdb_sys_rt_sigreturn)
916  {
918  return -1;
919  return 0;
920  }
921 
922  ret = record_linux_system_call (syscall_gdb, regcache,
924  if (ret != 0)
925  return ret;
926 
927  /* Record the return value of the system call. */
929  return -1;
930  /* Record LR. */
932  return -1;
933  /* Record CPSR. */
935  return -1;
936 
937  return 0;
938 }
939 
940 static void
942 {
943  static const char *const stap_integer_prefixes[] = { "#", "", NULL };
944  static const char *const stap_register_prefixes[] = { "", NULL };
945  static const char *const stap_register_indirection_prefixes[] = { "[",
946  NULL };
947  static const char *const stap_register_indirection_suffixes[] = { "]",
948  NULL };
949  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
950 
951  tdep->lowest_pc = 0x8000;
952 
953  linux_init_abi (info, gdbarch);
954 
957 
958  /* Enable TLS support. */
961 
962  /* Shared library handling. */
964 
965  tramp_frame_prepend_unwinder (gdbarch, &aarch64_linux_rt_sigframe);
966 
967  /* Enable longjmp. */
968  tdep->jb_pc = 11;
969 
972 
973  /* SystemTap related. */
974  set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
975  set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
977  stap_register_indirection_prefixes);
979  stap_register_indirection_suffixes);
983 
984  /* Reversible debugging, process record. */
986  /* Syscall record. */
988 
989  /* Initialize the aarch64_linux_record_tdep. */
990  /* These values are the size of the type that will be used in a system
991  call. They are obtained from Linux Kernel source. */
993  = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
1015  = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
1017  = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
1019  = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
1064 
1065  /* These values are the second argument of system call "sys_ioctl".
1066  They are obtained from Linux Kernel source. */
1132 
1133  /* These values are the second argument of system call "sys_fcntl"
1134  and "sys_fcntl64". They are obtained from Linux Kernel source. */
1139 
1140  /* The AArch64 syscall calling convention: reg x0-x6 for arguments,
1141  reg x8 for syscall number and return value in reg x0. */
1149 
1150  /* `catch syscall' */
1151  set_xml_syscall_file_name (gdbarch, "syscalls/aarch64-linux.xml");
1153 }
1154 
1155 /* Provide a prototype to silence -Wmissing-prototypes. */
1157 
1158 void
1160 {
1161  gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_LINUX,
1163 }
ssize_t read(int fd, void *buf, size_t count)
Definition: expect-read1.c:26
void trad_frame_set_reg_addr(struct trad_frame_cache *this_trad_cache, int regnum, CORE_ADDR addr)
Definition: trad-frame.c:119
int size_serial_icounter_struct
Definition: linux-record.h:90
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
Definition: frame.c:554
struct type * arg_type
Definition: stap-probe.h:46
bfd_vma CORE_ADDR
Definition: common-types.h:41
void set_gdbarch_fetch_tls_load_module_address(struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype fetch_tls_load_module_address)
Definition: gdbarch.c:2822
#define TRAMP_SENTINEL_INSN
Definition: tramp-frame.h:44
struct link_map_offsets * svr4_lp64_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3180
struct regcache * get_thread_regcache(ptid_t ptid)
Definition: regcache.c:529
const char * ptr
Definition: parser-defs.h:79
void set_gdbarch_stap_parse_special_token(struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype stap_parse_special_token)
Definition: gdbarch.c:4243
int record_full_arch_list_add_reg(struct regcache *regcache, int regnum)
Definition: record-full.c:466
int gdbarch_int_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1490
void(* func)(char *)
void set_gdbarch_skip_trampoline_code(struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
Definition: gdbarch.c:3084
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1690
void trad_frame_set_id(struct trad_frame_cache *this_trad_cache, struct frame_id this_id)
Definition: trad-frame.c:164
void set_gdbarch_stap_register_prefixes(struct gdbarch *gdbarch, const char *const *stap_register_prefixes)
Definition: gdbarch.c:4110
int(* aarch64_syscall_record)(struct regcache *regcache, unsigned long svc_number)
Definition: aarch64-tdep.h:93
void regcache_supply_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
Definition: regcache.c:1149
const char * arg
Definition: stap-probe.h:32
void linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: linux-tdep.c:2427
#define AARCH64_DWARF_X0
Definition: aarch64-tdep.h:30
int gdbarch_long_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1507
CORE_ADDR lowest_pc
Definition: aarch64-tdep.h:76
static const struct regcache_map_entry aarch64_linux_gregmap[]
#define _(String)
Definition: gdb_locale.h:40
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1402
void set_gdbarch_process_record(struct gdbarch *gdbarch, gdbarch_process_record_ftype process_record)
Definition: gdbarch.c:3881
PTRACE_TYPE_RET ptrace()
void set_gdbarch_stap_register_indirection_suffixes(struct gdbarch *gdbarch, const char *const *stap_register_indirection_suffixes)
Definition: gdbarch.c:4161
Definition: ptid.h:35
static int aarch64_linux_syscall_record(struct regcache *regcache, unsigned long svc_number)
CORE_ADDR svr4_fetch_objfile_link_map(struct objfile *objfile)
Definition: solib-svr4.c:1573
Definition: regset.h:34
#define AARCH64_SIGCONTEXT_REG_SIZE
void set_gdbarch_stap_integer_prefixes(struct gdbarch *gdbarch, const char *const *stap_integer_prefixes)
Definition: gdbarch.c:4076
static void aarch64_linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
struct parser_state pstate
Definition: stap-probe.h:35
static const struct regcache_map_entry aarch64_linux_fpregmap[]
void write_exp_elt_longcst(struct parser_state *ps, LONGEST expelt)
Definition: parse.c:276
static void aarch64_linux_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
#define AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET
void initialize_file_ftype(void)
Definition: defs.h:281
int record_linux_system_call(enum gdb_syscall syscall, struct regcache *regcache, struct linux_record_tdep *tdep)
Definition: linux-record.c:227
CORE_ADDR find_solib_trampoline_target(struct frame_info *frame, CORE_ADDR pc)
Definition: minsyms.c:1394
const char * skip_spaces_const(const char *chp)
Definition: common-utils.c:271
static int aarch64_stap_parse_special_token(struct gdbarch *gdbarch, struct stap_parse_info *p)
static LONGEST aarch64_linux_get_syscall_number(struct gdbarch *gdbarch, ptid_t ptid)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition: gdbarch.c:1420
#define TARGET_CHAR_BIT
Definition: host-defs.h:29
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
Definition: solib-svr4.c:3108
void set_gdbarch_stap_register_indirection_prefixes(struct gdbarch *gdbarch, const char *const *stap_register_indirection_prefixes)
Definition: gdbarch.c:4144
void regcache_collect_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
Definition: regcache.c:1162
#define SYSCALL_MAP(SYSCALL)
const char * saved_arg
Definition: stap-probe.h:40
#define X_REGISTER_SIZE
Definition: aarch64-tdep.h:61
void set_xml_syscall_file_name(struct gdbarch *gdbarch, const char *name)
Definition: xml-syscall.c:392
void printf_unfiltered(const char *format,...)
Definition: utils.c:2399
void( iterate_over_regset_sections_cb)(const char *sect_name, int size, const struct regset *regset, const char *human_name, void *cb_data)
Definition: gdbarch.h:98
int user_reg_map_name_to_regnum(struct gdbarch *gdbarch, const char *name, int len)
Definition: user-regs.c:129
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
Definition: frame.c:1194
#define AARCH64_UCONTEXT_SIGCONTEXT_OFFSET
gdb_syscall
Definition: linux-record.h:184
void write_exp_elt_opcode(struct parser_state *ps, enum exp_opcode expelt)
Definition: parse.c:236
bfd_byte gdb_byte
Definition: common-types.h:38
initialize_file_ftype _initialize_aarch64_linux_tdep
#define AARCH64_LINUX_SIZEOF_FPREGSET
static void aarch64_linux_sigframe_init(const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func)
void set_gdbarch_stap_is_single_operand(struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype stap_is_single_operand)
Definition: gdbarch.c:4219
void set_gdbarch_get_syscall_number(struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype get_syscall_number)
Definition: gdbarch.c:4025
void tramp_frame_prepend_unwinder(struct gdbarch *gdbarch, const struct tramp_frame *tramp_frame)
Definition: tramp-frame.c:145
int aarch64_process_record(struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR insn_addr)
enum register_status regcache_cooked_read(struct regcache *regcache, int regnum, gdb_byte *buf)
Definition: regcache.c:737
#define AARCH64_LINUX_SIZEOF_GREGSET
static int aarch64_all_but_pc_registers_record(struct regcache *regcache)
static enum gdb_syscall aarch64_canonicalize_syscall(enum aarch64_syscall syscall_number)
aarch64_syscall
void set_gdbarch_iterate_over_regset_sections(struct gdbarch *gdbarch, gdbarch_iterate_over_regset_sections_ftype iterate_over_regset_sections)
Definition: gdbarch.c:3398
LONGEST extract_signed_integer(const gdb_byte *, int, enum bfd_endian)
Definition: findvar.c:49
#define AARCH64_SIGCONTEXT_XO_OFFSET
void write_exp_string(struct parser_state *ps, struct stoken str)
Definition: parse.c:349
void write_exp_elt_type(struct parser_state *ps, struct type *expelt)
Definition: parse.c:308
static int aarch64_stap_is_single_operand(struct gdbarch *gdbarch, const char *s)
void gdbarch_register_osabi(enum bfd_architecture arch, unsigned long machine, enum gdb_osabi osabi, void(*init_osabi)(struct gdbarch_info, struct gdbarch *))
Definition: osabi.c:148
void error(const char *fmt,...)
Definition: errors.c:38
struct linux_record_tdep aarch64_linux_record_tdep
struct type * lookup_pointer_type(struct type *type)
Definition: gdbtypes.c:368
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
Definition: frame.c:2535
long long LONGEST
Definition: common-types.h:52
Definition: regcache.h:167
int length
Definition: parser-defs.h:81
const ULONGEST const LONGEST len
Definition: target.h:309