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))
275 case gdb_sys_waitpid:
284 case gdb_sys_lchown16:
285 case gdb_sys_ni_syscall17:
291 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
292 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
293 tdep->size__old_kernel_stat))
300 case gdb_sys_oldumount:
301 case gdb_sys_setuid16:
302 case gdb_sys_getuid16:
307 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
308 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
309 || tmpulongest == RECORD_PTRACE_PEEKDATA
310 || tmpulongest == RECORD_PTRACE_PEEKUSR)
312 regcache_raw_read_unsigned (regcache, tdep->arg4,
314 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
322 case gdb_sys_ni_syscall31:
323 case gdb_sys_ni_syscall32:
326 case gdb_sys_ni_syscall35:
337 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
338 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
343 case gdb_sys_ni_syscall44:
345 case gdb_sys_setgid16:
346 case gdb_sys_getgid16:
348 case gdb_sys_geteuid16:
349 case gdb_sys_getegid16:
352 case gdb_sys_ni_syscall53:
356 /* XXX Need to add a lot of support of other ioctl requests. */
357 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
358 if (tmpulongest == tdep->ioctl_FIOCLEX
359 || tmpulongest == tdep->ioctl_FIONCLEX
360 || tmpulongest == tdep->ioctl_FIONBIO
361 || tmpulongest == tdep->ioctl_FIOASYNC
362 || tmpulongest == tdep->ioctl_TCSETS
363 || tmpulongest == tdep->ioctl_TCSETSW
364 || tmpulongest == tdep->ioctl_TCSETSF
365 || tmpulongest == tdep->ioctl_TCSETA
366 || tmpulongest == tdep->ioctl_TCSETAW
367 || tmpulongest == tdep->ioctl_TCSETAF
368 || tmpulongest == tdep->ioctl_TCSBRK
369 || tmpulongest == tdep->ioctl_TCXONC
370 || tmpulongest == tdep->ioctl_TCFLSH
371 || tmpulongest == tdep->ioctl_TIOCEXCL
372 || tmpulongest == tdep->ioctl_TIOCNXCL
373 || tmpulongest == tdep->ioctl_TIOCSCTTY
374 || tmpulongest == tdep->ioctl_TIOCSPGRP
375 || tmpulongest == tdep->ioctl_TIOCSTI
376 || tmpulongest == tdep->ioctl_TIOCSWINSZ
377 || tmpulongest == tdep->ioctl_TIOCMBIS
378 || tmpulongest == tdep->ioctl_TIOCMBIC
379 || tmpulongest == tdep->ioctl_TIOCMSET
380 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
381 || tmpulongest == tdep->ioctl_TIOCCONS
382 || tmpulongest == tdep->ioctl_TIOCSSERIAL
383 || tmpulongest == tdep->ioctl_TIOCPKT
384 || tmpulongest == tdep->ioctl_TIOCNOTTY
385 || tmpulongest == tdep->ioctl_TIOCSETD
386 || tmpulongest == tdep->ioctl_TCSBRKP
387 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
388 || tmpulongest == tdep->ioctl_TIOCSBRK
389 || tmpulongest == tdep->ioctl_TIOCCBRK
390 || tmpulongest == tdep->ioctl_TCSETS2
391 || tmpulongest == tdep->ioctl_TCSETSW2
392 || tmpulongest == tdep->ioctl_TCSETSF2
393 || tmpulongest == tdep->ioctl_TIOCSPTLCK
394 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
395 || tmpulongest == tdep->ioctl_TIOCSERGWILD
396 || tmpulongest == tdep->ioctl_TIOCSERSWILD
397 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
398 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
399 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
400 || tmpulongest == tdep->ioctl_TIOCMIWAIT
401 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
405 else if (tmpulongest == tdep->ioctl_TCGETS
406 || tmpulongest == tdep->ioctl_TCGETA
407 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
409 regcache_raw_read_unsigned (regcache, tdep->arg3,
411 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
415 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
416 || tmpulongest == tdep->ioctl_TIOCGSID)
418 regcache_raw_read_unsigned (regcache, tdep->arg3,
420 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
424 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
425 || tmpulongest == tdep->ioctl_TIOCMGET
426 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
427 || tmpulongest == tdep->ioctl_FIONREAD
428 || tmpulongest == tdep->ioctl_TIOCINQ
429 || tmpulongest == tdep->ioctl_TIOCGETD
430 || tmpulongest == tdep->ioctl_TIOCGPTN
431 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
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_TIOCGWINSZ)
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_TIOCLINUX)
449 regcache_raw_read_unsigned (regcache, tdep->arg3,
451 /* This syscall affects a char-size memory. */
452 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
455 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
457 regcache_raw_read_unsigned (regcache, tdep->arg3,
459 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
460 tdep->size_serial_struct))
463 else if (tmpulongest == tdep->ioctl_TCGETS2)
465 regcache_raw_read_unsigned (regcache, tdep->arg3,
467 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
468 tdep->size_termios2))
471 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
473 regcache_raw_read_unsigned (regcache, tdep->arg3,
475 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
479 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
481 regcache_raw_read_unsigned (regcache, tdep->arg3,
483 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
484 tdep->size_serial_icounter_struct))
487 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
489 regcache_raw_read_unsigned (regcache, tdep->arg3,
491 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
492 tdep->size_hayes_esp_config))
495 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
497 printf_unfiltered (_("Process record and replay target doesn't "
498 "support ioctl request TIOCSERGSTRUCT\n"));
503 printf_unfiltered (_("Process record and replay target doesn't "
504 "support ioctl request 0x%s.\n"),
505 OUTPUT_REG (tmpulongest, tdep->arg2));
512 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
514 if (tmpulongest == tdep->fcntl_F_GETLK)
516 regcache_raw_read_unsigned (regcache, tdep->arg3,
518 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
524 case gdb_sys_ni_syscall56:
525 case gdb_sys_setpgid:
526 case gdb_sys_ni_syscall58:
529 case gdb_sys_olduname:
530 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
531 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
532 tdep->size_oldold_utsname))
541 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
542 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
548 case gdb_sys_getppid:
549 case gdb_sys_getpgrp:
553 case gdb_sys_sigaction:
554 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
555 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
556 tdep->size_old_sigaction))
560 case gdb_sys_sgetmask:
561 case gdb_sys_ssetmask:
562 case gdb_sys_setreuid16:
563 case gdb_sys_setregid16:
564 case gdb_sys_sigsuspend:
567 case gdb_sys_sigpending:
568 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
569 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
570 tdep->size_old_sigset_t))
574 case gdb_sys_sethostname:
575 case gdb_sys_setrlimit:
578 case gdb_sys_old_getrlimit:
579 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
580 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
585 case gdb_sys_getrusage:
586 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
587 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
592 case gdb_sys_gettimeofday:
593 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
594 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
597 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
598 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
599 tdep->size_timezone))
603 case gdb_sys_settimeofday:
606 case gdb_sys_getgroups16:
607 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
608 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
609 tdep->size_old_gid_t))
613 case gdb_sys_setgroups16:
614 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
615 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
616 tdep->size_old_gid_t))
622 struct sel_arg_struct
631 regcache_raw_read_unsigned (regcache, tdep->arg1,
635 if (target_read_memory (tmpulongest, (gdb_byte *) &sel,
639 fprintf_unfiltered (gdb_stdlog,
640 "Process record: error reading memory "
641 "at addr = 0x%s len = %lu.\n",
642 OUTPUT_REG (tmpulongest, tdep->arg1),
643 (unsigned long) sizeof (sel));
646 if (record_full_arch_list_add_mem (sel.inp, tdep->size_fd_set))
648 if (record_full_arch_list_add_mem (sel.outp, tdep->size_fd_set))
650 if (record_full_arch_list_add_mem (sel.exp, tdep->size_fd_set))
652 if (record_full_arch_list_add_mem (sel.tvp, tdep->size_timeval))
658 case gdb_sys_symlink:
661 case gdb_sys_readlink:
665 regcache_raw_read_unsigned (regcache, tdep->arg2,
667 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
668 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
681 target_terminal_ours ();
682 q = yquery (_("The next instruction is syscall reboot. "
683 "It will restart the computer. "
684 "Do you want to stop the program?"));
685 target_terminal_inferior ();
691 case gdb_old_readdir:
692 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
693 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
694 tdep->size_old_dirent))
705 regcache_raw_read_unsigned (regcache, tdep->arg1,
707 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
708 if (record_full_memory_query)
712 target_terminal_ours ();
714 The next instruction is syscall munmap.\n\
715 It will free the memory addr = 0x%s len = %u.\n\
716 It will make record target cannot record some memory change.\n\
717 Do you want to stop the program?"),
718 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
719 target_terminal_inferior ();
726 case gdb_sys_truncate:
727 case gdb_sys_ftruncate:
729 case gdb_sys_fchown16:
730 case gdb_sys_getpriority:
731 case gdb_sys_setpriority:
732 case gdb_sys_ni_syscall98:
736 case gdb_sys_fstatfs:
737 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
738 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
748 case gdb_sys_sendmsg:
749 case gdb_sys_shutdown:
751 case gdb_sys_connect:
753 case gdb_sys_setsockopt:
757 case gdb_sys_getsockname:
758 case gdb_sys_getpeername:
762 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
763 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
764 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
769 case gdb_sys_recvfrom:
773 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
774 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
775 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
784 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
785 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
786 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
792 case gdb_sys_recvmsg:
793 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
794 if (record_linux_msghdr (regcache, tdep, tmpulongest))
798 case gdb_sys_socketpair:
799 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
800 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
805 case gdb_sys_getsockopt:
806 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
810 gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
812 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
816 fprintf_unfiltered (gdb_stdlog,
817 "Process record: error reading "
818 "memory at addr = 0x%s "
820 OUTPUT_REG (tmpulongest, tdep->arg5),
824 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
825 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
827 if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
829 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
835 case gdb_sys_socketcall:
836 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
839 case RECORD_SYS_SOCKET:
840 case RECORD_SYS_BIND:
841 case RECORD_SYS_CONNECT:
842 case RECORD_SYS_LISTEN:
844 case RECORD_SYS_ACCEPT:
845 case RECORD_SYS_GETSOCKNAME:
846 case RECORD_SYS_GETPEERNAME:
848 regcache_raw_read_unsigned (regcache, tdep->arg2,
852 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
855 tmpulongest += tdep->size_ulong;
856 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
857 tdep->size_ulong * 2))
860 fprintf_unfiltered (gdb_stdlog,
861 "Process record: error reading "
862 "memory at addr = 0x%s len = %d.\n",
863 OUTPUT_REG (tmpulongest, tdep->arg2),
864 tdep->size_ulong * 2);
867 tmpulongest = extract_unsigned_integer (a,
870 len = extract_unsigned_integer (a + tdep->size_ulong,
871 tdep->size_ulong, byte_order);
872 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
878 case RECORD_SYS_SOCKETPAIR:
880 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
882 regcache_raw_read_unsigned (regcache, tdep->arg2,
886 tmpulongest += tdep->size_ulong * 3;
887 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
891 fprintf_unfiltered (gdb_stdlog,
892 "Process record: error reading "
893 "memory at addr = 0x%s len = %d.\n",
894 OUTPUT_REG (tmpulongest, tdep->arg2),
899 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
901 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
906 case RECORD_SYS_SEND:
907 case RECORD_SYS_SENDTO:
909 case RECORD_SYS_RECVFROM:
910 regcache_raw_read_unsigned (regcache, tdep->arg2,
914 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
917 tmpulongest += tdep->size_ulong * 4;
918 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
919 tdep->size_ulong * 2))
922 fprintf_unfiltered (gdb_stdlog,
923 "Process record: error reading "
924 "memory at addr = 0x%s len = %d.\n",
925 OUTPUT_REG (tmpulongest, tdep->arg2),
926 tdep->size_ulong * 2);
929 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
931 len = extract_unsigned_integer (a + tdep->size_ulong,
932 tdep->size_ulong, byte_order);
933 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
936 case RECORD_SYS_RECV:
937 regcache_raw_read_unsigned (regcache, tdep->arg2,
941 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
943 tmpulongest += tdep->size_ulong;
944 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
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),
955 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
959 a += tdep->size_ulong;
960 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
962 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
968 case RECORD_SYS_SHUTDOWN:
969 case RECORD_SYS_SETSOCKOPT:
971 case RECORD_SYS_GETSOCKOPT:
973 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
974 gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
976 regcache_raw_read_unsigned (regcache, tdep->arg2,
980 tmpulongest += tdep->size_ulong * 3;
981 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
982 tdep->size_ulong * 2))
985 fprintf_unfiltered (gdb_stdlog,
986 "Process record: error reading "
987 "memory at addr = 0x%s len = %d.\n",
988 OUTPUT_REG (tmpulongest, tdep->arg2),
989 tdep->size_ulong * 2);
992 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
997 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
1001 fprintf_unfiltered (gdb_stdlog,
1002 "Process record: error reading "
1003 "memory at addr = 0x%s "
1005 phex_nz (tmpulongest,
1011 = (CORE_ADDR) extract_unsigned_integer (a,
1014 tmpint = (int) extract_unsigned_integer (av,
1017 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1019 a += tdep->size_ulong;
1021 = (CORE_ADDR) extract_unsigned_integer (a,
1024 if (record_full_arch_list_add_mem (tmpaddr,
1031 case RECORD_SYS_SENDMSG:
1033 case RECORD_SYS_RECVMSG:
1035 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
1037 regcache_raw_read_unsigned (regcache, tdep->arg2,
1041 tmpulongest += tdep->size_ulong;
1042 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1046 fprintf_unfiltered (gdb_stdlog,
1047 "Process record: error reading "
1048 "memory at addr = 0x%s len = %d.\n",
1049 OUTPUT_REG (tmpulongest, tdep->arg2),
1053 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1055 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1061 printf_unfiltered (_("Process record and replay target "
1062 "doesn't support socketcall call 0x%s\n"),
1063 OUTPUT_REG (tmpulongest, tdep->arg1));
1069 case gdb_sys_syslog:
1072 case gdb_sys_setitimer:
1073 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1074 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1075 tdep->size_itimerval))
1079 case gdb_sys_getitimer:
1080 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1081 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1082 tdep->size_itimerval))
1086 case gdb_sys_newstat:
1087 case gdb_sys_newlstat:
1088 case gdb_sys_newfstat:
1089 case gdb_sys_newfstatat:
1090 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1091 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1097 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1098 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1099 tdep->size_old_utsname))
1104 case gdb_sys_vhangup:
1105 case gdb_sys_ni_syscall112:
1106 case gdb_sys_vm86old:
1110 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1111 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1114 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1115 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1120 case gdb_sys_swapoff:
1123 case gdb_sys_sysinfo:
1124 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1125 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1126 tdep->size_sysinfo))
1130 case gdb_sys_shmget:
1131 case gdb_sys_semget:
1133 case gdb_sys_msgget:
1134 /* XXX maybe need do some record works with sys_shmdt. */
1136 case gdb_sys_msgsnd:
1137 case gdb_sys_semtimedop:
1141 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1142 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1147 case gdb_sys_shmctl:
1148 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1149 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1150 tdep->size_shmid_ds))
1154 /* XXX sys_semctl 525 still not supported. */
1157 case gdb_sys_msgrcv:
1162 regcache_raw_read_signed (regcache, tdep->arg3, &l);
1163 regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
1164 tmpint = l + tdep->size_long;
1165 if (record_full_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
1170 case gdb_sys_msgctl:
1171 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1172 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1173 tdep->size_msqid_ds))
1178 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1179 tmpulongest &= 0xffff;
1180 switch (tmpulongest)
1184 case RECORD_SEMTIMEDOP:
1187 /* XXX maybe need do some record works with RECORD_SHMDT. */
1196 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1197 regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
1198 tmpint = (int) second + tdep->size_long;
1199 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
1204 regcache_raw_read_unsigned (regcache, tdep->arg5,
1206 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1207 tdep->size_msqid_ds))
1211 regcache_raw_read_unsigned (regcache, tdep->arg4,
1213 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1218 regcache_raw_read_unsigned (regcache, tdep->arg5,
1220 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1221 tdep->size_shmid_ds))
1225 /* XXX RECORD_SEMCTL still not supported. */
1226 printf_unfiltered (_("Process record and replay target doesn't "
1227 "support ipc number %s\n"),
1228 pulongest (tmpulongest));
1234 case gdb_sys_sigreturn:
1236 case gdb_sys_setdomainname:
1239 case gdb_sys_newuname:
1240 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1241 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1242 tdep->size_new_utsname))
1246 case gdb_sys_modify_ldt:
1247 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1248 if (tmpulongest == 0 || tmpulongest == 2)
1250 ULONGEST ptr, bytecount;
1252 regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
1253 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1254 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
1259 case gdb_sys_adjtimex:
1260 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1261 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1266 case gdb_sys_mprotect:
1269 case gdb_sys_sigprocmask:
1270 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1271 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1272 tdep->size_old_sigset_t))
1276 case gdb_sys_ni_syscall127:
1277 case gdb_sys_init_module:
1278 case gdb_sys_delete_module:
1279 case gdb_sys_ni_syscall130:
1282 case gdb_sys_quotactl:
1283 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1284 switch (tmpulongest)
1286 case RECORD_Q_GETFMT:
1287 regcache_raw_read_unsigned (regcache, tdep->arg4,
1290 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
1293 case RECORD_Q_GETINFO:
1294 regcache_raw_read_unsigned (regcache, tdep->arg4,
1296 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1297 tdep->size_mem_dqinfo))
1300 case RECORD_Q_GETQUOTA:
1301 regcache_raw_read_unsigned (regcache, tdep->arg4,
1303 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1304 tdep->size_if_dqblk))
1307 case RECORD_Q_XGETQSTAT:
1308 case RECORD_Q_XGETQUOTA:
1309 regcache_raw_read_unsigned (regcache, tdep->arg4,
1311 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1312 tdep->size_fs_quota_stat))
1318 case gdb_sys_getpgid:
1319 case gdb_sys_fchdir:
1320 case gdb_sys_bdflush:
1324 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1325 if (tmpulongest == 2)
1327 regcache_raw_read_unsigned (regcache, tdep->arg3,
1329 /*XXX the size of memory is not very clear. */
1330 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
1335 case gdb_sys_personality:
1336 case gdb_sys_ni_syscall137:
1337 case gdb_sys_setfsuid16:
1338 case gdb_sys_setfsgid16:
1341 case gdb_sys_llseek:
1342 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1343 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1348 case gdb_sys_getdents:
1349 case gdb_sys_getdents64:
1353 regcache_raw_read_unsigned (regcache, tdep->arg2,
1355 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1356 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, count))
1361 case gdb_sys_select:
1362 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1363 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1366 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1367 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1370 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1371 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1374 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
1375 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1376 tdep->size_timeval))
1388 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1391 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
1393 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1394 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1396 if (target_read_memory ((CORE_ADDR) vec, iov,
1400 fprintf_unfiltered (gdb_stdlog,
1401 "Process record: error reading "
1402 "memory at addr = 0x%s len = %d.\n",
1403 OUTPUT_REG (vec, tdep->arg2),
1408 = (CORE_ADDR) extract_unsigned_integer (iov,
1412 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1415 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1417 vec += tdep->size_iovec;
1423 case gdb_sys_writev:
1424 case gdb_sys_getsid:
1425 case gdb_sys_fdatasync:
1426 case gdb_sys_sysctl:
1428 case gdb_sys_munlock:
1429 case gdb_sys_mlockall:
1430 case gdb_sys_munlockall:
1431 case gdb_sys_sched_setparam:
1434 case gdb_sys_sched_getparam:
1435 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1436 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1441 case gdb_sys_sched_setscheduler:
1442 case gdb_sys_sched_getscheduler:
1443 case gdb_sys_sched_yield:
1444 case gdb_sys_sched_get_priority_max:
1445 case gdb_sys_sched_get_priority_min:
1448 case gdb_sys_sched_rr_get_interval:
1449 case gdb_sys_nanosleep:
1450 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1451 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1452 tdep->size_timespec))
1456 case gdb_sys_mremap:
1457 case gdb_sys_setresuid16:
1460 case gdb_sys_getresuid16:
1461 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1462 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1463 tdep->size_old_uid_t))
1465 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1466 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1467 tdep->size_old_uid_t))
1469 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1470 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1471 tdep->size_old_uid_t))
1476 case gdb_sys_ni_syscall167:
1480 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1485 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1486 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1487 tdep->size_pollfd * nfds))
1492 case gdb_sys_nfsservctl:
1493 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1494 if (tmpulongest == 7 || tmpulongest == 8)
1498 if (tmpulongest == 7)
1499 rsize = tdep->size_NFS_FHSIZE;
1501 rsize = tdep->size_knfsd_fh;
1502 regcache_raw_read_unsigned (regcache, tdep->arg3,
1504 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
1509 case gdb_sys_setresgid16:
1512 case gdb_sys_getresgid16:
1513 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1514 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1515 tdep->size_old_gid_t))
1517 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1518 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1519 tdep->size_old_gid_t))
1521 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1522 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1523 tdep->size_old_gid_t))
1528 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1529 switch (tmpulongest)
1532 regcache_raw_read_unsigned (regcache, tdep->arg2,
1534 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1539 regcache_raw_read_unsigned (regcache, tdep->arg2,
1541 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1542 tdep->size_TASK_COMM_LEN))
1548 case gdb_sys_rt_sigreturn:
1551 case gdb_sys_rt_sigaction:
1552 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1553 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1554 tdep->size_sigaction))
1558 case gdb_sys_rt_sigprocmask:
1559 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1560 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1561 tdep->size_sigset_t))
1565 case gdb_sys_rt_sigpending:
1566 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1569 ULONGEST sigsetsize;
1571 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1572 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1578 case gdb_sys_rt_sigtimedwait:
1579 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1580 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1581 tdep->size_siginfo_t))
1585 case gdb_sys_rt_sigqueueinfo:
1586 case gdb_sys_rt_sigsuspend:
1589 case gdb_sys_pread64:
1590 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1595 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1596 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1602 case gdb_sys_pwrite64:
1603 case gdb_sys_chown16:
1606 case gdb_sys_getcwd:
1607 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1612 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1613 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1619 case gdb_sys_capget:
1620 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1621 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1622 tdep->size_cap_user_data_t))
1626 case gdb_sys_capset:
1629 case gdb_sys_sigaltstack:
1630 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1631 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1632 tdep->size_stack_t))
1636 case gdb_sys_sendfile:
1637 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1638 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1643 case gdb_sys_ni_syscall188:
1644 case gdb_sys_ni_syscall189:
1648 case gdb_sys_getrlimit:
1649 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1650 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1658 case gdb_sys_truncate64:
1659 case gdb_sys_ftruncate64:
1662 case gdb_sys_stat64:
1663 case gdb_sys_lstat64:
1664 case gdb_sys_fstat64:
1665 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1666 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1671 case gdb_sys_lchown:
1672 case gdb_sys_getuid:
1673 case gdb_sys_getgid:
1674 case gdb_sys_geteuid:
1675 case gdb_sys_getegid:
1676 case gdb_sys_setreuid:
1677 case gdb_sys_setregid:
1680 case gdb_sys_getgroups:
1681 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1684 ULONGEST gidsetsize;
1686 regcache_raw_read_unsigned (regcache, tdep->arg1,
1688 tmpint = tdep->size_gid_t * (int) gidsetsize;
1689 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1694 case gdb_sys_setgroups:
1695 case gdb_sys_fchown:
1696 case gdb_sys_setresuid:
1699 case gdb_sys_getresuid:
1700 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1701 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1704 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1705 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1708 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1709 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1714 case gdb_sys_setresgid:
1717 case gdb_sys_getresgid:
1718 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1719 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1722 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1723 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1726 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1727 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1733 case gdb_sys_setuid:
1734 case gdb_sys_setgid:
1735 case gdb_sys_setfsuid:
1736 case gdb_sys_setfsgid:
1737 case gdb_sys_pivot_root:
1740 case gdb_sys_mincore:
1741 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1742 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1743 tdep->size_PAGE_SIZE))
1747 case gdb_sys_madvise:
1750 case gdb_sys_fcntl64:
1751 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1752 if (tmpulongest == tdep->fcntl_F_GETLK64)
1754 regcache_raw_read_unsigned (regcache, tdep->arg3,
1756 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1757 tdep->size_flock64))
1760 else if (tmpulongest != tdep->fcntl_F_SETLK64
1761 && tmpulongest != tdep->fcntl_F_SETLKW64)
1767 case gdb_sys_ni_syscall222:
1768 case gdb_sys_ni_syscall223:
1769 case gdb_sys_gettid:
1770 case gdb_sys_readahead:
1771 case gdb_sys_setxattr:
1772 case gdb_sys_lsetxattr:
1773 case gdb_sys_fsetxattr:
1776 case gdb_sys_getxattr:
1777 case gdb_sys_lgetxattr:
1778 case gdb_sys_fgetxattr:
1779 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1784 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1785 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1791 case gdb_sys_listxattr:
1792 case gdb_sys_llistxattr:
1793 case gdb_sys_flistxattr:
1794 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1799 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1800 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1806 case gdb_sys_removexattr:
1807 case gdb_sys_lremovexattr:
1808 case gdb_sys_fremovexattr:
1812 case gdb_sys_sendfile64:
1813 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1814 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1820 case gdb_sys_sched_setaffinity:
1823 case gdb_sys_sched_getaffinity:
1824 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1829 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1830 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1836 case gdb_sys_set_thread_area:
1837 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1838 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1843 case gdb_sys_get_thread_area:
1844 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1845 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1846 tdep->size_user_desc))
1850 case gdb_sys_io_setup:
1851 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1852 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1857 case gdb_sys_io_destroy:
1860 case gdb_sys_io_getevents:
1861 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1866 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1867 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1868 nr * tdep->size_io_event))
1873 case gdb_sys_io_submit:
1874 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1880 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1881 iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
1882 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1883 nr * tdep->size_pointer))
1886 fprintf_unfiltered (gdb_stdlog,
1887 "Process record: error reading memory "
1888 "at addr = 0x%s len = %u.\n",
1889 OUTPUT_REG (tmpulongest, tdep->arg2),
1890 (int) (nr * tdep->size_pointer));
1893 for (i = 0; i < nr; i++)
1896 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1899 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1901 iocbp += tdep->size_pointer;
1906 case gdb_sys_io_cancel:
1907 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1908 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1909 tdep->size_io_event))
1913 case gdb_sys_fadvise64:
1914 case gdb_sys_ni_syscall251:
1917 case gdb_sys_exit_group:
1921 target_terminal_ours ();
1922 q = yquery (_("The next instruction is syscall exit_group. "
1923 "It will make the program exit. "
1924 "Do you want to stop the program?"));
1925 target_terminal_inferior ();
1931 case gdb_sys_lookup_dcookie:
1932 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1937 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1938 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1944 case gdb_sys_epoll_create:
1945 case gdb_sys_epoll_ctl:
1948 case gdb_sys_epoll_wait:
1949 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1954 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1955 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1957 * tdep->size_epoll_event)))
1962 case gdb_sys_remap_file_pages:
1963 case gdb_sys_set_tid_address:
1966 case gdb_sys_timer_create:
1967 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1968 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1973 case gdb_sys_timer_settime:
1974 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1975 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1976 tdep->size_itimerspec))
1980 case gdb_sys_timer_gettime:
1981 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1982 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1983 tdep->size_itimerspec))
1987 case gdb_sys_timer_getoverrun:
1988 case gdb_sys_timer_delete:
1989 case gdb_sys_clock_settime:
1992 case gdb_sys_clock_gettime:
1993 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1994 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1995 tdep->size_timespec))
1999 case gdb_sys_clock_getres:
2000 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2001 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2002 tdep->size_timespec))
2006 case gdb_sys_clock_nanosleep:
2007 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2008 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2009 tdep->size_timespec))
2013 case gdb_sys_statfs64:
2014 case gdb_sys_fstatfs64:
2015 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2016 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2017 tdep->size_statfs64))
2021 case gdb_sys_tgkill:
2022 case gdb_sys_utimes:
2023 case gdb_sys_fadvise64_64:
2024 case gdb_sys_ni_syscall273:
2028 case gdb_sys_get_mempolicy:
2029 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2030 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2033 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2038 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
2039 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2040 maxnode * tdep->size_long))
2045 case gdb_sys_set_mempolicy:
2046 case gdb_sys_mq_open:
2047 case gdb_sys_mq_unlink:
2048 case gdb_sys_mq_timedsend:
2051 case gdb_sys_mq_timedreceive:
2052 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2057 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
2058 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2062 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2063 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2068 case gdb_sys_mq_notify:
2071 case gdb_sys_mq_getsetattr:
2072 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2073 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2074 tdep->size_mq_attr))
2078 case gdb_sys_kexec_load:
2081 case gdb_sys_waitid:
2082 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2083 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2084 tdep->size_siginfo_t))
2086 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2087 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2092 case gdb_sys_ni_syscall285:
2093 case gdb_sys_add_key:
2094 case gdb_sys_request_key:
2097 case gdb_sys_keyctl:
2098 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2099 if (tmpulongest == 6 || tmpulongest == 11)
2101 regcache_raw_read_unsigned (regcache, tdep->arg3,
2107 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
2108 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2115 case gdb_sys_ioprio_set:
2116 case gdb_sys_ioprio_get:
2117 case gdb_sys_inotify_init:
2118 case gdb_sys_inotify_add_watch:
2119 case gdb_sys_inotify_rm_watch:
2120 case gdb_sys_migrate_pages:
2121 case gdb_sys_openat:
2122 case gdb_sys_mkdirat:
2123 case gdb_sys_mknodat:
2124 case gdb_sys_fchownat:
2125 case gdb_sys_futimesat:
2128 case gdb_sys_fstatat64:
2129 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2130 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2135 case gdb_sys_unlinkat:
2136 case gdb_sys_renameat:
2137 case gdb_sys_linkat:
2138 case gdb_sys_symlinkat:
2141 case gdb_sys_readlinkat:
2142 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2147 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
2148 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2154 case gdb_sys_fchmodat:
2155 case gdb_sys_faccessat:
2158 case gdb_sys_pselect6:
2159 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2160 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2163 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2164 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2167 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2168 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2171 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2172 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2173 tdep->size_timespec))
2178 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2183 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
2184 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2185 tdep->size_pollfd * nfds))
2188 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2189 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2190 tdep->size_timespec))
2194 case gdb_sys_unshare:
2195 case gdb_sys_set_robust_list:
2198 case gdb_sys_get_robust_list:
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,
2209 case gdb_sys_splice:
2210 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2211 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2214 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2215 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2220 case gdb_sys_sync_file_range:
2222 case gdb_sys_vmsplice:
2225 case gdb_sys_move_pages:
2226 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2231 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2232 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2233 nr_pages * tdep->size_int))
2238 case gdb_sys_getcpu:
2239 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2240 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2243 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2244 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2247 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2248 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2249 tdep->size_ulong * 2))
2253 case gdb_sys_epoll_pwait:
2254 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2259 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2260 tmpint = (int) maxevents * tdep->size_epoll_event;
2261 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2267 printf_unfiltered (_("Process record and replay target doesn't "
2268 "support syscall number %d\n"), syscall);