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))
777 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
778 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
779 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
784 case gdb_sys_recvmsg:
785 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
786 if (record_linux_msghdr (regcache, tdep, tmpulongest))
790 case gdb_sys_socketpair:
791 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
792 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
796 case gdb_sys_getsockopt:
797 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
801 gdb_byte *optlenp = alloca (tdep->size_int);
803 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
807 fprintf_unfiltered (gdb_stdlog,
808 "Process record: error reading "
809 "memory at addr = 0x%s "
811 OUTPUT_REG (tmpulongest, tdep->arg5),
815 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
816 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
818 if (record_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
820 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
826 case gdb_sys_socketcall:
827 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
830 case RECORD_SYS_SOCKET:
831 case RECORD_SYS_BIND:
832 case RECORD_SYS_CONNECT:
833 case RECORD_SYS_LISTEN:
835 case RECORD_SYS_ACCEPT:
836 case RECORD_SYS_GETSOCKNAME:
837 case RECORD_SYS_GETPEERNAME:
839 regcache_raw_read_unsigned (regcache, tdep->arg2,
843 gdb_byte *a = alloca (tdep->size_ulong * 2);
846 tmpulongest += tdep->size_ulong;
847 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
848 tdep->size_ulong * 2))
851 fprintf_unfiltered (gdb_stdlog,
852 "Process record: error reading "
853 "memory at addr = 0x%s len = %d.\n",
854 OUTPUT_REG (tmpulongest, tdep->arg2),
855 tdep->size_ulong * 2);
858 tmpulongest = extract_unsigned_integer (a,
861 len = extract_unsigned_integer (a + tdep->size_ulong,
862 tdep->size_ulong, byte_order);
863 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
869 case RECORD_SYS_SOCKETPAIR:
871 gdb_byte *a = alloca (tdep->size_ulong);
873 regcache_raw_read_unsigned (regcache, tdep->arg2,
877 tmpulongest += tdep->size_ulong * 3;
878 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
882 fprintf_unfiltered (gdb_stdlog,
883 "Process record: error reading "
884 "memory at addr = 0x%s len = %d.\n",
885 OUTPUT_REG (tmpulongest, tdep->arg2),
890 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
892 if (record_arch_list_add_mem (tmpaddr, tdep->size_int))
897 case RECORD_SYS_SEND:
898 case RECORD_SYS_SENDTO:
900 case RECORD_SYS_RECVFROM:
901 regcache_raw_read_unsigned (regcache, tdep->arg2,
905 gdb_byte *a = alloca (tdep->size_ulong * 2);
908 tmpulongest += tdep->size_ulong * 4;
909 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
910 tdep->size_ulong * 2))
913 fprintf_unfiltered (gdb_stdlog,
914 "Process record: error reading "
915 "memory at addr = 0x%s len = %d.\n",
916 OUTPUT_REG (tmpulongest, tdep->arg2),
917 tdep->size_ulong * 2);
920 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
922 len = extract_unsigned_integer (a + tdep->size_ulong,
923 tdep->size_ulong, byte_order);
924 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
927 case RECORD_SYS_RECV:
928 regcache_raw_read_unsigned (regcache, tdep->arg2,
932 gdb_byte *a = alloca (tdep->size_ulong * 2);
934 tmpulongest += tdep->size_ulong;
935 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
939 fprintf_unfiltered (gdb_stdlog,
940 "Process record: error reading "
941 "memory at addr = 0x%s len = %d.\n",
942 OUTPUT_REG (tmpulongest, tdep->arg2),
946 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
950 a += tdep->size_ulong;
951 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
953 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
959 case RECORD_SYS_SHUTDOWN:
960 case RECORD_SYS_SETSOCKOPT:
962 case RECORD_SYS_GETSOCKOPT:
964 gdb_byte *a = alloca (tdep->size_ulong * 2);
965 gdb_byte *av = alloca (tdep->size_int);
967 regcache_raw_read_unsigned (regcache, tdep->arg2,
971 tmpulongest += tdep->size_ulong * 3;
972 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
973 tdep->size_ulong * 2))
976 fprintf_unfiltered (gdb_stdlog,
977 "Process record: error reading "
978 "memory at addr = 0x%s len = %d.\n",
979 OUTPUT_REG (tmpulongest, tdep->arg2),
980 tdep->size_ulong * 2);
983 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
988 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
992 fprintf_unfiltered (gdb_stdlog,
993 "Process record: error reading "
994 "memory at addr = 0x%s "
996 phex_nz (tmpulongest,
1002 = (CORE_ADDR) extract_unsigned_integer (a,
1005 tmpint = (int) extract_unsigned_integer (av,
1008 if (record_arch_list_add_mem (tmpaddr, tmpint))
1010 a += tdep->size_ulong;
1012 = (CORE_ADDR) extract_unsigned_integer (a,
1015 if (record_arch_list_add_mem (tmpaddr, tdep->size_int))
1021 case RECORD_SYS_SENDMSG:
1023 case RECORD_SYS_RECVMSG:
1025 gdb_byte *a = alloca (tdep->size_ulong);
1027 regcache_raw_read_unsigned (regcache, tdep->arg2,
1031 tmpulongest += tdep->size_ulong;
1032 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1036 fprintf_unfiltered (gdb_stdlog,
1037 "Process record: error reading "
1038 "memory at addr = 0x%s len = %d.\n",
1039 OUTPUT_REG (tmpulongest, tdep->arg2),
1043 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1045 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1051 printf_unfiltered (_("Process record and replay target "
1052 "doesn't support socketcall call 0x%s\n"),
1053 OUTPUT_REG (tmpulongest, tdep->arg1));
1059 case gdb_sys_syslog:
1062 case gdb_sys_setitimer:
1063 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1064 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1065 tdep->size_itimerval))
1069 case gdb_sys_getitimer:
1070 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1071 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1072 tdep->size_itimerval))
1076 case gdb_sys_newstat:
1077 case gdb_sys_newlstat:
1078 case gdb_sys_newfstat:
1079 case gdb_sys_newfstatat:
1080 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1081 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_stat))
1086 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1087 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1088 tdep->size_old_utsname))
1093 case gdb_sys_vhangup:
1094 case gdb_sys_ni_syscall112:
1095 case gdb_sys_vm86old:
1099 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1100 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1103 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1104 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1109 case gdb_sys_swapoff:
1112 case gdb_sys_sysinfo:
1113 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1114 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1115 tdep->size_sysinfo))
1119 case gdb_sys_shmget:
1120 case gdb_sys_semget:
1122 case gdb_sys_msgget:
1123 /* XXX maybe need do some record works with sys_shmdt. */
1125 case gdb_sys_msgsnd:
1126 case gdb_sys_semtimedop:
1130 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1131 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1136 case gdb_sys_shmctl:
1137 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1138 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1139 tdep->size_shmid_ds))
1143 /* XXX sys_semctl 525 still not supported. */
1146 case gdb_sys_msgrcv:
1150 regcache_raw_read_signed (regcache, tdep->arg3, &tmpulongest);
1151 regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
1152 tmpint = (int) tmpulongest + tdep->size_long;
1153 if (record_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
1158 case gdb_sys_msgctl:
1159 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1160 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1161 tdep->size_msqid_ds))
1166 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1167 tmpulongest &= 0xffff;
1168 switch (tmpulongest)
1172 case RECORD_SEMTIMEDOP:
1175 /* XXX maybe need do some record works with RECORD_SHMDT. */
1184 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1185 regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
1186 tmpint = (int) second + tdep->size_long;
1187 if (record_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
1192 regcache_raw_read_unsigned (regcache, tdep->arg5,
1194 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1195 tdep->size_msqid_ds))
1199 regcache_raw_read_unsigned (regcache, tdep->arg4,
1201 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1206 regcache_raw_read_unsigned (regcache, tdep->arg5,
1208 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1209 tdep->size_shmid_ds))
1213 /* XXX RECORD_SEMCTL still not supported. */
1214 printf_unfiltered (_("Process record and replay target doesn't "
1215 "support ipc number %s\n"),
1216 pulongest (tmpulongest));
1222 case gdb_sys_sigreturn:
1224 case gdb_sys_setdomainname:
1227 case gdb_sys_newuname:
1228 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1229 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1230 tdep->size_new_utsname))
1234 case gdb_sys_modify_ldt:
1235 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1236 if (tmpulongest == 0 || tmpulongest == 2)
1238 ULONGEST ptr, bytecount;
1240 regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
1241 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
1242 if (record_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
1247 case gdb_sys_adjtimex:
1248 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1249 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_timex))
1253 case gdb_sys_mprotect:
1256 case gdb_sys_sigprocmask:
1257 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1258 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1259 tdep->size_old_sigset_t))
1263 case gdb_sys_ni_syscall127:
1264 case gdb_sys_init_module:
1265 case gdb_sys_delete_module:
1266 case gdb_sys_ni_syscall130:
1269 case gdb_sys_quotactl:
1270 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1271 switch (tmpulongest)
1273 case RECORD_Q_GETFMT:
1274 regcache_raw_read_unsigned (regcache, tdep->arg4,
1277 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
1280 case RECORD_Q_GETINFO:
1281 regcache_raw_read_unsigned (regcache, tdep->arg4,
1283 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1284 tdep->size_mem_dqinfo))
1287 case RECORD_Q_GETQUOTA:
1288 regcache_raw_read_unsigned (regcache, tdep->arg4,
1290 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1291 tdep->size_if_dqblk))
1294 case RECORD_Q_XGETQSTAT:
1295 case RECORD_Q_XGETQUOTA:
1296 regcache_raw_read_unsigned (regcache, tdep->arg4,
1298 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1299 tdep->size_fs_quota_stat))
1305 case gdb_sys_getpgid:
1306 case gdb_sys_fchdir:
1307 case gdb_sys_bdflush:
1311 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1312 if (tmpulongest == 2)
1314 regcache_raw_read_unsigned (regcache, tdep->arg3,
1316 /*XXX the size of memory is not very clear. */
1317 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
1322 case gdb_sys_personality:
1323 case gdb_sys_ni_syscall137:
1324 case gdb_sys_setfsuid16:
1325 case gdb_sys_setfsgid16:
1328 case gdb_sys_llseek:
1329 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1330 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1335 case gdb_sys_getdents:
1339 regcache_raw_read_unsigned (regcache, tdep->arg2,
1341 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1342 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1343 tdep->size_dirent * count))
1348 case gdb_sys_select:
1349 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1350 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1353 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1354 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1357 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1358 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1361 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
1362 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1363 tdep->size_timeval))
1375 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1378 gdb_byte *iov = alloca (tdep->size_iovec);
1380 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1381 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1383 if (target_read_memory ((CORE_ADDR) vec, iov,
1387 fprintf_unfiltered (gdb_stdlog,
1388 "Process record: error reading "
1389 "memory at addr = 0x%s len = %d.\n",
1390 OUTPUT_REG (vec, tdep->arg2),
1395 = (CORE_ADDR) extract_unsigned_integer (iov,
1399 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1402 if (record_arch_list_add_mem (tmpaddr, tmpint))
1404 vec += tdep->size_iovec;
1410 case gdb_sys_writev:
1411 case gdb_sys_getsid:
1412 case gdb_sys_fdatasync:
1413 case gdb_sys_sysctl:
1415 case gdb_sys_munlock:
1416 case gdb_sys_mlockall:
1417 case gdb_sys_munlockall:
1418 case gdb_sys_sched_setparam:
1421 case gdb_sys_sched_getparam:
1422 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1423 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1427 case gdb_sys_sched_setscheduler:
1428 case gdb_sys_sched_getscheduler:
1429 case gdb_sys_sched_yield:
1430 case gdb_sys_sched_get_priority_max:
1431 case gdb_sys_sched_get_priority_min:
1434 case gdb_sys_sched_rr_get_interval:
1435 case gdb_sys_nanosleep:
1436 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1437 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1438 tdep->size_timespec))
1442 case gdb_sys_mremap:
1443 case gdb_sys_setresuid16:
1446 case gdb_sys_getresuid16:
1447 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1448 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1449 tdep->size_old_uid_t))
1451 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1452 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1453 tdep->size_old_uid_t))
1455 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1456 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1457 tdep->size_old_uid_t))
1462 case gdb_sys_ni_syscall167:
1466 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1471 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
1472 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1473 tdep->size_pollfd * nfds))
1478 case gdb_sys_nfsservctl:
1479 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1480 if (tmpulongest == 7 || tmpulongest == 8)
1484 if (tmpulongest == 7)
1485 rsize = tdep->size_NFS_FHSIZE;
1487 rsize = tdep->size_knfsd_fh;
1488 regcache_raw_read_unsigned (regcache, tdep->arg3,
1490 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
1495 case gdb_sys_setresgid16:
1498 case gdb_sys_getresgid16:
1499 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1500 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1501 tdep->size_old_gid_t))
1503 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1504 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1505 tdep->size_old_gid_t))
1507 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1508 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1509 tdep->size_old_gid_t))
1514 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1515 switch (tmpulongest)
1518 regcache_raw_read_unsigned (regcache, tdep->arg2,
1520 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1525 regcache_raw_read_unsigned (regcache, tdep->arg2,
1527 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1528 tdep->size_TASK_COMM_LEN))
1534 case gdb_sys_rt_sigreturn:
1537 case gdb_sys_rt_sigaction:
1538 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1539 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1540 tdep->size_sigaction))
1544 case gdb_sys_rt_sigprocmask:
1545 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1546 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1547 tdep->size_sigset_t))
1551 case gdb_sys_rt_sigpending:
1552 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1555 ULONGEST sigsetsize;
1557 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
1558 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1564 case gdb_sys_rt_sigtimedwait:
1565 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1566 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1567 tdep->size_siginfo_t))
1571 case gdb_sys_rt_sigqueueinfo:
1572 case gdb_sys_rt_sigsuspend:
1575 case gdb_sys_pread64:
1576 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1581 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
1582 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) count))
1587 case gdb_sys_pwrite64:
1588 case gdb_sys_chown16:
1591 case gdb_sys_getcwd:
1592 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1597 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
1598 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1603 case gdb_sys_capget:
1604 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1605 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1606 tdep->size_cap_user_data_t))
1610 case gdb_sys_capset:
1613 case gdb_sys_sigaltstack:
1614 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1615 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1616 tdep->size_stack_t))
1620 case gdb_sys_sendfile:
1621 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1622 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1627 case gdb_sys_ni_syscall188:
1628 case gdb_sys_ni_syscall189:
1632 case gdb_sys_getrlimit:
1633 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1634 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1642 case gdb_sys_truncate64:
1643 case gdb_sys_ftruncate64:
1646 case gdb_sys_stat64:
1647 case gdb_sys_lstat64:
1648 case gdb_sys_fstat64:
1649 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1650 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1655 case gdb_sys_lchown:
1656 case gdb_sys_getuid:
1657 case gdb_sys_getgid:
1658 case gdb_sys_geteuid:
1659 case gdb_sys_getegid:
1660 case gdb_sys_setreuid:
1661 case gdb_sys_setregid:
1664 case gdb_sys_getgroups:
1665 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1668 ULONGEST gidsetsize;
1670 regcache_raw_read_unsigned (regcache, tdep->arg1,
1672 tmpint = tdep->size_gid_t * (int) gidsetsize;
1673 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
1678 case gdb_sys_setgroups:
1679 case gdb_sys_fchown:
1680 case gdb_sys_setresuid:
1683 case gdb_sys_getresuid:
1684 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1685 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1687 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1688 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1690 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1691 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
1695 case gdb_sys_setresgid:
1698 case gdb_sys_getresgid:
1699 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1700 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1702 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1703 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1705 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1706 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
1711 case gdb_sys_setuid:
1712 case gdb_sys_setgid:
1713 case gdb_sys_setfsuid:
1714 case gdb_sys_setfsgid:
1715 case gdb_sys_pivot_root:
1718 case gdb_sys_mincore:
1719 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1720 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1721 tdep->size_PAGE_SIZE))
1725 case gdb_sys_madvise:
1728 case gdb_sys_getdents64:
1732 regcache_raw_read_unsigned (regcache, tdep->arg2,
1734 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
1735 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1736 tdep->size_dirent64 * count))
1741 case gdb_sys_fcntl64:
1742 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1743 if (tmpulongest == tdep->fcntl_F_GETLK64)
1745 regcache_raw_read_unsigned (regcache, tdep->arg3,
1747 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1748 tdep->size_flock64))
1751 else if (tmpulongest != tdep->fcntl_F_SETLK64
1752 && tmpulongest != tdep->fcntl_F_SETLKW64)
1758 case gdb_sys_ni_syscall222:
1759 case gdb_sys_ni_syscall223:
1760 case gdb_sys_gettid:
1761 case gdb_sys_readahead:
1762 case gdb_sys_setxattr:
1763 case gdb_sys_lsetxattr:
1764 case gdb_sys_fsetxattr:
1767 case gdb_sys_getxattr:
1768 case gdb_sys_lgetxattr:
1769 case gdb_sys_fgetxattr:
1770 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1775 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
1776 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1781 case gdb_sys_listxattr:
1782 case gdb_sys_llistxattr:
1783 case gdb_sys_flistxattr:
1784 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1789 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
1790 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
1795 case gdb_sys_removexattr:
1796 case gdb_sys_lremovexattr:
1797 case gdb_sys_fremovexattr:
1801 case gdb_sys_sendfile64:
1802 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1803 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1809 case gdb_sys_sched_setaffinity:
1812 case gdb_sys_sched_getaffinity:
1813 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1818 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
1819 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
1824 case gdb_sys_set_thread_area:
1825 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1826 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1830 case gdb_sys_get_thread_area:
1831 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1832 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1833 tdep->size_user_desc))
1837 case gdb_sys_io_setup:
1838 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1839 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_long))
1843 case gdb_sys_io_destroy:
1846 case gdb_sys_io_getevents:
1847 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1852 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
1853 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1854 nr * tdep->size_io_event))
1859 case gdb_sys_io_submit:
1860 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1866 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
1867 iocbp = alloca (nr * tdep->size_pointer);
1868 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1869 nr * tdep->size_pointer))
1872 fprintf_unfiltered (gdb_stdlog,
1873 "Process record: error reading memory "
1874 "at addr = 0x%s len = %u.\n",
1875 OUTPUT_REG (tmpulongest, tdep->arg2),
1876 (int) (nr * tdep->size_pointer));
1879 for (i = 0; i < nr; i++)
1882 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1885 if (record_arch_list_add_mem (tmpaddr, tdep->size_iocb))
1887 iocbp += tdep->size_pointer;
1892 case gdb_sys_io_cancel:
1893 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1894 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1895 tdep->size_io_event))
1899 case gdb_sys_fadvise64:
1900 case gdb_sys_ni_syscall251:
1903 case gdb_sys_exit_group:
1907 target_terminal_ours ();
1908 q = yquery (_("The next instruction is syscall exit_group. "
1909 "It will make the program exit. "
1910 "Do you want to stop the program?"));
1911 target_terminal_inferior ();
1917 case gdb_sys_lookup_dcookie:
1918 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1923 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
1924 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
1929 case gdb_sys_epoll_create:
1930 case gdb_sys_epoll_ctl:
1933 case gdb_sys_epoll_wait:
1934 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1939 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
1940 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1941 maxevents * tdep->size_epoll_event))
1946 case gdb_sys_remap_file_pages:
1947 case gdb_sys_set_tid_address:
1950 case gdb_sys_timer_create:
1951 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1952 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
1956 case gdb_sys_timer_settime:
1957 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1958 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1959 tdep->size_itimerspec))
1963 case gdb_sys_timer_gettime:
1964 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1965 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1966 tdep->size_itimerspec))
1970 case gdb_sys_timer_getoverrun:
1971 case gdb_sys_timer_delete:
1972 case gdb_sys_clock_settime:
1975 case gdb_sys_clock_gettime:
1976 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1977 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1978 tdep->size_timespec))
1982 case gdb_sys_clock_getres:
1983 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1984 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1985 tdep->size_timespec))
1989 case gdb_sys_clock_nanosleep:
1990 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1991 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1992 tdep->size_timespec))
1996 case gdb_sys_statfs64:
1997 case gdb_sys_fstatfs64:
1998 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1999 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2000 tdep->size_statfs64))
2004 case gdb_sys_tgkill:
2005 case gdb_sys_utimes:
2006 case gdb_sys_fadvise64_64:
2007 case gdb_sys_ni_syscall273:
2011 case gdb_sys_get_mempolicy:
2012 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2013 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2015 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2020 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
2021 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2022 maxnode * tdep->size_long))
2027 case gdb_sys_set_mempolicy:
2028 case gdb_sys_mq_open:
2029 case gdb_sys_mq_unlink:
2030 case gdb_sys_mq_timedsend:
2033 case gdb_sys_mq_timedreceive:
2034 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2039 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
2040 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2044 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2045 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2049 case gdb_sys_mq_notify:
2052 case gdb_sys_mq_getsetattr:
2053 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2054 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2055 tdep->size_mq_attr))
2059 case gdb_sys_kexec_load:
2062 case gdb_sys_waitid:
2063 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2064 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2065 tdep->size_siginfo))
2067 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2068 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2073 case gdb_sys_ni_syscall285:
2074 case gdb_sys_add_key:
2075 case gdb_sys_request_key:
2078 case gdb_sys_keyctl:
2079 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2080 if (tmpulongest == 6 || tmpulongest == 11)
2082 regcache_raw_read_unsigned (regcache, tdep->arg3,
2088 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
2089 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2096 case gdb_sys_ioprio_set:
2097 case gdb_sys_ioprio_get:
2098 case gdb_sys_inotify_init:
2099 case gdb_sys_inotify_add_watch:
2100 case gdb_sys_inotify_rm_watch:
2101 case gdb_sys_migrate_pages:
2102 case gdb_sys_openat:
2103 case gdb_sys_mkdirat:
2104 case gdb_sys_mknodat:
2105 case gdb_sys_fchownat:
2106 case gdb_sys_futimesat:
2109 case gdb_sys_fstatat64:
2110 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2111 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2116 case gdb_sys_unlinkat:
2117 case gdb_sys_renameat:
2118 case gdb_sys_linkat:
2119 case gdb_sys_symlinkat:
2122 case gdb_sys_readlinkat:
2123 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2128 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
2129 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) bufsiz))
2134 case gdb_sys_fchmodat:
2135 case gdb_sys_faccessat:
2138 case gdb_sys_pselect6:
2139 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2140 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2143 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2144 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2147 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2148 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2151 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2152 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2153 tdep->size_timespec))
2158 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2163 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
2164 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2165 tdep->size_pollfd * nfds))
2168 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2169 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2170 tdep->size_timespec))
2174 case gdb_sys_unshare:
2175 case gdb_sys_set_robust_list:
2178 case gdb_sys_get_robust_list:
2179 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2180 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2182 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2183 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2187 case gdb_sys_splice:
2188 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2189 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2192 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
2193 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2198 case gdb_sys_sync_file_range:
2200 case gdb_sys_vmsplice:
2203 case gdb_sys_move_pages:
2204 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2209 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
2210 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2211 nr_pages * tdep->size_int))
2216 case gdb_sys_getcpu:
2217 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2218 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2220 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2221 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
2223 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2224 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2225 tdep->size_ulong * 2))
2229 case gdb_sys_epoll_pwait:
2230 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2235 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2236 tmpint = (int) maxevents * tdep->size_epoll_event;
2237 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2243 printf_unfiltered (_("Process record and replay target doesn't "
2244 "support syscall number %d\n"), syscall);