1 /* Process record and replay target code for GNU/Linux.
3 Copyright (C) 2008, 2009, 2010, 2011 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 "linux-record.h"
27 /* These macros are the values of the first argument of system call
28 "sys_ptrace". The values of these macros were obtained from Linux
31 #define RECORD_PTRACE_PEEKTEXT 1
32 #define RECORD_PTRACE_PEEKDATA 2
33 #define RECORD_PTRACE_PEEKUSR 3
35 /* These macros are the values of the first argument of system call
36 "sys_socketcall". The values of these macros were obtained from
37 Linux Kernel source. */
39 #define RECORD_SYS_SOCKET 1
40 #define RECORD_SYS_BIND 2
41 #define RECORD_SYS_CONNECT 3
42 #define RECORD_SYS_LISTEN 4
43 #define RECORD_SYS_ACCEPT 5
44 #define RECORD_SYS_GETSOCKNAME 6
45 #define RECORD_SYS_GETPEERNAME 7
46 #define RECORD_SYS_SOCKETPAIR 8
47 #define RECORD_SYS_SEND 9
48 #define RECORD_SYS_RECV 10
49 #define RECORD_SYS_SENDTO 11
50 #define RECORD_SYS_RECVFROM 12
51 #define RECORD_SYS_SHUTDOWN 13
52 #define RECORD_SYS_SETSOCKOPT 14
53 #define RECORD_SYS_GETSOCKOPT 15
54 #define RECORD_SYS_SENDMSG 16
55 #define RECORD_SYS_RECVMSG 17
57 /* These macros are the values of the first argument of system call
58 "sys_ipc". The values of these macros were obtained from Linux
61 #define RECORD_SEMOP 1
62 #define RECORD_SEMGET 2
63 #define RECORD_SEMCTL 3
64 #define RECORD_SEMTIMEDOP 4
65 #define RECORD_MSGSND 11
66 #define RECORD_MSGRCV 12
67 #define RECORD_MSGGET 13
68 #define RECORD_MSGCTL 14
69 #define RECORD_SHMAT 21
70 #define RECORD_SHMDT 22
71 #define RECORD_SHMGET 23
72 #define RECORD_SHMCTL 24
74 /* These macros are the values of the first argument of system call
75 "sys_quotactl". The values of these macros were obtained from Linux
78 #define RECORD_Q_GETFMT 0x800004
79 #define RECORD_Q_GETINFO 0x800005
80 #define RECORD_Q_GETQUOTA 0x800007
81 #define RECORD_Q_XGETQSTAT (('5' << 8) + 5)
82 #define RECORD_Q_XGETQUOTA (('3' << 8) + 3)
84 #define OUTPUT_REG(val, num) phex_nz ((val), \
85 TYPE_LENGTH (gdbarch_register_type (get_regcache_arch (regcache), (num))))
88 record_linux_sockaddr (struct regcache *regcache,
89 struct linux_record_tdep *tdep, ULONGEST addr,
94 struct gdbarch *gdbarch = get_regcache_arch (regcache);
95 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
100 a = alloca (tdep->size_int);
102 if (record_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
105 /* Get the addrlen. */
106 if (target_read_memory ((CORE_ADDR) len, a, tdep->size_int))
109 fprintf_unfiltered (gdb_stdlog,
110 "Process record: error reading "
111 "memory at addr = 0x%s len = %d.\n",
112 phex_nz (len, tdep->size_pointer),
116 addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order);
117 if (addrlen <= 0 || addrlen > tdep->size_sockaddr)
118 addrlen = tdep->size_sockaddr;
120 if (record_arch_list_add_mem ((CORE_ADDR) addr, addrlen))
127 record_linux_msghdr (struct regcache *regcache,
128 struct linux_record_tdep *tdep, ULONGEST addr)
131 struct gdbarch *gdbarch = get_regcache_arch (regcache);
132 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
139 if (record_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
142 a = alloca (tdep->size_msghdr);
143 if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
146 fprintf_unfiltered (gdb_stdlog,
147 "Process record: error reading "
148 "memory at addr = 0x%s "
150 phex_nz (addr, tdep->size_pointer),
155 /* msg_name msg_namelen */
156 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
157 a += tdep->size_pointer;
158 if (record_arch_list_add_mem ((CORE_ADDR) addr,
159 (int) extract_unsigned_integer (a,
165 /* msg_iov msg_iovlen */
166 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
167 a += tdep->size_pointer;
171 ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
173 gdb_byte *iov = alloca (tdep->size_iovec);
175 for (i = 0; i < len; i++)
177 if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
180 fprintf_unfiltered (gdb_stdlog,
181 "Process record: error "
185 phex_nz (addr,tdep->size_pointer),
189 tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
192 tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
195 if (record_arch_list_add_mem (tmpaddr, tmpint))
197 addr += tdep->size_iovec;
200 a += tdep->size_size_t;
202 /* msg_control msg_controllen */
203 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
204 a += tdep->size_pointer;
205 tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
206 if (record_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
212 /* When the architecture process record get a Linux syscall
213 instruction, it will get a Linux syscall number of this
214 architecture and convert it to the Linux syscall number "num" which
215 is internal to GDB. Most Linux syscalls across architectures in
216 Linux would be similar and mostly differ by sizes of types and
217 structures. This sizes are put to "tdep".
219 Record the values of the registers and memory that will be changed
220 in current system call.
222 Return -1 if something wrong. */
225 record_linux_system_call (enum gdb_syscall syscall,
226 struct regcache *regcache,
227 struct linux_record_tdep *tdep)
229 struct gdbarch *gdbarch = get_regcache_arch (regcache);
230 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
231 ULONGEST tmpulongest;
237 case gdb_sys_restart_syscall:
244 target_terminal_ours ();
245 q = yquery (_("The next instruction is syscall exit. "
246 "It will make the program exit. "
247 "Do you want to stop the program?"));
248 target_terminal_inferior ();
259 ULONGEST addr, count;
261 regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
262 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
263 if (record_arch_list_add_mem ((CORE_ADDR) addr, (int) count))
271 case gdb_sys_waitpid:
280 case gdb_sys_lchown16:
281 case gdb_sys_ni_syscall17:
287 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
288 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
289 tdep->size__old_kernel_stat))
296 case gdb_sys_oldumount:
297 case gdb_sys_setuid16:
298 case gdb_sys_getuid16:
303 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
304 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
305 || tmpulongest == RECORD_PTRACE_PEEKDATA
306 || tmpulongest == RECORD_PTRACE_PEEKUSR)
308 regcache_raw_read_unsigned (regcache, tdep->arg4,
310 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
318 case gdb_sys_ni_syscall31:
319 case gdb_sys_ni_syscall32:
322 case gdb_sys_ni_syscall35:
333 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
334 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_tms))
338 case gdb_sys_ni_syscall44:
340 case gdb_sys_setgid16:
341 case gdb_sys_getgid16:
343 case gdb_sys_geteuid16:
344 case gdb_sys_getegid16:
347 case gdb_sys_ni_syscall53:
351 /* XXX Need to add a lot of support of other ioctl requests. */
352 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
353 if (tmpulongest == tdep->ioctl_FIOCLEX
354 || tmpulongest == tdep->ioctl_FIONCLEX
355 || tmpulongest == tdep->ioctl_FIONBIO
356 || tmpulongest == tdep->ioctl_FIOASYNC
357 || tmpulongest == tdep->ioctl_TCSETS
358 || tmpulongest == tdep->ioctl_TCSETSW
359 || tmpulongest == tdep->ioctl_TCSETSF
360 || tmpulongest == tdep->ioctl_TCSETA
361 || tmpulongest == tdep->ioctl_TCSETAW
362 || tmpulongest == tdep->ioctl_TCSETAF
363 || tmpulongest == tdep->ioctl_TCSBRK
364 || tmpulongest == tdep->ioctl_TCXONC
365 || tmpulongest == tdep->ioctl_TCFLSH
366 || tmpulongest == tdep->ioctl_TIOCEXCL
367 || tmpulongest == tdep->ioctl_TIOCNXCL
368 || tmpulongest == tdep->ioctl_TIOCSCTTY
369 || tmpulongest == tdep->ioctl_TIOCSPGRP
370 || tmpulongest == tdep->ioctl_TIOCSTI
371 || tmpulongest == tdep->ioctl_TIOCSWINSZ
372 || tmpulongest == tdep->ioctl_TIOCMBIS
373 || tmpulongest == tdep->ioctl_TIOCMBIC
374 || tmpulongest == tdep->ioctl_TIOCMSET
375 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
376 || tmpulongest == tdep->ioctl_TIOCCONS
377 || tmpulongest == tdep->ioctl_TIOCSSERIAL
378 || tmpulongest == tdep->ioctl_TIOCPKT
379 || tmpulongest == tdep->ioctl_TIOCNOTTY
380 || tmpulongest == tdep->ioctl_TIOCSETD
381 || tmpulongest == tdep->ioctl_TCSBRKP
382 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
383 || tmpulongest == tdep->ioctl_TIOCSBRK
384 || tmpulongest == tdep->ioctl_TIOCCBRK
385 || tmpulongest == tdep->ioctl_TCSETS2
386 || tmpulongest == tdep->ioctl_TCSETSW2
387 || tmpulongest == tdep->ioctl_TCSETSF2
388 || tmpulongest == tdep->ioctl_TIOCSPTLCK
389 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
390 || tmpulongest == tdep->ioctl_TIOCSERGWILD
391 || tmpulongest == tdep->ioctl_TIOCSERSWILD
392 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
393 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
394 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
395 || tmpulongest == tdep->ioctl_TIOCMIWAIT
396 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
400 else if (tmpulongest == tdep->ioctl_TCGETS
401 || tmpulongest == tdep->ioctl_TCGETA
402 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
404 regcache_raw_read_unsigned (regcache, tdep->arg3,
406 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
410 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
411 || tmpulongest == tdep->ioctl_TIOCGSID)
413 regcache_raw_read_unsigned (regcache, tdep->arg3,
415 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
419 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
420 || tmpulongest == tdep->ioctl_TIOCMGET
421 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
422 || tmpulongest == tdep->ioctl_FIONREAD
423 || tmpulongest == tdep->ioctl_TIOCINQ
424 || tmpulongest == tdep->ioctl_TIOCGETD
425 || tmpulongest == tdep->ioctl_TIOCGPTN
426 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
428 regcache_raw_read_unsigned (regcache, tdep->arg3,
430 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
434 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
436 regcache_raw_read_unsigned (regcache, tdep->arg3,
438 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
442 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
444 regcache_raw_read_unsigned (regcache, tdep->arg3,
446 /* This syscall affects a char-size memory. */
447 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
450 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
452 regcache_raw_read_unsigned (regcache, tdep->arg3,
454 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
455 tdep->size_serial_struct))
458 else if (tmpulongest == tdep->ioctl_TCGETS2)
460 regcache_raw_read_unsigned (regcache, tdep->arg3,
462 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
463 tdep->size_termios2))
466 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
468 regcache_raw_read_unsigned (regcache, tdep->arg3,
470 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
474 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
476 regcache_raw_read_unsigned (regcache, tdep->arg3,
478 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
479 tdep->size_serial_icounter_struct))
482 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
484 regcache_raw_read_unsigned (regcache, tdep->arg3,
486 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
487 tdep->size_hayes_esp_config))
490 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
492 printf_unfiltered (_("Process record and replay target doesn't "
493 "support ioctl request TIOCSERGSTRUCT\n"));
498 printf_unfiltered (_("Process record and replay target doesn't "
499 "support ioctl request 0x%s.\n"),
500 OUTPUT_REG (tmpulongest, tdep->arg2));
507 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
509 if (tmpulongest == tdep->fcntl_F_GETLK)
511 regcache_raw_read_unsigned (regcache, tdep->arg3,
513 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
519 case gdb_sys_ni_syscall56:
520 case gdb_sys_setpgid:
521 case gdb_sys_ni_syscall58:
524 case gdb_sys_olduname:
525 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
526 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
527 tdep->size_oldold_utsname))
536 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
537 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
543 case gdb_sys_getppid:
544 case gdb_sys_getpgrp:
548 case gdb_sys_sigaction:
549 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
550 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
551 tdep->size_old_sigaction))
555 case gdb_sys_sgetmask:
556 case gdb_sys_ssetmask:
557 case gdb_sys_setreuid16:
558 case gdb_sys_setregid16:
559 case gdb_sys_sigsuspend:
562 case gdb_sys_sigpending:
563 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
564 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
565 tdep->size_old_sigset_t))
569 case gdb_sys_sethostname:
570 case gdb_sys_setrlimit:
573 case gdb_sys_old_getrlimit:
574 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
575 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
580 case gdb_sys_getrusage:
581 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
582 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
587 case gdb_sys_gettimeofday:
588 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
589 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
592 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
593 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
594 tdep->size_timezone))
598 case gdb_sys_settimeofday:
601 case gdb_sys_getgroups16:
602 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
603 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
604 tdep->size_old_gid_t))
608 case gdb_sys_setgroups16:
609 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
610 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
611 tdep->size_old_gid_t))
617 struct sel_arg_struct
626 regcache_raw_read_unsigned (regcache, tdep->arg1,
630 if (target_read_memory (tmpulongest, (gdb_byte *) &sel,
634 fprintf_unfiltered (gdb_stdlog,
635 "Process record: error reading memory "
636 "at addr = 0x%s len = %lu.\n",
637 OUTPUT_REG (tmpulongest, tdep->arg1),
638 (unsigned long) sizeof (sel));
641 if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
643 if (record_arch_list_add_mem (sel.outp, tdep->size_fd_set))
645 if (record_arch_list_add_mem (sel.exp, tdep->size_fd_set))
647 if (record_arch_list_add_mem (sel.tvp, tdep->size_timeval))
653 case gdb_sys_symlink:
656 case gdb_sys_readlink:
660 regcache_raw_read_unsigned (regcache, tdep->arg2,
662 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
663 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
676 target_terminal_ours ();
677 q = yquery (_("The next instruction is syscall reboot. "
678 "It will restart the computer. "
679 "Do you want to stop the program?"));
680 target_terminal_inferior ();
686 case gdb_old_readdir:
687 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
688 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
700 regcache_raw_read_unsigned (regcache, tdep->arg1,
702 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
703 if (record_memory_query)
707 target_terminal_ours ();
709 The next instruction is syscall munmap.\n\
710 It will free the memory addr = 0x%s len = %u.\n\
711 It will make record target cannot record some memory change.\n\
712 Do you want to stop the program?"),
713 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
714 target_terminal_inferior ();
721 case gdb_sys_truncate:
722 case gdb_sys_ftruncate:
724 case gdb_sys_fchown16:
725 case gdb_sys_getpriority:
726 case gdb_sys_setpriority:
727 case gdb_sys_ni_syscall98:
731 case gdb_sys_fstatfs:
732 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
733 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
743 case gdb_sys_sendmsg:
744 case gdb_sys_shutdown:
746 case gdb_sys_connect:
748 case gdb_sys_setsockopt:
752 case gdb_sys_getsockname:
753 case gdb_sys_getpeername:
757 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
758 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
759 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
764 case gdb_sys_recvfrom:
768 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
769 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
770 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
779 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
780 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
781 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
786 case gdb_sys_recvmsg:
787 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
788 if (record_linux_msghdr (regcache, tdep, tmpulongest))
792 case gdb_sys_socketpair:
793 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
794 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
798 case gdb_sys_getsockopt:
799 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
803 gdb_byte *optlenp = alloca (tdep->size_int);
805 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
809 fprintf_unfiltered (gdb_stdlog,
810 "Process record: error reading "
811 "memory at addr = 0x%s "
813 OUTPUT_REG (tmpulongest, tdep->arg5),
817 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
818 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
820 if (record_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
822 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
828 case gdb_sys_socketcall:
829 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
832 case RECORD_SYS_SOCKET:
833 case RECORD_SYS_BIND:
834 case RECORD_SYS_CONNECT:
835 case RECORD_SYS_LISTEN:
837 case RECORD_SYS_ACCEPT:
838 case RECORD_SYS_GETSOCKNAME:
839 case RECORD_SYS_GETPEERNAME:
841 regcache_raw_read_unsigned (regcache, tdep->arg2,
845 gdb_byte *a = alloca (tdep->size_ulong * 2);
848 tmpulongest += tdep->size_ulong;
849 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
850 tdep->size_ulong * 2))
853 fprintf_unfiltered (gdb_stdlog,
854 "Process record: error reading "
855 "memory at addr = 0x%s len = %d.\n",
856 OUTPUT_REG (tmpulongest, tdep->arg2),
857 tdep->size_ulong * 2);
860 tmpulongest = extract_unsigned_integer (a,
863 len = extract_unsigned_integer (a + tdep->size_ulong,
864 tdep->size_ulong, byte_order);
865 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
871 case RECORD_SYS_SOCKETPAIR:
873 gdb_byte *a = alloca (tdep->size_ulong);
875 regcache_raw_read_unsigned (regcache, tdep->arg2,
879 tmpulongest += tdep->size_ulong * 3;
880 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
884 fprintf_unfiltered (gdb_stdlog,
885 "Process record: error reading "
886 "memory at addr = 0x%s len = %d.\n",
887 OUTPUT_REG (tmpulongest, tdep->arg2),
892 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
894 if (record_arch_list_add_mem (tmpaddr, tdep->size_int))
899 case RECORD_SYS_SEND:
900 case RECORD_SYS_SENDTO:
902 case RECORD_SYS_RECVFROM:
903 regcache_raw_read_unsigned (regcache, tdep->arg2,
907 gdb_byte *a = alloca (tdep->size_ulong * 2);
910 tmpulongest += tdep->size_ulong * 4;
911 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
912 tdep->size_ulong * 2))
915 fprintf_unfiltered (gdb_stdlog,
916 "Process record: error reading "
917 "memory at addr = 0x%s len = %d.\n",
918 OUTPUT_REG (tmpulongest, tdep->arg2),
919 tdep->size_ulong * 2);
922 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
924 len = extract_unsigned_integer (a + tdep->size_ulong,
925 tdep->size_ulong, byte_order);
926 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
929 case RECORD_SYS_RECV:
930 regcache_raw_read_unsigned (regcache, tdep->arg2,
934 gdb_byte *a = alloca (tdep->size_ulong * 2);
936 tmpulongest += tdep->size_ulong;
937 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
941 fprintf_unfiltered (gdb_stdlog,
942 "Process record: error reading "
943 "memory at addr = 0x%s len = %d.\n",
944 OUTPUT_REG (tmpulongest, tdep->arg2),
948 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
952 a += tdep->size_ulong;
953 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
955 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
961 case RECORD_SYS_SHUTDOWN:
962 case RECORD_SYS_SETSOCKOPT:
964 case RECORD_SYS_GETSOCKOPT:
966 gdb_byte *a = alloca (tdep->size_ulong * 2);
967 gdb_byte *av = alloca (tdep->size_int);
969 regcache_raw_read_unsigned (regcache, tdep->arg2,
973 tmpulongest += tdep->size_ulong * 3;
974 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
975 tdep->size_ulong * 2))
978 fprintf_unfiltered (gdb_stdlog,
979 "Process record: error reading "
980 "memory at addr = 0x%s len = %d.\n",
981 OUTPUT_REG (tmpulongest, tdep->arg2),
982 tdep->size_ulong * 2);
985 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
990 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
994 fprintf_unfiltered (gdb_stdlog,
995 "Process record: error reading "
996 "memory at addr = 0x%s "
998 phex_nz (tmpulongest,
1004 = (CORE_ADDR) extract_unsigned_integer (a,
1007 tmpint = (int) extract_unsigned_integer (av,
1010 if (record_arch_list_add_mem (tmpaddr, tmpint))
1012 a += tdep->size_ulong;
1014 = (CORE_ADDR) extract_unsigned_integer (a,
1017 if (record_arch_list_add_mem (tmpaddr, tdep->size_int))
1023 case RECORD_SYS_SENDMSG:
1025 case RECORD_SYS_RECVMSG:
1027 gdb_byte *a = alloca (tdep->size_ulong);
1029 regcache_raw_read_unsigned (regcache, tdep->arg2,
1033 tmpulongest += tdep->size_ulong;
1034 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1038 fprintf_unfiltered (gdb_stdlog,
1039 "Process record: error reading "
1040 "memory at addr = 0x%s len = %d.\n",
1041 OUTPUT_REG (tmpulongest, tdep->arg2),
1045 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1047 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1053 printf_unfiltered (_("Process record and replay target "
1054 "doesn't support socketcall call 0x%s\n"),
1055 OUTPUT_REG (tmpulongest, tdep->arg1));
1061 case gdb_sys_syslog:
1064 case gdb_sys_setitimer:
1065 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1066 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1067 tdep->size_itimerval))
1071 case gdb_sys_getitimer:
1072 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1073 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1074 tdep->size_itimerval))
1078 case gdb_sys_newstat:
1079 case gdb_sys_newlstat:
1080 case gdb_sys_newfstat:
1081 case gdb_sys_newfstatat:
1082 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1083 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_stat))
1088 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1089 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1090 tdep->size_old_utsname))
1095 case gdb_sys_vhangup:
1096 case gdb_sys_ni_syscall112:
1097 case gdb_sys_vm86old:
1101 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1102 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1105 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1106 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1111 case gdb_sys_swapoff:
1114 case gdb_sys_sysinfo:
1115 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1116 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1117 tdep->size_sysinfo))
1121 case gdb_sys_shmget:
1122 case gdb_sys_semget:
1124 case gdb_sys_msgget:
1125 /* XXX maybe need do some record works with sys_shmdt. */
1127 case gdb_sys_msgsnd:
1128 case gdb_sys_semtimedop:
1132 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1133 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1138 case gdb_sys_shmctl:
1139 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1140 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1141 tdep->size_shmid_ds))
1145 /* XXX sys_semctl 525 still not supported. */
1148 case gdb_sys_msgrcv:
1152 regcache_raw_read_signed (regcache, tdep->arg3, &tmpulongest);
1153 regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
1154 tmpint = (int) tmpulongest + tdep->size_long;
1155 if (record_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
1160 case gdb_sys_msgctl:
1161 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1162 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1163 tdep->size_msqid_ds))
1168 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1169 tmpulongest &= 0xffff;
1170 switch (tmpulongest)
1174 case RECORD_SEMTIMEDOP:
1177 /* XXX maybe need do some record works with RECORD_SHMDT. */
1186 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1187 regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
1188 tmpint = (int) second + tdep->size_long;
1189 if (record_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
1194 regcache_raw_read_unsigned (regcache, tdep->arg5,
1196 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1197 tdep->size_msqid_ds))
1201 regcache_raw_read_unsigned (regcache, tdep->arg4,
1203 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1208 regcache_raw_read_unsigned (regcache, tdep->arg5,
1210 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1211 tdep->size_shmid_ds))
1215 /* XXX RECORD_SEMCTL still not supported. */
1216 printf_unfiltered (_("Process record and replay target doesn't "
1217 "support ipc number %s\n"),
1218 pulongest (tmpulongest));
1224 case gdb_sys_sigreturn:
1226 case gdb_sys_setdomainname:
1229 case gdb_sys_newuname:
1230 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1231 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1232 tdep->size_new_utsname))
1236 case gdb_sys_modify_ldt:
1237 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1238 if (tmpulongest == 0 || tmpulongest == 2)
1240 ULONGEST ptr, bytecount;
1242 regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
1243 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1244 if (record_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
1249 case gdb_sys_adjtimex:
1250 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1251 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_timex))
1255 case gdb_sys_mprotect:
1258 case gdb_sys_sigprocmask:
1259 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1260 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1261 tdep->size_old_sigset_t))
1265 case gdb_sys_ni_syscall127:
1266 case gdb_sys_init_module:
1267 case gdb_sys_delete_module:
1268 case gdb_sys_ni_syscall130:
1271 case gdb_sys_quotactl:
1272 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1273 switch (tmpulongest)
1275 case RECORD_Q_GETFMT:
1276 regcache_raw_read_unsigned (regcache, tdep->arg4,
1279 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
1282 case RECORD_Q_GETINFO:
1283 regcache_raw_read_unsigned (regcache, tdep->arg4,
1285 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1286 tdep->size_mem_dqinfo))
1289 case RECORD_Q_GETQUOTA:
1290 regcache_raw_read_unsigned (regcache, tdep->arg4,
1292 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1293 tdep->size_if_dqblk))
1296 case RECORD_Q_XGETQSTAT:
1297 case RECORD_Q_XGETQUOTA:
1298 regcache_raw_read_unsigned (regcache, tdep->arg4,
1300 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1301 tdep->size_fs_quota_stat))
1307 case gdb_sys_getpgid:
1308 case gdb_sys_fchdir:
1309 case gdb_sys_bdflush:
1313 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1314 if (tmpulongest == 2)
1316 regcache_raw_read_unsigned (regcache, tdep->arg3,
1318 /*XXX the size of memory is not very clear. */
1319 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
1324 case gdb_sys_personality:
1325 case gdb_sys_ni_syscall137:
1326 case gdb_sys_setfsuid16:
1327 case gdb_sys_setfsgid16:
1330 case gdb_sys_llseek:
1331 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1332 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1337 case gdb_sys_getdents:
1341 regcache_raw_read_unsigned (regcache, tdep->arg2,
1343 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1344 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1345 tdep->size_dirent * count))
1350 case gdb_sys_select:
1351 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1352 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1355 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1356 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1359 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1360 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1363 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
1364 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1365 tdep->size_timeval))
1377 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1380 gdb_byte *iov = alloca (tdep->size_iovec);
1382 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1383 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1385 if (target_read_memory ((CORE_ADDR) vec, iov,
1389 fprintf_unfiltered (gdb_stdlog,
1390 "Process record: error reading "
1391 "memory at addr = 0x%s len = %d.\n",
1392 OUTPUT_REG (vec, tdep->arg2),
1397 = (CORE_ADDR) extract_unsigned_integer (iov,
1401 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1404 if (record_arch_list_add_mem (tmpaddr, tmpint))
1406 vec += tdep->size_iovec;
1412 case gdb_sys_writev:
1413 case gdb_sys_getsid:
1414 case gdb_sys_fdatasync:
1415 case gdb_sys_sysctl:
1417 case gdb_sys_munlock:
1418 case gdb_sys_mlockall:
1419 case gdb_sys_munlockall:
1420 case gdb_sys_sched_setparam:
1423 case gdb_sys_sched_getparam:
1424 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1425 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1429 case gdb_sys_sched_setscheduler:
1430 case gdb_sys_sched_getscheduler:
1431 case gdb_sys_sched_yield:
1432 case gdb_sys_sched_get_priority_max:
1433 case gdb_sys_sched_get_priority_min:
1436 case gdb_sys_sched_rr_get_interval:
1437 case gdb_sys_nanosleep:
1438 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1439 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1440 tdep->size_timespec))
1444 case gdb_sys_mremap:
1445 case gdb_sys_setresuid16:
1448 case gdb_sys_getresuid16:
1449 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1450 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1451 tdep->size_old_uid_t))
1453 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1454 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1455 tdep->size_old_uid_t))
1457 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1458 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1459 tdep->size_old_uid_t))
1464 case gdb_sys_ni_syscall167:
1468 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1473 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1474 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1475 tdep->size_pollfd * nfds))
1480 case gdb_sys_nfsservctl:
1481 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1482 if (tmpulongest == 7 || tmpulongest == 8)
1486 if (tmpulongest == 7)
1487 rsize = tdep->size_NFS_FHSIZE;
1489 rsize = tdep->size_knfsd_fh;
1490 regcache_raw_read_unsigned (regcache, tdep->arg3,
1492 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
1497 case gdb_sys_setresgid16:
1500 case gdb_sys_getresgid16:
1501 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1502 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1503 tdep->size_old_gid_t))
1505 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1506 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1507 tdep->size_old_gid_t))
1509 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1510 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1511 tdep->size_old_gid_t))
1516 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1517 switch (tmpulongest)
1520 regcache_raw_read_unsigned (regcache, tdep->arg2,
1522 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1527 regcache_raw_read_unsigned (regcache, tdep->arg2,
1529 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1530 tdep->size_TASK_COMM_LEN))
1536 case gdb_sys_rt_sigreturn:
1539 case gdb_sys_rt_sigaction:
1540 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1541 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1542 tdep->size_sigaction))
1546 case gdb_sys_rt_sigprocmask:
1547 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1548 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1549 tdep->size_sigset_t))
1553 case gdb_sys_rt_sigpending:
1554 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1557 ULONGEST sigsetsize;
1559 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1560 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1566 case gdb_sys_rt_sigtimedwait:
1567 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1568 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1569 tdep->size_siginfo_t))
1573 case gdb_sys_rt_sigqueueinfo:
1574 case gdb_sys_rt_sigsuspend:
1577 case gdb_sys_pread64:
1578 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1583 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1584 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) count))
1589 case gdb_sys_pwrite64:
1590 case gdb_sys_chown16:
1593 case gdb_sys_getcwd:
1594 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1599 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1600 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1605 case gdb_sys_capget:
1606 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1607 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1608 tdep->size_cap_user_data_t))
1612 case gdb_sys_capset:
1615 case gdb_sys_sigaltstack:
1616 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1617 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1618 tdep->size_stack_t))
1622 case gdb_sys_sendfile:
1623 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1624 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1629 case gdb_sys_ni_syscall188:
1630 case gdb_sys_ni_syscall189:
1634 case gdb_sys_getrlimit:
1635 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1636 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1644 case gdb_sys_truncate64:
1645 case gdb_sys_ftruncate64:
1648 case gdb_sys_stat64:
1649 case gdb_sys_lstat64:
1650 case gdb_sys_fstat64:
1651 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1652 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1657 case gdb_sys_lchown:
1658 case gdb_sys_getuid:
1659 case gdb_sys_getgid:
1660 case gdb_sys_geteuid:
1661 case gdb_sys_getegid:
1662 case gdb_sys_setreuid:
1663 case gdb_sys_setregid:
1666 case gdb_sys_getgroups:
1667 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1670 ULONGEST gidsetsize;
1672 regcache_raw_read_unsigned (regcache, tdep->arg1,
1674 tmpint = tdep->size_gid_t * (int) gidsetsize;
1675 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1680 case gdb_sys_setgroups:
1681 case gdb_sys_fchown:
1682 case gdb_sys_setresuid:
1685 case gdb_sys_getresuid:
1686 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1687 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1689 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1690 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1692 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1693 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1697 case gdb_sys_setresgid:
1700 case gdb_sys_getresgid:
1701 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1702 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1704 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1705 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1707 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1708 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1713 case gdb_sys_setuid:
1714 case gdb_sys_setgid:
1715 case gdb_sys_setfsuid:
1716 case gdb_sys_setfsgid:
1717 case gdb_sys_pivot_root:
1720 case gdb_sys_mincore:
1721 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1722 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1723 tdep->size_PAGE_SIZE))
1727 case gdb_sys_madvise:
1730 case gdb_sys_getdents64:
1734 regcache_raw_read_unsigned (regcache, tdep->arg2,
1736 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1737 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1738 tdep->size_dirent64 * count))
1743 case gdb_sys_fcntl64:
1744 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1745 if (tmpulongest == tdep->fcntl_F_GETLK64)
1747 regcache_raw_read_unsigned (regcache, tdep->arg3,
1749 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1750 tdep->size_flock64))
1753 else if (tmpulongest != tdep->fcntl_F_SETLK64
1754 && tmpulongest != tdep->fcntl_F_SETLKW64)
1760 case gdb_sys_ni_syscall222:
1761 case gdb_sys_ni_syscall223:
1762 case gdb_sys_gettid:
1763 case gdb_sys_readahead:
1764 case gdb_sys_setxattr:
1765 case gdb_sys_lsetxattr:
1766 case gdb_sys_fsetxattr:
1769 case gdb_sys_getxattr:
1770 case gdb_sys_lgetxattr:
1771 case gdb_sys_fgetxattr:
1772 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1777 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1778 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1783 case gdb_sys_listxattr:
1784 case gdb_sys_llistxattr:
1785 case gdb_sys_flistxattr:
1786 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1791 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1792 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1797 case gdb_sys_removexattr:
1798 case gdb_sys_lremovexattr:
1799 case gdb_sys_fremovexattr:
1803 case gdb_sys_sendfile64:
1804 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1805 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1811 case gdb_sys_sched_setaffinity:
1814 case gdb_sys_sched_getaffinity:
1815 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1820 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1821 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
1826 case gdb_sys_set_thread_area:
1827 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1828 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1832 case gdb_sys_get_thread_area:
1833 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1834 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1835 tdep->size_user_desc))
1839 case gdb_sys_io_setup:
1840 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1841 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_long))
1845 case gdb_sys_io_destroy:
1848 case gdb_sys_io_getevents:
1849 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1854 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1855 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1856 nr * tdep->size_io_event))
1861 case gdb_sys_io_submit:
1862 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1868 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1869 iocbp = alloca (nr * tdep->size_pointer);
1870 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1871 nr * tdep->size_pointer))
1874 fprintf_unfiltered (gdb_stdlog,
1875 "Process record: error reading memory "
1876 "at addr = 0x%s len = %u.\n",
1877 OUTPUT_REG (tmpulongest, tdep->arg2),
1878 (int) (nr * tdep->size_pointer));
1881 for (i = 0; i < nr; i++)
1884 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1887 if (record_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1889 iocbp += tdep->size_pointer;
1894 case gdb_sys_io_cancel:
1895 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1896 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1897 tdep->size_io_event))
1901 case gdb_sys_fadvise64:
1902 case gdb_sys_ni_syscall251:
1905 case gdb_sys_exit_group:
1909 target_terminal_ours ();
1910 q = yquery (_("The next instruction is syscall exit_group. "
1911 "It will make the program exit. "
1912 "Do you want to stop the program?"));
1913 target_terminal_inferior ();
1919 case gdb_sys_lookup_dcookie:
1920 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1925 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1926 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
1931 case gdb_sys_epoll_create:
1932 case gdb_sys_epoll_ctl:
1935 case gdb_sys_epoll_wait:
1936 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1941 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1942 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1943 maxevents * tdep->size_epoll_event))
1948 case gdb_sys_remap_file_pages:
1949 case gdb_sys_set_tid_address:
1952 case gdb_sys_timer_create:
1953 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1954 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1958 case gdb_sys_timer_settime:
1959 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1960 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1961 tdep->size_itimerspec))
1965 case gdb_sys_timer_gettime:
1966 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1967 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1968 tdep->size_itimerspec))
1972 case gdb_sys_timer_getoverrun:
1973 case gdb_sys_timer_delete:
1974 case gdb_sys_clock_settime:
1977 case gdb_sys_clock_gettime:
1978 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1979 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1980 tdep->size_timespec))
1984 case gdb_sys_clock_getres:
1985 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1986 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1987 tdep->size_timespec))
1991 case gdb_sys_clock_nanosleep:
1992 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1993 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1994 tdep->size_timespec))
1998 case gdb_sys_statfs64:
1999 case gdb_sys_fstatfs64:
2000 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2001 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2002 tdep->size_statfs64))
2006 case gdb_sys_tgkill:
2007 case gdb_sys_utimes:
2008 case gdb_sys_fadvise64_64:
2009 case gdb_sys_ni_syscall273:
2013 case gdb_sys_get_mempolicy:
2014 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2015 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2017 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2022 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
2023 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2024 maxnode * tdep->size_long))
2029 case gdb_sys_set_mempolicy:
2030 case gdb_sys_mq_open:
2031 case gdb_sys_mq_unlink:
2032 case gdb_sys_mq_timedsend:
2035 case gdb_sys_mq_timedreceive:
2036 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2041 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
2042 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2046 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2047 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2051 case gdb_sys_mq_notify:
2054 case gdb_sys_mq_getsetattr:
2055 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2056 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2057 tdep->size_mq_attr))
2061 case gdb_sys_kexec_load:
2064 case gdb_sys_waitid:
2065 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2066 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2067 tdep->size_siginfo))
2069 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2070 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2075 case gdb_sys_ni_syscall285:
2076 case gdb_sys_add_key:
2077 case gdb_sys_request_key:
2080 case gdb_sys_keyctl:
2081 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2082 if (tmpulongest == 6 || tmpulongest == 11)
2084 regcache_raw_read_unsigned (regcache, tdep->arg3,
2090 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
2091 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2098 case gdb_sys_ioprio_set:
2099 case gdb_sys_ioprio_get:
2100 case gdb_sys_inotify_init:
2101 case gdb_sys_inotify_add_watch:
2102 case gdb_sys_inotify_rm_watch:
2103 case gdb_sys_migrate_pages:
2104 case gdb_sys_openat:
2105 case gdb_sys_mkdirat:
2106 case gdb_sys_mknodat:
2107 case gdb_sys_fchownat:
2108 case gdb_sys_futimesat:
2111 case gdb_sys_fstatat64:
2112 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2113 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2118 case gdb_sys_unlinkat:
2119 case gdb_sys_renameat:
2120 case gdb_sys_linkat:
2121 case gdb_sys_symlinkat:
2124 case gdb_sys_readlinkat:
2125 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2130 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
2131 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) bufsiz))
2136 case gdb_sys_fchmodat:
2137 case gdb_sys_faccessat:
2140 case gdb_sys_pselect6:
2141 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2142 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2145 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2146 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2149 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2150 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2153 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2154 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2155 tdep->size_timespec))
2160 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2165 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
2166 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2167 tdep->size_pollfd * nfds))
2170 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2171 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2172 tdep->size_timespec))
2176 case gdb_sys_unshare:
2177 case gdb_sys_set_robust_list:
2180 case gdb_sys_get_robust_list:
2181 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2182 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2184 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2185 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2189 case gdb_sys_splice:
2190 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2191 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2194 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2195 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2200 case gdb_sys_sync_file_range:
2202 case gdb_sys_vmsplice:
2205 case gdb_sys_move_pages:
2206 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2211 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2212 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2213 nr_pages * tdep->size_int))
2218 case gdb_sys_getcpu:
2219 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2220 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2222 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2223 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2225 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2226 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2227 tdep->size_ulong * 2))
2231 case gdb_sys_epoll_pwait:
2232 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2237 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2238 tmpint = (int) maxevents * tdep->size_epoll_event;
2239 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2245 printf_unfiltered (_("Process record and replay target doesn't "
2246 "support syscall number %d\n"), syscall);