1 /* Process record and replay target code for GNU/Linux.
3 Copyright (C) 2008-2016 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
25 #include "record-full.h"
26 #include "linux-record.h"
28 /* These macros are the values of the first argument of system call
29 "sys_ptrace". The values of these macros were obtained from Linux
32 #define RECORD_PTRACE_PEEKTEXT 1
33 #define RECORD_PTRACE_PEEKDATA 2
34 #define RECORD_PTRACE_PEEKUSR 3
36 /* These macros are the values of the first argument of system call
37 "sys_socketcall". The values of these macros were obtained from
38 Linux Kernel source. */
40 #define RECORD_SYS_SOCKET 1
41 #define RECORD_SYS_BIND 2
42 #define RECORD_SYS_CONNECT 3
43 #define RECORD_SYS_LISTEN 4
44 #define RECORD_SYS_ACCEPT 5
45 #define RECORD_SYS_GETSOCKNAME 6
46 #define RECORD_SYS_GETPEERNAME 7
47 #define RECORD_SYS_SOCKETPAIR 8
48 #define RECORD_SYS_SEND 9
49 #define RECORD_SYS_RECV 10
50 #define RECORD_SYS_SENDTO 11
51 #define RECORD_SYS_RECVFROM 12
52 #define RECORD_SYS_SHUTDOWN 13
53 #define RECORD_SYS_SETSOCKOPT 14
54 #define RECORD_SYS_GETSOCKOPT 15
55 #define RECORD_SYS_SENDMSG 16
56 #define RECORD_SYS_RECVMSG 17
58 /* These macros are the values of the first argument of system call
59 "sys_ipc". The values of these macros were obtained from Linux
62 #define RECORD_SEMOP 1
63 #define RECORD_SEMGET 2
64 #define RECORD_SEMCTL 3
65 #define RECORD_SEMTIMEDOP 4
66 #define RECORD_MSGSND 11
67 #define RECORD_MSGRCV 12
68 #define RECORD_MSGGET 13
69 #define RECORD_MSGCTL 14
70 #define RECORD_SHMAT 21
71 #define RECORD_SHMDT 22
72 #define RECORD_SHMGET 23
73 #define RECORD_SHMCTL 24
75 /* These macros are the values of the first argument of system call
76 "sys_quotactl". The values of these macros were obtained from Linux
79 #define RECORD_Q_GETFMT 0x800004
80 #define RECORD_Q_GETINFO 0x800005
81 #define RECORD_Q_GETQUOTA 0x800007
82 #define RECORD_Q_XGETQSTAT (('5' << 8) + 5)
83 #define RECORD_Q_XGETQUOTA (('3' << 8) + 3)
85 #define OUTPUT_REG(val, num) phex_nz ((val), \
86 TYPE_LENGTH (gdbarch_register_type (get_regcache_arch (regcache), (num))))
88 /* Record a memory area of length LEN pointed to by register
92 record_mem_at_reg (struct regcache *regcache, int regnum, int len)
96 regcache_raw_read_unsigned (regcache, regnum, &addr);
97 return record_full_arch_list_add_mem ((CORE_ADDR) addr, len);
101 record_linux_sockaddr (struct regcache *regcache,
102 struct linux_record_tdep *tdep, ULONGEST addr,
107 struct gdbarch *gdbarch = get_regcache_arch (regcache);
108 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
113 a = (gdb_byte *) alloca (tdep->size_int);
115 if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
118 /* Get the addrlen. */
119 if (target_read_memory ((CORE_ADDR) len, a, tdep->size_int))
122 fprintf_unfiltered (gdb_stdlog,
123 "Process record: error reading "
124 "memory at addr = 0x%s len = %d.\n",
125 phex_nz (len, tdep->size_pointer),
129 addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order);
130 if (addrlen <= 0 || addrlen > tdep->size_sockaddr)
131 addrlen = tdep->size_sockaddr;
133 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, addrlen))
140 record_linux_msghdr (struct regcache *regcache,
141 struct linux_record_tdep *tdep, ULONGEST addr)
144 struct gdbarch *gdbarch = get_regcache_arch (regcache);
145 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
152 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
155 a = (gdb_byte *) alloca (tdep->size_msghdr);
156 if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
159 fprintf_unfiltered (gdb_stdlog,
160 "Process record: error reading "
161 "memory at addr = 0x%s "
163 phex_nz (addr, tdep->size_pointer),
168 /* msg_name msg_namelen */
169 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
170 a += tdep->size_pointer;
171 if (record_full_arch_list_add_mem
173 (int) extract_unsigned_integer (a,
177 /* We have read an int, but skip size_pointer bytes to account for alignment
178 of the next field on 64-bit targets. */
179 a += tdep->size_pointer;
181 /* msg_iov msg_iovlen */
182 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
183 a += tdep->size_pointer;
187 ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
189 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
191 for (i = 0; i < len; i++)
193 if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
196 fprintf_unfiltered (gdb_stdlog,
197 "Process record: error "
201 phex_nz (addr,tdep->size_pointer),
205 tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
208 tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
211 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
213 addr += tdep->size_iovec;
216 a += tdep->size_size_t;
218 /* msg_control msg_controllen */
219 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
220 a += tdep->size_pointer;
221 tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
222 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
228 /* When the architecture process record get a Linux syscall
229 instruction, it will get a Linux syscall number of this
230 architecture and convert it to the Linux syscall number "num" which
231 is internal to GDB. Most Linux syscalls across architectures in
232 Linux would be similar and mostly differ by sizes of types and
233 structures. This sizes are put to "tdep".
235 Record the values of the registers and memory that will be changed
236 in current system call.
238 Return -1 if something wrong. */
241 record_linux_system_call (enum gdb_syscall syscall,
242 struct regcache *regcache,
243 struct linux_record_tdep *tdep)
245 struct gdbarch *gdbarch = get_regcache_arch (regcache);
246 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
247 ULONGEST tmpulongest;
253 case gdb_sys_restart_syscall:
257 if (yquery (_("The next instruction is syscall exit. "
258 "It will make the program exit. "
259 "Do you want to stop the program?")))
267 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
268 if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
277 case gdb_sys_waitpid:
278 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
280 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
293 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
295 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
302 case gdb_sys_lchown16:
303 case gdb_sys_ni_syscall17:
309 if (record_mem_at_reg (regcache, tdep->arg2,
310 tdep->size__old_kernel_stat))
317 case gdb_sys_oldumount:
318 case gdb_sys_setuid16:
319 case gdb_sys_getuid16:
324 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
325 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
326 || tmpulongest == RECORD_PTRACE_PEEKDATA
327 || tmpulongest == RECORD_PTRACE_PEEKUSR)
329 if (record_mem_at_reg (regcache, tdep->arg4, 4))
337 case gdb_sys_ni_syscall31:
338 case gdb_sys_ni_syscall32:
341 case gdb_sys_ni_syscall35:
351 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
356 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_tms))
360 case gdb_sys_ni_syscall44:
362 case gdb_sys_setgid16:
363 case gdb_sys_getgid16:
365 case gdb_sys_geteuid16:
366 case gdb_sys_getegid16:
369 case gdb_sys_ni_syscall53:
373 /* XXX Need to add a lot of support of other ioctl requests. */
374 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
375 if (tmpulongest == tdep->ioctl_FIOCLEX
376 || tmpulongest == tdep->ioctl_FIONCLEX
377 || tmpulongest == tdep->ioctl_FIONBIO
378 || tmpulongest == tdep->ioctl_FIOASYNC
379 || tmpulongest == tdep->ioctl_TCSETS
380 || tmpulongest == tdep->ioctl_TCSETSW
381 || tmpulongest == tdep->ioctl_TCSETSF
382 || tmpulongest == tdep->ioctl_TCSETA
383 || tmpulongest == tdep->ioctl_TCSETAW
384 || tmpulongest == tdep->ioctl_TCSETAF
385 || tmpulongest == tdep->ioctl_TCSBRK
386 || tmpulongest == tdep->ioctl_TCXONC
387 || tmpulongest == tdep->ioctl_TCFLSH
388 || tmpulongest == tdep->ioctl_TIOCEXCL
389 || tmpulongest == tdep->ioctl_TIOCNXCL
390 || tmpulongest == tdep->ioctl_TIOCSCTTY
391 || tmpulongest == tdep->ioctl_TIOCSPGRP
392 || tmpulongest == tdep->ioctl_TIOCSTI
393 || tmpulongest == tdep->ioctl_TIOCSWINSZ
394 || tmpulongest == tdep->ioctl_TIOCMBIS
395 || tmpulongest == tdep->ioctl_TIOCMBIC
396 || tmpulongest == tdep->ioctl_TIOCMSET
397 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
398 || tmpulongest == tdep->ioctl_TIOCCONS
399 || tmpulongest == tdep->ioctl_TIOCSSERIAL
400 || tmpulongest == tdep->ioctl_TIOCPKT
401 || tmpulongest == tdep->ioctl_TIOCNOTTY
402 || tmpulongest == tdep->ioctl_TIOCSETD
403 || tmpulongest == tdep->ioctl_TCSBRKP
404 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
405 || tmpulongest == tdep->ioctl_TIOCSBRK
406 || tmpulongest == tdep->ioctl_TIOCCBRK
407 || tmpulongest == tdep->ioctl_TCSETS2
408 || tmpulongest == tdep->ioctl_TCSETSW2
409 || tmpulongest == tdep->ioctl_TCSETSF2
410 || tmpulongest == tdep->ioctl_TIOCSPTLCK
411 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
412 || tmpulongest == tdep->ioctl_TIOCSERGWILD
413 || tmpulongest == tdep->ioctl_TIOCSERSWILD
414 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
415 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
416 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
417 || tmpulongest == tdep->ioctl_TIOCMIWAIT
418 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
422 else if (tmpulongest == tdep->ioctl_TCGETS
423 || tmpulongest == tdep->ioctl_TCGETA
424 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
426 if (record_mem_at_reg (regcache, tdep->arg3,
430 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
431 || tmpulongest == tdep->ioctl_TIOCGSID)
433 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_pid_t))
436 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
437 || tmpulongest == tdep->ioctl_TIOCMGET
438 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
439 || tmpulongest == tdep->ioctl_FIONREAD
440 || tmpulongest == tdep->ioctl_TIOCINQ
441 || tmpulongest == tdep->ioctl_TIOCGETD
442 || tmpulongest == tdep->ioctl_TIOCGPTN
443 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
445 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
448 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
450 if (record_mem_at_reg (regcache, tdep->arg3,
454 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
456 /* This syscall affects a char-size memory. */
457 if (record_mem_at_reg (regcache, tdep->arg3, 1))
460 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
462 if (record_mem_at_reg (regcache, tdep->arg3,
463 tdep->size_serial_struct))
466 else if (tmpulongest == tdep->ioctl_TCGETS2)
468 if (record_mem_at_reg (regcache, tdep->arg3,
469 tdep->size_termios2))
472 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
474 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
477 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
479 if (record_mem_at_reg (regcache, tdep->arg3,
480 tdep->size_serial_icounter_struct))
483 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
485 if (record_mem_at_reg (regcache, tdep->arg3,
486 tdep->size_hayes_esp_config))
489 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
491 printf_unfiltered (_("Process record and replay target doesn't "
492 "support ioctl request TIOCSERGSTRUCT\n"));
497 printf_unfiltered (_("Process record and replay target doesn't "
498 "support ioctl request 0x%s.\n"),
499 OUTPUT_REG (tmpulongest, tdep->arg2));
506 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
508 if (tmpulongest == tdep->fcntl_F_GETLK)
510 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_flock))
515 case gdb_sys_ni_syscall56:
516 case gdb_sys_setpgid:
517 case gdb_sys_ni_syscall58:
520 case gdb_sys_olduname:
521 if (record_mem_at_reg (regcache, tdep->arg1,
522 tdep->size_oldold_utsname))
531 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_ustat))
536 case gdb_sys_getppid:
537 case gdb_sys_getpgrp:
541 case gdb_sys_sigaction:
542 if (record_mem_at_reg (regcache, tdep->arg3,
543 tdep->size_old_sigaction))
547 case gdb_sys_sgetmask:
548 case gdb_sys_ssetmask:
549 case gdb_sys_setreuid16:
550 case gdb_sys_setregid16:
551 case gdb_sys_sigsuspend:
554 case gdb_sys_sigpending:
555 if (record_mem_at_reg (regcache, tdep->arg1,
556 tdep->size_old_sigset_t))
560 case gdb_sys_sethostname:
561 case gdb_sys_setrlimit:
564 case gdb_sys_old_getrlimit:
565 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
569 case gdb_sys_getrusage:
570 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rusage))
574 case gdb_sys_gettimeofday:
575 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timeval)
576 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_timezone))
580 case gdb_sys_settimeofday:
583 case gdb_sys_getgroups16:
584 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
589 regcache_raw_read_unsigned (regcache, tdep->arg1,
591 tmpint = tdep->size_old_gid_t * (int) gidsetsize;
592 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
597 case gdb_sys_setgroups16:
602 unsigned long sz_sel_arg = tdep->size_long + tdep->size_pointer * 4;
603 gdb_byte *a = (gdb_byte *) alloca (sz_sel_arg);
604 CORE_ADDR inp, outp, exp, tvp;
606 regcache_raw_read_unsigned (regcache, tdep->arg1,
610 if (target_read_memory (tmpulongest, a, sz_sel_arg))
613 fprintf_unfiltered (gdb_stdlog,
614 "Process record: error reading memory "
615 "at addr = 0x%s len = %lu.\n",
616 OUTPUT_REG (tmpulongest, tdep->arg1),
621 a += tdep->size_long;
622 inp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
623 a += tdep->size_pointer;
624 outp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
625 a += tdep->size_pointer;
626 exp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
627 a += tdep->size_pointer;
628 tvp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
630 if (record_full_arch_list_add_mem (inp, tdep->size_fd_set))
633 if (record_full_arch_list_add_mem (outp, tdep->size_fd_set))
636 if (record_full_arch_list_add_mem (exp, tdep->size_fd_set))
639 if (record_full_arch_list_add_mem (tvp, tdep->size_timeval))
645 case gdb_sys_symlink:
648 case gdb_sys_readlink:
649 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
650 if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
659 if (yquery (_("The next instruction is syscall reboot. "
660 "It will restart the computer. "
661 "Do you want to stop the program?")))
665 case gdb_old_readdir:
666 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_old_dirent))
677 regcache_raw_read_unsigned (regcache, tdep->arg1,
679 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
680 if (record_full_memory_query)
683 The next instruction is syscall munmap.\n\
684 It will free the memory addr = 0x%s len = %u.\n\
685 It will make record target cannot record some memory change.\n\
686 Do you want to stop the program?"),
687 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len))
693 case gdb_sys_truncate:
694 case gdb_sys_ftruncate:
696 case gdb_sys_fchown16:
697 case gdb_sys_getpriority:
698 case gdb_sys_setpriority:
699 case gdb_sys_ni_syscall98:
703 case gdb_sys_fstatfs:
704 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_statfs))
713 case gdb_sys_sendmsg:
714 case gdb_sys_shutdown:
716 case gdb_sys_connect:
718 case gdb_sys_setsockopt:
722 case gdb_sys_getsockname:
723 case gdb_sys_getpeername:
727 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
728 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
729 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
734 case gdb_sys_recvfrom:
738 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
739 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
740 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
746 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
747 if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
751 case gdb_sys_recvmsg:
752 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
753 if (record_linux_msghdr (regcache, tdep, tmpulongest))
757 case gdb_sys_socketpair:
758 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
762 case gdb_sys_getsockopt:
763 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
767 gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
769 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
773 fprintf_unfiltered (gdb_stdlog,
774 "Process record: error reading "
775 "memory at addr = 0x%s "
777 OUTPUT_REG (tmpulongest, tdep->arg5),
781 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
782 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
784 if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
786 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
792 case gdb_sys_socketcall:
793 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
796 case RECORD_SYS_SOCKET:
797 case RECORD_SYS_BIND:
798 case RECORD_SYS_CONNECT:
799 case RECORD_SYS_LISTEN:
801 case RECORD_SYS_ACCEPT:
802 case RECORD_SYS_GETSOCKNAME:
803 case RECORD_SYS_GETPEERNAME:
805 regcache_raw_read_unsigned (regcache, tdep->arg2,
809 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
812 tmpulongest += tdep->size_ulong;
813 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
814 tdep->size_ulong * 2))
817 fprintf_unfiltered (gdb_stdlog,
818 "Process record: error reading "
819 "memory at addr = 0x%s len = %d.\n",
820 OUTPUT_REG (tmpulongest, tdep->arg2),
821 tdep->size_ulong * 2);
824 tmpulongest = extract_unsigned_integer (a,
827 len = extract_unsigned_integer (a + tdep->size_ulong,
828 tdep->size_ulong, byte_order);
829 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
835 case RECORD_SYS_SOCKETPAIR:
837 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
839 regcache_raw_read_unsigned (regcache, tdep->arg2,
843 tmpulongest += tdep->size_ulong * 3;
844 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
848 fprintf_unfiltered (gdb_stdlog,
849 "Process record: error reading "
850 "memory at addr = 0x%s len = %d.\n",
851 OUTPUT_REG (tmpulongest, tdep->arg2),
856 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
858 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
863 case RECORD_SYS_SEND:
864 case RECORD_SYS_SENDTO:
866 case RECORD_SYS_RECVFROM:
867 regcache_raw_read_unsigned (regcache, tdep->arg2,
871 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
874 tmpulongest += tdep->size_ulong * 4;
875 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
876 tdep->size_ulong * 2))
879 fprintf_unfiltered (gdb_stdlog,
880 "Process record: error reading "
881 "memory at addr = 0x%s len = %d.\n",
882 OUTPUT_REG (tmpulongest, tdep->arg2),
883 tdep->size_ulong * 2);
886 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
888 len = extract_unsigned_integer (a + tdep->size_ulong,
889 tdep->size_ulong, byte_order);
890 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
893 case RECORD_SYS_RECV:
894 regcache_raw_read_unsigned (regcache, tdep->arg2,
898 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
900 tmpulongest += tdep->size_ulong;
901 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
905 fprintf_unfiltered (gdb_stdlog,
906 "Process record: error reading "
907 "memory at addr = 0x%s len = %d.\n",
908 OUTPUT_REG (tmpulongest, tdep->arg2),
912 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
916 a += tdep->size_ulong;
917 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
919 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
925 case RECORD_SYS_SHUTDOWN:
926 case RECORD_SYS_SETSOCKOPT:
928 case RECORD_SYS_GETSOCKOPT:
930 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
931 gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
933 regcache_raw_read_unsigned (regcache, tdep->arg2,
937 tmpulongest += tdep->size_ulong * 3;
938 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
939 tdep->size_ulong * 2))
942 fprintf_unfiltered (gdb_stdlog,
943 "Process record: error reading "
944 "memory at addr = 0x%s len = %d.\n",
945 OUTPUT_REG (tmpulongest, tdep->arg2),
946 tdep->size_ulong * 2);
949 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
954 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
958 fprintf_unfiltered (gdb_stdlog,
959 "Process record: error reading "
960 "memory at addr = 0x%s "
962 phex_nz (tmpulongest,
968 = (CORE_ADDR) extract_unsigned_integer (a,
971 tmpint = (int) extract_unsigned_integer (av,
974 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
976 a += tdep->size_ulong;
978 = (CORE_ADDR) extract_unsigned_integer (a,
981 if (record_full_arch_list_add_mem (tmpaddr,
988 case RECORD_SYS_SENDMSG:
990 case RECORD_SYS_RECVMSG:
992 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
994 regcache_raw_read_unsigned (regcache, tdep->arg2,
998 tmpulongest += tdep->size_ulong;
999 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1003 fprintf_unfiltered (gdb_stdlog,
1004 "Process record: error reading "
1005 "memory at addr = 0x%s len = %d.\n",
1006 OUTPUT_REG (tmpulongest, tdep->arg2),
1010 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1012 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1018 printf_unfiltered (_("Process record and replay target "
1019 "doesn't support socketcall call 0x%s\n"),
1020 OUTPUT_REG (tmpulongest, tdep->arg1));
1026 case gdb_sys_syslog:
1029 case gdb_sys_setitimer:
1030 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_itimerval))
1034 case gdb_sys_getitimer:
1035 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerval))
1039 case gdb_sys_newstat:
1040 case gdb_sys_newlstat:
1041 case gdb_sys_newfstat:
1042 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat))
1046 case gdb_sys_newfstatat:
1047 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1048 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1054 if (record_mem_at_reg (regcache, tdep->arg1,
1055 tdep->size_old_utsname))
1060 case gdb_sys_vhangup:
1061 case gdb_sys_ni_syscall112:
1062 case gdb_sys_vm86old:
1066 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
1067 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_rusage))
1071 case gdb_sys_swapoff:
1074 case gdb_sys_sysinfo:
1075 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_sysinfo))
1079 case gdb_sys_shmget:
1080 case gdb_sys_semget:
1082 case gdb_sys_msgget:
1083 /* XXX maybe need do some record works with sys_shmdt. */
1085 case gdb_sys_msgsnd:
1086 case gdb_sys_semtimedop:
1090 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_ulong))
1094 case gdb_sys_shmctl:
1095 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_shmid_ds))
1099 /* XXX sys_semctl 525 still not supported. */
1102 case gdb_sys_msgrcv:
1106 regcache_raw_read_signed (regcache, tdep->arg3, &l);
1107 tmpint = l + tdep->size_long;
1108 if (record_mem_at_reg (regcache, tdep->arg2, tmpint))
1113 case gdb_sys_msgctl:
1114 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_msqid_ds))
1119 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1120 tmpulongest &= 0xffff;
1121 switch (tmpulongest)
1125 case RECORD_SEMTIMEDOP:
1128 /* XXX maybe need do some record works with RECORD_SHMDT. */
1136 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1137 tmpint = (int) second + tdep->size_long;
1138 if (record_mem_at_reg (regcache, tdep->arg5, tmpint))
1143 if (record_mem_at_reg (regcache, tdep->arg5,
1144 tdep->size_msqid_ds))
1148 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_ulong))
1152 if (record_mem_at_reg (regcache, tdep->arg5,
1153 tdep->size_shmid_ds))
1157 /* XXX RECORD_SEMCTL still not supported. */
1158 printf_unfiltered (_("Process record and replay target doesn't "
1159 "support ipc number %s\n"),
1160 pulongest (tmpulongest));
1166 case gdb_sys_sigreturn:
1168 case gdb_sys_setdomainname:
1171 case gdb_sys_newuname:
1172 if (record_mem_at_reg (regcache, tdep->arg1,
1173 tdep->size_new_utsname))
1177 case gdb_sys_modify_ldt:
1178 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1179 if (tmpulongest == 0 || tmpulongest == 2)
1183 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1184 if (record_mem_at_reg (regcache, tdep->arg2, (int) bytecount))
1189 case gdb_sys_adjtimex:
1190 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timex))
1194 case gdb_sys_mprotect:
1197 case gdb_sys_sigprocmask:
1198 if (record_mem_at_reg (regcache, tdep->arg3,
1199 tdep->size_old_sigset_t))
1203 case gdb_sys_ni_syscall127:
1204 case gdb_sys_init_module:
1205 case gdb_sys_delete_module:
1206 case gdb_sys_ni_syscall130:
1209 case gdb_sys_quotactl:
1210 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1211 switch (tmpulongest)
1213 case RECORD_Q_GETFMT:
1215 if (record_mem_at_reg (regcache, tdep->arg4, 4))
1218 case RECORD_Q_GETINFO:
1219 if (record_mem_at_reg (regcache, tdep->arg4,
1220 tdep->size_mem_dqinfo))
1223 case RECORD_Q_GETQUOTA:
1224 if (record_mem_at_reg (regcache, tdep->arg4,
1225 tdep->size_if_dqblk))
1228 case RECORD_Q_XGETQSTAT:
1229 case RECORD_Q_XGETQUOTA:
1230 if (record_mem_at_reg (regcache, tdep->arg4,
1231 tdep->size_fs_quota_stat))
1237 case gdb_sys_getpgid:
1238 case gdb_sys_fchdir:
1239 case gdb_sys_bdflush:
1243 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1244 if (tmpulongest == 2)
1246 /*XXX the size of memory is not very clear. */
1247 if (record_mem_at_reg (regcache, tdep->arg3, 10))
1252 case gdb_sys_personality:
1253 case gdb_sys_ni_syscall137:
1254 case gdb_sys_setfsuid16:
1255 case gdb_sys_setfsgid16:
1258 case gdb_sys_llseek:
1259 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
1263 case gdb_sys_getdents:
1264 case gdb_sys_getdents64:
1265 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1266 if (record_mem_at_reg (regcache, tdep->arg2, tmpulongest))
1270 case gdb_sys_select:
1271 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_fd_set)
1272 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_fd_set)
1273 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_fd_set)
1274 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_timeval))
1286 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1289 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
1291 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1292 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1294 if (target_read_memory ((CORE_ADDR) vec, iov,
1298 fprintf_unfiltered (gdb_stdlog,
1299 "Process record: error reading "
1300 "memory at addr = 0x%s len = %d.\n",
1301 OUTPUT_REG (vec, tdep->arg2),
1306 = (CORE_ADDR) extract_unsigned_integer (iov,
1310 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1313 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1315 vec += tdep->size_iovec;
1321 case gdb_sys_writev:
1322 case gdb_sys_getsid:
1323 case gdb_sys_fdatasync:
1324 case gdb_sys_sysctl:
1326 case gdb_sys_munlock:
1327 case gdb_sys_mlockall:
1328 case gdb_sys_munlockall:
1329 case gdb_sys_sched_setparam:
1332 case gdb_sys_sched_getparam:
1333 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
1337 case gdb_sys_sched_setscheduler:
1338 case gdb_sys_sched_getscheduler:
1339 case gdb_sys_sched_yield:
1340 case gdb_sys_sched_get_priority_max:
1341 case gdb_sys_sched_get_priority_min:
1344 case gdb_sys_sched_rr_get_interval:
1345 case gdb_sys_nanosleep:
1346 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1350 case gdb_sys_mremap:
1351 case gdb_sys_setresuid16:
1354 case gdb_sys_getresuid16:
1355 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_uid_t)
1356 || record_mem_at_reg (regcache, tdep->arg2,
1357 tdep->size_old_uid_t)
1358 || record_mem_at_reg (regcache, tdep->arg3,
1359 tdep->size_old_uid_t))
1364 case gdb_sys_ni_syscall167:
1368 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1373 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1374 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1375 tdep->size_pollfd * nfds))
1380 case gdb_sys_nfsservctl:
1381 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1382 if (tmpulongest == 7 || tmpulongest == 8)
1386 if (tmpulongest == 7)
1387 rsize = tdep->size_NFS_FHSIZE;
1389 rsize = tdep->size_knfsd_fh;
1390 if (record_mem_at_reg (regcache, tdep->arg3, rsize))
1395 case gdb_sys_setresgid16:
1398 case gdb_sys_getresgid16:
1399 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_gid_t)
1400 || record_mem_at_reg (regcache, tdep->arg2,
1401 tdep->size_old_gid_t)
1402 || record_mem_at_reg (regcache, tdep->arg3,
1403 tdep->size_old_gid_t))
1408 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1409 switch (tmpulongest)
1412 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
1416 if (record_mem_at_reg (regcache, tdep->arg2,
1417 tdep->size_TASK_COMM_LEN))
1423 case gdb_sys_rt_sigreturn:
1426 case gdb_sys_rt_sigaction:
1427 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigaction))
1431 case gdb_sys_rt_sigprocmask:
1432 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigset_t))
1436 case gdb_sys_rt_sigpending:
1437 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1440 ULONGEST sigsetsize;
1442 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1443 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1449 case gdb_sys_rt_sigtimedwait:
1450 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_siginfo_t))
1454 case gdb_sys_rt_sigqueueinfo:
1455 case gdb_sys_rt_sigsuspend:
1458 case gdb_sys_pread64:
1459 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1464 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1465 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1471 case gdb_sys_pwrite64:
1472 case gdb_sys_chown16:
1475 case gdb_sys_getcwd:
1476 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1481 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1482 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1488 case gdb_sys_capget:
1489 if (record_mem_at_reg (regcache, tdep->arg2,
1490 tdep->size_cap_user_data_t))
1494 case gdb_sys_capset:
1497 case gdb_sys_sigaltstack:
1498 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stack_t))
1502 case gdb_sys_sendfile:
1503 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_off_t))
1507 case gdb_sys_ni_syscall188:
1508 case gdb_sys_ni_syscall189:
1512 case gdb_sys_getrlimit:
1513 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
1520 case gdb_sys_truncate64:
1521 case gdb_sys_ftruncate64:
1524 case gdb_sys_stat64:
1525 case gdb_sys_lstat64:
1526 case gdb_sys_fstat64:
1527 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat64))
1531 case gdb_sys_lchown:
1532 case gdb_sys_getuid:
1533 case gdb_sys_getgid:
1534 case gdb_sys_geteuid:
1535 case gdb_sys_getegid:
1536 case gdb_sys_setreuid:
1537 case gdb_sys_setregid:
1540 case gdb_sys_getgroups:
1541 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1544 ULONGEST gidsetsize;
1546 regcache_raw_read_unsigned (regcache, tdep->arg1,
1548 tmpint = tdep->size_gid_t * (int) gidsetsize;
1549 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1554 case gdb_sys_setgroups:
1555 case gdb_sys_fchown:
1556 case gdb_sys_setresuid:
1559 case gdb_sys_getresuid:
1560 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_uid_t)
1561 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_uid_t)
1562 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_uid_t))
1566 case gdb_sys_setresgid:
1569 case gdb_sys_getresgid:
1570 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_gid_t)
1571 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_gid_t)
1572 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_gid_t))
1577 case gdb_sys_setuid:
1578 case gdb_sys_setgid:
1579 case gdb_sys_setfsuid:
1580 case gdb_sys_setfsgid:
1581 case gdb_sys_pivot_root:
1584 case gdb_sys_mincore:
1585 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_PAGE_SIZE))
1589 case gdb_sys_madvise:
1592 case gdb_sys_fcntl64:
1593 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1594 if (tmpulongest == tdep->fcntl_F_GETLK64)
1596 if (record_mem_at_reg (regcache, tdep->arg3,
1597 tdep->size_flock64))
1600 else if (tmpulongest != tdep->fcntl_F_SETLK64
1601 && tmpulongest != tdep->fcntl_F_SETLKW64)
1607 case gdb_sys_ni_syscall222:
1608 case gdb_sys_ni_syscall223:
1609 case gdb_sys_gettid:
1610 case gdb_sys_readahead:
1611 case gdb_sys_setxattr:
1612 case gdb_sys_lsetxattr:
1613 case gdb_sys_fsetxattr:
1616 case gdb_sys_getxattr:
1617 case gdb_sys_lgetxattr:
1618 case gdb_sys_fgetxattr:
1619 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1624 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1625 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1631 case gdb_sys_listxattr:
1632 case gdb_sys_llistxattr:
1633 case gdb_sys_flistxattr:
1634 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1639 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1640 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1646 case gdb_sys_removexattr:
1647 case gdb_sys_lremovexattr:
1648 case gdb_sys_fremovexattr:
1652 case gdb_sys_sendfile64:
1653 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
1658 case gdb_sys_sched_setaffinity:
1661 case gdb_sys_sched_getaffinity:
1662 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1667 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1668 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1674 case gdb_sys_set_thread_area:
1675 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
1679 case gdb_sys_get_thread_area:
1680 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_user_desc))
1684 case gdb_sys_io_setup:
1685 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_long))
1689 case gdb_sys_io_destroy:
1692 case gdb_sys_io_getevents:
1693 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1698 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1699 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1700 nr * tdep->size_io_event))
1705 case gdb_sys_io_submit:
1706 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1712 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1713 iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
1714 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1715 nr * tdep->size_pointer))
1718 fprintf_unfiltered (gdb_stdlog,
1719 "Process record: error reading memory "
1720 "at addr = 0x%s len = %u.\n",
1721 OUTPUT_REG (tmpulongest, tdep->arg2),
1722 (int) (nr * tdep->size_pointer));
1725 for (i = 0; i < nr; i++)
1728 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1731 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1733 iocbp += tdep->size_pointer;
1738 case gdb_sys_io_cancel:
1739 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_io_event))
1743 case gdb_sys_fadvise64:
1744 case gdb_sys_ni_syscall251:
1747 case gdb_sys_exit_group:
1748 if (yquery (_("The next instruction is syscall exit_group. "
1749 "It will make the program exit. "
1750 "Do you want to stop the program?")))
1754 case gdb_sys_lookup_dcookie:
1755 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1760 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1761 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1767 case gdb_sys_epoll_create:
1768 case gdb_sys_epoll_ctl:
1771 case gdb_sys_epoll_wait:
1772 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1777 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1778 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1780 * tdep->size_epoll_event)))
1785 case gdb_sys_remap_file_pages:
1786 case gdb_sys_set_tid_address:
1789 case gdb_sys_timer_create:
1790 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
1794 case gdb_sys_timer_settime:
1795 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_itimerspec))
1799 case gdb_sys_timer_gettime:
1800 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerspec))
1804 case gdb_sys_timer_getoverrun:
1805 case gdb_sys_timer_delete:
1806 case gdb_sys_clock_settime:
1809 case gdb_sys_clock_gettime:
1810 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1814 case gdb_sys_clock_getres:
1815 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1819 case gdb_sys_clock_nanosleep:
1820 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_timespec))
1824 case gdb_sys_statfs64:
1825 case gdb_sys_fstatfs64:
1826 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_statfs64))
1830 case gdb_sys_tgkill:
1831 case gdb_sys_utimes:
1832 case gdb_sys_fadvise64_64:
1833 case gdb_sys_ni_syscall273:
1837 case gdb_sys_get_mempolicy:
1838 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
1840 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1845 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
1846 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1847 maxnode * tdep->size_long))
1852 case gdb_sys_set_mempolicy:
1853 case gdb_sys_mq_open:
1854 case gdb_sys_mq_unlink:
1855 case gdb_sys_mq_timedsend:
1858 case gdb_sys_mq_timedreceive:
1859 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1864 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
1865 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1869 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
1873 case gdb_sys_mq_notify:
1876 case gdb_sys_mq_getsetattr:
1877 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_mq_attr))
1881 case gdb_sys_kexec_load:
1884 case gdb_sys_waitid:
1885 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_siginfo_t)
1886 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_rusage))
1890 case gdb_sys_ni_syscall285:
1891 case gdb_sys_add_key:
1892 case gdb_sys_request_key:
1895 case gdb_sys_keyctl:
1896 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1897 if (tmpulongest == 6 || tmpulongest == 11)
1899 regcache_raw_read_unsigned (regcache, tdep->arg3,
1905 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
1906 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1913 case gdb_sys_ioprio_set:
1914 case gdb_sys_ioprio_get:
1915 case gdb_sys_inotify_init:
1916 case gdb_sys_inotify_add_watch:
1917 case gdb_sys_inotify_rm_watch:
1918 case gdb_sys_migrate_pages:
1919 case gdb_sys_openat:
1920 case gdb_sys_mkdirat:
1921 case gdb_sys_mknodat:
1922 case gdb_sys_fchownat:
1923 case gdb_sys_futimesat:
1926 case gdb_sys_fstatat64:
1927 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_stat64))
1931 case gdb_sys_unlinkat:
1932 case gdb_sys_renameat:
1933 case gdb_sys_linkat:
1934 case gdb_sys_symlinkat:
1937 case gdb_sys_readlinkat:
1938 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1943 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
1944 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1950 case gdb_sys_fchmodat:
1951 case gdb_sys_faccessat:
1954 case gdb_sys_pselect6:
1955 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_fd_set)
1956 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_fd_set)
1957 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_fd_set)
1958 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_timespec))
1963 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1968 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1969 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1970 tdep->size_pollfd * nfds))
1973 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_timespec))
1977 case gdb_sys_unshare:
1978 case gdb_sys_set_robust_list:
1981 case gdb_sys_get_robust_list:
1982 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
1983 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
1987 case gdb_sys_splice:
1988 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_loff_t)
1989 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
1993 case gdb_sys_sync_file_range:
1995 case gdb_sys_vmsplice:
1998 case gdb_sys_move_pages:
1999 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2004 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2005 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2006 nr_pages * tdep->size_int))
2011 case gdb_sys_getcpu:
2012 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int)
2013 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
2014 || record_mem_at_reg (regcache, tdep->arg3,
2015 tdep->size_ulong * 2))
2019 case gdb_sys_epoll_pwait:
2020 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2025 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2026 tmpint = (int) maxevents * tdep->size_epoll_event;
2027 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2032 case gdb_sys_fallocate:
2033 case gdb_sys_eventfd2:
2034 case gdb_sys_epoll_create1:
2039 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
2043 case gdb_sys_inotify_init1:
2047 printf_unfiltered (_("Process record and replay target doesn't "
2048 "support syscall number %d\n"), syscall);