1 /* Process record and replay target code for GNU/Linux.
3 Copyright (C) 2008-2013 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_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_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_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_arch_list_add_mem ((CORE_ADDR) addr,
160 (int) extract_unsigned_integer (a,
166 /* msg_iov msg_iovlen */
167 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
168 a += tdep->size_pointer;
172 ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
174 gdb_byte *iov = alloca (tdep->size_iovec);
176 for (i = 0; i < len; i++)
178 if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
181 fprintf_unfiltered (gdb_stdlog,
182 "Process record: error "
186 phex_nz (addr,tdep->size_pointer),
190 tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
193 tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
196 if (record_arch_list_add_mem (tmpaddr, tmpint))
198 addr += tdep->size_iovec;
201 a += tdep->size_size_t;
203 /* msg_control msg_controllen */
204 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
205 a += tdep->size_pointer;
206 tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
207 if (record_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
213 /* When the architecture process record get a Linux syscall
214 instruction, it will get a Linux syscall number of this
215 architecture and convert it to the Linux syscall number "num" which
216 is internal to GDB. Most Linux syscalls across architectures in
217 Linux would be similar and mostly differ by sizes of types and
218 structures. This sizes are put to "tdep".
220 Record the values of the registers and memory that will be changed
221 in current system call.
223 Return -1 if something wrong. */
226 record_linux_system_call (enum gdb_syscall syscall,
227 struct regcache *regcache,
228 struct linux_record_tdep *tdep)
230 struct gdbarch *gdbarch = get_regcache_arch (regcache);
231 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
232 ULONGEST tmpulongest;
238 case gdb_sys_restart_syscall:
245 target_terminal_ours ();
246 q = yquery (_("The next instruction is syscall exit. "
247 "It will make the program exit. "
248 "Do you want to stop the program?"));
249 target_terminal_inferior ();
260 ULONGEST addr, count;
262 regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
263 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
264 if (record_arch_list_add_mem ((CORE_ADDR) addr, (int) count))
272 case gdb_sys_waitpid:
281 case gdb_sys_lchown16:
282 case gdb_sys_ni_syscall17:
288 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
289 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
290 tdep->size__old_kernel_stat))
297 case gdb_sys_oldumount:
298 case gdb_sys_setuid16:
299 case gdb_sys_getuid16:
304 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
305 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
306 || tmpulongest == RECORD_PTRACE_PEEKDATA
307 || tmpulongest == RECORD_PTRACE_PEEKUSR)
309 regcache_raw_read_unsigned (regcache, tdep->arg4,
311 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
319 case gdb_sys_ni_syscall31:
320 case gdb_sys_ni_syscall32:
323 case gdb_sys_ni_syscall35:
334 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
335 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_tms))
339 case gdb_sys_ni_syscall44:
341 case gdb_sys_setgid16:
342 case gdb_sys_getgid16:
344 case gdb_sys_geteuid16:
345 case gdb_sys_getegid16:
348 case gdb_sys_ni_syscall53:
352 /* XXX Need to add a lot of support of other ioctl requests. */
353 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
354 if (tmpulongest == tdep->ioctl_FIOCLEX
355 || tmpulongest == tdep->ioctl_FIONCLEX
356 || tmpulongest == tdep->ioctl_FIONBIO
357 || tmpulongest == tdep->ioctl_FIOASYNC
358 || tmpulongest == tdep->ioctl_TCSETS
359 || tmpulongest == tdep->ioctl_TCSETSW
360 || tmpulongest == tdep->ioctl_TCSETSF
361 || tmpulongest == tdep->ioctl_TCSETA
362 || tmpulongest == tdep->ioctl_TCSETAW
363 || tmpulongest == tdep->ioctl_TCSETAF
364 || tmpulongest == tdep->ioctl_TCSBRK
365 || tmpulongest == tdep->ioctl_TCXONC
366 || tmpulongest == tdep->ioctl_TCFLSH
367 || tmpulongest == tdep->ioctl_TIOCEXCL
368 || tmpulongest == tdep->ioctl_TIOCNXCL
369 || tmpulongest == tdep->ioctl_TIOCSCTTY
370 || tmpulongest == tdep->ioctl_TIOCSPGRP
371 || tmpulongest == tdep->ioctl_TIOCSTI
372 || tmpulongest == tdep->ioctl_TIOCSWINSZ
373 || tmpulongest == tdep->ioctl_TIOCMBIS
374 || tmpulongest == tdep->ioctl_TIOCMBIC
375 || tmpulongest == tdep->ioctl_TIOCMSET
376 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
377 || tmpulongest == tdep->ioctl_TIOCCONS
378 || tmpulongest == tdep->ioctl_TIOCSSERIAL
379 || tmpulongest == tdep->ioctl_TIOCPKT
380 || tmpulongest == tdep->ioctl_TIOCNOTTY
381 || tmpulongest == tdep->ioctl_TIOCSETD
382 || tmpulongest == tdep->ioctl_TCSBRKP
383 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
384 || tmpulongest == tdep->ioctl_TIOCSBRK
385 || tmpulongest == tdep->ioctl_TIOCCBRK
386 || tmpulongest == tdep->ioctl_TCSETS2
387 || tmpulongest == tdep->ioctl_TCSETSW2
388 || tmpulongest == tdep->ioctl_TCSETSF2
389 || tmpulongest == tdep->ioctl_TIOCSPTLCK
390 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
391 || tmpulongest == tdep->ioctl_TIOCSERGWILD
392 || tmpulongest == tdep->ioctl_TIOCSERSWILD
393 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
394 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
395 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
396 || tmpulongest == tdep->ioctl_TIOCMIWAIT
397 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
401 else if (tmpulongest == tdep->ioctl_TCGETS
402 || tmpulongest == tdep->ioctl_TCGETA
403 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
405 regcache_raw_read_unsigned (regcache, tdep->arg3,
407 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
411 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
412 || tmpulongest == tdep->ioctl_TIOCGSID)
414 regcache_raw_read_unsigned (regcache, tdep->arg3,
416 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
420 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
421 || tmpulongest == tdep->ioctl_TIOCMGET
422 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
423 || tmpulongest == tdep->ioctl_FIONREAD
424 || tmpulongest == tdep->ioctl_TIOCINQ
425 || tmpulongest == tdep->ioctl_TIOCGETD
426 || tmpulongest == tdep->ioctl_TIOCGPTN
427 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
429 regcache_raw_read_unsigned (regcache, tdep->arg3,
431 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
435 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
437 regcache_raw_read_unsigned (regcache, tdep->arg3,
439 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
443 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
445 regcache_raw_read_unsigned (regcache, tdep->arg3,
447 /* This syscall affects a char-size memory. */
448 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
451 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
453 regcache_raw_read_unsigned (regcache, tdep->arg3,
455 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
456 tdep->size_serial_struct))
459 else if (tmpulongest == tdep->ioctl_TCGETS2)
461 regcache_raw_read_unsigned (regcache, tdep->arg3,
463 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
464 tdep->size_termios2))
467 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
469 regcache_raw_read_unsigned (regcache, tdep->arg3,
471 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
475 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
477 regcache_raw_read_unsigned (regcache, tdep->arg3,
479 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
480 tdep->size_serial_icounter_struct))
483 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
485 regcache_raw_read_unsigned (regcache, tdep->arg3,
487 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
488 tdep->size_hayes_esp_config))
491 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
493 printf_unfiltered (_("Process record and replay target doesn't "
494 "support ioctl request TIOCSERGSTRUCT\n"));
499 printf_unfiltered (_("Process record and replay target doesn't "
500 "support ioctl request 0x%s.\n"),
501 OUTPUT_REG (tmpulongest, tdep->arg2));
508 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
510 if (tmpulongest == tdep->fcntl_F_GETLK)
512 regcache_raw_read_unsigned (regcache, tdep->arg3,
514 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
520 case gdb_sys_ni_syscall56:
521 case gdb_sys_setpgid:
522 case gdb_sys_ni_syscall58:
525 case gdb_sys_olduname:
526 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
527 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
528 tdep->size_oldold_utsname))
537 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
538 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
544 case gdb_sys_getppid:
545 case gdb_sys_getpgrp:
549 case gdb_sys_sigaction:
550 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
551 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
552 tdep->size_old_sigaction))
556 case gdb_sys_sgetmask:
557 case gdb_sys_ssetmask:
558 case gdb_sys_setreuid16:
559 case gdb_sys_setregid16:
560 case gdb_sys_sigsuspend:
563 case gdb_sys_sigpending:
564 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
565 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
566 tdep->size_old_sigset_t))
570 case gdb_sys_sethostname:
571 case gdb_sys_setrlimit:
574 case gdb_sys_old_getrlimit:
575 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
576 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
581 case gdb_sys_getrusage:
582 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
583 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
588 case gdb_sys_gettimeofday:
589 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
590 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
593 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
594 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
595 tdep->size_timezone))
599 case gdb_sys_settimeofday:
602 case gdb_sys_getgroups16:
603 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
604 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
605 tdep->size_old_gid_t))
609 case gdb_sys_setgroups16:
610 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
611 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
612 tdep->size_old_gid_t))
618 struct sel_arg_struct
627 regcache_raw_read_unsigned (regcache, tdep->arg1,
631 if (target_read_memory (tmpulongest, (gdb_byte *) &sel,
635 fprintf_unfiltered (gdb_stdlog,
636 "Process record: error reading memory "
637 "at addr = 0x%s len = %lu.\n",
638 OUTPUT_REG (tmpulongest, tdep->arg1),
639 (unsigned long) sizeof (sel));
642 if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
644 if (record_arch_list_add_mem (sel.outp, tdep->size_fd_set))
646 if (record_arch_list_add_mem (sel.exp, tdep->size_fd_set))
648 if (record_arch_list_add_mem (sel.tvp, tdep->size_timeval))
654 case gdb_sys_symlink:
657 case gdb_sys_readlink:
661 regcache_raw_read_unsigned (regcache, tdep->arg2,
663 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
664 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
677 target_terminal_ours ();
678 q = yquery (_("The next instruction is syscall reboot. "
679 "It will restart the computer. "
680 "Do you want to stop the program?"));
681 target_terminal_inferior ();
687 case gdb_old_readdir:
688 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
689 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
701 regcache_raw_read_unsigned (regcache, tdep->arg1,
703 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
704 if (record_memory_query)
708 target_terminal_ours ();
710 The next instruction is syscall munmap.\n\
711 It will free the memory addr = 0x%s len = %u.\n\
712 It will make record target cannot record some memory change.\n\
713 Do you want to stop the program?"),
714 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
715 target_terminal_inferior ();
722 case gdb_sys_truncate:
723 case gdb_sys_ftruncate:
725 case gdb_sys_fchown16:
726 case gdb_sys_getpriority:
727 case gdb_sys_setpriority:
728 case gdb_sys_ni_syscall98:
732 case gdb_sys_fstatfs:
733 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
734 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
744 case gdb_sys_sendmsg:
745 case gdb_sys_shutdown:
747 case gdb_sys_connect:
749 case gdb_sys_setsockopt:
753 case gdb_sys_getsockname:
754 case gdb_sys_getpeername:
758 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
759 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
760 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
765 case gdb_sys_recvfrom:
769 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
770 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
771 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
780 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
781 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
782 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
787 case gdb_sys_recvmsg:
788 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
789 if (record_linux_msghdr (regcache, tdep, tmpulongest))
793 case gdb_sys_socketpair:
794 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
795 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
799 case gdb_sys_getsockopt:
800 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
804 gdb_byte *optlenp = alloca (tdep->size_int);
806 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
810 fprintf_unfiltered (gdb_stdlog,
811 "Process record: error reading "
812 "memory at addr = 0x%s "
814 OUTPUT_REG (tmpulongest, tdep->arg5),
818 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
819 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
821 if (record_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
823 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
829 case gdb_sys_socketcall:
830 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
833 case RECORD_SYS_SOCKET:
834 case RECORD_SYS_BIND:
835 case RECORD_SYS_CONNECT:
836 case RECORD_SYS_LISTEN:
838 case RECORD_SYS_ACCEPT:
839 case RECORD_SYS_GETSOCKNAME:
840 case RECORD_SYS_GETPEERNAME:
842 regcache_raw_read_unsigned (regcache, tdep->arg2,
846 gdb_byte *a = alloca (tdep->size_ulong * 2);
849 tmpulongest += tdep->size_ulong;
850 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
851 tdep->size_ulong * 2))
854 fprintf_unfiltered (gdb_stdlog,
855 "Process record: error reading "
856 "memory at addr = 0x%s len = %d.\n",
857 OUTPUT_REG (tmpulongest, tdep->arg2),
858 tdep->size_ulong * 2);
861 tmpulongest = extract_unsigned_integer (a,
864 len = extract_unsigned_integer (a + tdep->size_ulong,
865 tdep->size_ulong, byte_order);
866 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
872 case RECORD_SYS_SOCKETPAIR:
874 gdb_byte *a = alloca (tdep->size_ulong);
876 regcache_raw_read_unsigned (regcache, tdep->arg2,
880 tmpulongest += tdep->size_ulong * 3;
881 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
885 fprintf_unfiltered (gdb_stdlog,
886 "Process record: error reading "
887 "memory at addr = 0x%s len = %d.\n",
888 OUTPUT_REG (tmpulongest, tdep->arg2),
893 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
895 if (record_arch_list_add_mem (tmpaddr, tdep->size_int))
900 case RECORD_SYS_SEND:
901 case RECORD_SYS_SENDTO:
903 case RECORD_SYS_RECVFROM:
904 regcache_raw_read_unsigned (regcache, tdep->arg2,
908 gdb_byte *a = alloca (tdep->size_ulong * 2);
911 tmpulongest += tdep->size_ulong * 4;
912 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
913 tdep->size_ulong * 2))
916 fprintf_unfiltered (gdb_stdlog,
917 "Process record: error reading "
918 "memory at addr = 0x%s len = %d.\n",
919 OUTPUT_REG (tmpulongest, tdep->arg2),
920 tdep->size_ulong * 2);
923 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
925 len = extract_unsigned_integer (a + tdep->size_ulong,
926 tdep->size_ulong, byte_order);
927 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
930 case RECORD_SYS_RECV:
931 regcache_raw_read_unsigned (regcache, tdep->arg2,
935 gdb_byte *a = alloca (tdep->size_ulong * 2);
937 tmpulongest += tdep->size_ulong;
938 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
942 fprintf_unfiltered (gdb_stdlog,
943 "Process record: error reading "
944 "memory at addr = 0x%s len = %d.\n",
945 OUTPUT_REG (tmpulongest, tdep->arg2),
949 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
953 a += tdep->size_ulong;
954 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
956 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
962 case RECORD_SYS_SHUTDOWN:
963 case RECORD_SYS_SETSOCKOPT:
965 case RECORD_SYS_GETSOCKOPT:
967 gdb_byte *a = alloca (tdep->size_ulong * 2);
968 gdb_byte *av = alloca (tdep->size_int);
970 regcache_raw_read_unsigned (regcache, tdep->arg2,
974 tmpulongest += tdep->size_ulong * 3;
975 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
976 tdep->size_ulong * 2))
979 fprintf_unfiltered (gdb_stdlog,
980 "Process record: error reading "
981 "memory at addr = 0x%s len = %d.\n",
982 OUTPUT_REG (tmpulongest, tdep->arg2),
983 tdep->size_ulong * 2);
986 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
991 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
995 fprintf_unfiltered (gdb_stdlog,
996 "Process record: error reading "
997 "memory at addr = 0x%s "
999 phex_nz (tmpulongest,
1005 = (CORE_ADDR) extract_unsigned_integer (a,
1008 tmpint = (int) extract_unsigned_integer (av,
1011 if (record_arch_list_add_mem (tmpaddr, tmpint))
1013 a += tdep->size_ulong;
1015 = (CORE_ADDR) extract_unsigned_integer (a,
1018 if (record_arch_list_add_mem (tmpaddr, tdep->size_int))
1024 case RECORD_SYS_SENDMSG:
1026 case RECORD_SYS_RECVMSG:
1028 gdb_byte *a = alloca (tdep->size_ulong);
1030 regcache_raw_read_unsigned (regcache, tdep->arg2,
1034 tmpulongest += tdep->size_ulong;
1035 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1039 fprintf_unfiltered (gdb_stdlog,
1040 "Process record: error reading "
1041 "memory at addr = 0x%s len = %d.\n",
1042 OUTPUT_REG (tmpulongest, tdep->arg2),
1046 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1048 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1054 printf_unfiltered (_("Process record and replay target "
1055 "doesn't support socketcall call 0x%s\n"),
1056 OUTPUT_REG (tmpulongest, tdep->arg1));
1062 case gdb_sys_syslog:
1065 case gdb_sys_setitimer:
1066 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1067 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1068 tdep->size_itimerval))
1072 case gdb_sys_getitimer:
1073 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1074 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1075 tdep->size_itimerval))
1079 case gdb_sys_newstat:
1080 case gdb_sys_newlstat:
1081 case gdb_sys_newfstat:
1082 case gdb_sys_newfstatat:
1083 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1084 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_stat))
1089 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1090 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1091 tdep->size_old_utsname))
1096 case gdb_sys_vhangup:
1097 case gdb_sys_ni_syscall112:
1098 case gdb_sys_vm86old:
1102 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1103 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1106 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1107 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1112 case gdb_sys_swapoff:
1115 case gdb_sys_sysinfo:
1116 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1117 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1118 tdep->size_sysinfo))
1122 case gdb_sys_shmget:
1123 case gdb_sys_semget:
1125 case gdb_sys_msgget:
1126 /* XXX maybe need do some record works with sys_shmdt. */
1128 case gdb_sys_msgsnd:
1129 case gdb_sys_semtimedop:
1133 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1134 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1139 case gdb_sys_shmctl:
1140 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1141 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1142 tdep->size_shmid_ds))
1146 /* XXX sys_semctl 525 still not supported. */
1149 case gdb_sys_msgrcv:
1154 regcache_raw_read_signed (regcache, tdep->arg3, &l);
1155 regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
1156 tmpint = l + tdep->size_long;
1157 if (record_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
1162 case gdb_sys_msgctl:
1163 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1164 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1165 tdep->size_msqid_ds))
1170 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1171 tmpulongest &= 0xffff;
1172 switch (tmpulongest)
1176 case RECORD_SEMTIMEDOP:
1179 /* XXX maybe need do some record works with RECORD_SHMDT. */
1188 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1189 regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
1190 tmpint = (int) second + tdep->size_long;
1191 if (record_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
1196 regcache_raw_read_unsigned (regcache, tdep->arg5,
1198 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1199 tdep->size_msqid_ds))
1203 regcache_raw_read_unsigned (regcache, tdep->arg4,
1205 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1210 regcache_raw_read_unsigned (regcache, tdep->arg5,
1212 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1213 tdep->size_shmid_ds))
1217 /* XXX RECORD_SEMCTL still not supported. */
1218 printf_unfiltered (_("Process record and replay target doesn't "
1219 "support ipc number %s\n"),
1220 pulongest (tmpulongest));
1226 case gdb_sys_sigreturn:
1228 case gdb_sys_setdomainname:
1231 case gdb_sys_newuname:
1232 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1233 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1234 tdep->size_new_utsname))
1238 case gdb_sys_modify_ldt:
1239 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1240 if (tmpulongest == 0 || tmpulongest == 2)
1242 ULONGEST ptr, bytecount;
1244 regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
1245 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1246 if (record_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
1251 case gdb_sys_adjtimex:
1252 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1253 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_timex))
1257 case gdb_sys_mprotect:
1260 case gdb_sys_sigprocmask:
1261 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1262 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1263 tdep->size_old_sigset_t))
1267 case gdb_sys_ni_syscall127:
1268 case gdb_sys_init_module:
1269 case gdb_sys_delete_module:
1270 case gdb_sys_ni_syscall130:
1273 case gdb_sys_quotactl:
1274 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1275 switch (tmpulongest)
1277 case RECORD_Q_GETFMT:
1278 regcache_raw_read_unsigned (regcache, tdep->arg4,
1281 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
1284 case RECORD_Q_GETINFO:
1285 regcache_raw_read_unsigned (regcache, tdep->arg4,
1287 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1288 tdep->size_mem_dqinfo))
1291 case RECORD_Q_GETQUOTA:
1292 regcache_raw_read_unsigned (regcache, tdep->arg4,
1294 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1295 tdep->size_if_dqblk))
1298 case RECORD_Q_XGETQSTAT:
1299 case RECORD_Q_XGETQUOTA:
1300 regcache_raw_read_unsigned (regcache, tdep->arg4,
1302 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1303 tdep->size_fs_quota_stat))
1309 case gdb_sys_getpgid:
1310 case gdb_sys_fchdir:
1311 case gdb_sys_bdflush:
1315 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1316 if (tmpulongest == 2)
1318 regcache_raw_read_unsigned (regcache, tdep->arg3,
1320 /*XXX the size of memory is not very clear. */
1321 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
1326 case gdb_sys_personality:
1327 case gdb_sys_ni_syscall137:
1328 case gdb_sys_setfsuid16:
1329 case gdb_sys_setfsgid16:
1332 case gdb_sys_llseek:
1333 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1334 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1339 case gdb_sys_getdents:
1343 regcache_raw_read_unsigned (regcache, tdep->arg2,
1345 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1346 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1347 tdep->size_dirent * count))
1352 case gdb_sys_select:
1353 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1354 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1357 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1358 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1361 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1362 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1365 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
1366 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1367 tdep->size_timeval))
1379 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1382 gdb_byte *iov = alloca (tdep->size_iovec);
1384 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1385 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1387 if (target_read_memory ((CORE_ADDR) vec, iov,
1391 fprintf_unfiltered (gdb_stdlog,
1392 "Process record: error reading "
1393 "memory at addr = 0x%s len = %d.\n",
1394 OUTPUT_REG (vec, tdep->arg2),
1399 = (CORE_ADDR) extract_unsigned_integer (iov,
1403 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1406 if (record_arch_list_add_mem (tmpaddr, tmpint))
1408 vec += tdep->size_iovec;
1414 case gdb_sys_writev:
1415 case gdb_sys_getsid:
1416 case gdb_sys_fdatasync:
1417 case gdb_sys_sysctl:
1419 case gdb_sys_munlock:
1420 case gdb_sys_mlockall:
1421 case gdb_sys_munlockall:
1422 case gdb_sys_sched_setparam:
1425 case gdb_sys_sched_getparam:
1426 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1427 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1431 case gdb_sys_sched_setscheduler:
1432 case gdb_sys_sched_getscheduler:
1433 case gdb_sys_sched_yield:
1434 case gdb_sys_sched_get_priority_max:
1435 case gdb_sys_sched_get_priority_min:
1438 case gdb_sys_sched_rr_get_interval:
1439 case gdb_sys_nanosleep:
1440 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1441 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1442 tdep->size_timespec))
1446 case gdb_sys_mremap:
1447 case gdb_sys_setresuid16:
1450 case gdb_sys_getresuid16:
1451 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1452 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1453 tdep->size_old_uid_t))
1455 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1456 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1457 tdep->size_old_uid_t))
1459 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1460 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1461 tdep->size_old_uid_t))
1466 case gdb_sys_ni_syscall167:
1470 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1475 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1476 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1477 tdep->size_pollfd * nfds))
1482 case gdb_sys_nfsservctl:
1483 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1484 if (tmpulongest == 7 || tmpulongest == 8)
1488 if (tmpulongest == 7)
1489 rsize = tdep->size_NFS_FHSIZE;
1491 rsize = tdep->size_knfsd_fh;
1492 regcache_raw_read_unsigned (regcache, tdep->arg3,
1494 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
1499 case gdb_sys_setresgid16:
1502 case gdb_sys_getresgid16:
1503 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1504 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1505 tdep->size_old_gid_t))
1507 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1508 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1509 tdep->size_old_gid_t))
1511 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1512 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1513 tdep->size_old_gid_t))
1518 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1519 switch (tmpulongest)
1522 regcache_raw_read_unsigned (regcache, tdep->arg2,
1524 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1529 regcache_raw_read_unsigned (regcache, tdep->arg2,
1531 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1532 tdep->size_TASK_COMM_LEN))
1538 case gdb_sys_rt_sigreturn:
1541 case gdb_sys_rt_sigaction:
1542 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1543 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1544 tdep->size_sigaction))
1548 case gdb_sys_rt_sigprocmask:
1549 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1550 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1551 tdep->size_sigset_t))
1555 case gdb_sys_rt_sigpending:
1556 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1559 ULONGEST sigsetsize;
1561 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1562 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1568 case gdb_sys_rt_sigtimedwait:
1569 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1570 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1571 tdep->size_siginfo_t))
1575 case gdb_sys_rt_sigqueueinfo:
1576 case gdb_sys_rt_sigsuspend:
1579 case gdb_sys_pread64:
1580 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1585 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1586 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) count))
1591 case gdb_sys_pwrite64:
1592 case gdb_sys_chown16:
1595 case gdb_sys_getcwd:
1596 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1601 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1602 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1607 case gdb_sys_capget:
1608 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1609 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1610 tdep->size_cap_user_data_t))
1614 case gdb_sys_capset:
1617 case gdb_sys_sigaltstack:
1618 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1619 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1620 tdep->size_stack_t))
1624 case gdb_sys_sendfile:
1625 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1626 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1631 case gdb_sys_ni_syscall188:
1632 case gdb_sys_ni_syscall189:
1636 case gdb_sys_getrlimit:
1637 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1638 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1646 case gdb_sys_truncate64:
1647 case gdb_sys_ftruncate64:
1650 case gdb_sys_stat64:
1651 case gdb_sys_lstat64:
1652 case gdb_sys_fstat64:
1653 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1654 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1659 case gdb_sys_lchown:
1660 case gdb_sys_getuid:
1661 case gdb_sys_getgid:
1662 case gdb_sys_geteuid:
1663 case gdb_sys_getegid:
1664 case gdb_sys_setreuid:
1665 case gdb_sys_setregid:
1668 case gdb_sys_getgroups:
1669 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1672 ULONGEST gidsetsize;
1674 regcache_raw_read_unsigned (regcache, tdep->arg1,
1676 tmpint = tdep->size_gid_t * (int) gidsetsize;
1677 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1682 case gdb_sys_setgroups:
1683 case gdb_sys_fchown:
1684 case gdb_sys_setresuid:
1687 case gdb_sys_getresuid:
1688 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1689 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1691 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1692 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1694 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1695 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1699 case gdb_sys_setresgid:
1702 case gdb_sys_getresgid:
1703 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1704 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1706 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1707 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1709 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1710 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1715 case gdb_sys_setuid:
1716 case gdb_sys_setgid:
1717 case gdb_sys_setfsuid:
1718 case gdb_sys_setfsgid:
1719 case gdb_sys_pivot_root:
1722 case gdb_sys_mincore:
1723 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1724 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1725 tdep->size_PAGE_SIZE))
1729 case gdb_sys_madvise:
1732 case gdb_sys_getdents64:
1736 regcache_raw_read_unsigned (regcache, tdep->arg2,
1738 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1739 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1740 tdep->size_dirent64 * count))
1745 case gdb_sys_fcntl64:
1746 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1747 if (tmpulongest == tdep->fcntl_F_GETLK64)
1749 regcache_raw_read_unsigned (regcache, tdep->arg3,
1751 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1752 tdep->size_flock64))
1755 else if (tmpulongest != tdep->fcntl_F_SETLK64
1756 && tmpulongest != tdep->fcntl_F_SETLKW64)
1762 case gdb_sys_ni_syscall222:
1763 case gdb_sys_ni_syscall223:
1764 case gdb_sys_gettid:
1765 case gdb_sys_readahead:
1766 case gdb_sys_setxattr:
1767 case gdb_sys_lsetxattr:
1768 case gdb_sys_fsetxattr:
1771 case gdb_sys_getxattr:
1772 case gdb_sys_lgetxattr:
1773 case gdb_sys_fgetxattr:
1774 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1779 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1780 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1785 case gdb_sys_listxattr:
1786 case gdb_sys_llistxattr:
1787 case gdb_sys_flistxattr:
1788 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1793 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1794 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1799 case gdb_sys_removexattr:
1800 case gdb_sys_lremovexattr:
1801 case gdb_sys_fremovexattr:
1805 case gdb_sys_sendfile64:
1806 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1807 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1813 case gdb_sys_sched_setaffinity:
1816 case gdb_sys_sched_getaffinity:
1817 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1822 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1823 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
1828 case gdb_sys_set_thread_area:
1829 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1830 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1834 case gdb_sys_get_thread_area:
1835 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1836 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1837 tdep->size_user_desc))
1841 case gdb_sys_io_setup:
1842 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1843 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_long))
1847 case gdb_sys_io_destroy:
1850 case gdb_sys_io_getevents:
1851 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1856 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1857 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1858 nr * tdep->size_io_event))
1863 case gdb_sys_io_submit:
1864 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1870 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1871 iocbp = alloca (nr * tdep->size_pointer);
1872 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1873 nr * tdep->size_pointer))
1876 fprintf_unfiltered (gdb_stdlog,
1877 "Process record: error reading memory "
1878 "at addr = 0x%s len = %u.\n",
1879 OUTPUT_REG (tmpulongest, tdep->arg2),
1880 (int) (nr * tdep->size_pointer));
1883 for (i = 0; i < nr; i++)
1886 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1889 if (record_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1891 iocbp += tdep->size_pointer;
1896 case gdb_sys_io_cancel:
1897 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1898 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1899 tdep->size_io_event))
1903 case gdb_sys_fadvise64:
1904 case gdb_sys_ni_syscall251:
1907 case gdb_sys_exit_group:
1911 target_terminal_ours ();
1912 q = yquery (_("The next instruction is syscall exit_group. "
1913 "It will make the program exit. "
1914 "Do you want to stop the program?"));
1915 target_terminal_inferior ();
1921 case gdb_sys_lookup_dcookie:
1922 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1927 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1928 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
1933 case gdb_sys_epoll_create:
1934 case gdb_sys_epoll_ctl:
1937 case gdb_sys_epoll_wait:
1938 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1943 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1944 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1945 maxevents * tdep->size_epoll_event))
1950 case gdb_sys_remap_file_pages:
1951 case gdb_sys_set_tid_address:
1954 case gdb_sys_timer_create:
1955 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1956 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1960 case gdb_sys_timer_settime:
1961 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1962 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1963 tdep->size_itimerspec))
1967 case gdb_sys_timer_gettime:
1968 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1969 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1970 tdep->size_itimerspec))
1974 case gdb_sys_timer_getoverrun:
1975 case gdb_sys_timer_delete:
1976 case gdb_sys_clock_settime:
1979 case gdb_sys_clock_gettime:
1980 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1981 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1982 tdep->size_timespec))
1986 case gdb_sys_clock_getres:
1987 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1988 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1989 tdep->size_timespec))
1993 case gdb_sys_clock_nanosleep:
1994 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1995 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1996 tdep->size_timespec))
2000 case gdb_sys_statfs64:
2001 case gdb_sys_fstatfs64:
2002 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2003 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2004 tdep->size_statfs64))
2008 case gdb_sys_tgkill:
2009 case gdb_sys_utimes:
2010 case gdb_sys_fadvise64_64:
2011 case gdb_sys_ni_syscall273:
2015 case gdb_sys_get_mempolicy:
2016 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2017 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2019 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2024 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
2025 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2026 maxnode * tdep->size_long))
2031 case gdb_sys_set_mempolicy:
2032 case gdb_sys_mq_open:
2033 case gdb_sys_mq_unlink:
2034 case gdb_sys_mq_timedsend:
2037 case gdb_sys_mq_timedreceive:
2038 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2043 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
2044 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2048 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2049 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2053 case gdb_sys_mq_notify:
2056 case gdb_sys_mq_getsetattr:
2057 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2058 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2059 tdep->size_mq_attr))
2063 case gdb_sys_kexec_load:
2066 case gdb_sys_waitid:
2067 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2068 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2069 tdep->size_siginfo))
2071 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2072 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2077 case gdb_sys_ni_syscall285:
2078 case gdb_sys_add_key:
2079 case gdb_sys_request_key:
2082 case gdb_sys_keyctl:
2083 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2084 if (tmpulongest == 6 || tmpulongest == 11)
2086 regcache_raw_read_unsigned (regcache, tdep->arg3,
2092 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
2093 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2100 case gdb_sys_ioprio_set:
2101 case gdb_sys_ioprio_get:
2102 case gdb_sys_inotify_init:
2103 case gdb_sys_inotify_add_watch:
2104 case gdb_sys_inotify_rm_watch:
2105 case gdb_sys_migrate_pages:
2106 case gdb_sys_openat:
2107 case gdb_sys_mkdirat:
2108 case gdb_sys_mknodat:
2109 case gdb_sys_fchownat:
2110 case gdb_sys_futimesat:
2113 case gdb_sys_fstatat64:
2114 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2115 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2120 case gdb_sys_unlinkat:
2121 case gdb_sys_renameat:
2122 case gdb_sys_linkat:
2123 case gdb_sys_symlinkat:
2126 case gdb_sys_readlinkat:
2127 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2132 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
2133 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) bufsiz))
2138 case gdb_sys_fchmodat:
2139 case gdb_sys_faccessat:
2142 case gdb_sys_pselect6:
2143 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2144 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2147 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2148 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2151 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2152 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2155 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2156 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2157 tdep->size_timespec))
2162 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2167 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
2168 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2169 tdep->size_pollfd * nfds))
2172 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2173 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2174 tdep->size_timespec))
2178 case gdb_sys_unshare:
2179 case gdb_sys_set_robust_list:
2182 case gdb_sys_get_robust_list:
2183 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2184 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2186 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2187 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2191 case gdb_sys_splice:
2192 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2193 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2196 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2197 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2202 case gdb_sys_sync_file_range:
2204 case gdb_sys_vmsplice:
2207 case gdb_sys_move_pages:
2208 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2213 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2214 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2215 nr_pages * tdep->size_int))
2220 case gdb_sys_getcpu:
2221 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2222 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2224 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2225 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2227 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2228 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2229 tdep->size_ulong * 2))
2233 case gdb_sys_epoll_pwait:
2234 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2239 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2240 tmpint = (int) maxevents * tdep->size_epoll_event;
2241 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2247 printf_unfiltered (_("Process record and replay target doesn't "
2248 "support syscall number %d\n"), syscall);