1 /* Process record and replay target code for GNU/Linux.
3 Copyright (C) 2008-2015 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))))
89 record_linux_sockaddr (struct regcache *regcache,
90 struct linux_record_tdep *tdep, ULONGEST addr,
95 struct gdbarch *gdbarch = get_regcache_arch (regcache);
96 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
101 a = (gdb_byte *) alloca (tdep->size_int);
103 if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
106 /* Get the addrlen. */
107 if (target_read_memory ((CORE_ADDR) len, a, tdep->size_int))
110 fprintf_unfiltered (gdb_stdlog,
111 "Process record: error reading "
112 "memory at addr = 0x%s len = %d.\n",
113 phex_nz (len, tdep->size_pointer),
117 addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order);
118 if (addrlen <= 0 || addrlen > tdep->size_sockaddr)
119 addrlen = tdep->size_sockaddr;
121 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, addrlen))
128 record_linux_msghdr (struct regcache *regcache,
129 struct linux_record_tdep *tdep, ULONGEST addr)
132 struct gdbarch *gdbarch = get_regcache_arch (regcache);
133 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
140 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
143 a = (gdb_byte *) alloca (tdep->size_msghdr);
144 if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
147 fprintf_unfiltered (gdb_stdlog,
148 "Process record: error reading "
149 "memory at addr = 0x%s "
151 phex_nz (addr, tdep->size_pointer),
156 /* msg_name msg_namelen */
157 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
158 a += tdep->size_pointer;
159 if (record_full_arch_list_add_mem
161 (int) extract_unsigned_integer (a,
165 /* We have read an int, but skip size_pointer bytes to account for alignment
166 of the next field on 64-bit targets. */
167 a += tdep->size_pointer;
169 /* msg_iov msg_iovlen */
170 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
171 a += tdep->size_pointer;
175 ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
177 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
179 for (i = 0; i < len; i++)
181 if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
184 fprintf_unfiltered (gdb_stdlog,
185 "Process record: error "
189 phex_nz (addr,tdep->size_pointer),
193 tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
196 tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
199 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
201 addr += tdep->size_iovec;
204 a += tdep->size_size_t;
206 /* msg_control msg_controllen */
207 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
208 a += tdep->size_pointer;
209 tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
210 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
216 /* When the architecture process record get a Linux syscall
217 instruction, it will get a Linux syscall number of this
218 architecture and convert it to the Linux syscall number "num" which
219 is internal to GDB. Most Linux syscalls across architectures in
220 Linux would be similar and mostly differ by sizes of types and
221 structures. This sizes are put to "tdep".
223 Record the values of the registers and memory that will be changed
224 in current system call.
226 Return -1 if something wrong. */
229 record_linux_system_call (enum gdb_syscall syscall,
230 struct regcache *regcache,
231 struct linux_record_tdep *tdep)
233 struct gdbarch *gdbarch = get_regcache_arch (regcache);
234 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
235 ULONGEST tmpulongest;
241 case gdb_sys_restart_syscall:
248 target_terminal_ours ();
249 q = yquery (_("The next instruction is syscall exit. "
250 "It will make the program exit. "
251 "Do you want to stop the program?"));
252 target_terminal_inferior ();
263 ULONGEST addr, count;
265 regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
266 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
267 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, (int) count))
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 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
310 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
311 tdep->size__old_kernel_stat))
318 case gdb_sys_oldumount:
319 case gdb_sys_setuid16:
320 case gdb_sys_getuid16:
325 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
326 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
327 || tmpulongest == RECORD_PTRACE_PEEKDATA
328 || tmpulongest == RECORD_PTRACE_PEEKUSR)
330 regcache_raw_read_unsigned (regcache, tdep->arg4,
332 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
340 case gdb_sys_ni_syscall31:
341 case gdb_sys_ni_syscall32:
344 case gdb_sys_ni_syscall35:
354 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
355 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
360 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
361 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
366 case gdb_sys_ni_syscall44:
368 case gdb_sys_setgid16:
369 case gdb_sys_getgid16:
371 case gdb_sys_geteuid16:
372 case gdb_sys_getegid16:
375 case gdb_sys_ni_syscall53:
379 /* XXX Need to add a lot of support of other ioctl requests. */
380 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
381 if (tmpulongest == tdep->ioctl_FIOCLEX
382 || tmpulongest == tdep->ioctl_FIONCLEX
383 || tmpulongest == tdep->ioctl_FIONBIO
384 || tmpulongest == tdep->ioctl_FIOASYNC
385 || tmpulongest == tdep->ioctl_TCSETS
386 || tmpulongest == tdep->ioctl_TCSETSW
387 || tmpulongest == tdep->ioctl_TCSETSF
388 || tmpulongest == tdep->ioctl_TCSETA
389 || tmpulongest == tdep->ioctl_TCSETAW
390 || tmpulongest == tdep->ioctl_TCSETAF
391 || tmpulongest == tdep->ioctl_TCSBRK
392 || tmpulongest == tdep->ioctl_TCXONC
393 || tmpulongest == tdep->ioctl_TCFLSH
394 || tmpulongest == tdep->ioctl_TIOCEXCL
395 || tmpulongest == tdep->ioctl_TIOCNXCL
396 || tmpulongest == tdep->ioctl_TIOCSCTTY
397 || tmpulongest == tdep->ioctl_TIOCSPGRP
398 || tmpulongest == tdep->ioctl_TIOCSTI
399 || tmpulongest == tdep->ioctl_TIOCSWINSZ
400 || tmpulongest == tdep->ioctl_TIOCMBIS
401 || tmpulongest == tdep->ioctl_TIOCMBIC
402 || tmpulongest == tdep->ioctl_TIOCMSET
403 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
404 || tmpulongest == tdep->ioctl_TIOCCONS
405 || tmpulongest == tdep->ioctl_TIOCSSERIAL
406 || tmpulongest == tdep->ioctl_TIOCPKT
407 || tmpulongest == tdep->ioctl_TIOCNOTTY
408 || tmpulongest == tdep->ioctl_TIOCSETD
409 || tmpulongest == tdep->ioctl_TCSBRKP
410 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
411 || tmpulongest == tdep->ioctl_TIOCSBRK
412 || tmpulongest == tdep->ioctl_TIOCCBRK
413 || tmpulongest == tdep->ioctl_TCSETS2
414 || tmpulongest == tdep->ioctl_TCSETSW2
415 || tmpulongest == tdep->ioctl_TCSETSF2
416 || tmpulongest == tdep->ioctl_TIOCSPTLCK
417 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
418 || tmpulongest == tdep->ioctl_TIOCSERGWILD
419 || tmpulongest == tdep->ioctl_TIOCSERSWILD
420 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
421 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
422 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
423 || tmpulongest == tdep->ioctl_TIOCMIWAIT
424 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
428 else if (tmpulongest == tdep->ioctl_TCGETS
429 || tmpulongest == tdep->ioctl_TCGETA
430 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
432 regcache_raw_read_unsigned (regcache, tdep->arg3,
434 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
438 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
439 || tmpulongest == tdep->ioctl_TIOCGSID)
441 regcache_raw_read_unsigned (regcache, tdep->arg3,
443 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
447 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
448 || tmpulongest == tdep->ioctl_TIOCMGET
449 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
450 || tmpulongest == tdep->ioctl_FIONREAD
451 || tmpulongest == tdep->ioctl_TIOCINQ
452 || tmpulongest == tdep->ioctl_TIOCGETD
453 || tmpulongest == tdep->ioctl_TIOCGPTN
454 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
456 regcache_raw_read_unsigned (regcache, tdep->arg3,
458 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
462 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
464 regcache_raw_read_unsigned (regcache, tdep->arg3,
466 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
470 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
472 regcache_raw_read_unsigned (regcache, tdep->arg3,
474 /* This syscall affects a char-size memory. */
475 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
478 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
480 regcache_raw_read_unsigned (regcache, tdep->arg3,
482 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
483 tdep->size_serial_struct))
486 else if (tmpulongest == tdep->ioctl_TCGETS2)
488 regcache_raw_read_unsigned (regcache, tdep->arg3,
490 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
491 tdep->size_termios2))
494 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
496 regcache_raw_read_unsigned (regcache, tdep->arg3,
498 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
502 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
504 regcache_raw_read_unsigned (regcache, tdep->arg3,
506 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
507 tdep->size_serial_icounter_struct))
510 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
512 regcache_raw_read_unsigned (regcache, tdep->arg3,
514 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
515 tdep->size_hayes_esp_config))
518 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
520 printf_unfiltered (_("Process record and replay target doesn't "
521 "support ioctl request TIOCSERGSTRUCT\n"));
526 printf_unfiltered (_("Process record and replay target doesn't "
527 "support ioctl request 0x%s.\n"),
528 OUTPUT_REG (tmpulongest, tdep->arg2));
535 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
537 if (tmpulongest == tdep->fcntl_F_GETLK)
539 regcache_raw_read_unsigned (regcache, tdep->arg3,
541 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
547 case gdb_sys_ni_syscall56:
548 case gdb_sys_setpgid:
549 case gdb_sys_ni_syscall58:
552 case gdb_sys_olduname:
553 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
554 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
555 tdep->size_oldold_utsname))
564 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
565 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
571 case gdb_sys_getppid:
572 case gdb_sys_getpgrp:
576 case gdb_sys_sigaction:
577 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
578 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
579 tdep->size_old_sigaction))
583 case gdb_sys_sgetmask:
584 case gdb_sys_ssetmask:
585 case gdb_sys_setreuid16:
586 case gdb_sys_setregid16:
587 case gdb_sys_sigsuspend:
590 case gdb_sys_sigpending:
591 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
592 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
593 tdep->size_old_sigset_t))
597 case gdb_sys_sethostname:
598 case gdb_sys_setrlimit:
601 case gdb_sys_old_getrlimit:
602 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
603 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
608 case gdb_sys_getrusage:
609 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
610 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
615 case gdb_sys_gettimeofday:
616 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
617 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
620 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
621 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
622 tdep->size_timezone))
626 case gdb_sys_settimeofday:
629 case gdb_sys_getgroups16:
630 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
635 regcache_raw_read_unsigned (regcache, tdep->arg1,
637 tmpint = tdep->size_old_gid_t * (int) gidsetsize;
638 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
643 case gdb_sys_setgroups16:
648 struct sel_arg_struct
657 regcache_raw_read_unsigned (regcache, tdep->arg1,
661 if (target_read_memory (tmpulongest, (gdb_byte *) &sel,
665 fprintf_unfiltered (gdb_stdlog,
666 "Process record: error reading memory "
667 "at addr = 0x%s len = %lu.\n",
668 OUTPUT_REG (tmpulongest, tdep->arg1),
669 (unsigned long) sizeof (sel));
672 if (record_full_arch_list_add_mem (sel.inp, tdep->size_fd_set))
674 if (record_full_arch_list_add_mem (sel.outp, tdep->size_fd_set))
676 if (record_full_arch_list_add_mem (sel.exp, tdep->size_fd_set))
678 if (record_full_arch_list_add_mem (sel.tvp, tdep->size_timeval))
684 case gdb_sys_symlink:
687 case gdb_sys_readlink:
691 regcache_raw_read_unsigned (regcache, tdep->arg2,
693 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
694 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
707 target_terminal_ours ();
708 q = yquery (_("The next instruction is syscall reboot. "
709 "It will restart the computer. "
710 "Do you want to stop the program?"));
711 target_terminal_inferior ();
717 case gdb_old_readdir:
718 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
719 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
720 tdep->size_old_dirent))
731 regcache_raw_read_unsigned (regcache, tdep->arg1,
733 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
734 if (record_full_memory_query)
738 target_terminal_ours ();
740 The next instruction is syscall munmap.\n\
741 It will free the memory addr = 0x%s len = %u.\n\
742 It will make record target cannot record some memory change.\n\
743 Do you want to stop the program?"),
744 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
745 target_terminal_inferior ();
752 case gdb_sys_truncate:
753 case gdb_sys_ftruncate:
755 case gdb_sys_fchown16:
756 case gdb_sys_getpriority:
757 case gdb_sys_setpriority:
758 case gdb_sys_ni_syscall98:
762 case gdb_sys_fstatfs:
763 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
764 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
774 case gdb_sys_sendmsg:
775 case gdb_sys_shutdown:
777 case gdb_sys_connect:
779 case gdb_sys_setsockopt:
783 case gdb_sys_getsockname:
784 case gdb_sys_getpeername:
788 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
789 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
790 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
795 case gdb_sys_recvfrom:
799 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
800 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
801 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
810 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
811 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
812 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
818 case gdb_sys_recvmsg:
819 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
820 if (record_linux_msghdr (regcache, tdep, tmpulongest))
824 case gdb_sys_socketpair:
825 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
826 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
831 case gdb_sys_getsockopt:
832 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
836 gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
838 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
842 fprintf_unfiltered (gdb_stdlog,
843 "Process record: error reading "
844 "memory at addr = 0x%s "
846 OUTPUT_REG (tmpulongest, tdep->arg5),
850 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
851 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
853 if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
855 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
861 case gdb_sys_socketcall:
862 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
865 case RECORD_SYS_SOCKET:
866 case RECORD_SYS_BIND:
867 case RECORD_SYS_CONNECT:
868 case RECORD_SYS_LISTEN:
870 case RECORD_SYS_ACCEPT:
871 case RECORD_SYS_GETSOCKNAME:
872 case RECORD_SYS_GETPEERNAME:
874 regcache_raw_read_unsigned (regcache, tdep->arg2,
878 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
881 tmpulongest += tdep->size_ulong;
882 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
883 tdep->size_ulong * 2))
886 fprintf_unfiltered (gdb_stdlog,
887 "Process record: error reading "
888 "memory at addr = 0x%s len = %d.\n",
889 OUTPUT_REG (tmpulongest, tdep->arg2),
890 tdep->size_ulong * 2);
893 tmpulongest = extract_unsigned_integer (a,
896 len = extract_unsigned_integer (a + tdep->size_ulong,
897 tdep->size_ulong, byte_order);
898 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
904 case RECORD_SYS_SOCKETPAIR:
906 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
908 regcache_raw_read_unsigned (regcache, tdep->arg2,
912 tmpulongest += tdep->size_ulong * 3;
913 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
917 fprintf_unfiltered (gdb_stdlog,
918 "Process record: error reading "
919 "memory at addr = 0x%s len = %d.\n",
920 OUTPUT_REG (tmpulongest, tdep->arg2),
925 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
927 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
932 case RECORD_SYS_SEND:
933 case RECORD_SYS_SENDTO:
935 case RECORD_SYS_RECVFROM:
936 regcache_raw_read_unsigned (regcache, tdep->arg2,
940 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
943 tmpulongest += tdep->size_ulong * 4;
944 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
945 tdep->size_ulong * 2))
948 fprintf_unfiltered (gdb_stdlog,
949 "Process record: error reading "
950 "memory at addr = 0x%s len = %d.\n",
951 OUTPUT_REG (tmpulongest, tdep->arg2),
952 tdep->size_ulong * 2);
955 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
957 len = extract_unsigned_integer (a + tdep->size_ulong,
958 tdep->size_ulong, byte_order);
959 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
962 case RECORD_SYS_RECV:
963 regcache_raw_read_unsigned (regcache, tdep->arg2,
967 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
969 tmpulongest += tdep->size_ulong;
970 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
974 fprintf_unfiltered (gdb_stdlog,
975 "Process record: error reading "
976 "memory at addr = 0x%s len = %d.\n",
977 OUTPUT_REG (tmpulongest, tdep->arg2),
981 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
985 a += tdep->size_ulong;
986 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
988 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
994 case RECORD_SYS_SHUTDOWN:
995 case RECORD_SYS_SETSOCKOPT:
997 case RECORD_SYS_GETSOCKOPT:
999 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
1000 gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
1002 regcache_raw_read_unsigned (regcache, tdep->arg2,
1006 tmpulongest += tdep->size_ulong * 3;
1007 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1008 tdep->size_ulong * 2))
1011 fprintf_unfiltered (gdb_stdlog,
1012 "Process record: error reading "
1013 "memory at addr = 0x%s len = %d.\n",
1014 OUTPUT_REG (tmpulongest, tdep->arg2),
1015 tdep->size_ulong * 2);
1018 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
1023 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
1027 fprintf_unfiltered (gdb_stdlog,
1028 "Process record: error reading "
1029 "memory at addr = 0x%s "
1031 phex_nz (tmpulongest,
1037 = (CORE_ADDR) extract_unsigned_integer (a,
1040 tmpint = (int) extract_unsigned_integer (av,
1043 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1045 a += tdep->size_ulong;
1047 = (CORE_ADDR) extract_unsigned_integer (a,
1050 if (record_full_arch_list_add_mem (tmpaddr,
1057 case RECORD_SYS_SENDMSG:
1059 case RECORD_SYS_RECVMSG:
1061 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
1063 regcache_raw_read_unsigned (regcache, tdep->arg2,
1067 tmpulongest += tdep->size_ulong;
1068 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1072 fprintf_unfiltered (gdb_stdlog,
1073 "Process record: error reading "
1074 "memory at addr = 0x%s len = %d.\n",
1075 OUTPUT_REG (tmpulongest, tdep->arg2),
1079 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1081 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1087 printf_unfiltered (_("Process record and replay target "
1088 "doesn't support socketcall call 0x%s\n"),
1089 OUTPUT_REG (tmpulongest, tdep->arg1));
1095 case gdb_sys_syslog:
1098 case gdb_sys_setitimer:
1099 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1100 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1101 tdep->size_itimerval))
1105 case gdb_sys_getitimer:
1106 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1107 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1108 tdep->size_itimerval))
1112 case gdb_sys_newstat:
1113 case gdb_sys_newlstat:
1114 case gdb_sys_newfstat:
1115 case gdb_sys_newfstatat:
1116 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1117 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1123 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1124 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1125 tdep->size_old_utsname))
1130 case gdb_sys_vhangup:
1131 case gdb_sys_ni_syscall112:
1132 case gdb_sys_vm86old:
1136 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1137 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1140 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1141 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1146 case gdb_sys_swapoff:
1149 case gdb_sys_sysinfo:
1150 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1151 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1152 tdep->size_sysinfo))
1156 case gdb_sys_shmget:
1157 case gdb_sys_semget:
1159 case gdb_sys_msgget:
1160 /* XXX maybe need do some record works with sys_shmdt. */
1162 case gdb_sys_msgsnd:
1163 case gdb_sys_semtimedop:
1167 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1168 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1173 case gdb_sys_shmctl:
1174 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1175 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1176 tdep->size_shmid_ds))
1180 /* XXX sys_semctl 525 still not supported. */
1183 case gdb_sys_msgrcv:
1188 regcache_raw_read_signed (regcache, tdep->arg3, &l);
1189 regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
1190 tmpint = l + tdep->size_long;
1191 if (record_full_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
1196 case gdb_sys_msgctl:
1197 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1198 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1199 tdep->size_msqid_ds))
1204 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1205 tmpulongest &= 0xffff;
1206 switch (tmpulongest)
1210 case RECORD_SEMTIMEDOP:
1213 /* XXX maybe need do some record works with RECORD_SHMDT. */
1222 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1223 regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
1224 tmpint = (int) second + tdep->size_long;
1225 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
1230 regcache_raw_read_unsigned (regcache, tdep->arg5,
1232 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1233 tdep->size_msqid_ds))
1237 regcache_raw_read_unsigned (regcache, tdep->arg4,
1239 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1244 regcache_raw_read_unsigned (regcache, tdep->arg5,
1246 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1247 tdep->size_shmid_ds))
1251 /* XXX RECORD_SEMCTL still not supported. */
1252 printf_unfiltered (_("Process record and replay target doesn't "
1253 "support ipc number %s\n"),
1254 pulongest (tmpulongest));
1260 case gdb_sys_sigreturn:
1262 case gdb_sys_setdomainname:
1265 case gdb_sys_newuname:
1266 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1267 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1268 tdep->size_new_utsname))
1272 case gdb_sys_modify_ldt:
1273 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1274 if (tmpulongest == 0 || tmpulongest == 2)
1276 ULONGEST ptr, bytecount;
1278 regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
1279 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1280 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
1285 case gdb_sys_adjtimex:
1286 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1287 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1292 case gdb_sys_mprotect:
1295 case gdb_sys_sigprocmask:
1296 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1297 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1298 tdep->size_old_sigset_t))
1302 case gdb_sys_ni_syscall127:
1303 case gdb_sys_init_module:
1304 case gdb_sys_delete_module:
1305 case gdb_sys_ni_syscall130:
1308 case gdb_sys_quotactl:
1309 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1310 switch (tmpulongest)
1312 case RECORD_Q_GETFMT:
1313 regcache_raw_read_unsigned (regcache, tdep->arg4,
1316 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
1319 case RECORD_Q_GETINFO:
1320 regcache_raw_read_unsigned (regcache, tdep->arg4,
1322 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1323 tdep->size_mem_dqinfo))
1326 case RECORD_Q_GETQUOTA:
1327 regcache_raw_read_unsigned (regcache, tdep->arg4,
1329 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1330 tdep->size_if_dqblk))
1333 case RECORD_Q_XGETQSTAT:
1334 case RECORD_Q_XGETQUOTA:
1335 regcache_raw_read_unsigned (regcache, tdep->arg4,
1337 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1338 tdep->size_fs_quota_stat))
1344 case gdb_sys_getpgid:
1345 case gdb_sys_fchdir:
1346 case gdb_sys_bdflush:
1350 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1351 if (tmpulongest == 2)
1353 regcache_raw_read_unsigned (regcache, tdep->arg3,
1355 /*XXX the size of memory is not very clear. */
1356 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
1361 case gdb_sys_personality:
1362 case gdb_sys_ni_syscall137:
1363 case gdb_sys_setfsuid16:
1364 case gdb_sys_setfsgid16:
1367 case gdb_sys_llseek:
1368 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1369 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1374 case gdb_sys_getdents:
1375 case gdb_sys_getdents64:
1379 regcache_raw_read_unsigned (regcache, tdep->arg2,
1381 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1382 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, count))
1387 case gdb_sys_select:
1388 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1389 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1392 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1393 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1396 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1397 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1400 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
1401 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1402 tdep->size_timeval))
1414 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1417 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
1419 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1420 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1422 if (target_read_memory ((CORE_ADDR) vec, iov,
1426 fprintf_unfiltered (gdb_stdlog,
1427 "Process record: error reading "
1428 "memory at addr = 0x%s len = %d.\n",
1429 OUTPUT_REG (vec, tdep->arg2),
1434 = (CORE_ADDR) extract_unsigned_integer (iov,
1438 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1441 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1443 vec += tdep->size_iovec;
1449 case gdb_sys_writev:
1450 case gdb_sys_getsid:
1451 case gdb_sys_fdatasync:
1452 case gdb_sys_sysctl:
1454 case gdb_sys_munlock:
1455 case gdb_sys_mlockall:
1456 case gdb_sys_munlockall:
1457 case gdb_sys_sched_setparam:
1460 case gdb_sys_sched_getparam:
1461 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1462 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1467 case gdb_sys_sched_setscheduler:
1468 case gdb_sys_sched_getscheduler:
1469 case gdb_sys_sched_yield:
1470 case gdb_sys_sched_get_priority_max:
1471 case gdb_sys_sched_get_priority_min:
1474 case gdb_sys_sched_rr_get_interval:
1475 case gdb_sys_nanosleep:
1476 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1477 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1478 tdep->size_timespec))
1482 case gdb_sys_mremap:
1483 case gdb_sys_setresuid16:
1486 case gdb_sys_getresuid16:
1487 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1488 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1489 tdep->size_old_uid_t))
1491 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1492 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1493 tdep->size_old_uid_t))
1495 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1496 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1497 tdep->size_old_uid_t))
1502 case gdb_sys_ni_syscall167:
1506 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1511 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1512 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1513 tdep->size_pollfd * nfds))
1518 case gdb_sys_nfsservctl:
1519 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1520 if (tmpulongest == 7 || tmpulongest == 8)
1524 if (tmpulongest == 7)
1525 rsize = tdep->size_NFS_FHSIZE;
1527 rsize = tdep->size_knfsd_fh;
1528 regcache_raw_read_unsigned (regcache, tdep->arg3,
1530 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
1535 case gdb_sys_setresgid16:
1538 case gdb_sys_getresgid16:
1539 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1540 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1541 tdep->size_old_gid_t))
1543 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1544 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1545 tdep->size_old_gid_t))
1547 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1548 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1549 tdep->size_old_gid_t))
1554 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1555 switch (tmpulongest)
1558 regcache_raw_read_unsigned (regcache, tdep->arg2,
1560 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1565 regcache_raw_read_unsigned (regcache, tdep->arg2,
1567 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1568 tdep->size_TASK_COMM_LEN))
1574 case gdb_sys_rt_sigreturn:
1577 case gdb_sys_rt_sigaction:
1578 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1579 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1580 tdep->size_sigaction))
1584 case gdb_sys_rt_sigprocmask:
1585 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1586 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1587 tdep->size_sigset_t))
1591 case gdb_sys_rt_sigpending:
1592 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1595 ULONGEST sigsetsize;
1597 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1598 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1604 case gdb_sys_rt_sigtimedwait:
1605 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1606 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1607 tdep->size_siginfo_t))
1611 case gdb_sys_rt_sigqueueinfo:
1612 case gdb_sys_rt_sigsuspend:
1615 case gdb_sys_pread64:
1616 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1621 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1622 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1628 case gdb_sys_pwrite64:
1629 case gdb_sys_chown16:
1632 case gdb_sys_getcwd:
1633 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1638 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1639 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1645 case gdb_sys_capget:
1646 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1647 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1648 tdep->size_cap_user_data_t))
1652 case gdb_sys_capset:
1655 case gdb_sys_sigaltstack:
1656 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1657 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1658 tdep->size_stack_t))
1662 case gdb_sys_sendfile:
1663 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1664 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1669 case gdb_sys_ni_syscall188:
1670 case gdb_sys_ni_syscall189:
1674 case gdb_sys_getrlimit:
1675 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1676 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1684 case gdb_sys_truncate64:
1685 case gdb_sys_ftruncate64:
1688 case gdb_sys_stat64:
1689 case gdb_sys_lstat64:
1690 case gdb_sys_fstat64:
1691 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1692 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1697 case gdb_sys_lchown:
1698 case gdb_sys_getuid:
1699 case gdb_sys_getgid:
1700 case gdb_sys_geteuid:
1701 case gdb_sys_getegid:
1702 case gdb_sys_setreuid:
1703 case gdb_sys_setregid:
1706 case gdb_sys_getgroups:
1707 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1710 ULONGEST gidsetsize;
1712 regcache_raw_read_unsigned (regcache, tdep->arg1,
1714 tmpint = tdep->size_gid_t * (int) gidsetsize;
1715 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1720 case gdb_sys_setgroups:
1721 case gdb_sys_fchown:
1722 case gdb_sys_setresuid:
1725 case gdb_sys_getresuid:
1726 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1727 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1730 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1731 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1734 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1735 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1740 case gdb_sys_setresgid:
1743 case gdb_sys_getresgid:
1744 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1745 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1748 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1749 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1752 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1753 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1759 case gdb_sys_setuid:
1760 case gdb_sys_setgid:
1761 case gdb_sys_setfsuid:
1762 case gdb_sys_setfsgid:
1763 case gdb_sys_pivot_root:
1766 case gdb_sys_mincore:
1767 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1768 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1769 tdep->size_PAGE_SIZE))
1773 case gdb_sys_madvise:
1776 case gdb_sys_fcntl64:
1777 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1778 if (tmpulongest == tdep->fcntl_F_GETLK64)
1780 regcache_raw_read_unsigned (regcache, tdep->arg3,
1782 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1783 tdep->size_flock64))
1786 else if (tmpulongest != tdep->fcntl_F_SETLK64
1787 && tmpulongest != tdep->fcntl_F_SETLKW64)
1793 case gdb_sys_ni_syscall222:
1794 case gdb_sys_ni_syscall223:
1795 case gdb_sys_gettid:
1796 case gdb_sys_readahead:
1797 case gdb_sys_setxattr:
1798 case gdb_sys_lsetxattr:
1799 case gdb_sys_fsetxattr:
1802 case gdb_sys_getxattr:
1803 case gdb_sys_lgetxattr:
1804 case gdb_sys_fgetxattr:
1805 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1810 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1811 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1817 case gdb_sys_listxattr:
1818 case gdb_sys_llistxattr:
1819 case gdb_sys_flistxattr:
1820 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1825 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1826 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1832 case gdb_sys_removexattr:
1833 case gdb_sys_lremovexattr:
1834 case gdb_sys_fremovexattr:
1838 case gdb_sys_sendfile64:
1839 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1840 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1846 case gdb_sys_sched_setaffinity:
1849 case gdb_sys_sched_getaffinity:
1850 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1855 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1856 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1862 case gdb_sys_set_thread_area:
1863 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1864 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1869 case gdb_sys_get_thread_area:
1870 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1871 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1872 tdep->size_user_desc))
1876 case gdb_sys_io_setup:
1877 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1878 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1883 case gdb_sys_io_destroy:
1886 case gdb_sys_io_getevents:
1887 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1892 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1893 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1894 nr * tdep->size_io_event))
1899 case gdb_sys_io_submit:
1900 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1906 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1907 iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
1908 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1909 nr * tdep->size_pointer))
1912 fprintf_unfiltered (gdb_stdlog,
1913 "Process record: error reading memory "
1914 "at addr = 0x%s len = %u.\n",
1915 OUTPUT_REG (tmpulongest, tdep->arg2),
1916 (int) (nr * tdep->size_pointer));
1919 for (i = 0; i < nr; i++)
1922 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1925 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1927 iocbp += tdep->size_pointer;
1932 case gdb_sys_io_cancel:
1933 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1934 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1935 tdep->size_io_event))
1939 case gdb_sys_fadvise64:
1940 case gdb_sys_ni_syscall251:
1943 case gdb_sys_exit_group:
1947 target_terminal_ours ();
1948 q = yquery (_("The next instruction is syscall exit_group. "
1949 "It will make the program exit. "
1950 "Do you want to stop the program?"));
1951 target_terminal_inferior ();
1957 case gdb_sys_lookup_dcookie:
1958 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1963 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1964 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1970 case gdb_sys_epoll_create:
1971 case gdb_sys_epoll_ctl:
1974 case gdb_sys_epoll_wait:
1975 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1980 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1981 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1983 * tdep->size_epoll_event)))
1988 case gdb_sys_remap_file_pages:
1989 case gdb_sys_set_tid_address:
1992 case gdb_sys_timer_create:
1993 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1994 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1999 case gdb_sys_timer_settime:
2000 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2001 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2002 tdep->size_itimerspec))
2006 case gdb_sys_timer_gettime:
2007 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2008 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2009 tdep->size_itimerspec))
2013 case gdb_sys_timer_getoverrun:
2014 case gdb_sys_timer_delete:
2015 case gdb_sys_clock_settime:
2018 case gdb_sys_clock_gettime:
2019 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2020 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2021 tdep->size_timespec))
2025 case gdb_sys_clock_getres:
2026 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2027 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2028 tdep->size_timespec))
2032 case gdb_sys_clock_nanosleep:
2033 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2034 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2035 tdep->size_timespec))
2039 case gdb_sys_statfs64:
2040 case gdb_sys_fstatfs64:
2041 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2042 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2043 tdep->size_statfs64))
2047 case gdb_sys_tgkill:
2048 case gdb_sys_utimes:
2049 case gdb_sys_fadvise64_64:
2050 case gdb_sys_ni_syscall273:
2054 case gdb_sys_get_mempolicy:
2055 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2056 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2059 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2064 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
2065 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2066 maxnode * tdep->size_long))
2071 case gdb_sys_set_mempolicy:
2072 case gdb_sys_mq_open:
2073 case gdb_sys_mq_unlink:
2074 case gdb_sys_mq_timedsend:
2077 case gdb_sys_mq_timedreceive:
2078 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2083 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
2084 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2088 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2089 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2094 case gdb_sys_mq_notify:
2097 case gdb_sys_mq_getsetattr:
2098 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2099 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2100 tdep->size_mq_attr))
2104 case gdb_sys_kexec_load:
2107 case gdb_sys_waitid:
2108 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2109 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2110 tdep->size_siginfo_t))
2112 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2113 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2118 case gdb_sys_ni_syscall285:
2119 case gdb_sys_add_key:
2120 case gdb_sys_request_key:
2123 case gdb_sys_keyctl:
2124 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2125 if (tmpulongest == 6 || tmpulongest == 11)
2127 regcache_raw_read_unsigned (regcache, tdep->arg3,
2133 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
2134 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2141 case gdb_sys_ioprio_set:
2142 case gdb_sys_ioprio_get:
2143 case gdb_sys_inotify_init:
2144 case gdb_sys_inotify_add_watch:
2145 case gdb_sys_inotify_rm_watch:
2146 case gdb_sys_migrate_pages:
2147 case gdb_sys_openat:
2148 case gdb_sys_mkdirat:
2149 case gdb_sys_mknodat:
2150 case gdb_sys_fchownat:
2151 case gdb_sys_futimesat:
2154 case gdb_sys_fstatat64:
2155 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2156 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2161 case gdb_sys_unlinkat:
2162 case gdb_sys_renameat:
2163 case gdb_sys_linkat:
2164 case gdb_sys_symlinkat:
2167 case gdb_sys_readlinkat:
2168 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2173 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
2174 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2180 case gdb_sys_fchmodat:
2181 case gdb_sys_faccessat:
2184 case gdb_sys_pselect6:
2185 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2186 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2189 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2190 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2193 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2194 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2197 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2198 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2199 tdep->size_timespec))
2204 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2209 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
2210 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2211 tdep->size_pollfd * nfds))
2214 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2215 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2216 tdep->size_timespec))
2220 case gdb_sys_unshare:
2221 case gdb_sys_set_robust_list:
2224 case gdb_sys_get_robust_list:
2225 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2226 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2229 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2230 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2235 case gdb_sys_splice:
2236 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2237 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2240 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2241 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2246 case gdb_sys_sync_file_range:
2248 case gdb_sys_vmsplice:
2251 case gdb_sys_move_pages:
2252 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2257 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2258 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2259 nr_pages * tdep->size_int))
2264 case gdb_sys_getcpu:
2265 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2266 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2269 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2270 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2273 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2274 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2275 tdep->size_ulong * 2))
2279 case gdb_sys_epoll_pwait:
2280 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2285 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2286 tmpint = (int) maxevents * tdep->size_epoll_event;
2287 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2293 printf_unfiltered (_("Process record and replay target doesn't "
2294 "support syscall number %d\n"), syscall);