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 = 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 = 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,
167 /* msg_iov msg_iovlen */
168 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
169 a += tdep->size_pointer;
173 ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
175 gdb_byte *iov = alloca (tdep->size_iovec);
177 for (i = 0; i < len; i++)
179 if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
182 fprintf_unfiltered (gdb_stdlog,
183 "Process record: error "
187 phex_nz (addr,tdep->size_pointer),
191 tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
194 tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
197 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
199 addr += tdep->size_iovec;
202 a += tdep->size_size_t;
204 /* msg_control msg_controllen */
205 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
206 a += tdep->size_pointer;
207 tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
208 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
214 /* When the architecture process record get a Linux syscall
215 instruction, it will get a Linux syscall number of this
216 architecture and convert it to the Linux syscall number "num" which
217 is internal to GDB. Most Linux syscalls across architectures in
218 Linux would be similar and mostly differ by sizes of types and
219 structures. This sizes are put to "tdep".
221 Record the values of the registers and memory that will be changed
222 in current system call.
224 Return -1 if something wrong. */
227 record_linux_system_call (enum gdb_syscall syscall,
228 struct regcache *regcache,
229 struct linux_record_tdep *tdep)
231 struct gdbarch *gdbarch = get_regcache_arch (regcache);
232 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
233 ULONGEST tmpulongest;
239 case gdb_sys_restart_syscall:
246 target_terminal_ours ();
247 q = yquery (_("The next instruction is syscall exit. "
248 "It will make the program exit. "
249 "Do you want to stop the program?"));
250 target_terminal_inferior ();
261 ULONGEST addr, count;
263 regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
264 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
265 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, (int) count))
273 case gdb_sys_waitpid:
282 case gdb_sys_lchown16:
283 case gdb_sys_ni_syscall17:
289 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
290 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
291 tdep->size__old_kernel_stat))
298 case gdb_sys_oldumount:
299 case gdb_sys_setuid16:
300 case gdb_sys_getuid16:
305 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
306 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
307 || tmpulongest == RECORD_PTRACE_PEEKDATA
308 || tmpulongest == RECORD_PTRACE_PEEKUSR)
310 regcache_raw_read_unsigned (regcache, tdep->arg4,
312 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
320 case gdb_sys_ni_syscall31:
321 case gdb_sys_ni_syscall32:
324 case gdb_sys_ni_syscall35:
335 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
336 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
341 case gdb_sys_ni_syscall44:
343 case gdb_sys_setgid16:
344 case gdb_sys_getgid16:
346 case gdb_sys_geteuid16:
347 case gdb_sys_getegid16:
350 case gdb_sys_ni_syscall53:
354 /* XXX Need to add a lot of support of other ioctl requests. */
355 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
356 if (tmpulongest == tdep->ioctl_FIOCLEX
357 || tmpulongest == tdep->ioctl_FIONCLEX
358 || tmpulongest == tdep->ioctl_FIONBIO
359 || tmpulongest == tdep->ioctl_FIOASYNC
360 || tmpulongest == tdep->ioctl_TCSETS
361 || tmpulongest == tdep->ioctl_TCSETSW
362 || tmpulongest == tdep->ioctl_TCSETSF
363 || tmpulongest == tdep->ioctl_TCSETA
364 || tmpulongest == tdep->ioctl_TCSETAW
365 || tmpulongest == tdep->ioctl_TCSETAF
366 || tmpulongest == tdep->ioctl_TCSBRK
367 || tmpulongest == tdep->ioctl_TCXONC
368 || tmpulongest == tdep->ioctl_TCFLSH
369 || tmpulongest == tdep->ioctl_TIOCEXCL
370 || tmpulongest == tdep->ioctl_TIOCNXCL
371 || tmpulongest == tdep->ioctl_TIOCSCTTY
372 || tmpulongest == tdep->ioctl_TIOCSPGRP
373 || tmpulongest == tdep->ioctl_TIOCSTI
374 || tmpulongest == tdep->ioctl_TIOCSWINSZ
375 || tmpulongest == tdep->ioctl_TIOCMBIS
376 || tmpulongest == tdep->ioctl_TIOCMBIC
377 || tmpulongest == tdep->ioctl_TIOCMSET
378 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
379 || tmpulongest == tdep->ioctl_TIOCCONS
380 || tmpulongest == tdep->ioctl_TIOCSSERIAL
381 || tmpulongest == tdep->ioctl_TIOCPKT
382 || tmpulongest == tdep->ioctl_TIOCNOTTY
383 || tmpulongest == tdep->ioctl_TIOCSETD
384 || tmpulongest == tdep->ioctl_TCSBRKP
385 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
386 || tmpulongest == tdep->ioctl_TIOCSBRK
387 || tmpulongest == tdep->ioctl_TIOCCBRK
388 || tmpulongest == tdep->ioctl_TCSETS2
389 || tmpulongest == tdep->ioctl_TCSETSW2
390 || tmpulongest == tdep->ioctl_TCSETSF2
391 || tmpulongest == tdep->ioctl_TIOCSPTLCK
392 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
393 || tmpulongest == tdep->ioctl_TIOCSERGWILD
394 || tmpulongest == tdep->ioctl_TIOCSERSWILD
395 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
396 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
397 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
398 || tmpulongest == tdep->ioctl_TIOCMIWAIT
399 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
403 else if (tmpulongest == tdep->ioctl_TCGETS
404 || tmpulongest == tdep->ioctl_TCGETA
405 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
407 regcache_raw_read_unsigned (regcache, tdep->arg3,
409 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
413 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
414 || tmpulongest == tdep->ioctl_TIOCGSID)
416 regcache_raw_read_unsigned (regcache, tdep->arg3,
418 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
422 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
423 || tmpulongest == tdep->ioctl_TIOCMGET
424 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
425 || tmpulongest == tdep->ioctl_FIONREAD
426 || tmpulongest == tdep->ioctl_TIOCINQ
427 || tmpulongest == tdep->ioctl_TIOCGETD
428 || tmpulongest == tdep->ioctl_TIOCGPTN
429 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
431 regcache_raw_read_unsigned (regcache, tdep->arg3,
433 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
437 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
439 regcache_raw_read_unsigned (regcache, tdep->arg3,
441 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
445 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
447 regcache_raw_read_unsigned (regcache, tdep->arg3,
449 /* This syscall affects a char-size memory. */
450 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
453 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
455 regcache_raw_read_unsigned (regcache, tdep->arg3,
457 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
458 tdep->size_serial_struct))
461 else if (tmpulongest == tdep->ioctl_TCGETS2)
463 regcache_raw_read_unsigned (regcache, tdep->arg3,
465 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
466 tdep->size_termios2))
469 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
471 regcache_raw_read_unsigned (regcache, tdep->arg3,
473 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
477 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
479 regcache_raw_read_unsigned (regcache, tdep->arg3,
481 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
482 tdep->size_serial_icounter_struct))
485 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
487 regcache_raw_read_unsigned (regcache, tdep->arg3,
489 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
490 tdep->size_hayes_esp_config))
493 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
495 printf_unfiltered (_("Process record and replay target doesn't "
496 "support ioctl request TIOCSERGSTRUCT\n"));
501 printf_unfiltered (_("Process record and replay target doesn't "
502 "support ioctl request 0x%s.\n"),
503 OUTPUT_REG (tmpulongest, tdep->arg2));
510 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
512 if (tmpulongest == tdep->fcntl_F_GETLK)
514 regcache_raw_read_unsigned (regcache, tdep->arg3,
516 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
522 case gdb_sys_ni_syscall56:
523 case gdb_sys_setpgid:
524 case gdb_sys_ni_syscall58:
527 case gdb_sys_olduname:
528 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
529 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
530 tdep->size_oldold_utsname))
539 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
540 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
546 case gdb_sys_getppid:
547 case gdb_sys_getpgrp:
551 case gdb_sys_sigaction:
552 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
553 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
554 tdep->size_old_sigaction))
558 case gdb_sys_sgetmask:
559 case gdb_sys_ssetmask:
560 case gdb_sys_setreuid16:
561 case gdb_sys_setregid16:
562 case gdb_sys_sigsuspend:
565 case gdb_sys_sigpending:
566 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
567 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
568 tdep->size_old_sigset_t))
572 case gdb_sys_sethostname:
573 case gdb_sys_setrlimit:
576 case gdb_sys_old_getrlimit:
577 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
578 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
583 case gdb_sys_getrusage:
584 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
585 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
590 case gdb_sys_gettimeofday:
591 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
592 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
595 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
596 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
597 tdep->size_timezone))
601 case gdb_sys_settimeofday:
604 case gdb_sys_getgroups16:
605 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
606 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
607 tdep->size_old_gid_t))
611 case gdb_sys_setgroups16:
612 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
613 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
614 tdep->size_old_gid_t))
620 struct sel_arg_struct
629 regcache_raw_read_unsigned (regcache, tdep->arg1,
633 if (target_read_memory (tmpulongest, (gdb_byte *) &sel,
637 fprintf_unfiltered (gdb_stdlog,
638 "Process record: error reading memory "
639 "at addr = 0x%s len = %lu.\n",
640 OUTPUT_REG (tmpulongest, tdep->arg1),
641 (unsigned long) sizeof (sel));
644 if (record_full_arch_list_add_mem (sel.inp, tdep->size_fd_set))
646 if (record_full_arch_list_add_mem (sel.outp, tdep->size_fd_set))
648 if (record_full_arch_list_add_mem (sel.exp, tdep->size_fd_set))
650 if (record_full_arch_list_add_mem (sel.tvp, tdep->size_timeval))
656 case gdb_sys_symlink:
659 case gdb_sys_readlink:
663 regcache_raw_read_unsigned (regcache, tdep->arg2,
665 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
666 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
679 target_terminal_ours ();
680 q = yquery (_("The next instruction is syscall reboot. "
681 "It will restart the computer. "
682 "Do you want to stop the program?"));
683 target_terminal_inferior ();
689 case gdb_old_readdir:
690 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
691 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
703 regcache_raw_read_unsigned (regcache, tdep->arg1,
705 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
706 if (record_full_memory_query)
710 target_terminal_ours ();
712 The next instruction is syscall munmap.\n\
713 It will free the memory addr = 0x%s len = %u.\n\
714 It will make record target cannot record some memory change.\n\
715 Do you want to stop the program?"),
716 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
717 target_terminal_inferior ();
724 case gdb_sys_truncate:
725 case gdb_sys_ftruncate:
727 case gdb_sys_fchown16:
728 case gdb_sys_getpriority:
729 case gdb_sys_setpriority:
730 case gdb_sys_ni_syscall98:
734 case gdb_sys_fstatfs:
735 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
736 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
746 case gdb_sys_sendmsg:
747 case gdb_sys_shutdown:
749 case gdb_sys_connect:
751 case gdb_sys_setsockopt:
755 case gdb_sys_getsockname:
756 case gdb_sys_getpeername:
760 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
761 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
762 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
767 case gdb_sys_recvfrom:
771 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
772 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
773 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
782 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
783 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
784 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
790 case gdb_sys_recvmsg:
791 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
792 if (record_linux_msghdr (regcache, tdep, tmpulongest))
796 case gdb_sys_socketpair:
797 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
798 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
803 case gdb_sys_getsockopt:
804 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
808 gdb_byte *optlenp = alloca (tdep->size_int);
810 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
814 fprintf_unfiltered (gdb_stdlog,
815 "Process record: error reading "
816 "memory at addr = 0x%s "
818 OUTPUT_REG (tmpulongest, tdep->arg5),
822 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
823 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
825 if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
827 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
833 case gdb_sys_socketcall:
834 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
837 case RECORD_SYS_SOCKET:
838 case RECORD_SYS_BIND:
839 case RECORD_SYS_CONNECT:
840 case RECORD_SYS_LISTEN:
842 case RECORD_SYS_ACCEPT:
843 case RECORD_SYS_GETSOCKNAME:
844 case RECORD_SYS_GETPEERNAME:
846 regcache_raw_read_unsigned (regcache, tdep->arg2,
850 gdb_byte *a = alloca (tdep->size_ulong * 2);
853 tmpulongest += tdep->size_ulong;
854 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
855 tdep->size_ulong * 2))
858 fprintf_unfiltered (gdb_stdlog,
859 "Process record: error reading "
860 "memory at addr = 0x%s len = %d.\n",
861 OUTPUT_REG (tmpulongest, tdep->arg2),
862 tdep->size_ulong * 2);
865 tmpulongest = extract_unsigned_integer (a,
868 len = extract_unsigned_integer (a + tdep->size_ulong,
869 tdep->size_ulong, byte_order);
870 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
876 case RECORD_SYS_SOCKETPAIR:
878 gdb_byte *a = alloca (tdep->size_ulong);
880 regcache_raw_read_unsigned (regcache, tdep->arg2,
884 tmpulongest += tdep->size_ulong * 3;
885 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
889 fprintf_unfiltered (gdb_stdlog,
890 "Process record: error reading "
891 "memory at addr = 0x%s len = %d.\n",
892 OUTPUT_REG (tmpulongest, tdep->arg2),
897 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
899 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
904 case RECORD_SYS_SEND:
905 case RECORD_SYS_SENDTO:
907 case RECORD_SYS_RECVFROM:
908 regcache_raw_read_unsigned (regcache, tdep->arg2,
912 gdb_byte *a = alloca (tdep->size_ulong * 2);
915 tmpulongest += tdep->size_ulong * 4;
916 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
917 tdep->size_ulong * 2))
920 fprintf_unfiltered (gdb_stdlog,
921 "Process record: error reading "
922 "memory at addr = 0x%s len = %d.\n",
923 OUTPUT_REG (tmpulongest, tdep->arg2),
924 tdep->size_ulong * 2);
927 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
929 len = extract_unsigned_integer (a + tdep->size_ulong,
930 tdep->size_ulong, byte_order);
931 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
934 case RECORD_SYS_RECV:
935 regcache_raw_read_unsigned (regcache, tdep->arg2,
939 gdb_byte *a = alloca (tdep->size_ulong * 2);
941 tmpulongest += tdep->size_ulong;
942 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
946 fprintf_unfiltered (gdb_stdlog,
947 "Process record: error reading "
948 "memory at addr = 0x%s len = %d.\n",
949 OUTPUT_REG (tmpulongest, tdep->arg2),
953 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
957 a += tdep->size_ulong;
958 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
960 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
966 case RECORD_SYS_SHUTDOWN:
967 case RECORD_SYS_SETSOCKOPT:
969 case RECORD_SYS_GETSOCKOPT:
971 gdb_byte *a = alloca (tdep->size_ulong * 2);
972 gdb_byte *av = alloca (tdep->size_int);
974 regcache_raw_read_unsigned (regcache, tdep->arg2,
978 tmpulongest += tdep->size_ulong * 3;
979 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
980 tdep->size_ulong * 2))
983 fprintf_unfiltered (gdb_stdlog,
984 "Process record: error reading "
985 "memory at addr = 0x%s len = %d.\n",
986 OUTPUT_REG (tmpulongest, tdep->arg2),
987 tdep->size_ulong * 2);
990 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
995 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
999 fprintf_unfiltered (gdb_stdlog,
1000 "Process record: error reading "
1001 "memory at addr = 0x%s "
1003 phex_nz (tmpulongest,
1009 = (CORE_ADDR) extract_unsigned_integer (a,
1012 tmpint = (int) extract_unsigned_integer (av,
1015 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1017 a += tdep->size_ulong;
1019 = (CORE_ADDR) extract_unsigned_integer (a,
1022 if (record_full_arch_list_add_mem (tmpaddr,
1029 case RECORD_SYS_SENDMSG:
1031 case RECORD_SYS_RECVMSG:
1033 gdb_byte *a = alloca (tdep->size_ulong);
1035 regcache_raw_read_unsigned (regcache, tdep->arg2,
1039 tmpulongest += tdep->size_ulong;
1040 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1044 fprintf_unfiltered (gdb_stdlog,
1045 "Process record: error reading "
1046 "memory at addr = 0x%s len = %d.\n",
1047 OUTPUT_REG (tmpulongest, tdep->arg2),
1051 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1053 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1059 printf_unfiltered (_("Process record and replay target "
1060 "doesn't support socketcall call 0x%s\n"),
1061 OUTPUT_REG (tmpulongest, tdep->arg1));
1067 case gdb_sys_syslog:
1070 case gdb_sys_setitimer:
1071 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1072 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1073 tdep->size_itimerval))
1077 case gdb_sys_getitimer:
1078 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1079 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1080 tdep->size_itimerval))
1084 case gdb_sys_newstat:
1085 case gdb_sys_newlstat:
1086 case gdb_sys_newfstat:
1087 case gdb_sys_newfstatat:
1088 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1089 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1095 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1096 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1097 tdep->size_old_utsname))
1102 case gdb_sys_vhangup:
1103 case gdb_sys_ni_syscall112:
1104 case gdb_sys_vm86old:
1108 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1109 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1112 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1113 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1118 case gdb_sys_swapoff:
1121 case gdb_sys_sysinfo:
1122 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1123 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1124 tdep->size_sysinfo))
1128 case gdb_sys_shmget:
1129 case gdb_sys_semget:
1131 case gdb_sys_msgget:
1132 /* XXX maybe need do some record works with sys_shmdt. */
1134 case gdb_sys_msgsnd:
1135 case gdb_sys_semtimedop:
1139 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1140 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1145 case gdb_sys_shmctl:
1146 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1147 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1148 tdep->size_shmid_ds))
1152 /* XXX sys_semctl 525 still not supported. */
1155 case gdb_sys_msgrcv:
1160 regcache_raw_read_signed (regcache, tdep->arg3, &l);
1161 regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
1162 tmpint = l + tdep->size_long;
1163 if (record_full_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
1168 case gdb_sys_msgctl:
1169 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1170 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1171 tdep->size_msqid_ds))
1176 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1177 tmpulongest &= 0xffff;
1178 switch (tmpulongest)
1182 case RECORD_SEMTIMEDOP:
1185 /* XXX maybe need do some record works with RECORD_SHMDT. */
1194 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1195 regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
1196 tmpint = (int) second + tdep->size_long;
1197 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
1202 regcache_raw_read_unsigned (regcache, tdep->arg5,
1204 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1205 tdep->size_msqid_ds))
1209 regcache_raw_read_unsigned (regcache, tdep->arg4,
1211 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1216 regcache_raw_read_unsigned (regcache, tdep->arg5,
1218 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1219 tdep->size_shmid_ds))
1223 /* XXX RECORD_SEMCTL still not supported. */
1224 printf_unfiltered (_("Process record and replay target doesn't "
1225 "support ipc number %s\n"),
1226 pulongest (tmpulongest));
1232 case gdb_sys_sigreturn:
1234 case gdb_sys_setdomainname:
1237 case gdb_sys_newuname:
1238 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1239 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1240 tdep->size_new_utsname))
1244 case gdb_sys_modify_ldt:
1245 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1246 if (tmpulongest == 0 || tmpulongest == 2)
1248 ULONGEST ptr, bytecount;
1250 regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
1251 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1252 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
1257 case gdb_sys_adjtimex:
1258 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1259 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1264 case gdb_sys_mprotect:
1267 case gdb_sys_sigprocmask:
1268 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1269 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1270 tdep->size_old_sigset_t))
1274 case gdb_sys_ni_syscall127:
1275 case gdb_sys_init_module:
1276 case gdb_sys_delete_module:
1277 case gdb_sys_ni_syscall130:
1280 case gdb_sys_quotactl:
1281 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1282 switch (tmpulongest)
1284 case RECORD_Q_GETFMT:
1285 regcache_raw_read_unsigned (regcache, tdep->arg4,
1288 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
1291 case RECORD_Q_GETINFO:
1292 regcache_raw_read_unsigned (regcache, tdep->arg4,
1294 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1295 tdep->size_mem_dqinfo))
1298 case RECORD_Q_GETQUOTA:
1299 regcache_raw_read_unsigned (regcache, tdep->arg4,
1301 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1302 tdep->size_if_dqblk))
1305 case RECORD_Q_XGETQSTAT:
1306 case RECORD_Q_XGETQUOTA:
1307 regcache_raw_read_unsigned (regcache, tdep->arg4,
1309 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1310 tdep->size_fs_quota_stat))
1316 case gdb_sys_getpgid:
1317 case gdb_sys_fchdir:
1318 case gdb_sys_bdflush:
1322 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1323 if (tmpulongest == 2)
1325 regcache_raw_read_unsigned (regcache, tdep->arg3,
1327 /*XXX the size of memory is not very clear. */
1328 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
1333 case gdb_sys_personality:
1334 case gdb_sys_ni_syscall137:
1335 case gdb_sys_setfsuid16:
1336 case gdb_sys_setfsgid16:
1339 case gdb_sys_llseek:
1340 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1341 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1346 case gdb_sys_getdents:
1350 regcache_raw_read_unsigned (regcache, tdep->arg2,
1352 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1353 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1354 tdep->size_dirent * count))
1359 case gdb_sys_select:
1360 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1361 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1364 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1365 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1368 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1369 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1372 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
1373 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1374 tdep->size_timeval))
1386 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1389 gdb_byte *iov = alloca (tdep->size_iovec);
1391 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1392 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1394 if (target_read_memory ((CORE_ADDR) vec, iov,
1398 fprintf_unfiltered (gdb_stdlog,
1399 "Process record: error reading "
1400 "memory at addr = 0x%s len = %d.\n",
1401 OUTPUT_REG (vec, tdep->arg2),
1406 = (CORE_ADDR) extract_unsigned_integer (iov,
1410 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1413 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
1415 vec += tdep->size_iovec;
1421 case gdb_sys_writev:
1422 case gdb_sys_getsid:
1423 case gdb_sys_fdatasync:
1424 case gdb_sys_sysctl:
1426 case gdb_sys_munlock:
1427 case gdb_sys_mlockall:
1428 case gdb_sys_munlockall:
1429 case gdb_sys_sched_setparam:
1432 case gdb_sys_sched_getparam:
1433 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1434 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1439 case gdb_sys_sched_setscheduler:
1440 case gdb_sys_sched_getscheduler:
1441 case gdb_sys_sched_yield:
1442 case gdb_sys_sched_get_priority_max:
1443 case gdb_sys_sched_get_priority_min:
1446 case gdb_sys_sched_rr_get_interval:
1447 case gdb_sys_nanosleep:
1448 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1449 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1450 tdep->size_timespec))
1454 case gdb_sys_mremap:
1455 case gdb_sys_setresuid16:
1458 case gdb_sys_getresuid16:
1459 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1460 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1461 tdep->size_old_uid_t))
1463 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1464 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1465 tdep->size_old_uid_t))
1467 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1468 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1469 tdep->size_old_uid_t))
1474 case gdb_sys_ni_syscall167:
1478 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1483 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1484 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1485 tdep->size_pollfd * nfds))
1490 case gdb_sys_nfsservctl:
1491 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1492 if (tmpulongest == 7 || tmpulongest == 8)
1496 if (tmpulongest == 7)
1497 rsize = tdep->size_NFS_FHSIZE;
1499 rsize = tdep->size_knfsd_fh;
1500 regcache_raw_read_unsigned (regcache, tdep->arg3,
1502 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
1507 case gdb_sys_setresgid16:
1510 case gdb_sys_getresgid16:
1511 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1512 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1513 tdep->size_old_gid_t))
1515 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1516 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1517 tdep->size_old_gid_t))
1519 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1520 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1521 tdep->size_old_gid_t))
1526 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1527 switch (tmpulongest)
1530 regcache_raw_read_unsigned (regcache, tdep->arg2,
1532 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1537 regcache_raw_read_unsigned (regcache, tdep->arg2,
1539 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1540 tdep->size_TASK_COMM_LEN))
1546 case gdb_sys_rt_sigreturn:
1549 case gdb_sys_rt_sigaction:
1550 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1551 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1552 tdep->size_sigaction))
1556 case gdb_sys_rt_sigprocmask:
1557 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1558 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1559 tdep->size_sigset_t))
1563 case gdb_sys_rt_sigpending:
1564 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1567 ULONGEST sigsetsize;
1569 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1570 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1576 case gdb_sys_rt_sigtimedwait:
1577 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1578 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1579 tdep->size_siginfo_t))
1583 case gdb_sys_rt_sigqueueinfo:
1584 case gdb_sys_rt_sigsuspend:
1587 case gdb_sys_pread64:
1588 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1593 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1594 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1600 case gdb_sys_pwrite64:
1601 case gdb_sys_chown16:
1604 case gdb_sys_getcwd:
1605 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1610 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1611 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1617 case gdb_sys_capget:
1618 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1619 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1620 tdep->size_cap_user_data_t))
1624 case gdb_sys_capset:
1627 case gdb_sys_sigaltstack:
1628 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1629 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1630 tdep->size_stack_t))
1634 case gdb_sys_sendfile:
1635 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1636 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1641 case gdb_sys_ni_syscall188:
1642 case gdb_sys_ni_syscall189:
1646 case gdb_sys_getrlimit:
1647 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1648 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1656 case gdb_sys_truncate64:
1657 case gdb_sys_ftruncate64:
1660 case gdb_sys_stat64:
1661 case gdb_sys_lstat64:
1662 case gdb_sys_fstat64:
1663 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1664 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1669 case gdb_sys_lchown:
1670 case gdb_sys_getuid:
1671 case gdb_sys_getgid:
1672 case gdb_sys_geteuid:
1673 case gdb_sys_getegid:
1674 case gdb_sys_setreuid:
1675 case gdb_sys_setregid:
1678 case gdb_sys_getgroups:
1679 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1682 ULONGEST gidsetsize;
1684 regcache_raw_read_unsigned (regcache, tdep->arg1,
1686 tmpint = tdep->size_gid_t * (int) gidsetsize;
1687 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1692 case gdb_sys_setgroups:
1693 case gdb_sys_fchown:
1694 case gdb_sys_setresuid:
1697 case gdb_sys_getresuid:
1698 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1699 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1702 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1703 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1706 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1707 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1712 case gdb_sys_setresgid:
1715 case gdb_sys_getresgid:
1716 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1717 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1720 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1721 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1724 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1725 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1731 case gdb_sys_setuid:
1732 case gdb_sys_setgid:
1733 case gdb_sys_setfsuid:
1734 case gdb_sys_setfsgid:
1735 case gdb_sys_pivot_root:
1738 case gdb_sys_mincore:
1739 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1740 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1741 tdep->size_PAGE_SIZE))
1745 case gdb_sys_madvise:
1748 case gdb_sys_getdents64:
1752 regcache_raw_read_unsigned (regcache, tdep->arg2,
1754 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1755 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1756 tdep->size_dirent64 * count))
1761 case gdb_sys_fcntl64:
1762 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1763 if (tmpulongest == tdep->fcntl_F_GETLK64)
1765 regcache_raw_read_unsigned (regcache, tdep->arg3,
1767 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1768 tdep->size_flock64))
1771 else if (tmpulongest != tdep->fcntl_F_SETLK64
1772 && tmpulongest != tdep->fcntl_F_SETLKW64)
1778 case gdb_sys_ni_syscall222:
1779 case gdb_sys_ni_syscall223:
1780 case gdb_sys_gettid:
1781 case gdb_sys_readahead:
1782 case gdb_sys_setxattr:
1783 case gdb_sys_lsetxattr:
1784 case gdb_sys_fsetxattr:
1787 case gdb_sys_getxattr:
1788 case gdb_sys_lgetxattr:
1789 case gdb_sys_fgetxattr:
1790 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1795 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1796 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1802 case gdb_sys_listxattr:
1803 case gdb_sys_llistxattr:
1804 case gdb_sys_flistxattr:
1805 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1810 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1811 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1817 case gdb_sys_removexattr:
1818 case gdb_sys_lremovexattr:
1819 case gdb_sys_fremovexattr:
1823 case gdb_sys_sendfile64:
1824 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1825 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1831 case gdb_sys_sched_setaffinity:
1834 case gdb_sys_sched_getaffinity:
1835 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1840 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1841 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1847 case gdb_sys_set_thread_area:
1848 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1849 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1854 case gdb_sys_get_thread_area:
1855 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1856 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1857 tdep->size_user_desc))
1861 case gdb_sys_io_setup:
1862 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1863 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1868 case gdb_sys_io_destroy:
1871 case gdb_sys_io_getevents:
1872 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1877 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1878 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1879 nr * tdep->size_io_event))
1884 case gdb_sys_io_submit:
1885 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1891 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1892 iocbp = alloca (nr * tdep->size_pointer);
1893 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1894 nr * tdep->size_pointer))
1897 fprintf_unfiltered (gdb_stdlog,
1898 "Process record: error reading memory "
1899 "at addr = 0x%s len = %u.\n",
1900 OUTPUT_REG (tmpulongest, tdep->arg2),
1901 (int) (nr * tdep->size_pointer));
1904 for (i = 0; i < nr; i++)
1907 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1910 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1912 iocbp += tdep->size_pointer;
1917 case gdb_sys_io_cancel:
1918 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1919 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1920 tdep->size_io_event))
1924 case gdb_sys_fadvise64:
1925 case gdb_sys_ni_syscall251:
1928 case gdb_sys_exit_group:
1932 target_terminal_ours ();
1933 q = yquery (_("The next instruction is syscall exit_group. "
1934 "It will make the program exit. "
1935 "Do you want to stop the program?"));
1936 target_terminal_inferior ();
1942 case gdb_sys_lookup_dcookie:
1943 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1948 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1949 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1955 case gdb_sys_epoll_create:
1956 case gdb_sys_epoll_ctl:
1959 case gdb_sys_epoll_wait:
1960 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1965 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1966 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1968 * tdep->size_epoll_event)))
1973 case gdb_sys_remap_file_pages:
1974 case gdb_sys_set_tid_address:
1977 case gdb_sys_timer_create:
1978 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1979 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1984 case gdb_sys_timer_settime:
1985 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1986 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1987 tdep->size_itimerspec))
1991 case gdb_sys_timer_gettime:
1992 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1993 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1994 tdep->size_itimerspec))
1998 case gdb_sys_timer_getoverrun:
1999 case gdb_sys_timer_delete:
2000 case gdb_sys_clock_settime:
2003 case gdb_sys_clock_gettime:
2004 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2005 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2006 tdep->size_timespec))
2010 case gdb_sys_clock_getres:
2011 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2012 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2013 tdep->size_timespec))
2017 case gdb_sys_clock_nanosleep:
2018 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2019 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2020 tdep->size_timespec))
2024 case gdb_sys_statfs64:
2025 case gdb_sys_fstatfs64:
2026 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2027 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2028 tdep->size_statfs64))
2032 case gdb_sys_tgkill:
2033 case gdb_sys_utimes:
2034 case gdb_sys_fadvise64_64:
2035 case gdb_sys_ni_syscall273:
2039 case gdb_sys_get_mempolicy:
2040 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2041 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2044 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2049 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
2050 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2051 maxnode * tdep->size_long))
2056 case gdb_sys_set_mempolicy:
2057 case gdb_sys_mq_open:
2058 case gdb_sys_mq_unlink:
2059 case gdb_sys_mq_timedsend:
2062 case gdb_sys_mq_timedreceive:
2063 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2068 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
2069 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2073 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2074 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2079 case gdb_sys_mq_notify:
2082 case gdb_sys_mq_getsetattr:
2083 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2084 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2085 tdep->size_mq_attr))
2089 case gdb_sys_kexec_load:
2092 case gdb_sys_waitid:
2093 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2094 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2095 tdep->size_siginfo))
2097 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2098 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2103 case gdb_sys_ni_syscall285:
2104 case gdb_sys_add_key:
2105 case gdb_sys_request_key:
2108 case gdb_sys_keyctl:
2109 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2110 if (tmpulongest == 6 || tmpulongest == 11)
2112 regcache_raw_read_unsigned (regcache, tdep->arg3,
2118 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
2119 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2126 case gdb_sys_ioprio_set:
2127 case gdb_sys_ioprio_get:
2128 case gdb_sys_inotify_init:
2129 case gdb_sys_inotify_add_watch:
2130 case gdb_sys_inotify_rm_watch:
2131 case gdb_sys_migrate_pages:
2132 case gdb_sys_openat:
2133 case gdb_sys_mkdirat:
2134 case gdb_sys_mknodat:
2135 case gdb_sys_fchownat:
2136 case gdb_sys_futimesat:
2139 case gdb_sys_fstatat64:
2140 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2141 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2146 case gdb_sys_unlinkat:
2147 case gdb_sys_renameat:
2148 case gdb_sys_linkat:
2149 case gdb_sys_symlinkat:
2152 case gdb_sys_readlinkat:
2153 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2158 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
2159 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2165 case gdb_sys_fchmodat:
2166 case gdb_sys_faccessat:
2169 case gdb_sys_pselect6:
2170 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2171 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2174 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2175 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2178 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2179 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2182 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2183 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2184 tdep->size_timespec))
2189 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2194 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
2195 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2196 tdep->size_pollfd * nfds))
2199 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2200 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2201 tdep->size_timespec))
2205 case gdb_sys_unshare:
2206 case gdb_sys_set_robust_list:
2209 case gdb_sys_get_robust_list:
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->arg3, &tmpulongest);
2215 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2220 case gdb_sys_splice:
2221 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2222 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2225 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2226 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2231 case gdb_sys_sync_file_range:
2233 case gdb_sys_vmsplice:
2236 case gdb_sys_move_pages:
2237 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2242 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2243 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2244 nr_pages * tdep->size_int))
2249 case gdb_sys_getcpu:
2250 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2251 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2254 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2255 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2258 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2259 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2260 tdep->size_ulong * 2))
2264 case gdb_sys_epoll_pwait:
2265 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2270 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2271 tmpint = (int) maxevents * tdep->size_epoll_event;
2272 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2278 printf_unfiltered (_("Process record and replay target doesn't "
2279 "support syscall number %d\n"), syscall);