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))))
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,
361 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
362 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
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 regcache_raw_read_unsigned (regcache, tdep->arg3,
435 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
439 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
440 || tmpulongest == tdep->ioctl_TIOCGSID)
442 regcache_raw_read_unsigned (regcache, tdep->arg3,
444 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
448 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
449 || tmpulongest == tdep->ioctl_TIOCMGET
450 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
451 || tmpulongest == tdep->ioctl_FIONREAD
452 || tmpulongest == tdep->ioctl_TIOCINQ
453 || tmpulongest == tdep->ioctl_TIOCGETD
454 || tmpulongest == tdep->ioctl_TIOCGPTN
455 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
457 regcache_raw_read_unsigned (regcache, tdep->arg3,
459 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
463 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
465 regcache_raw_read_unsigned (regcache, tdep->arg3,
467 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
471 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
473 regcache_raw_read_unsigned (regcache, tdep->arg3,
475 /* This syscall affects a char-size memory. */
476 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
479 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
481 regcache_raw_read_unsigned (regcache, tdep->arg3,
483 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
484 tdep->size_serial_struct))
487 else if (tmpulongest == tdep->ioctl_TCGETS2)
489 regcache_raw_read_unsigned (regcache, tdep->arg3,
491 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
492 tdep->size_termios2))
495 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
497 regcache_raw_read_unsigned (regcache, tdep->arg3,
499 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
503 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
505 regcache_raw_read_unsigned (regcache, tdep->arg3,
507 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
508 tdep->size_serial_icounter_struct))
511 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
513 regcache_raw_read_unsigned (regcache, tdep->arg3,
515 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
516 tdep->size_hayes_esp_config))
519 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
521 printf_unfiltered (_("Process record and replay target doesn't "
522 "support ioctl request TIOCSERGSTRUCT\n"));
527 printf_unfiltered (_("Process record and replay target doesn't "
528 "support ioctl request 0x%s.\n"),
529 OUTPUT_REG (tmpulongest, tdep->arg2));
536 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
538 if (tmpulongest == tdep->fcntl_F_GETLK)
540 regcache_raw_read_unsigned (regcache, tdep->arg3,
542 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
548 case gdb_sys_ni_syscall56:
549 case gdb_sys_setpgid:
550 case gdb_sys_ni_syscall58:
553 case gdb_sys_olduname:
554 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
555 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
556 tdep->size_oldold_utsname))
565 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
566 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
572 case gdb_sys_getppid:
573 case gdb_sys_getpgrp:
577 case gdb_sys_sigaction:
578 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
579 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
580 tdep->size_old_sigaction))
584 case gdb_sys_sgetmask:
585 case gdb_sys_ssetmask:
586 case gdb_sys_setreuid16:
587 case gdb_sys_setregid16:
588 case gdb_sys_sigsuspend:
591 case gdb_sys_sigpending:
592 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
593 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
594 tdep->size_old_sigset_t))
598 case gdb_sys_sethostname:
599 case gdb_sys_setrlimit:
602 case gdb_sys_old_getrlimit:
603 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
604 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
609 case gdb_sys_getrusage:
610 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
611 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
616 case gdb_sys_gettimeofday:
617 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
618 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
621 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
622 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
623 tdep->size_timezone))
627 case gdb_sys_settimeofday:
630 case gdb_sys_getgroups16:
631 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
636 regcache_raw_read_unsigned (regcache, tdep->arg1,
638 tmpint = tdep->size_old_gid_t * (int) gidsetsize;
639 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
644 case gdb_sys_setgroups16:
649 unsigned long sz_sel_arg = tdep->size_long + tdep->size_pointer * 4;
650 gdb_byte *a = (gdb_byte *) alloca (sz_sel_arg);
651 CORE_ADDR inp, outp, exp, tvp;
653 regcache_raw_read_unsigned (regcache, tdep->arg1,
657 if (target_read_memory (tmpulongest, a, sz_sel_arg))
660 fprintf_unfiltered (gdb_stdlog,
661 "Process record: error reading memory "
662 "at addr = 0x%s len = %lu.\n",
663 OUTPUT_REG (tmpulongest, tdep->arg1),
668 a += tdep->size_long;
669 inp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
670 a += tdep->size_pointer;
671 outp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
672 a += tdep->size_pointer;
673 exp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
674 a += tdep->size_pointer;
675 tvp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
677 if (record_full_arch_list_add_mem (inp, tdep->size_fd_set))
680 if (record_full_arch_list_add_mem (outp, tdep->size_fd_set))
683 if (record_full_arch_list_add_mem (exp, tdep->size_fd_set))
686 if (record_full_arch_list_add_mem (tvp, tdep->size_timeval))
692 case gdb_sys_symlink:
695 case gdb_sys_readlink:
699 regcache_raw_read_unsigned (regcache, tdep->arg2,
701 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
702 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
715 target_terminal_ours ();
716 q = yquery (_("The next instruction is syscall reboot. "
717 "It will restart the computer. "
718 "Do you want to stop the program?"));
719 target_terminal_inferior ();
725 case gdb_old_readdir:
726 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
727 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
728 tdep->size_old_dirent))
739 regcache_raw_read_unsigned (regcache, tdep->arg1,
741 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
742 if (record_full_memory_query)
746 target_terminal_ours ();
748 The next instruction is syscall munmap.\n\
749 It will free the memory addr = 0x%s len = %u.\n\
750 It will make record target cannot record some memory change.\n\
751 Do you want to stop the program?"),
752 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
753 target_terminal_inferior ();
760 case gdb_sys_truncate:
761 case gdb_sys_ftruncate:
763 case gdb_sys_fchown16:
764 case gdb_sys_getpriority:
765 case gdb_sys_setpriority:
766 case gdb_sys_ni_syscall98:
770 case gdb_sys_fstatfs:
771 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
772 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
782 case gdb_sys_sendmsg:
783 case gdb_sys_shutdown:
785 case gdb_sys_connect:
787 case gdb_sys_setsockopt:
791 case gdb_sys_getsockname:
792 case gdb_sys_getpeername:
796 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
797 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
798 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
803 case gdb_sys_recvfrom:
807 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
808 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
809 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
818 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
819 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
820 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
826 case gdb_sys_recvmsg:
827 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
828 if (record_linux_msghdr (regcache, tdep, tmpulongest))
832 case gdb_sys_socketpair:
833 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
834 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
839 case gdb_sys_getsockopt:
840 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
844 gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
846 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
850 fprintf_unfiltered (gdb_stdlog,
851 "Process record: error reading "
852 "memory at addr = 0x%s "
854 OUTPUT_REG (tmpulongest, tdep->arg5),
858 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
859 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
861 if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
863 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
869 case gdb_sys_socketcall:
870 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
873 case RECORD_SYS_SOCKET:
874 case RECORD_SYS_BIND:
875 case RECORD_SYS_CONNECT:
876 case RECORD_SYS_LISTEN:
878 case RECORD_SYS_ACCEPT:
879 case RECORD_SYS_GETSOCKNAME:
880 case RECORD_SYS_GETPEERNAME:
882 regcache_raw_read_unsigned (regcache, tdep->arg2,
886 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
889 tmpulongest += tdep->size_ulong;
890 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
891 tdep->size_ulong * 2))
894 fprintf_unfiltered (gdb_stdlog,
895 "Process record: error reading "
896 "memory at addr = 0x%s len = %d.\n",
897 OUTPUT_REG (tmpulongest, tdep->arg2),
898 tdep->size_ulong * 2);
901 tmpulongest = extract_unsigned_integer (a,
904 len = extract_unsigned_integer (a + tdep->size_ulong,
905 tdep->size_ulong, byte_order);
906 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
912 case RECORD_SYS_SOCKETPAIR:
914 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
916 regcache_raw_read_unsigned (regcache, tdep->arg2,
920 tmpulongest += tdep->size_ulong * 3;
921 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
925 fprintf_unfiltered (gdb_stdlog,
926 "Process record: error reading "
927 "memory at addr = 0x%s len = %d.\n",
928 OUTPUT_REG (tmpulongest, tdep->arg2),
933 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
935 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
940 case RECORD_SYS_SEND:
941 case RECORD_SYS_SENDTO:
943 case RECORD_SYS_RECVFROM:
944 regcache_raw_read_unsigned (regcache, tdep->arg2,
948 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
951 tmpulongest += tdep->size_ulong * 4;
952 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
953 tdep->size_ulong * 2))
956 fprintf_unfiltered (gdb_stdlog,
957 "Process record: error reading "
958 "memory at addr = 0x%s len = %d.\n",
959 OUTPUT_REG (tmpulongest, tdep->arg2),
960 tdep->size_ulong * 2);
963 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
965 len = extract_unsigned_integer (a + tdep->size_ulong,
966 tdep->size_ulong, byte_order);
967 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
970 case RECORD_SYS_RECV:
971 regcache_raw_read_unsigned (regcache, tdep->arg2,
975 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
977 tmpulongest += tdep->size_ulong;
978 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
982 fprintf_unfiltered (gdb_stdlog,
983 "Process record: error reading "
984 "memory at addr = 0x%s len = %d.\n",
985 OUTPUT_REG (tmpulongest, tdep->arg2),
989 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
993 a += tdep->size_ulong;
994 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
996 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1002 case RECORD_SYS_SHUTDOWN:
1003 case RECORD_SYS_SETSOCKOPT:
1005 case RECORD_SYS_GETSOCKOPT:
1007 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
1008 gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
1010 regcache_raw_read_unsigned (regcache, tdep->arg2,
1014 tmpulongest += tdep->size_ulong * 3;
1015 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1016 tdep->size_ulong * 2))
1019 fprintf_unfiltered (gdb_stdlog,
1020 "Process record: error reading "
1021 "memory at addr = 0x%s len = %d.\n",
1022 OUTPUT_REG (tmpulongest, tdep->arg2),
1023 tdep->size_ulong * 2);
1026 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
1031 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
1035 fprintf_unfiltered (gdb_stdlog,
1036 "Process record: error reading "
1037 "memory at addr = 0x%s "
1039 phex_nz (tmpulongest,
1045 = (CORE_ADDR) extract_unsigned_integer (a,
1048 tmpint = (int) extract_unsigned_integer (av,
1051 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1053 a += tdep->size_ulong;
1055 = (CORE_ADDR) extract_unsigned_integer (a,
1058 if (record_full_arch_list_add_mem (tmpaddr,
1065 case RECORD_SYS_SENDMSG:
1067 case RECORD_SYS_RECVMSG:
1069 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
1071 regcache_raw_read_unsigned (regcache, tdep->arg2,
1075 tmpulongest += tdep->size_ulong;
1076 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1080 fprintf_unfiltered (gdb_stdlog,
1081 "Process record: error reading "
1082 "memory at addr = 0x%s len = %d.\n",
1083 OUTPUT_REG (tmpulongest, tdep->arg2),
1087 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1089 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1095 printf_unfiltered (_("Process record and replay target "
1096 "doesn't support socketcall call 0x%s\n"),
1097 OUTPUT_REG (tmpulongest, tdep->arg1));
1103 case gdb_sys_syslog:
1106 case gdb_sys_setitimer:
1107 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1108 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1109 tdep->size_itimerval))
1113 case gdb_sys_getitimer:
1114 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1115 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1116 tdep->size_itimerval))
1120 case gdb_sys_newstat:
1121 case gdb_sys_newlstat:
1122 case gdb_sys_newfstat:
1123 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1124 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1129 case gdb_sys_newfstatat:
1130 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1131 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1137 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1138 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1139 tdep->size_old_utsname))
1144 case gdb_sys_vhangup:
1145 case gdb_sys_ni_syscall112:
1146 case gdb_sys_vm86old:
1150 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1151 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1154 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1155 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1160 case gdb_sys_swapoff:
1163 case gdb_sys_sysinfo:
1164 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1165 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1166 tdep->size_sysinfo))
1170 case gdb_sys_shmget:
1171 case gdb_sys_semget:
1173 case gdb_sys_msgget:
1174 /* XXX maybe need do some record works with sys_shmdt. */
1176 case gdb_sys_msgsnd:
1177 case gdb_sys_semtimedop:
1181 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1182 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1187 case gdb_sys_shmctl:
1188 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1189 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1190 tdep->size_shmid_ds))
1194 /* XXX sys_semctl 525 still not supported. */
1197 case gdb_sys_msgrcv:
1202 regcache_raw_read_signed (regcache, tdep->arg3, &l);
1203 regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
1204 tmpint = l + tdep->size_long;
1205 if (record_full_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
1210 case gdb_sys_msgctl:
1211 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1212 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1213 tdep->size_msqid_ds))
1218 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1219 tmpulongest &= 0xffff;
1220 switch (tmpulongest)
1224 case RECORD_SEMTIMEDOP:
1227 /* XXX maybe need do some record works with RECORD_SHMDT. */
1236 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1237 regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
1238 tmpint = (int) second + tdep->size_long;
1239 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
1244 regcache_raw_read_unsigned (regcache, tdep->arg5,
1246 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1247 tdep->size_msqid_ds))
1251 regcache_raw_read_unsigned (regcache, tdep->arg4,
1253 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1258 regcache_raw_read_unsigned (regcache, tdep->arg5,
1260 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1261 tdep->size_shmid_ds))
1265 /* XXX RECORD_SEMCTL still not supported. */
1266 printf_unfiltered (_("Process record and replay target doesn't "
1267 "support ipc number %s\n"),
1268 pulongest (tmpulongest));
1274 case gdb_sys_sigreturn:
1276 case gdb_sys_setdomainname:
1279 case gdb_sys_newuname:
1280 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1281 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1282 tdep->size_new_utsname))
1286 case gdb_sys_modify_ldt:
1287 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1288 if (tmpulongest == 0 || tmpulongest == 2)
1290 ULONGEST ptr, bytecount;
1292 regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
1293 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1294 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
1299 case gdb_sys_adjtimex:
1300 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1301 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1306 case gdb_sys_mprotect:
1309 case gdb_sys_sigprocmask:
1310 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1311 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1312 tdep->size_old_sigset_t))
1316 case gdb_sys_ni_syscall127:
1317 case gdb_sys_init_module:
1318 case gdb_sys_delete_module:
1319 case gdb_sys_ni_syscall130:
1322 case gdb_sys_quotactl:
1323 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1324 switch (tmpulongest)
1326 case RECORD_Q_GETFMT:
1327 regcache_raw_read_unsigned (regcache, tdep->arg4,
1330 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
1333 case RECORD_Q_GETINFO:
1334 regcache_raw_read_unsigned (regcache, tdep->arg4,
1336 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1337 tdep->size_mem_dqinfo))
1340 case RECORD_Q_GETQUOTA:
1341 regcache_raw_read_unsigned (regcache, tdep->arg4,
1343 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1344 tdep->size_if_dqblk))
1347 case RECORD_Q_XGETQSTAT:
1348 case RECORD_Q_XGETQUOTA:
1349 regcache_raw_read_unsigned (regcache, tdep->arg4,
1351 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1352 tdep->size_fs_quota_stat))
1358 case gdb_sys_getpgid:
1359 case gdb_sys_fchdir:
1360 case gdb_sys_bdflush:
1364 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1365 if (tmpulongest == 2)
1367 regcache_raw_read_unsigned (regcache, tdep->arg3,
1369 /*XXX the size of memory is not very clear. */
1370 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
1375 case gdb_sys_personality:
1376 case gdb_sys_ni_syscall137:
1377 case gdb_sys_setfsuid16:
1378 case gdb_sys_setfsgid16:
1381 case gdb_sys_llseek:
1382 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1383 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1388 case gdb_sys_getdents:
1389 case gdb_sys_getdents64:
1393 regcache_raw_read_unsigned (regcache, tdep->arg2,
1395 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1396 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, count))
1401 case gdb_sys_select:
1402 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1403 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1406 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1407 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1410 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1411 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1414 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
1415 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1416 tdep->size_timeval))
1428 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1431 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
1433 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1434 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1436 if (target_read_memory ((CORE_ADDR) vec, iov,
1440 fprintf_unfiltered (gdb_stdlog,
1441 "Process record: error reading "
1442 "memory at addr = 0x%s len = %d.\n",
1443 OUTPUT_REG (vec, tdep->arg2),
1448 = (CORE_ADDR) extract_unsigned_integer (iov,
1452 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1455 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1457 vec += tdep->size_iovec;
1463 case gdb_sys_writev:
1464 case gdb_sys_getsid:
1465 case gdb_sys_fdatasync:
1466 case gdb_sys_sysctl:
1468 case gdb_sys_munlock:
1469 case gdb_sys_mlockall:
1470 case gdb_sys_munlockall:
1471 case gdb_sys_sched_setparam:
1474 case gdb_sys_sched_getparam:
1475 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1476 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1481 case gdb_sys_sched_setscheduler:
1482 case gdb_sys_sched_getscheduler:
1483 case gdb_sys_sched_yield:
1484 case gdb_sys_sched_get_priority_max:
1485 case gdb_sys_sched_get_priority_min:
1488 case gdb_sys_sched_rr_get_interval:
1489 case gdb_sys_nanosleep:
1490 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1491 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1492 tdep->size_timespec))
1496 case gdb_sys_mremap:
1497 case gdb_sys_setresuid16:
1500 case gdb_sys_getresuid16:
1501 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1502 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1503 tdep->size_old_uid_t))
1505 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1506 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1507 tdep->size_old_uid_t))
1509 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1510 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1511 tdep->size_old_uid_t))
1516 case gdb_sys_ni_syscall167:
1520 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1525 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1526 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1527 tdep->size_pollfd * nfds))
1532 case gdb_sys_nfsservctl:
1533 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1534 if (tmpulongest == 7 || tmpulongest == 8)
1538 if (tmpulongest == 7)
1539 rsize = tdep->size_NFS_FHSIZE;
1541 rsize = tdep->size_knfsd_fh;
1542 regcache_raw_read_unsigned (regcache, tdep->arg3,
1544 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
1549 case gdb_sys_setresgid16:
1552 case gdb_sys_getresgid16:
1553 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1554 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1555 tdep->size_old_gid_t))
1557 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1558 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1559 tdep->size_old_gid_t))
1561 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1562 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1563 tdep->size_old_gid_t))
1568 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1569 switch (tmpulongest)
1572 regcache_raw_read_unsigned (regcache, tdep->arg2,
1574 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1579 regcache_raw_read_unsigned (regcache, tdep->arg2,
1581 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1582 tdep->size_TASK_COMM_LEN))
1588 case gdb_sys_rt_sigreturn:
1591 case gdb_sys_rt_sigaction:
1592 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1593 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1594 tdep->size_sigaction))
1598 case gdb_sys_rt_sigprocmask:
1599 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1600 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1601 tdep->size_sigset_t))
1605 case gdb_sys_rt_sigpending:
1606 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1609 ULONGEST sigsetsize;
1611 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1612 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1618 case gdb_sys_rt_sigtimedwait:
1619 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1620 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1621 tdep->size_siginfo_t))
1625 case gdb_sys_rt_sigqueueinfo:
1626 case gdb_sys_rt_sigsuspend:
1629 case gdb_sys_pread64:
1630 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1635 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1636 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1642 case gdb_sys_pwrite64:
1643 case gdb_sys_chown16:
1646 case gdb_sys_getcwd:
1647 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1652 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1653 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1659 case gdb_sys_capget:
1660 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1661 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1662 tdep->size_cap_user_data_t))
1666 case gdb_sys_capset:
1669 case gdb_sys_sigaltstack:
1670 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1671 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1672 tdep->size_stack_t))
1676 case gdb_sys_sendfile:
1677 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1678 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1683 case gdb_sys_ni_syscall188:
1684 case gdb_sys_ni_syscall189:
1688 case gdb_sys_getrlimit:
1689 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1690 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1698 case gdb_sys_truncate64:
1699 case gdb_sys_ftruncate64:
1702 case gdb_sys_stat64:
1703 case gdb_sys_lstat64:
1704 case gdb_sys_fstat64:
1705 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1706 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1711 case gdb_sys_lchown:
1712 case gdb_sys_getuid:
1713 case gdb_sys_getgid:
1714 case gdb_sys_geteuid:
1715 case gdb_sys_getegid:
1716 case gdb_sys_setreuid:
1717 case gdb_sys_setregid:
1720 case gdb_sys_getgroups:
1721 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1724 ULONGEST gidsetsize;
1726 regcache_raw_read_unsigned (regcache, tdep->arg1,
1728 tmpint = tdep->size_gid_t * (int) gidsetsize;
1729 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1734 case gdb_sys_setgroups:
1735 case gdb_sys_fchown:
1736 case gdb_sys_setresuid:
1739 case gdb_sys_getresuid:
1740 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1741 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1744 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1745 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1748 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1749 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1754 case gdb_sys_setresgid:
1757 case gdb_sys_getresgid:
1758 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1759 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1762 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1763 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1766 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1767 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1773 case gdb_sys_setuid:
1774 case gdb_sys_setgid:
1775 case gdb_sys_setfsuid:
1776 case gdb_sys_setfsgid:
1777 case gdb_sys_pivot_root:
1780 case gdb_sys_mincore:
1781 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1782 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1783 tdep->size_PAGE_SIZE))
1787 case gdb_sys_madvise:
1790 case gdb_sys_fcntl64:
1791 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1792 if (tmpulongest == tdep->fcntl_F_GETLK64)
1794 regcache_raw_read_unsigned (regcache, tdep->arg3,
1796 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1797 tdep->size_flock64))
1800 else if (tmpulongest != tdep->fcntl_F_SETLK64
1801 && tmpulongest != tdep->fcntl_F_SETLKW64)
1807 case gdb_sys_ni_syscall222:
1808 case gdb_sys_ni_syscall223:
1809 case gdb_sys_gettid:
1810 case gdb_sys_readahead:
1811 case gdb_sys_setxattr:
1812 case gdb_sys_lsetxattr:
1813 case gdb_sys_fsetxattr:
1816 case gdb_sys_getxattr:
1817 case gdb_sys_lgetxattr:
1818 case gdb_sys_fgetxattr:
1819 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1824 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1825 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1831 case gdb_sys_listxattr:
1832 case gdb_sys_llistxattr:
1833 case gdb_sys_flistxattr:
1834 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1839 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1840 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1846 case gdb_sys_removexattr:
1847 case gdb_sys_lremovexattr:
1848 case gdb_sys_fremovexattr:
1852 case gdb_sys_sendfile64:
1853 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1854 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1860 case gdb_sys_sched_setaffinity:
1863 case gdb_sys_sched_getaffinity:
1864 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1869 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1870 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1876 case gdb_sys_set_thread_area:
1877 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1878 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1883 case gdb_sys_get_thread_area:
1884 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1885 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1886 tdep->size_user_desc))
1890 case gdb_sys_io_setup:
1891 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1892 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1897 case gdb_sys_io_destroy:
1900 case gdb_sys_io_getevents:
1901 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1906 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1907 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1908 nr * tdep->size_io_event))
1913 case gdb_sys_io_submit:
1914 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1920 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1921 iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
1922 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1923 nr * tdep->size_pointer))
1926 fprintf_unfiltered (gdb_stdlog,
1927 "Process record: error reading memory "
1928 "at addr = 0x%s len = %u.\n",
1929 OUTPUT_REG (tmpulongest, tdep->arg2),
1930 (int) (nr * tdep->size_pointer));
1933 for (i = 0; i < nr; i++)
1936 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1939 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1941 iocbp += tdep->size_pointer;
1946 case gdb_sys_io_cancel:
1947 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1948 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1949 tdep->size_io_event))
1953 case gdb_sys_fadvise64:
1954 case gdb_sys_ni_syscall251:
1957 case gdb_sys_exit_group:
1961 target_terminal_ours ();
1962 q = yquery (_("The next instruction is syscall exit_group. "
1963 "It will make the program exit. "
1964 "Do you want to stop the program?"));
1965 target_terminal_inferior ();
1971 case gdb_sys_lookup_dcookie:
1972 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1977 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1978 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1984 case gdb_sys_epoll_create:
1985 case gdb_sys_epoll_ctl:
1988 case gdb_sys_epoll_wait:
1989 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1994 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1995 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1997 * tdep->size_epoll_event)))
2002 case gdb_sys_remap_file_pages:
2003 case gdb_sys_set_tid_address:
2006 case gdb_sys_timer_create:
2007 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2008 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2013 case gdb_sys_timer_settime:
2014 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2015 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2016 tdep->size_itimerspec))
2020 case gdb_sys_timer_gettime:
2021 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2022 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2023 tdep->size_itimerspec))
2027 case gdb_sys_timer_getoverrun:
2028 case gdb_sys_timer_delete:
2029 case gdb_sys_clock_settime:
2032 case gdb_sys_clock_gettime:
2033 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2034 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2035 tdep->size_timespec))
2039 case gdb_sys_clock_getres:
2040 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2041 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2042 tdep->size_timespec))
2046 case gdb_sys_clock_nanosleep:
2047 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2048 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2049 tdep->size_timespec))
2053 case gdb_sys_statfs64:
2054 case gdb_sys_fstatfs64:
2055 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2056 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2057 tdep->size_statfs64))
2061 case gdb_sys_tgkill:
2062 case gdb_sys_utimes:
2063 case gdb_sys_fadvise64_64:
2064 case gdb_sys_ni_syscall273:
2068 case gdb_sys_get_mempolicy:
2069 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2070 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2073 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2078 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
2079 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2080 maxnode * tdep->size_long))
2085 case gdb_sys_set_mempolicy:
2086 case gdb_sys_mq_open:
2087 case gdb_sys_mq_unlink:
2088 case gdb_sys_mq_timedsend:
2091 case gdb_sys_mq_timedreceive:
2092 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2097 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
2098 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2102 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2103 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2108 case gdb_sys_mq_notify:
2111 case gdb_sys_mq_getsetattr:
2112 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2113 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2114 tdep->size_mq_attr))
2118 case gdb_sys_kexec_load:
2121 case gdb_sys_waitid:
2122 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2123 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2124 tdep->size_siginfo_t))
2126 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2127 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2132 case gdb_sys_ni_syscall285:
2133 case gdb_sys_add_key:
2134 case gdb_sys_request_key:
2137 case gdb_sys_keyctl:
2138 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2139 if (tmpulongest == 6 || tmpulongest == 11)
2141 regcache_raw_read_unsigned (regcache, tdep->arg3,
2147 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
2148 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2155 case gdb_sys_ioprio_set:
2156 case gdb_sys_ioprio_get:
2157 case gdb_sys_inotify_init:
2158 case gdb_sys_inotify_add_watch:
2159 case gdb_sys_inotify_rm_watch:
2160 case gdb_sys_migrate_pages:
2161 case gdb_sys_openat:
2162 case gdb_sys_mkdirat:
2163 case gdb_sys_mknodat:
2164 case gdb_sys_fchownat:
2165 case gdb_sys_futimesat:
2168 case gdb_sys_fstatat64:
2169 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2170 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2175 case gdb_sys_unlinkat:
2176 case gdb_sys_renameat:
2177 case gdb_sys_linkat:
2178 case gdb_sys_symlinkat:
2181 case gdb_sys_readlinkat:
2182 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2187 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
2188 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2194 case gdb_sys_fchmodat:
2195 case gdb_sys_faccessat:
2198 case gdb_sys_pselect6:
2199 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2200 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2203 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2204 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2207 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2208 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2211 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2212 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2213 tdep->size_timespec))
2218 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2223 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
2224 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2225 tdep->size_pollfd * nfds))
2228 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2229 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2230 tdep->size_timespec))
2234 case gdb_sys_unshare:
2235 case gdb_sys_set_robust_list:
2238 case gdb_sys_get_robust_list:
2239 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2240 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2243 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2244 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2249 case gdb_sys_splice:
2250 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2251 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2254 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2255 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2260 case gdb_sys_sync_file_range:
2262 case gdb_sys_vmsplice:
2265 case gdb_sys_move_pages:
2266 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2271 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2272 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2273 nr_pages * tdep->size_int))
2278 case gdb_sys_getcpu:
2279 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2280 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2283 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2284 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2287 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2288 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2289 tdep->size_ulong * 2))
2293 case gdb_sys_epoll_pwait:
2294 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2299 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2300 tmpint = (int) maxevents * tdep->size_epoll_event;
2301 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2306 case gdb_sys_fallocate:
2307 case gdb_sys_eventfd2:
2308 case gdb_sys_epoll_create1:
2313 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2314 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2315 tdep->size_int * 2))
2319 case gdb_sys_inotify_init1:
2323 printf_unfiltered (_("Process record and replay target doesn't "
2324 "support syscall number %d\n"), syscall);