1 /* Process record and replay target code for GNU/Linux.
3 Copyright (C) 2008-2017 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 case gdb_sys_readlink:
269 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
270 if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
279 case gdb_sys_waitpid:
280 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
282 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
295 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
297 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
304 case gdb_sys_lchown16:
305 case gdb_sys_ni_syscall17:
311 if (record_mem_at_reg (regcache, tdep->arg2,
312 tdep->size__old_kernel_stat))
319 case gdb_sys_oldumount:
320 case gdb_sys_setuid16:
321 case gdb_sys_getuid16:
326 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
327 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
328 || tmpulongest == RECORD_PTRACE_PEEKDATA
329 || tmpulongest == RECORD_PTRACE_PEEKUSR)
331 if (record_mem_at_reg (regcache, tdep->arg4, 4))
339 case gdb_sys_ni_syscall31:
340 case gdb_sys_ni_syscall32:
343 case gdb_sys_ni_syscall35:
354 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
359 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_tms))
363 case gdb_sys_ni_syscall44:
365 case gdb_sys_setgid16:
366 case gdb_sys_getgid16:
368 case gdb_sys_geteuid16:
369 case gdb_sys_getegid16:
372 case gdb_sys_ni_syscall53:
376 /* XXX Need to add a lot of support of other ioctl requests. */
377 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
378 if (tmpulongest == tdep->ioctl_FIOCLEX
379 || tmpulongest == tdep->ioctl_FIONCLEX
380 || tmpulongest == tdep->ioctl_FIONBIO
381 || tmpulongest == tdep->ioctl_FIOASYNC
382 || tmpulongest == tdep->ioctl_TCSETS
383 || tmpulongest == tdep->ioctl_TCSETSW
384 || tmpulongest == tdep->ioctl_TCSETSF
385 || tmpulongest == tdep->ioctl_TCSETA
386 || tmpulongest == tdep->ioctl_TCSETAW
387 || tmpulongest == tdep->ioctl_TCSETAF
388 || tmpulongest == tdep->ioctl_TCSBRK
389 || tmpulongest == tdep->ioctl_TCXONC
390 || tmpulongest == tdep->ioctl_TCFLSH
391 || tmpulongest == tdep->ioctl_TIOCEXCL
392 || tmpulongest == tdep->ioctl_TIOCNXCL
393 || tmpulongest == tdep->ioctl_TIOCSCTTY
394 || tmpulongest == tdep->ioctl_TIOCSPGRP
395 || tmpulongest == tdep->ioctl_TIOCSTI
396 || tmpulongest == tdep->ioctl_TIOCSWINSZ
397 || tmpulongest == tdep->ioctl_TIOCMBIS
398 || tmpulongest == tdep->ioctl_TIOCMBIC
399 || tmpulongest == tdep->ioctl_TIOCMSET
400 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
401 || tmpulongest == tdep->ioctl_TIOCCONS
402 || tmpulongest == tdep->ioctl_TIOCSSERIAL
403 || tmpulongest == tdep->ioctl_TIOCPKT
404 || tmpulongest == tdep->ioctl_TIOCNOTTY
405 || tmpulongest == tdep->ioctl_TIOCSETD
406 || tmpulongest == tdep->ioctl_TCSBRKP
407 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
408 || tmpulongest == tdep->ioctl_TIOCSBRK
409 || tmpulongest == tdep->ioctl_TIOCCBRK
410 || tmpulongest == tdep->ioctl_TCSETS2
411 || tmpulongest == tdep->ioctl_TCSETSW2
412 || tmpulongest == tdep->ioctl_TCSETSF2
413 || tmpulongest == tdep->ioctl_TIOCSPTLCK
414 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
415 || tmpulongest == tdep->ioctl_TIOCSERGWILD
416 || tmpulongest == tdep->ioctl_TIOCSERSWILD
417 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
418 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
419 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
420 || tmpulongest == tdep->ioctl_TIOCMIWAIT
421 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
425 else if (tmpulongest == tdep->ioctl_TCGETS
426 || tmpulongest == tdep->ioctl_TCGETA
427 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
429 if (record_mem_at_reg (regcache, tdep->arg3,
433 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
434 || tmpulongest == tdep->ioctl_TIOCGSID)
436 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_pid_t))
439 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
440 || tmpulongest == tdep->ioctl_TIOCMGET
441 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
442 || tmpulongest == tdep->ioctl_FIONREAD
443 || tmpulongest == tdep->ioctl_TIOCINQ
444 || tmpulongest == tdep->ioctl_TIOCGETD
445 || tmpulongest == tdep->ioctl_TIOCGPTN
446 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
448 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
451 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
453 if (record_mem_at_reg (regcache, tdep->arg3,
457 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
459 /* This syscall affects a char-size memory. */
460 if (record_mem_at_reg (regcache, tdep->arg3, 1))
463 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
465 if (record_mem_at_reg (regcache, tdep->arg3,
466 tdep->size_serial_struct))
469 else if (tmpulongest == tdep->ioctl_TCGETS2)
471 if (record_mem_at_reg (regcache, tdep->arg3,
472 tdep->size_termios2))
475 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
477 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
480 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
482 if (record_mem_at_reg (regcache, tdep->arg3,
483 tdep->size_serial_icounter_struct))
486 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
488 if (record_mem_at_reg (regcache, tdep->arg3,
489 tdep->size_hayes_esp_config))
492 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
494 printf_unfiltered (_("Process record and replay target doesn't "
495 "support ioctl request TIOCSERGSTRUCT\n"));
500 printf_unfiltered (_("Process record and replay target doesn't "
501 "support ioctl request 0x%s.\n"),
502 OUTPUT_REG (tmpulongest, tdep->arg2));
509 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
511 if (tmpulongest == tdep->fcntl_F_GETLK)
513 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_flock))
518 case gdb_sys_ni_syscall56:
519 case gdb_sys_setpgid:
520 case gdb_sys_ni_syscall58:
523 case gdb_sys_olduname:
524 if (record_mem_at_reg (regcache, tdep->arg1,
525 tdep->size_oldold_utsname))
534 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_ustat))
539 case gdb_sys_getppid:
540 case gdb_sys_getpgrp:
544 case gdb_sys_sigaction:
545 if (record_mem_at_reg (regcache, tdep->arg3,
546 tdep->size_old_sigaction))
550 case gdb_sys_sgetmask:
551 case gdb_sys_ssetmask:
552 case gdb_sys_setreuid16:
553 case gdb_sys_setregid16:
554 case gdb_sys_sigsuspend:
557 case gdb_sys_sigpending:
558 if (record_mem_at_reg (regcache, tdep->arg1,
559 tdep->size_old_sigset_t))
563 case gdb_sys_sethostname:
564 case gdb_sys_setrlimit:
567 case gdb_sys_old_getrlimit:
568 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
572 case gdb_sys_getrusage:
573 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rusage))
577 case gdb_sys_gettimeofday:
578 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timeval)
579 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_timezone))
583 case gdb_sys_settimeofday:
586 case gdb_sys_getgroups16:
587 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
592 regcache_raw_read_unsigned (regcache, tdep->arg1,
594 tmpint = tdep->size_old_gid_t * (int) gidsetsize;
595 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
600 case gdb_sys_setgroups16:
605 unsigned long sz_sel_arg = tdep->size_long + tdep->size_pointer * 4;
606 gdb_byte *a = (gdb_byte *) alloca (sz_sel_arg);
607 CORE_ADDR inp, outp, exp, tvp;
609 regcache_raw_read_unsigned (regcache, tdep->arg1,
613 if (target_read_memory (tmpulongest, a, sz_sel_arg))
616 fprintf_unfiltered (gdb_stdlog,
617 "Process record: error reading memory "
618 "at addr = 0x%s len = %lu.\n",
619 OUTPUT_REG (tmpulongest, tdep->arg1),
624 a += tdep->size_long;
625 inp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
626 a += tdep->size_pointer;
627 outp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
628 a += tdep->size_pointer;
629 exp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
630 a += tdep->size_pointer;
631 tvp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
633 if (record_full_arch_list_add_mem (inp, tdep->size_fd_set))
636 if (record_full_arch_list_add_mem (outp, tdep->size_fd_set))
639 if (record_full_arch_list_add_mem (exp, tdep->size_fd_set))
642 if (record_full_arch_list_add_mem (tvp, tdep->size_timeval))
648 case gdb_sys_symlink:
656 if (yquery (_("The next instruction is syscall reboot. "
657 "It will restart the computer. "
658 "Do you want to stop the program?")))
662 case gdb_old_readdir:
663 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_old_dirent))
674 regcache_raw_read_unsigned (regcache, tdep->arg1,
676 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
677 if (record_full_memory_query)
680 The next instruction is syscall munmap.\n\
681 It will free the memory addr = 0x%s len = %u.\n\
682 It will make record target cannot record some memory change.\n\
683 Do you want to stop the program?"),
684 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len))
690 case gdb_sys_truncate:
691 case gdb_sys_ftruncate:
693 case gdb_sys_fchown16:
694 case gdb_sys_getpriority:
695 case gdb_sys_setpriority:
696 case gdb_sys_ni_syscall98:
700 case gdb_sys_fstatfs:
701 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_statfs))
710 case gdb_sys_sendmsg:
711 case gdb_sys_shutdown:
713 case gdb_sys_connect:
715 case gdb_sys_setsockopt:
719 case gdb_sys_getsockname:
720 case gdb_sys_getpeername:
724 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
725 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
726 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
731 case gdb_sys_recvfrom:
735 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
736 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
737 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
742 case gdb_sys_recvmsg:
743 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
744 if (record_linux_msghdr (regcache, tdep, tmpulongest))
748 case gdb_sys_socketpair:
749 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
753 case gdb_sys_getsockopt:
754 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
758 gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
760 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
764 fprintf_unfiltered (gdb_stdlog,
765 "Process record: error reading "
766 "memory at addr = 0x%s "
768 OUTPUT_REG (tmpulongest, tdep->arg5),
772 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
773 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
775 if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
777 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
783 case gdb_sys_socketcall:
784 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
787 case RECORD_SYS_SOCKET:
788 case RECORD_SYS_BIND:
789 case RECORD_SYS_CONNECT:
790 case RECORD_SYS_LISTEN:
792 case RECORD_SYS_ACCEPT:
793 case RECORD_SYS_GETSOCKNAME:
794 case RECORD_SYS_GETPEERNAME:
796 regcache_raw_read_unsigned (regcache, tdep->arg2,
800 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
803 tmpulongest += tdep->size_ulong;
804 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
805 tdep->size_ulong * 2))
808 fprintf_unfiltered (gdb_stdlog,
809 "Process record: error reading "
810 "memory at addr = 0x%s len = %d.\n",
811 OUTPUT_REG (tmpulongest, tdep->arg2),
812 tdep->size_ulong * 2);
815 tmpulongest = extract_unsigned_integer (a,
818 len = extract_unsigned_integer (a + tdep->size_ulong,
819 tdep->size_ulong, byte_order);
820 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
826 case RECORD_SYS_SOCKETPAIR:
828 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
830 regcache_raw_read_unsigned (regcache, tdep->arg2,
834 tmpulongest += tdep->size_ulong * 3;
835 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
839 fprintf_unfiltered (gdb_stdlog,
840 "Process record: error reading "
841 "memory at addr = 0x%s len = %d.\n",
842 OUTPUT_REG (tmpulongest, tdep->arg2),
847 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
849 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
854 case RECORD_SYS_SEND:
855 case RECORD_SYS_SENDTO:
857 case RECORD_SYS_RECVFROM:
858 regcache_raw_read_unsigned (regcache, tdep->arg2,
862 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
865 tmpulongest += tdep->size_ulong * 4;
866 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
867 tdep->size_ulong * 2))
870 fprintf_unfiltered (gdb_stdlog,
871 "Process record: error reading "
872 "memory at addr = 0x%s len = %d.\n",
873 OUTPUT_REG (tmpulongest, tdep->arg2),
874 tdep->size_ulong * 2);
877 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
879 len = extract_unsigned_integer (a + tdep->size_ulong,
880 tdep->size_ulong, byte_order);
881 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
884 case RECORD_SYS_RECV:
885 regcache_raw_read_unsigned (regcache, tdep->arg2,
889 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
891 tmpulongest += tdep->size_ulong;
892 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
896 fprintf_unfiltered (gdb_stdlog,
897 "Process record: error reading "
898 "memory at addr = 0x%s len = %d.\n",
899 OUTPUT_REG (tmpulongest, tdep->arg2),
903 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
907 a += tdep->size_ulong;
908 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
910 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
916 case RECORD_SYS_SHUTDOWN:
917 case RECORD_SYS_SETSOCKOPT:
919 case RECORD_SYS_GETSOCKOPT:
921 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
922 gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
924 regcache_raw_read_unsigned (regcache, tdep->arg2,
928 tmpulongest += tdep->size_ulong * 3;
929 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
930 tdep->size_ulong * 2))
933 fprintf_unfiltered (gdb_stdlog,
934 "Process record: error reading "
935 "memory at addr = 0x%s len = %d.\n",
936 OUTPUT_REG (tmpulongest, tdep->arg2),
937 tdep->size_ulong * 2);
940 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
945 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
949 fprintf_unfiltered (gdb_stdlog,
950 "Process record: error reading "
951 "memory at addr = 0x%s "
953 phex_nz (tmpulongest,
959 = (CORE_ADDR) extract_unsigned_integer (a,
962 tmpint = (int) extract_unsigned_integer (av,
965 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
967 a += tdep->size_ulong;
969 = (CORE_ADDR) extract_unsigned_integer (a,
972 if (record_full_arch_list_add_mem (tmpaddr,
979 case RECORD_SYS_SENDMSG:
981 case RECORD_SYS_RECVMSG:
983 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
985 regcache_raw_read_unsigned (regcache, tdep->arg2,
989 tmpulongest += tdep->size_ulong;
990 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
994 fprintf_unfiltered (gdb_stdlog,
995 "Process record: error reading "
996 "memory at addr = 0x%s len = %d.\n",
997 OUTPUT_REG (tmpulongest, tdep->arg2),
1001 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1003 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1009 printf_unfiltered (_("Process record and replay target "
1010 "doesn't support socketcall call 0x%s\n"),
1011 OUTPUT_REG (tmpulongest, tdep->arg1));
1017 case gdb_sys_syslog:
1020 case gdb_sys_setitimer:
1021 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_itimerval))
1025 case gdb_sys_getitimer:
1026 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerval))
1030 case gdb_sys_newstat:
1031 case gdb_sys_newlstat:
1032 case gdb_sys_newfstat:
1033 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat))
1037 case gdb_sys_newfstatat:
1038 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1039 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1045 if (record_mem_at_reg (regcache, tdep->arg1,
1046 tdep->size_old_utsname))
1051 case gdb_sys_vhangup:
1052 case gdb_sys_ni_syscall112:
1053 case gdb_sys_vm86old:
1057 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
1058 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_rusage))
1062 case gdb_sys_swapoff:
1065 case gdb_sys_sysinfo:
1066 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_sysinfo))
1070 case gdb_sys_shmget:
1071 case gdb_sys_semget:
1073 case gdb_sys_msgget:
1074 /* XXX maybe need do some record works with sys_shmdt. */
1076 case gdb_sys_msgsnd:
1077 case gdb_sys_semtimedop:
1081 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_ulong))
1085 case gdb_sys_shmctl:
1086 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_shmid_ds))
1090 /* XXX sys_semctl 525 still not supported. */
1093 case gdb_sys_msgrcv:
1097 regcache_raw_read_signed (regcache, tdep->arg3, &l);
1098 tmpint = l + tdep->size_long;
1099 if (record_mem_at_reg (regcache, tdep->arg2, tmpint))
1104 case gdb_sys_msgctl:
1105 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_msqid_ds))
1110 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1111 tmpulongest &= 0xffff;
1112 switch (tmpulongest)
1116 case RECORD_SEMTIMEDOP:
1119 /* XXX maybe need do some record works with RECORD_SHMDT. */
1127 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1128 tmpint = (int) second + tdep->size_long;
1129 if (record_mem_at_reg (regcache, tdep->arg5, tmpint))
1134 if (record_mem_at_reg (regcache, tdep->arg5,
1135 tdep->size_msqid_ds))
1139 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_ulong))
1143 if (record_mem_at_reg (regcache, tdep->arg5,
1144 tdep->size_shmid_ds))
1148 /* XXX RECORD_SEMCTL still not supported. */
1149 printf_unfiltered (_("Process record and replay target doesn't "
1150 "support ipc number %s\n"),
1151 pulongest (tmpulongest));
1157 case gdb_sys_sigreturn:
1159 case gdb_sys_setdomainname:
1162 case gdb_sys_newuname:
1163 if (record_mem_at_reg (regcache, tdep->arg1,
1164 tdep->size_new_utsname))
1168 case gdb_sys_modify_ldt:
1169 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1170 if (tmpulongest == 0 || tmpulongest == 2)
1174 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1175 if (record_mem_at_reg (regcache, tdep->arg2, (int) bytecount))
1180 case gdb_sys_adjtimex:
1181 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timex))
1185 case gdb_sys_mprotect:
1188 case gdb_sys_sigprocmask:
1189 if (record_mem_at_reg (regcache, tdep->arg3,
1190 tdep->size_old_sigset_t))
1194 case gdb_sys_ni_syscall127:
1195 case gdb_sys_init_module:
1196 case gdb_sys_delete_module:
1197 case gdb_sys_ni_syscall130:
1200 case gdb_sys_quotactl:
1201 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1202 switch (tmpulongest)
1204 case RECORD_Q_GETFMT:
1206 if (record_mem_at_reg (regcache, tdep->arg4, 4))
1209 case RECORD_Q_GETINFO:
1210 if (record_mem_at_reg (regcache, tdep->arg4,
1211 tdep->size_mem_dqinfo))
1214 case RECORD_Q_GETQUOTA:
1215 if (record_mem_at_reg (regcache, tdep->arg4,
1216 tdep->size_if_dqblk))
1219 case RECORD_Q_XGETQSTAT:
1220 case RECORD_Q_XGETQUOTA:
1221 if (record_mem_at_reg (regcache, tdep->arg4,
1222 tdep->size_fs_quota_stat))
1228 case gdb_sys_getpgid:
1229 case gdb_sys_fchdir:
1230 case gdb_sys_bdflush:
1234 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1235 if (tmpulongest == 2)
1237 /*XXX the size of memory is not very clear. */
1238 if (record_mem_at_reg (regcache, tdep->arg3, 10))
1243 case gdb_sys_personality:
1244 case gdb_sys_ni_syscall137:
1245 case gdb_sys_setfsuid16:
1246 case gdb_sys_setfsgid16:
1249 case gdb_sys_llseek:
1250 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
1254 case gdb_sys_getdents:
1255 case gdb_sys_getdents64:
1256 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1257 if (record_mem_at_reg (regcache, tdep->arg2, tmpulongest))
1261 case gdb_sys_select:
1262 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_fd_set)
1263 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_fd_set)
1264 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_fd_set)
1265 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_timeval))
1277 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1280 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
1282 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1283 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1285 if (target_read_memory ((CORE_ADDR) vec, iov,
1289 fprintf_unfiltered (gdb_stdlog,
1290 "Process record: error reading "
1291 "memory at addr = 0x%s len = %d.\n",
1292 OUTPUT_REG (vec, tdep->arg2),
1297 = (CORE_ADDR) extract_unsigned_integer (iov,
1301 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1304 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1306 vec += tdep->size_iovec;
1312 case gdb_sys_writev:
1313 case gdb_sys_getsid:
1314 case gdb_sys_fdatasync:
1315 case gdb_sys_sysctl:
1317 case gdb_sys_munlock:
1318 case gdb_sys_mlockall:
1319 case gdb_sys_munlockall:
1320 case gdb_sys_sched_setparam:
1323 case gdb_sys_sched_getparam:
1324 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
1328 case gdb_sys_sched_setscheduler:
1329 case gdb_sys_sched_getscheduler:
1330 case gdb_sys_sched_yield:
1331 case gdb_sys_sched_get_priority_max:
1332 case gdb_sys_sched_get_priority_min:
1335 case gdb_sys_sched_rr_get_interval:
1336 case gdb_sys_nanosleep:
1337 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1341 case gdb_sys_mremap:
1342 case gdb_sys_setresuid16:
1345 case gdb_sys_getresuid16:
1346 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_uid_t)
1347 || record_mem_at_reg (regcache, tdep->arg2,
1348 tdep->size_old_uid_t)
1349 || record_mem_at_reg (regcache, tdep->arg3,
1350 tdep->size_old_uid_t))
1355 case gdb_sys_ni_syscall167:
1359 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1364 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1365 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1366 tdep->size_pollfd * nfds))
1371 case gdb_sys_nfsservctl:
1372 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1373 if (tmpulongest == 7 || tmpulongest == 8)
1377 if (tmpulongest == 7)
1378 rsize = tdep->size_NFS_FHSIZE;
1380 rsize = tdep->size_knfsd_fh;
1381 if (record_mem_at_reg (regcache, tdep->arg3, rsize))
1386 case gdb_sys_setresgid16:
1389 case gdb_sys_getresgid16:
1390 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_gid_t)
1391 || record_mem_at_reg (regcache, tdep->arg2,
1392 tdep->size_old_gid_t)
1393 || record_mem_at_reg (regcache, tdep->arg3,
1394 tdep->size_old_gid_t))
1399 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1400 switch (tmpulongest)
1403 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
1407 if (record_mem_at_reg (regcache, tdep->arg2,
1408 tdep->size_TASK_COMM_LEN))
1414 case gdb_sys_rt_sigreturn:
1417 case gdb_sys_rt_sigaction:
1418 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigaction))
1422 case gdb_sys_rt_sigprocmask:
1423 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigset_t))
1427 case gdb_sys_rt_sigpending:
1428 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1431 ULONGEST sigsetsize;
1433 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1434 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1440 case gdb_sys_rt_sigtimedwait:
1441 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_siginfo_t))
1445 case gdb_sys_rt_sigqueueinfo:
1446 case gdb_sys_rt_sigsuspend:
1449 case gdb_sys_pread64:
1450 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1455 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1456 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1462 case gdb_sys_pwrite64:
1463 case gdb_sys_chown16:
1466 case gdb_sys_getcwd:
1467 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1472 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1473 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1479 case gdb_sys_capget:
1480 if (record_mem_at_reg (regcache, tdep->arg2,
1481 tdep->size_cap_user_data_t))
1485 case gdb_sys_capset:
1488 case gdb_sys_sigaltstack:
1489 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stack_t))
1493 case gdb_sys_sendfile:
1494 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_off_t))
1498 case gdb_sys_ni_syscall188:
1499 case gdb_sys_ni_syscall189:
1503 case gdb_sys_getrlimit:
1504 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
1511 case gdb_sys_truncate64:
1512 case gdb_sys_ftruncate64:
1515 case gdb_sys_stat64:
1516 case gdb_sys_lstat64:
1517 case gdb_sys_fstat64:
1518 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat64))
1522 case gdb_sys_lchown:
1523 case gdb_sys_getuid:
1524 case gdb_sys_getgid:
1525 case gdb_sys_geteuid:
1526 case gdb_sys_getegid:
1527 case gdb_sys_setreuid:
1528 case gdb_sys_setregid:
1531 case gdb_sys_getgroups:
1532 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1535 ULONGEST gidsetsize;
1537 regcache_raw_read_unsigned (regcache, tdep->arg1,
1539 tmpint = tdep->size_gid_t * (int) gidsetsize;
1540 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1545 case gdb_sys_setgroups:
1546 case gdb_sys_fchown:
1547 case gdb_sys_setresuid:
1550 case gdb_sys_getresuid:
1551 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_uid_t)
1552 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_uid_t)
1553 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_uid_t))
1557 case gdb_sys_setresgid:
1560 case gdb_sys_getresgid:
1561 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_gid_t)
1562 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_gid_t)
1563 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_gid_t))
1568 case gdb_sys_setuid:
1569 case gdb_sys_setgid:
1570 case gdb_sys_setfsuid:
1571 case gdb_sys_setfsgid:
1572 case gdb_sys_pivot_root:
1575 case gdb_sys_mincore:
1576 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_PAGE_SIZE))
1580 case gdb_sys_madvise:
1583 case gdb_sys_fcntl64:
1584 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1585 if (tmpulongest == tdep->fcntl_F_GETLK64)
1587 if (record_mem_at_reg (regcache, tdep->arg3,
1588 tdep->size_flock64))
1591 else if (tmpulongest != tdep->fcntl_F_SETLK64
1592 && tmpulongest != tdep->fcntl_F_SETLKW64)
1598 case gdb_sys_ni_syscall222:
1599 case gdb_sys_ni_syscall223:
1600 case gdb_sys_gettid:
1601 case gdb_sys_readahead:
1602 case gdb_sys_setxattr:
1603 case gdb_sys_lsetxattr:
1604 case gdb_sys_fsetxattr:
1607 case gdb_sys_getxattr:
1608 case gdb_sys_lgetxattr:
1609 case gdb_sys_fgetxattr:
1610 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1615 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1616 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1622 case gdb_sys_listxattr:
1623 case gdb_sys_llistxattr:
1624 case gdb_sys_flistxattr:
1625 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1630 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1631 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1637 case gdb_sys_removexattr:
1638 case gdb_sys_lremovexattr:
1639 case gdb_sys_fremovexattr:
1643 case gdb_sys_sendfile64:
1644 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
1649 case gdb_sys_sched_setaffinity:
1652 case gdb_sys_sched_getaffinity:
1653 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1658 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1659 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1665 case gdb_sys_set_thread_area:
1666 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
1670 case gdb_sys_get_thread_area:
1671 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_user_desc))
1675 case gdb_sys_io_setup:
1676 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_long))
1680 case gdb_sys_io_destroy:
1683 case gdb_sys_io_getevents:
1684 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1689 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1690 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1691 nr * tdep->size_io_event))
1696 case gdb_sys_io_submit:
1697 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1703 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1704 iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
1705 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1706 nr * tdep->size_pointer))
1709 fprintf_unfiltered (gdb_stdlog,
1710 "Process record: error reading memory "
1711 "at addr = 0x%s len = %u.\n",
1712 OUTPUT_REG (tmpulongest, tdep->arg2),
1713 (int) (nr * tdep->size_pointer));
1716 for (i = 0; i < nr; i++)
1719 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1722 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1724 iocbp += tdep->size_pointer;
1729 case gdb_sys_io_cancel:
1730 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_io_event))
1734 case gdb_sys_fadvise64:
1735 case gdb_sys_ni_syscall251:
1738 case gdb_sys_exit_group:
1739 if (yquery (_("The next instruction is syscall exit_group. "
1740 "It will make the program exit. "
1741 "Do you want to stop the program?")))
1745 case gdb_sys_lookup_dcookie:
1746 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1751 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1752 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1758 case gdb_sys_epoll_create:
1759 case gdb_sys_epoll_ctl:
1762 case gdb_sys_epoll_wait:
1763 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1768 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1769 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1771 * tdep->size_epoll_event)))
1776 case gdb_sys_remap_file_pages:
1777 case gdb_sys_set_tid_address:
1780 case gdb_sys_timer_create:
1781 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
1785 case gdb_sys_timer_settime:
1786 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_itimerspec))
1790 case gdb_sys_timer_gettime:
1791 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerspec))
1795 case gdb_sys_timer_getoverrun:
1796 case gdb_sys_timer_delete:
1797 case gdb_sys_clock_settime:
1800 case gdb_sys_clock_gettime:
1801 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1805 case gdb_sys_clock_getres:
1806 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1810 case gdb_sys_clock_nanosleep:
1811 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_timespec))
1815 case gdb_sys_statfs64:
1816 case gdb_sys_fstatfs64:
1817 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_statfs64))
1821 case gdb_sys_tgkill:
1822 case gdb_sys_utimes:
1823 case gdb_sys_fadvise64_64:
1824 case gdb_sys_ni_syscall273:
1828 case gdb_sys_get_mempolicy:
1829 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
1831 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1836 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
1837 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1838 maxnode * tdep->size_long))
1843 case gdb_sys_set_mempolicy:
1844 case gdb_sys_mq_open:
1845 case gdb_sys_mq_unlink:
1846 case gdb_sys_mq_timedsend:
1849 case gdb_sys_mq_timedreceive:
1850 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1855 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
1856 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1860 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
1864 case gdb_sys_mq_notify:
1867 case gdb_sys_mq_getsetattr:
1868 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_mq_attr))
1872 case gdb_sys_kexec_load:
1875 case gdb_sys_waitid:
1876 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_siginfo_t)
1877 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_rusage))
1881 case gdb_sys_ni_syscall285:
1882 case gdb_sys_add_key:
1883 case gdb_sys_request_key:
1886 case gdb_sys_keyctl:
1887 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1888 if (tmpulongest == 6 || tmpulongest == 11)
1890 regcache_raw_read_unsigned (regcache, tdep->arg3,
1896 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
1897 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1904 case gdb_sys_ioprio_set:
1905 case gdb_sys_ioprio_get:
1906 case gdb_sys_inotify_init:
1907 case gdb_sys_inotify_add_watch:
1908 case gdb_sys_inotify_rm_watch:
1909 case gdb_sys_migrate_pages:
1910 case gdb_sys_openat:
1911 case gdb_sys_mkdirat:
1912 case gdb_sys_mknodat:
1913 case gdb_sys_fchownat:
1914 case gdb_sys_futimesat:
1917 case gdb_sys_fstatat64:
1918 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_stat64))
1922 case gdb_sys_unlinkat:
1923 case gdb_sys_renameat:
1924 case gdb_sys_linkat:
1925 case gdb_sys_symlinkat:
1928 case gdb_sys_readlinkat:
1929 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1934 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
1935 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1941 case gdb_sys_fchmodat:
1942 case gdb_sys_faccessat:
1945 case gdb_sys_pselect6:
1946 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_fd_set)
1947 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_fd_set)
1948 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_fd_set)
1949 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_timespec))
1954 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1959 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1960 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1961 tdep->size_pollfd * nfds))
1964 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_timespec))
1968 case gdb_sys_unshare:
1969 case gdb_sys_set_robust_list:
1972 case gdb_sys_get_robust_list:
1973 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
1974 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
1978 case gdb_sys_splice:
1979 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_loff_t)
1980 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
1984 case gdb_sys_sync_file_range:
1986 case gdb_sys_vmsplice:
1989 case gdb_sys_move_pages:
1990 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
1995 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
1996 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1997 nr_pages * tdep->size_int))
2002 case gdb_sys_getcpu:
2003 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int)
2004 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
2005 || record_mem_at_reg (regcache, tdep->arg3,
2006 tdep->size_ulong * 2))
2010 case gdb_sys_epoll_pwait:
2011 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2016 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2017 tmpint = (int) maxevents * tdep->size_epoll_event;
2018 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2023 case gdb_sys_fallocate:
2024 case gdb_sys_eventfd2:
2025 case gdb_sys_epoll_create1:
2029 case gdb_sys_inotify_init1:
2033 printf_unfiltered (_("Process record and replay target doesn't "
2034 "support syscall number %d\n"), syscall);