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:
260 target_terminal_ours ();
261 q = yquery (_("The next instruction is syscall exit. "
262 "It will make the program exit. "
263 "Do you want to stop the program?"));
264 target_terminal_inferior ();
274 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
275 if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
284 case gdb_sys_waitpid:
285 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
287 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
300 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
302 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
309 case gdb_sys_lchown16:
310 case gdb_sys_ni_syscall17:
316 if (record_mem_at_reg (regcache, tdep->arg2,
317 tdep->size__old_kernel_stat))
324 case gdb_sys_oldumount:
325 case gdb_sys_setuid16:
326 case gdb_sys_getuid16:
331 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
332 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
333 || tmpulongest == RECORD_PTRACE_PEEKDATA
334 || tmpulongest == RECORD_PTRACE_PEEKUSR)
336 if (record_mem_at_reg (regcache, tdep->arg4, 4))
344 case gdb_sys_ni_syscall31:
345 case gdb_sys_ni_syscall32:
348 case gdb_sys_ni_syscall35:
358 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
363 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_tms))
367 case gdb_sys_ni_syscall44:
369 case gdb_sys_setgid16:
370 case gdb_sys_getgid16:
372 case gdb_sys_geteuid16:
373 case gdb_sys_getegid16:
376 case gdb_sys_ni_syscall53:
380 /* XXX Need to add a lot of support of other ioctl requests. */
381 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
382 if (tmpulongest == tdep->ioctl_FIOCLEX
383 || tmpulongest == tdep->ioctl_FIONCLEX
384 || tmpulongest == tdep->ioctl_FIONBIO
385 || tmpulongest == tdep->ioctl_FIOASYNC
386 || tmpulongest == tdep->ioctl_TCSETS
387 || tmpulongest == tdep->ioctl_TCSETSW
388 || tmpulongest == tdep->ioctl_TCSETSF
389 || tmpulongest == tdep->ioctl_TCSETA
390 || tmpulongest == tdep->ioctl_TCSETAW
391 || tmpulongest == tdep->ioctl_TCSETAF
392 || tmpulongest == tdep->ioctl_TCSBRK
393 || tmpulongest == tdep->ioctl_TCXONC
394 || tmpulongest == tdep->ioctl_TCFLSH
395 || tmpulongest == tdep->ioctl_TIOCEXCL
396 || tmpulongest == tdep->ioctl_TIOCNXCL
397 || tmpulongest == tdep->ioctl_TIOCSCTTY
398 || tmpulongest == tdep->ioctl_TIOCSPGRP
399 || tmpulongest == tdep->ioctl_TIOCSTI
400 || tmpulongest == tdep->ioctl_TIOCSWINSZ
401 || tmpulongest == tdep->ioctl_TIOCMBIS
402 || tmpulongest == tdep->ioctl_TIOCMBIC
403 || tmpulongest == tdep->ioctl_TIOCMSET
404 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
405 || tmpulongest == tdep->ioctl_TIOCCONS
406 || tmpulongest == tdep->ioctl_TIOCSSERIAL
407 || tmpulongest == tdep->ioctl_TIOCPKT
408 || tmpulongest == tdep->ioctl_TIOCNOTTY
409 || tmpulongest == tdep->ioctl_TIOCSETD
410 || tmpulongest == tdep->ioctl_TCSBRKP
411 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
412 || tmpulongest == tdep->ioctl_TIOCSBRK
413 || tmpulongest == tdep->ioctl_TIOCCBRK
414 || tmpulongest == tdep->ioctl_TCSETS2
415 || tmpulongest == tdep->ioctl_TCSETSW2
416 || tmpulongest == tdep->ioctl_TCSETSF2
417 || tmpulongest == tdep->ioctl_TIOCSPTLCK
418 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
419 || tmpulongest == tdep->ioctl_TIOCSERGWILD
420 || tmpulongest == tdep->ioctl_TIOCSERSWILD
421 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
422 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
423 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
424 || tmpulongest == tdep->ioctl_TIOCMIWAIT
425 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
429 else if (tmpulongest == tdep->ioctl_TCGETS
430 || tmpulongest == tdep->ioctl_TCGETA
431 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
433 if (record_mem_at_reg (regcache, tdep->arg3,
437 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
438 || tmpulongest == tdep->ioctl_TIOCGSID)
440 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_pid_t))
443 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
444 || tmpulongest == tdep->ioctl_TIOCMGET
445 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
446 || tmpulongest == tdep->ioctl_FIONREAD
447 || tmpulongest == tdep->ioctl_TIOCINQ
448 || tmpulongest == tdep->ioctl_TIOCGETD
449 || tmpulongest == tdep->ioctl_TIOCGPTN
450 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
452 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
455 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
457 if (record_mem_at_reg (regcache, tdep->arg3,
461 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
463 /* This syscall affects a char-size memory. */
464 if (record_mem_at_reg (regcache, tdep->arg3, 1))
467 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
469 if (record_mem_at_reg (regcache, tdep->arg3,
470 tdep->size_serial_struct))
473 else if (tmpulongest == tdep->ioctl_TCGETS2)
475 if (record_mem_at_reg (regcache, tdep->arg3,
476 tdep->size_termios2))
479 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
481 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
484 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
486 if (record_mem_at_reg (regcache, tdep->arg3,
487 tdep->size_serial_icounter_struct))
490 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
492 if (record_mem_at_reg (regcache, tdep->arg3,
493 tdep->size_hayes_esp_config))
496 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
498 printf_unfiltered (_("Process record and replay target doesn't "
499 "support ioctl request TIOCSERGSTRUCT\n"));
504 printf_unfiltered (_("Process record and replay target doesn't "
505 "support ioctl request 0x%s.\n"),
506 OUTPUT_REG (tmpulongest, tdep->arg2));
513 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
515 if (tmpulongest == tdep->fcntl_F_GETLK)
517 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_flock))
522 case gdb_sys_ni_syscall56:
523 case gdb_sys_setpgid:
524 case gdb_sys_ni_syscall58:
527 case gdb_sys_olduname:
528 if (record_mem_at_reg (regcache, tdep->arg1,
529 tdep->size_oldold_utsname))
538 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_ustat))
543 case gdb_sys_getppid:
544 case gdb_sys_getpgrp:
548 case gdb_sys_sigaction:
549 if (record_mem_at_reg (regcache, tdep->arg3,
550 tdep->size_old_sigaction))
554 case gdb_sys_sgetmask:
555 case gdb_sys_ssetmask:
556 case gdb_sys_setreuid16:
557 case gdb_sys_setregid16:
558 case gdb_sys_sigsuspend:
561 case gdb_sys_sigpending:
562 if (record_mem_at_reg (regcache, tdep->arg1,
563 tdep->size_old_sigset_t))
567 case gdb_sys_sethostname:
568 case gdb_sys_setrlimit:
571 case gdb_sys_old_getrlimit:
572 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
576 case gdb_sys_getrusage:
577 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rusage))
581 case gdb_sys_gettimeofday:
582 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timeval)
583 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_timezone))
587 case gdb_sys_settimeofday:
590 case gdb_sys_getgroups16:
591 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
596 regcache_raw_read_unsigned (regcache, tdep->arg1,
598 tmpint = tdep->size_old_gid_t * (int) gidsetsize;
599 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
604 case gdb_sys_setgroups16:
609 unsigned long sz_sel_arg = tdep->size_long + tdep->size_pointer * 4;
610 gdb_byte *a = (gdb_byte *) alloca (sz_sel_arg);
611 CORE_ADDR inp, outp, exp, tvp;
613 regcache_raw_read_unsigned (regcache, tdep->arg1,
617 if (target_read_memory (tmpulongest, a, sz_sel_arg))
620 fprintf_unfiltered (gdb_stdlog,
621 "Process record: error reading memory "
622 "at addr = 0x%s len = %lu.\n",
623 OUTPUT_REG (tmpulongest, tdep->arg1),
628 a += tdep->size_long;
629 inp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
630 a += tdep->size_pointer;
631 outp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
632 a += tdep->size_pointer;
633 exp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
634 a += tdep->size_pointer;
635 tvp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
637 if (record_full_arch_list_add_mem (inp, tdep->size_fd_set))
640 if (record_full_arch_list_add_mem (outp, tdep->size_fd_set))
643 if (record_full_arch_list_add_mem (exp, tdep->size_fd_set))
646 if (record_full_arch_list_add_mem (tvp, tdep->size_timeval))
652 case gdb_sys_symlink:
655 case gdb_sys_readlink:
656 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
657 if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
669 target_terminal_ours ();
670 q = yquery (_("The next instruction is syscall reboot. "
671 "It will restart the computer. "
672 "Do you want to stop the program?"));
673 target_terminal_inferior ();
679 case gdb_old_readdir:
680 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_old_dirent))
691 regcache_raw_read_unsigned (regcache, tdep->arg1,
693 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
694 if (record_full_memory_query)
698 target_terminal_ours ();
700 The next instruction is syscall munmap.\n\
701 It will free the memory addr = 0x%s len = %u.\n\
702 It will make record target cannot record some memory change.\n\
703 Do you want to stop the program?"),
704 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
705 target_terminal_inferior ();
712 case gdb_sys_truncate:
713 case gdb_sys_ftruncate:
715 case gdb_sys_fchown16:
716 case gdb_sys_getpriority:
717 case gdb_sys_setpriority:
718 case gdb_sys_ni_syscall98:
722 case gdb_sys_fstatfs:
723 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_statfs))
732 case gdb_sys_sendmsg:
733 case gdb_sys_shutdown:
735 case gdb_sys_connect:
737 case gdb_sys_setsockopt:
741 case gdb_sys_getsockname:
742 case gdb_sys_getpeername:
746 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
747 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
748 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
753 case gdb_sys_recvfrom:
757 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
758 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
759 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
765 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
766 if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
770 case gdb_sys_recvmsg:
771 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
772 if (record_linux_msghdr (regcache, tdep, tmpulongest))
776 case gdb_sys_socketpair:
777 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
781 case gdb_sys_getsockopt:
782 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
786 gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
788 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
792 fprintf_unfiltered (gdb_stdlog,
793 "Process record: error reading "
794 "memory at addr = 0x%s "
796 OUTPUT_REG (tmpulongest, tdep->arg5),
800 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
801 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
803 if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
805 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
811 case gdb_sys_socketcall:
812 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
815 case RECORD_SYS_SOCKET:
816 case RECORD_SYS_BIND:
817 case RECORD_SYS_CONNECT:
818 case RECORD_SYS_LISTEN:
820 case RECORD_SYS_ACCEPT:
821 case RECORD_SYS_GETSOCKNAME:
822 case RECORD_SYS_GETPEERNAME:
824 regcache_raw_read_unsigned (regcache, tdep->arg2,
828 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
831 tmpulongest += tdep->size_ulong;
832 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
833 tdep->size_ulong * 2))
836 fprintf_unfiltered (gdb_stdlog,
837 "Process record: error reading "
838 "memory at addr = 0x%s len = %d.\n",
839 OUTPUT_REG (tmpulongest, tdep->arg2),
840 tdep->size_ulong * 2);
843 tmpulongest = extract_unsigned_integer (a,
846 len = extract_unsigned_integer (a + tdep->size_ulong,
847 tdep->size_ulong, byte_order);
848 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
854 case RECORD_SYS_SOCKETPAIR:
856 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
858 regcache_raw_read_unsigned (regcache, tdep->arg2,
862 tmpulongest += tdep->size_ulong * 3;
863 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
867 fprintf_unfiltered (gdb_stdlog,
868 "Process record: error reading "
869 "memory at addr = 0x%s len = %d.\n",
870 OUTPUT_REG (tmpulongest, tdep->arg2),
875 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
877 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
882 case RECORD_SYS_SEND:
883 case RECORD_SYS_SENDTO:
885 case RECORD_SYS_RECVFROM:
886 regcache_raw_read_unsigned (regcache, tdep->arg2,
890 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
893 tmpulongest += tdep->size_ulong * 4;
894 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
895 tdep->size_ulong * 2))
898 fprintf_unfiltered (gdb_stdlog,
899 "Process record: error reading "
900 "memory at addr = 0x%s len = %d.\n",
901 OUTPUT_REG (tmpulongest, tdep->arg2),
902 tdep->size_ulong * 2);
905 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
907 len = extract_unsigned_integer (a + tdep->size_ulong,
908 tdep->size_ulong, byte_order);
909 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
912 case RECORD_SYS_RECV:
913 regcache_raw_read_unsigned (regcache, tdep->arg2,
917 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
919 tmpulongest += tdep->size_ulong;
920 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
924 fprintf_unfiltered (gdb_stdlog,
925 "Process record: error reading "
926 "memory at addr = 0x%s len = %d.\n",
927 OUTPUT_REG (tmpulongest, tdep->arg2),
931 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
935 a += tdep->size_ulong;
936 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
938 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
944 case RECORD_SYS_SHUTDOWN:
945 case RECORD_SYS_SETSOCKOPT:
947 case RECORD_SYS_GETSOCKOPT:
949 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
950 gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
952 regcache_raw_read_unsigned (regcache, tdep->arg2,
956 tmpulongest += tdep->size_ulong * 3;
957 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
958 tdep->size_ulong * 2))
961 fprintf_unfiltered (gdb_stdlog,
962 "Process record: error reading "
963 "memory at addr = 0x%s len = %d.\n",
964 OUTPUT_REG (tmpulongest, tdep->arg2),
965 tdep->size_ulong * 2);
968 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
973 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
977 fprintf_unfiltered (gdb_stdlog,
978 "Process record: error reading "
979 "memory at addr = 0x%s "
981 phex_nz (tmpulongest,
987 = (CORE_ADDR) extract_unsigned_integer (a,
990 tmpint = (int) extract_unsigned_integer (av,
993 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
995 a += tdep->size_ulong;
997 = (CORE_ADDR) extract_unsigned_integer (a,
1000 if (record_full_arch_list_add_mem (tmpaddr,
1007 case RECORD_SYS_SENDMSG:
1009 case RECORD_SYS_RECVMSG:
1011 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
1013 regcache_raw_read_unsigned (regcache, tdep->arg2,
1017 tmpulongest += tdep->size_ulong;
1018 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1022 fprintf_unfiltered (gdb_stdlog,
1023 "Process record: error reading "
1024 "memory at addr = 0x%s len = %d.\n",
1025 OUTPUT_REG (tmpulongest, tdep->arg2),
1029 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1031 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1037 printf_unfiltered (_("Process record and replay target "
1038 "doesn't support socketcall call 0x%s\n"),
1039 OUTPUT_REG (tmpulongest, tdep->arg1));
1045 case gdb_sys_syslog:
1048 case gdb_sys_setitimer:
1049 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_itimerval))
1053 case gdb_sys_getitimer:
1054 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerval))
1058 case gdb_sys_newstat:
1059 case gdb_sys_newlstat:
1060 case gdb_sys_newfstat:
1061 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat))
1065 case gdb_sys_newfstatat:
1066 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1067 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1073 if (record_mem_at_reg (regcache, tdep->arg1,
1074 tdep->size_old_utsname))
1079 case gdb_sys_vhangup:
1080 case gdb_sys_ni_syscall112:
1081 case gdb_sys_vm86old:
1085 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
1086 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_rusage))
1090 case gdb_sys_swapoff:
1093 case gdb_sys_sysinfo:
1094 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_sysinfo))
1098 case gdb_sys_shmget:
1099 case gdb_sys_semget:
1101 case gdb_sys_msgget:
1102 /* XXX maybe need do some record works with sys_shmdt. */
1104 case gdb_sys_msgsnd:
1105 case gdb_sys_semtimedop:
1109 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_ulong))
1113 case gdb_sys_shmctl:
1114 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_shmid_ds))
1118 /* XXX sys_semctl 525 still not supported. */
1121 case gdb_sys_msgrcv:
1125 regcache_raw_read_signed (regcache, tdep->arg3, &l);
1126 tmpint = l + tdep->size_long;
1127 if (record_mem_at_reg (regcache, tdep->arg2, tmpint))
1132 case gdb_sys_msgctl:
1133 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_msqid_ds))
1138 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1139 tmpulongest &= 0xffff;
1140 switch (tmpulongest)
1144 case RECORD_SEMTIMEDOP:
1147 /* XXX maybe need do some record works with RECORD_SHMDT. */
1155 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1156 tmpint = (int) second + tdep->size_long;
1157 if (record_mem_at_reg (regcache, tdep->arg5, tmpint))
1162 if (record_mem_at_reg (regcache, tdep->arg5,
1163 tdep->size_msqid_ds))
1167 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_ulong))
1171 if (record_mem_at_reg (regcache, tdep->arg5,
1172 tdep->size_shmid_ds))
1176 /* XXX RECORD_SEMCTL still not supported. */
1177 printf_unfiltered (_("Process record and replay target doesn't "
1178 "support ipc number %s\n"),
1179 pulongest (tmpulongest));
1185 case gdb_sys_sigreturn:
1187 case gdb_sys_setdomainname:
1190 case gdb_sys_newuname:
1191 if (record_mem_at_reg (regcache, tdep->arg1,
1192 tdep->size_new_utsname))
1196 case gdb_sys_modify_ldt:
1197 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1198 if (tmpulongest == 0 || tmpulongest == 2)
1202 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1203 if (record_mem_at_reg (regcache, tdep->arg2, (int) bytecount))
1208 case gdb_sys_adjtimex:
1209 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timex))
1213 case gdb_sys_mprotect:
1216 case gdb_sys_sigprocmask:
1217 if (record_mem_at_reg (regcache, tdep->arg3,
1218 tdep->size_old_sigset_t))
1222 case gdb_sys_ni_syscall127:
1223 case gdb_sys_init_module:
1224 case gdb_sys_delete_module:
1225 case gdb_sys_ni_syscall130:
1228 case gdb_sys_quotactl:
1229 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1230 switch (tmpulongest)
1232 case RECORD_Q_GETFMT:
1234 if (record_mem_at_reg (regcache, tdep->arg4, 4))
1237 case RECORD_Q_GETINFO:
1238 if (record_mem_at_reg (regcache, tdep->arg4,
1239 tdep->size_mem_dqinfo))
1242 case RECORD_Q_GETQUOTA:
1243 if (record_mem_at_reg (regcache, tdep->arg4,
1244 tdep->size_if_dqblk))
1247 case RECORD_Q_XGETQSTAT:
1248 case RECORD_Q_XGETQUOTA:
1249 if (record_mem_at_reg (regcache, tdep->arg4,
1250 tdep->size_fs_quota_stat))
1256 case gdb_sys_getpgid:
1257 case gdb_sys_fchdir:
1258 case gdb_sys_bdflush:
1262 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1263 if (tmpulongest == 2)
1265 /*XXX the size of memory is not very clear. */
1266 if (record_mem_at_reg (regcache, tdep->arg3, 10))
1271 case gdb_sys_personality:
1272 case gdb_sys_ni_syscall137:
1273 case gdb_sys_setfsuid16:
1274 case gdb_sys_setfsgid16:
1277 case gdb_sys_llseek:
1278 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
1282 case gdb_sys_getdents:
1283 case gdb_sys_getdents64:
1284 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1285 if (record_mem_at_reg (regcache, tdep->arg2, tmpulongest))
1289 case gdb_sys_select:
1290 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_fd_set)
1291 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_fd_set)
1292 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_fd_set)
1293 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_timeval))
1305 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1308 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
1310 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1311 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1313 if (target_read_memory ((CORE_ADDR) vec, iov,
1317 fprintf_unfiltered (gdb_stdlog,
1318 "Process record: error reading "
1319 "memory at addr = 0x%s len = %d.\n",
1320 OUTPUT_REG (vec, tdep->arg2),
1325 = (CORE_ADDR) extract_unsigned_integer (iov,
1329 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1332 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1334 vec += tdep->size_iovec;
1340 case gdb_sys_writev:
1341 case gdb_sys_getsid:
1342 case gdb_sys_fdatasync:
1343 case gdb_sys_sysctl:
1345 case gdb_sys_munlock:
1346 case gdb_sys_mlockall:
1347 case gdb_sys_munlockall:
1348 case gdb_sys_sched_setparam:
1351 case gdb_sys_sched_getparam:
1352 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
1356 case gdb_sys_sched_setscheduler:
1357 case gdb_sys_sched_getscheduler:
1358 case gdb_sys_sched_yield:
1359 case gdb_sys_sched_get_priority_max:
1360 case gdb_sys_sched_get_priority_min:
1363 case gdb_sys_sched_rr_get_interval:
1364 case gdb_sys_nanosleep:
1365 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1369 case gdb_sys_mremap:
1370 case gdb_sys_setresuid16:
1373 case gdb_sys_getresuid16:
1374 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_uid_t)
1375 || record_mem_at_reg (regcache, tdep->arg2,
1376 tdep->size_old_uid_t)
1377 || record_mem_at_reg (regcache, tdep->arg3,
1378 tdep->size_old_uid_t))
1383 case gdb_sys_ni_syscall167:
1387 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1392 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1393 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1394 tdep->size_pollfd * nfds))
1399 case gdb_sys_nfsservctl:
1400 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1401 if (tmpulongest == 7 || tmpulongest == 8)
1405 if (tmpulongest == 7)
1406 rsize = tdep->size_NFS_FHSIZE;
1408 rsize = tdep->size_knfsd_fh;
1409 if (record_mem_at_reg (regcache, tdep->arg3, rsize))
1414 case gdb_sys_setresgid16:
1417 case gdb_sys_getresgid16:
1418 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_gid_t)
1419 || record_mem_at_reg (regcache, tdep->arg2,
1420 tdep->size_old_gid_t)
1421 || record_mem_at_reg (regcache, tdep->arg3,
1422 tdep->size_old_gid_t))
1427 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1428 switch (tmpulongest)
1431 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
1435 if (record_mem_at_reg (regcache, tdep->arg2,
1436 tdep->size_TASK_COMM_LEN))
1442 case gdb_sys_rt_sigreturn:
1445 case gdb_sys_rt_sigaction:
1446 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigaction))
1450 case gdb_sys_rt_sigprocmask:
1451 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigset_t))
1455 case gdb_sys_rt_sigpending:
1456 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1459 ULONGEST sigsetsize;
1461 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1462 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1468 case gdb_sys_rt_sigtimedwait:
1469 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_siginfo_t))
1473 case gdb_sys_rt_sigqueueinfo:
1474 case gdb_sys_rt_sigsuspend:
1477 case gdb_sys_pread64:
1478 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1483 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1484 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1490 case gdb_sys_pwrite64:
1491 case gdb_sys_chown16:
1494 case gdb_sys_getcwd:
1495 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1500 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1501 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1507 case gdb_sys_capget:
1508 if (record_mem_at_reg (regcache, tdep->arg2,
1509 tdep->size_cap_user_data_t))
1513 case gdb_sys_capset:
1516 case gdb_sys_sigaltstack:
1517 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stack_t))
1521 case gdb_sys_sendfile:
1522 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_off_t))
1526 case gdb_sys_ni_syscall188:
1527 case gdb_sys_ni_syscall189:
1531 case gdb_sys_getrlimit:
1532 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
1539 case gdb_sys_truncate64:
1540 case gdb_sys_ftruncate64:
1543 case gdb_sys_stat64:
1544 case gdb_sys_lstat64:
1545 case gdb_sys_fstat64:
1546 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat64))
1550 case gdb_sys_lchown:
1551 case gdb_sys_getuid:
1552 case gdb_sys_getgid:
1553 case gdb_sys_geteuid:
1554 case gdb_sys_getegid:
1555 case gdb_sys_setreuid:
1556 case gdb_sys_setregid:
1559 case gdb_sys_getgroups:
1560 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1563 ULONGEST gidsetsize;
1565 regcache_raw_read_unsigned (regcache, tdep->arg1,
1567 tmpint = tdep->size_gid_t * (int) gidsetsize;
1568 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1573 case gdb_sys_setgroups:
1574 case gdb_sys_fchown:
1575 case gdb_sys_setresuid:
1578 case gdb_sys_getresuid:
1579 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_uid_t)
1580 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_uid_t)
1581 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_uid_t))
1585 case gdb_sys_setresgid:
1588 case gdb_sys_getresgid:
1589 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_gid_t)
1590 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_gid_t)
1591 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_gid_t))
1596 case gdb_sys_setuid:
1597 case gdb_sys_setgid:
1598 case gdb_sys_setfsuid:
1599 case gdb_sys_setfsgid:
1600 case gdb_sys_pivot_root:
1603 case gdb_sys_mincore:
1604 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_PAGE_SIZE))
1608 case gdb_sys_madvise:
1611 case gdb_sys_fcntl64:
1612 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1613 if (tmpulongest == tdep->fcntl_F_GETLK64)
1615 if (record_mem_at_reg (regcache, tdep->arg3,
1616 tdep->size_flock64))
1619 else if (tmpulongest != tdep->fcntl_F_SETLK64
1620 && tmpulongest != tdep->fcntl_F_SETLKW64)
1626 case gdb_sys_ni_syscall222:
1627 case gdb_sys_ni_syscall223:
1628 case gdb_sys_gettid:
1629 case gdb_sys_readahead:
1630 case gdb_sys_setxattr:
1631 case gdb_sys_lsetxattr:
1632 case gdb_sys_fsetxattr:
1635 case gdb_sys_getxattr:
1636 case gdb_sys_lgetxattr:
1637 case gdb_sys_fgetxattr:
1638 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1643 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1644 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1650 case gdb_sys_listxattr:
1651 case gdb_sys_llistxattr:
1652 case gdb_sys_flistxattr:
1653 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1658 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1659 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1665 case gdb_sys_removexattr:
1666 case gdb_sys_lremovexattr:
1667 case gdb_sys_fremovexattr:
1671 case gdb_sys_sendfile64:
1672 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
1677 case gdb_sys_sched_setaffinity:
1680 case gdb_sys_sched_getaffinity:
1681 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1686 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1687 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1693 case gdb_sys_set_thread_area:
1694 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
1698 case gdb_sys_get_thread_area:
1699 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_user_desc))
1703 case gdb_sys_io_setup:
1704 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_long))
1708 case gdb_sys_io_destroy:
1711 case gdb_sys_io_getevents:
1712 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1717 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1718 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1719 nr * tdep->size_io_event))
1724 case gdb_sys_io_submit:
1725 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1731 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1732 iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
1733 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1734 nr * tdep->size_pointer))
1737 fprintf_unfiltered (gdb_stdlog,
1738 "Process record: error reading memory "
1739 "at addr = 0x%s len = %u.\n",
1740 OUTPUT_REG (tmpulongest, tdep->arg2),
1741 (int) (nr * tdep->size_pointer));
1744 for (i = 0; i < nr; i++)
1747 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1750 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1752 iocbp += tdep->size_pointer;
1757 case gdb_sys_io_cancel:
1758 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_io_event))
1762 case gdb_sys_fadvise64:
1763 case gdb_sys_ni_syscall251:
1766 case gdb_sys_exit_group:
1770 target_terminal_ours ();
1771 q = yquery (_("The next instruction is syscall exit_group. "
1772 "It will make the program exit. "
1773 "Do you want to stop the program?"));
1774 target_terminal_inferior ();
1780 case gdb_sys_lookup_dcookie:
1781 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1786 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1787 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1793 case gdb_sys_epoll_create:
1794 case gdb_sys_epoll_ctl:
1797 case gdb_sys_epoll_wait:
1798 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1803 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1804 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1806 * tdep->size_epoll_event)))
1811 case gdb_sys_remap_file_pages:
1812 case gdb_sys_set_tid_address:
1815 case gdb_sys_timer_create:
1816 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
1820 case gdb_sys_timer_settime:
1821 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_itimerspec))
1825 case gdb_sys_timer_gettime:
1826 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerspec))
1830 case gdb_sys_timer_getoverrun:
1831 case gdb_sys_timer_delete:
1832 case gdb_sys_clock_settime:
1835 case gdb_sys_clock_gettime:
1836 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1840 case gdb_sys_clock_getres:
1841 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
1845 case gdb_sys_clock_nanosleep:
1846 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_timespec))
1850 case gdb_sys_statfs64:
1851 case gdb_sys_fstatfs64:
1852 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_statfs64))
1856 case gdb_sys_tgkill:
1857 case gdb_sys_utimes:
1858 case gdb_sys_fadvise64_64:
1859 case gdb_sys_ni_syscall273:
1863 case gdb_sys_get_mempolicy:
1864 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
1866 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1871 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
1872 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1873 maxnode * tdep->size_long))
1878 case gdb_sys_set_mempolicy:
1879 case gdb_sys_mq_open:
1880 case gdb_sys_mq_unlink:
1881 case gdb_sys_mq_timedsend:
1884 case gdb_sys_mq_timedreceive:
1885 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1890 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
1891 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1895 if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
1899 case gdb_sys_mq_notify:
1902 case gdb_sys_mq_getsetattr:
1903 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_mq_attr))
1907 case gdb_sys_kexec_load:
1910 case gdb_sys_waitid:
1911 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_siginfo_t)
1912 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_rusage))
1916 case gdb_sys_ni_syscall285:
1917 case gdb_sys_add_key:
1918 case gdb_sys_request_key:
1921 case gdb_sys_keyctl:
1922 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1923 if (tmpulongest == 6 || tmpulongest == 11)
1925 regcache_raw_read_unsigned (regcache, tdep->arg3,
1931 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
1932 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1939 case gdb_sys_ioprio_set:
1940 case gdb_sys_ioprio_get:
1941 case gdb_sys_inotify_init:
1942 case gdb_sys_inotify_add_watch:
1943 case gdb_sys_inotify_rm_watch:
1944 case gdb_sys_migrate_pages:
1945 case gdb_sys_openat:
1946 case gdb_sys_mkdirat:
1947 case gdb_sys_mknodat:
1948 case gdb_sys_fchownat:
1949 case gdb_sys_futimesat:
1952 case gdb_sys_fstatat64:
1953 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_stat64))
1957 case gdb_sys_unlinkat:
1958 case gdb_sys_renameat:
1959 case gdb_sys_linkat:
1960 case gdb_sys_symlinkat:
1963 case gdb_sys_readlinkat:
1964 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1969 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
1970 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1976 case gdb_sys_fchmodat:
1977 case gdb_sys_faccessat:
1980 case gdb_sys_pselect6:
1981 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_fd_set)
1982 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_fd_set)
1983 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_fd_set)
1984 || record_mem_at_reg (regcache, tdep->arg5, tdep->size_timespec))
1989 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1994 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1995 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1996 tdep->size_pollfd * nfds))
1999 if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_timespec))
2003 case gdb_sys_unshare:
2004 case gdb_sys_set_robust_list:
2007 case gdb_sys_get_robust_list:
2008 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
2009 || record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
2013 case gdb_sys_splice:
2014 if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_loff_t)
2015 || record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
2019 case gdb_sys_sync_file_range:
2021 case gdb_sys_vmsplice:
2024 case gdb_sys_move_pages:
2025 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2030 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2031 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2032 nr_pages * tdep->size_int))
2037 case gdb_sys_getcpu:
2038 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int)
2039 || record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
2040 || record_mem_at_reg (regcache, tdep->arg3,
2041 tdep->size_ulong * 2))
2045 case gdb_sys_epoll_pwait:
2046 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2051 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2052 tmpint = (int) maxevents * tdep->size_epoll_event;
2053 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2058 case gdb_sys_fallocate:
2059 case gdb_sys_eventfd2:
2060 case gdb_sys_epoll_create1:
2065 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
2069 case gdb_sys_inotify_init1:
2073 printf_unfiltered (_("Process record and replay target doesn't "
2074 "support syscall number %d\n"), syscall);