1 /* Process record and replay target code for GNU/Linux.
3 Copyright (C) 2008-2022 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #include "record-full.h"
26 #include "linux-record.h"
29 /* These macros are the values of the first argument of system call
30 "sys_ptrace". The values of these macros were obtained from Linux
33 #define RECORD_PTRACE_PEEKTEXT 1
34 #define RECORD_PTRACE_PEEKDATA 2
35 #define RECORD_PTRACE_PEEKUSR 3
37 /* These macros are the values of the first argument of system call
38 "sys_socketcall". The values of these macros were obtained from
39 Linux Kernel source. */
41 #define RECORD_SYS_SOCKET 1
42 #define RECORD_SYS_BIND 2
43 #define RECORD_SYS_CONNECT 3
44 #define RECORD_SYS_LISTEN 4
45 #define RECORD_SYS_ACCEPT 5
46 #define RECORD_SYS_GETSOCKNAME 6
47 #define RECORD_SYS_GETPEERNAME 7
48 #define RECORD_SYS_SOCKETPAIR 8
49 #define RECORD_SYS_SEND 9
50 #define RECORD_SYS_RECV 10
51 #define RECORD_SYS_SENDTO 11
52 #define RECORD_SYS_RECVFROM 12
53 #define RECORD_SYS_SHUTDOWN 13
54 #define RECORD_SYS_SETSOCKOPT 14
55 #define RECORD_SYS_GETSOCKOPT 15
56 #define RECORD_SYS_SENDMSG 16
57 #define RECORD_SYS_RECVMSG 17
59 /* These macros are the values of the first argument of system call
60 "sys_ipc". The values of these macros were obtained from Linux
63 #define RECORD_SEMOP 1
64 #define RECORD_SEMGET 2
65 #define RECORD_SEMCTL 3
66 #define RECORD_SEMTIMEDOP 4
67 #define RECORD_MSGSND 11
68 #define RECORD_MSGRCV 12
69 #define RECORD_MSGGET 13
70 #define RECORD_MSGCTL 14
71 #define RECORD_SHMAT 21
72 #define RECORD_SHMDT 22
73 #define RECORD_SHMGET 23
74 #define RECORD_SHMCTL 24
76 /* These macros are the values of the first argument of system call
77 "sys_quotactl". The values of these macros were obtained from Linux
80 #define RECORD_Q_GETFMT 0x800004
81 #define RECORD_Q_GETINFO 0x800005
82 #define RECORD_Q_GETQUOTA 0x800007
83 #define RECORD_Q_XGETQSTAT (('5' << 8) + 5)
84 #define RECORD_Q_XGETQUOTA (('3' << 8) + 3)
86 #define OUTPUT_REG(val, num) phex_nz ((val), \
87 TYPE_LENGTH (gdbarch_register_type (regcache->arch (), (num))))
89 /* Record a memory area of length LEN pointed to by register
93 record_mem_at_reg (struct regcache
*regcache
, int regnum
, int len
)
97 regcache_raw_read_unsigned (regcache
, regnum
, &addr
);
98 return record_full_arch_list_add_mem ((CORE_ADDR
) addr
, len
);
102 record_linux_sockaddr (struct regcache
*regcache
,
103 struct linux_record_tdep
*tdep
, ULONGEST addr
,
108 struct gdbarch
*gdbarch
= regcache
->arch ();
109 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
114 a
= (gdb_byte
*) alloca (tdep
->size_int
);
116 if (record_full_arch_list_add_mem ((CORE_ADDR
) len
, tdep
->size_int
))
119 /* Get the addrlen. */
120 if (target_read_memory ((CORE_ADDR
) len
, a
, tdep
->size_int
))
123 gdb_printf (gdb_stdlog
,
124 "Process record: error reading "
125 "memory at addr = 0x%s len = %d.\n",
126 phex_nz (len
, tdep
->size_pointer
),
130 addrlen
= (int) extract_unsigned_integer (a
, tdep
->size_int
, byte_order
);
131 if (addrlen
<= 0 || addrlen
> tdep
->size_sockaddr
)
132 addrlen
= tdep
->size_sockaddr
;
134 if (record_full_arch_list_add_mem ((CORE_ADDR
) addr
, addrlen
))
141 record_linux_msghdr (struct regcache
*regcache
,
142 struct linux_record_tdep
*tdep
, ULONGEST addr
)
145 struct gdbarch
*gdbarch
= regcache
->arch ();
146 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
153 if (record_full_arch_list_add_mem ((CORE_ADDR
) addr
, tdep
->size_msghdr
))
156 a
= (gdb_byte
*) alloca (tdep
->size_msghdr
);
157 if (target_read_memory ((CORE_ADDR
) addr
, a
, tdep
->size_msghdr
))
160 gdb_printf (gdb_stdlog
,
161 "Process record: error reading "
162 "memory at addr = 0x%s "
164 phex_nz (addr
, tdep
->size_pointer
),
169 /* msg_name msg_namelen */
170 addr
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
171 a
+= tdep
->size_pointer
;
172 if (record_full_arch_list_add_mem
174 (int) extract_unsigned_integer (a
,
178 /* We have read an int, but skip size_pointer bytes to account for alignment
179 of the next field on 64-bit targets. */
180 a
+= tdep
->size_pointer
;
182 /* msg_iov msg_iovlen */
183 addr
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
184 a
+= tdep
->size_pointer
;
188 ULONGEST len
= extract_unsigned_integer (a
, tdep
->size_size_t
,
190 gdb_byte
*iov
= (gdb_byte
*) alloca (tdep
->size_iovec
);
192 for (i
= 0; i
< len
; i
++)
194 if (target_read_memory ((CORE_ADDR
) addr
, iov
, tdep
->size_iovec
))
197 gdb_printf (gdb_stdlog
,
198 "Process record: error "
202 phex_nz (addr
,tdep
->size_pointer
),
206 tmpaddr
= (CORE_ADDR
) extract_unsigned_integer (iov
,
209 tmpint
= (int) extract_unsigned_integer (iov
+ tdep
->size_pointer
,
212 if (record_full_arch_list_add_mem (tmpaddr
, tmpint
))
214 addr
+= tdep
->size_iovec
;
217 a
+= tdep
->size_size_t
;
219 /* msg_control msg_controllen */
220 addr
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
221 a
+= tdep
->size_pointer
;
222 tmpint
= (int) extract_unsigned_integer (a
, tdep
->size_size_t
, byte_order
);
223 if (record_full_arch_list_add_mem ((CORE_ADDR
) addr
, tmpint
))
229 /* When the architecture process record get a Linux syscall
230 instruction, it will get a Linux syscall number of this
231 architecture and convert it to the Linux syscall number "num" which
232 is internal to GDB. Most Linux syscalls across architectures in
233 Linux would be similar and mostly differ by sizes of types and
234 structures. This sizes are put to "tdep".
236 Record the values of the registers and memory that will be changed
237 in current system call.
239 Return -1 if something wrong. */
242 record_linux_system_call (enum gdb_syscall syscall
,
243 struct regcache
*regcache
,
244 struct linux_record_tdep
*tdep
)
246 struct gdbarch
*gdbarch
= regcache
->arch ();
247 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
248 ULONGEST tmpulongest
;
254 case gdb_sys_restart_syscall
:
258 if (yquery (_("The next instruction is syscall exit. "
259 "It will make the program exit. "
260 "Do you want to stop the program?")))
268 case gdb_sys_readlink
:
270 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
271 if (record_mem_at_reg (regcache
, tdep
->arg2
, (int) tmpulongest
))
280 case gdb_sys_waitpid
:
281 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
283 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
296 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
298 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
305 case gdb_sys_lchown16
:
306 case gdb_sys_ni_syscall17
:
312 if (record_mem_at_reg (regcache
, tdep
->arg2
,
313 tdep
->size__old_kernel_stat
))
320 case gdb_sys_oldumount
:
321 case gdb_sys_setuid16
:
322 case gdb_sys_getuid16
:
327 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
328 if (tmpulongest
== RECORD_PTRACE_PEEKTEXT
329 || tmpulongest
== RECORD_PTRACE_PEEKDATA
330 || tmpulongest
== RECORD_PTRACE_PEEKUSR
)
332 if (record_mem_at_reg (regcache
, tdep
->arg4
, 4))
340 case gdb_sys_ni_syscall31
:
341 case gdb_sys_ni_syscall32
:
344 case gdb_sys_ni_syscall35
:
355 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_int
* 2))
359 case gdb_sys_getrandom
:
360 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
361 if (record_mem_at_reg (regcache
, tdep
->arg1
, tmpulongest
))
366 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_tms
))
370 case gdb_sys_ni_syscall44
:
372 case gdb_sys_setgid16
:
373 case gdb_sys_getgid16
:
375 case gdb_sys_geteuid16
:
376 case gdb_sys_getegid16
:
379 case gdb_sys_ni_syscall53
:
383 /* XXX Need to add a lot of support of other ioctl requests. */
384 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
385 if (tmpulongest
== tdep
->ioctl_FIOCLEX
386 || tmpulongest
== tdep
->ioctl_FIONCLEX
387 || tmpulongest
== tdep
->ioctl_FIONBIO
388 || tmpulongest
== tdep
->ioctl_FIOASYNC
389 || tmpulongest
== tdep
->ioctl_TCSETS
390 || tmpulongest
== tdep
->ioctl_TCSETSW
391 || tmpulongest
== tdep
->ioctl_TCSETSF
392 || tmpulongest
== tdep
->ioctl_TCSETA
393 || tmpulongest
== tdep
->ioctl_TCSETAW
394 || tmpulongest
== tdep
->ioctl_TCSETAF
395 || tmpulongest
== tdep
->ioctl_TCSBRK
396 || tmpulongest
== tdep
->ioctl_TCXONC
397 || tmpulongest
== tdep
->ioctl_TCFLSH
398 || tmpulongest
== tdep
->ioctl_TIOCEXCL
399 || tmpulongest
== tdep
->ioctl_TIOCNXCL
400 || tmpulongest
== tdep
->ioctl_TIOCSCTTY
401 || tmpulongest
== tdep
->ioctl_TIOCSPGRP
402 || tmpulongest
== tdep
->ioctl_TIOCSTI
403 || tmpulongest
== tdep
->ioctl_TIOCSWINSZ
404 || tmpulongest
== tdep
->ioctl_TIOCMBIS
405 || tmpulongest
== tdep
->ioctl_TIOCMBIC
406 || tmpulongest
== tdep
->ioctl_TIOCMSET
407 || tmpulongest
== tdep
->ioctl_TIOCSSOFTCAR
408 || tmpulongest
== tdep
->ioctl_TIOCCONS
409 || tmpulongest
== tdep
->ioctl_TIOCSSERIAL
410 || tmpulongest
== tdep
->ioctl_TIOCPKT
411 || tmpulongest
== tdep
->ioctl_TIOCNOTTY
412 || tmpulongest
== tdep
->ioctl_TIOCSETD
413 || tmpulongest
== tdep
->ioctl_TCSBRKP
414 || tmpulongest
== tdep
->ioctl_TIOCTTYGSTRUCT
415 || tmpulongest
== tdep
->ioctl_TIOCSBRK
416 || tmpulongest
== tdep
->ioctl_TIOCCBRK
417 || tmpulongest
== tdep
->ioctl_TCSETS2
418 || tmpulongest
== tdep
->ioctl_TCSETSW2
419 || tmpulongest
== tdep
->ioctl_TCSETSF2
420 || tmpulongest
== tdep
->ioctl_TIOCSPTLCK
421 || tmpulongest
== tdep
->ioctl_TIOCSERCONFIG
422 || tmpulongest
== tdep
->ioctl_TIOCSERGWILD
423 || tmpulongest
== tdep
->ioctl_TIOCSERSWILD
424 || tmpulongest
== tdep
->ioctl_TIOCSLCKTRMIOS
425 || tmpulongest
== tdep
->ioctl_TIOCSERGETMULTI
426 || tmpulongest
== tdep
->ioctl_TIOCSERSETMULTI
427 || tmpulongest
== tdep
->ioctl_TIOCMIWAIT
428 || tmpulongest
== tdep
->ioctl_TIOCSHAYESESP
)
432 else if (tmpulongest
== tdep
->ioctl_TCGETS
433 || tmpulongest
== tdep
->ioctl_TCGETA
434 || tmpulongest
== tdep
->ioctl_TIOCGLCKTRMIOS
)
436 if (record_mem_at_reg (regcache
, tdep
->arg3
,
440 else if (tmpulongest
== tdep
->ioctl_TIOCGPGRP
441 || tmpulongest
== tdep
->ioctl_TIOCGSID
)
443 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_pid_t
))
446 else if (tmpulongest
== tdep
->ioctl_TIOCOUTQ
447 || tmpulongest
== tdep
->ioctl_TIOCMGET
448 || tmpulongest
== tdep
->ioctl_TIOCGSOFTCAR
449 || tmpulongest
== tdep
->ioctl_FIONREAD
450 || tmpulongest
== tdep
->ioctl_TIOCINQ
451 || tmpulongest
== tdep
->ioctl_TIOCGETD
452 || tmpulongest
== tdep
->ioctl_TIOCGPTN
453 || tmpulongest
== tdep
->ioctl_TIOCSERGETLSR
)
455 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_int
))
458 else if (tmpulongest
== tdep
->ioctl_TIOCGWINSZ
)
460 if (record_mem_at_reg (regcache
, tdep
->arg3
,
464 else if (tmpulongest
== tdep
->ioctl_TIOCLINUX
)
466 /* This syscall affects a char-size memory. */
467 if (record_mem_at_reg (regcache
, tdep
->arg3
, 1))
470 else if (tmpulongest
== tdep
->ioctl_TIOCGSERIAL
)
472 if (record_mem_at_reg (regcache
, tdep
->arg3
,
473 tdep
->size_serial_struct
))
476 else if (tmpulongest
== tdep
->ioctl_TCGETS2
)
478 if (record_mem_at_reg (regcache
, tdep
->arg3
,
479 tdep
->size_termios2
))
482 else if (tmpulongest
== tdep
->ioctl_FIOQSIZE
)
484 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_loff_t
))
487 else if (tmpulongest
== tdep
->ioctl_TIOCGICOUNT
)
489 if (record_mem_at_reg (regcache
, tdep
->arg3
,
490 tdep
->size_serial_icounter_struct
))
493 else if (tmpulongest
== tdep
->ioctl_TIOCGHAYESESP
)
495 if (record_mem_at_reg (regcache
, tdep
->arg3
,
496 tdep
->size_hayes_esp_config
))
499 else if (tmpulongest
== tdep
->ioctl_TIOCSERGSTRUCT
)
501 gdb_printf (gdb_stderr
,
502 _("Process record and replay target doesn't "
503 "support ioctl request TIOCSERGSTRUCT\n"));
508 gdb_printf (gdb_stderr
,
509 _("Process record and replay target doesn't "
510 "support ioctl request 0x%s.\n"),
511 OUTPUT_REG (tmpulongest
, tdep
->arg2
));
518 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
520 if (tmpulongest
== tdep
->fcntl_F_GETLK
)
522 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_flock
))
527 case gdb_sys_ni_syscall56
:
528 case gdb_sys_setpgid
:
529 case gdb_sys_ni_syscall58
:
532 case gdb_sys_olduname
:
533 if (record_mem_at_reg (regcache
, tdep
->arg1
,
534 tdep
->size_oldold_utsname
))
543 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_ustat
))
548 case gdb_sys_getppid
:
549 case gdb_sys_getpgrp
:
553 case gdb_sys_sigaction
:
554 if (record_mem_at_reg (regcache
, tdep
->arg3
,
555 tdep
->size_old_sigaction
))
559 case gdb_sys_sgetmask
:
560 case gdb_sys_ssetmask
:
561 case gdb_sys_setreuid16
:
562 case gdb_sys_setregid16
:
563 case gdb_sys_sigsuspend
:
566 case gdb_sys_sigpending
:
567 if (record_mem_at_reg (regcache
, tdep
->arg1
,
568 tdep
->size_old_sigset_t
))
572 case gdb_sys_sethostname
:
573 case gdb_sys_setrlimit
:
576 case gdb_sys_old_getrlimit
:
577 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_rlimit
))
581 case gdb_sys_getrusage
:
582 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_rusage
))
586 case gdb_sys_gettimeofday
:
587 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_timeval
)
588 || record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_timezone
))
592 case gdb_sys_settimeofday
:
595 case gdb_sys_getgroups16
:
596 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
601 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
603 tmpint
= tdep
->size_old_gid_t
* (int) gidsetsize
;
604 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
609 case gdb_sys_setgroups16
:
614 unsigned long sz_sel_arg
= tdep
->size_long
+ tdep
->size_pointer
* 4;
615 gdb_byte
*a
= (gdb_byte
*) alloca (sz_sel_arg
);
616 CORE_ADDR inp
, outp
, exp
, tvp
;
618 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
622 if (target_read_memory (tmpulongest
, a
, sz_sel_arg
))
625 gdb_printf (gdb_stdlog
,
626 "Process record: error reading memory "
627 "at addr = 0x%s len = %lu.\n",
628 OUTPUT_REG (tmpulongest
, tdep
->arg1
),
633 a
+= tdep
->size_long
;
634 inp
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
635 a
+= tdep
->size_pointer
;
636 outp
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
637 a
+= tdep
->size_pointer
;
638 exp
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
639 a
+= tdep
->size_pointer
;
640 tvp
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
642 if (record_full_arch_list_add_mem (inp
, tdep
->size_fd_set
))
645 if (record_full_arch_list_add_mem (outp
, tdep
->size_fd_set
))
648 if (record_full_arch_list_add_mem (exp
, tdep
->size_fd_set
))
651 if (record_full_arch_list_add_mem (tvp
, tdep
->size_timeval
))
657 case gdb_sys_symlink
:
665 if (yquery (_("The next instruction is syscall reboot. "
666 "It will restart the computer. "
667 "Do you want to stop the program?")))
671 case gdb_old_readdir
:
672 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_old_dirent
))
683 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
685 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &len
);
686 if (record_full_memory_query
)
689 The next instruction is syscall munmap.\n\
690 It will free the memory addr = 0x%s len = %u.\n\
691 It will make record target cannot record some memory change.\n\
692 Do you want to stop the program?"),
693 OUTPUT_REG (tmpulongest
, tdep
->arg1
), (int) len
))
699 case gdb_sys_truncate
:
700 case gdb_sys_ftruncate
:
702 case gdb_sys_fchown16
:
703 case gdb_sys_getpriority
:
704 case gdb_sys_setpriority
:
705 case gdb_sys_ni_syscall98
:
709 case gdb_sys_fstatfs
:
710 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_statfs
))
719 case gdb_sys_sendmsg
:
720 case gdb_sys_shutdown
:
722 case gdb_sys_connect
:
724 case gdb_sys_setsockopt
:
728 case gdb_sys_getsockname
:
729 case gdb_sys_getpeername
:
733 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
734 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &len
);
735 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
740 case gdb_sys_recvfrom
:
744 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
745 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &len
);
746 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
751 case gdb_sys_recvmsg
:
752 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
753 if (record_linux_msghdr (regcache
, tdep
, tmpulongest
))
757 case gdb_sys_socketpair
:
758 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_int
))
762 case gdb_sys_getsockopt
:
763 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
767 gdb_byte
*optlenp
= (gdb_byte
*) alloca (tdep
->size_int
);
769 if (target_read_memory ((CORE_ADDR
) tmpulongest
, optlenp
,
773 gdb_printf (gdb_stdlog
,
774 "Process record: error reading "
775 "memory at addr = 0x%s "
777 OUTPUT_REG (tmpulongest
, tdep
->arg5
),
781 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &optvalp
);
782 tmpint
= (int) extract_signed_integer (optlenp
, tdep
->size_int
,
784 if (record_full_arch_list_add_mem ((CORE_ADDR
) optvalp
, tmpint
))
786 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
792 case gdb_sys_socketcall
:
793 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
796 case RECORD_SYS_SOCKET
:
797 case RECORD_SYS_BIND
:
798 case RECORD_SYS_CONNECT
:
799 case RECORD_SYS_LISTEN
:
801 case RECORD_SYS_ACCEPT
:
802 case RECORD_SYS_GETSOCKNAME
:
803 case RECORD_SYS_GETPEERNAME
:
805 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
809 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
* 2);
812 tmpulongest
+= tdep
->size_ulong
;
813 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
814 tdep
->size_ulong
* 2))
817 gdb_printf (gdb_stdlog
,
818 "Process record: error reading "
819 "memory at addr = 0x%s len = %d.\n",
820 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
821 tdep
->size_ulong
* 2);
824 tmpulongest
= extract_unsigned_integer (a
,
827 len
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
828 tdep
->size_ulong
, byte_order
);
829 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
835 case RECORD_SYS_SOCKETPAIR
:
837 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
);
839 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
843 tmpulongest
+= tdep
->size_ulong
* 3;
844 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
848 gdb_printf (gdb_stdlog
,
849 "Process record: error reading "
850 "memory at addr = 0x%s len = %d.\n",
851 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
856 = (CORE_ADDR
) extract_unsigned_integer (a
, tdep
->size_ulong
,
858 if (record_full_arch_list_add_mem (tmpaddr
, tdep
->size_int
))
863 case RECORD_SYS_SEND
:
864 case RECORD_SYS_SENDTO
:
866 case RECORD_SYS_RECVFROM
:
867 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
871 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
* 2);
874 tmpulongest
+= tdep
->size_ulong
* 4;
875 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
876 tdep
->size_ulong
* 2))
879 gdb_printf (gdb_stdlog
,
880 "Process record: error reading "
881 "memory at addr = 0x%s len = %d.\n",
882 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
883 tdep
->size_ulong
* 2);
886 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
888 len
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
889 tdep
->size_ulong
, byte_order
);
890 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
894 case RECORD_SYS_RECV
:
895 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
899 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
* 2);
901 tmpulongest
+= tdep
->size_ulong
;
902 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
906 gdb_printf (gdb_stdlog
,
907 "Process record: error reading "
908 "memory at addr = 0x%s len = %d.\n",
909 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
913 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
917 a
+= tdep
->size_ulong
;
918 tmpint
= (int) extract_unsigned_integer (a
, tdep
->size_ulong
,
920 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
926 case RECORD_SYS_SHUTDOWN
:
927 case RECORD_SYS_SETSOCKOPT
:
929 case RECORD_SYS_GETSOCKOPT
:
931 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
* 2);
932 gdb_byte
*av
= (gdb_byte
*) alloca (tdep
->size_int
);
934 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
938 tmpulongest
+= tdep
->size_ulong
* 3;
939 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
940 tdep
->size_ulong
* 2))
943 gdb_printf (gdb_stdlog
,
944 "Process record: error reading "
945 "memory at addr = 0x%s len = %d.\n",
946 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
947 tdep
->size_ulong
* 2);
950 tmpulongest
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
955 if (target_read_memory ((CORE_ADDR
) tmpulongest
, av
,
959 gdb_printf (gdb_stdlog
,
960 "Process record: error reading "
961 "memory at addr = 0x%s "
963 phex_nz (tmpulongest
,
969 = (CORE_ADDR
) extract_unsigned_integer (a
,
972 tmpint
= (int) extract_unsigned_integer (av
,
975 if (record_full_arch_list_add_mem (tmpaddr
, tmpint
))
977 a
+= tdep
->size_ulong
;
979 = (CORE_ADDR
) extract_unsigned_integer (a
,
982 if (record_full_arch_list_add_mem (tmpaddr
,
989 case RECORD_SYS_SENDMSG
:
991 case RECORD_SYS_RECVMSG
:
993 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
);
995 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
999 tmpulongest
+= tdep
->size_ulong
;
1000 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
1004 gdb_printf (gdb_stdlog
,
1005 "Process record: error reading "
1006 "memory at addr = 0x%s len = %d.\n",
1007 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
1011 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
1013 if (record_linux_msghdr (regcache
, tdep
, tmpulongest
))
1019 gdb_printf (gdb_stderr
,
1020 _("Process record and replay target "
1021 "doesn't support socketcall call 0x%s\n"),
1022 OUTPUT_REG (tmpulongest
, tdep
->arg1
));
1028 case gdb_sys_syslog
:
1031 case gdb_sys_setitimer
:
1032 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_itimerval
))
1036 case gdb_sys_getitimer
:
1037 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_itimerval
))
1041 case gdb_sys_newstat
:
1042 case gdb_sys_newlstat
:
1043 case gdb_sys_newfstat
:
1044 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_stat
))
1048 case gdb_sys_newfstatat
:
1049 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1050 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1056 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
1057 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, 256))
1062 if (record_mem_at_reg (regcache
, tdep
->arg1
,
1063 tdep
->size_old_utsname
))
1068 case gdb_sys_vhangup
:
1069 case gdb_sys_ni_syscall112
:
1070 case gdb_sys_vm86old
:
1074 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
)
1075 || record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_rusage
))
1079 case gdb_sys_swapoff
:
1082 case gdb_sys_sysinfo
:
1083 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_sysinfo
))
1087 case gdb_sys_shmget
:
1088 case gdb_sys_semget
:
1090 case gdb_sys_msgget
:
1091 /* XXX maybe need do some record works with sys_shmdt. */
1093 case gdb_sys_msgsnd
:
1094 case gdb_sys_semtimedop
:
1098 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_ulong
))
1102 case gdb_sys_shmctl
:
1103 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_shmid_ds
))
1107 /* XXX sys_semctl 525 still not supported. */
1110 case gdb_sys_msgrcv
:
1114 regcache_raw_read_signed (regcache
, tdep
->arg3
, &l
);
1115 tmpint
= l
+ tdep
->size_long
;
1116 if (record_mem_at_reg (regcache
, tdep
->arg2
, tmpint
))
1121 case gdb_sys_msgctl
:
1122 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_msqid_ds
))
1127 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1128 tmpulongest
&= 0xffff;
1129 switch (tmpulongest
)
1133 case RECORD_SEMTIMEDOP
:
1136 /* XXX maybe need do some record works with RECORD_SHMDT. */
1144 regcache_raw_read_signed (regcache
, tdep
->arg3
, &second
);
1145 tmpint
= (int) second
+ tdep
->size_long
;
1146 if (record_mem_at_reg (regcache
, tdep
->arg5
, tmpint
))
1151 if (record_mem_at_reg (regcache
, tdep
->arg5
,
1152 tdep
->size_msqid_ds
))
1156 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_ulong
))
1160 if (record_mem_at_reg (regcache
, tdep
->arg5
,
1161 tdep
->size_shmid_ds
))
1165 /* XXX RECORD_SEMCTL still not supported. */
1166 gdb_printf (gdb_stderr
,
1167 _("Process record and replay target doesn't "
1168 "support ipc number %s\n"),
1169 pulongest (tmpulongest
));
1175 case gdb_sys_sigreturn
:
1177 case gdb_sys_setdomainname
:
1180 case gdb_sys_newuname
:
1181 if (record_mem_at_reg (regcache
, tdep
->arg1
,
1182 tdep
->size_new_utsname
))
1186 case gdb_sys_modify_ldt
:
1187 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1188 if (tmpulongest
== 0 || tmpulongest
== 2)
1192 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &bytecount
);
1193 if (record_mem_at_reg (regcache
, tdep
->arg2
, (int) bytecount
))
1198 case gdb_sys_adjtimex
:
1199 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_timex
))
1203 case gdb_sys_mprotect
:
1206 case gdb_sys_sigprocmask
:
1207 if (record_mem_at_reg (regcache
, tdep
->arg3
,
1208 tdep
->size_old_sigset_t
))
1212 case gdb_sys_ni_syscall127
:
1213 case gdb_sys_init_module
:
1214 case gdb_sys_delete_module
:
1215 case gdb_sys_ni_syscall130
:
1218 case gdb_sys_quotactl
:
1219 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1220 switch (tmpulongest
)
1222 case RECORD_Q_GETFMT
:
1224 if (record_mem_at_reg (regcache
, tdep
->arg4
, 4))
1227 case RECORD_Q_GETINFO
:
1228 if (record_mem_at_reg (regcache
, tdep
->arg4
,
1229 tdep
->size_mem_dqinfo
))
1232 case RECORD_Q_GETQUOTA
:
1233 if (record_mem_at_reg (regcache
, tdep
->arg4
,
1234 tdep
->size_if_dqblk
))
1237 case RECORD_Q_XGETQSTAT
:
1238 case RECORD_Q_XGETQUOTA
:
1239 if (record_mem_at_reg (regcache
, tdep
->arg4
,
1240 tdep
->size_fs_quota_stat
))
1246 case gdb_sys_getpgid
:
1247 case gdb_sys_fchdir
:
1248 case gdb_sys_bdflush
:
1252 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1253 if (tmpulongest
== 2)
1255 /*XXX the size of memory is not very clear. */
1256 if (record_mem_at_reg (regcache
, tdep
->arg3
, 10))
1261 case gdb_sys_personality
:
1262 case gdb_sys_ni_syscall137
:
1263 case gdb_sys_setfsuid16
:
1264 case gdb_sys_setfsgid16
:
1267 case gdb_sys_llseek
:
1268 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_loff_t
))
1272 case gdb_sys_getdents
:
1273 case gdb_sys_getdents64
:
1274 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1275 if (record_mem_at_reg (regcache
, tdep
->arg2
, tmpulongest
))
1279 case gdb_sys_select
:
1280 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_fd_set
)
1281 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_fd_set
)
1282 || record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_fd_set
)
1283 || record_mem_at_reg (regcache
, tdep
->arg5
, tdep
->size_timeval
))
1295 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &vec
);
1298 gdb_byte
*iov
= (gdb_byte
*) alloca (tdep
->size_iovec
);
1300 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &vlen
);
1301 for (tmpulongest
= 0; tmpulongest
< vlen
; tmpulongest
++)
1303 if (target_read_memory ((CORE_ADDR
) vec
, iov
,
1307 gdb_printf (gdb_stdlog
,
1308 "Process record: error reading "
1309 "memory at addr = 0x%s len = %d.\n",
1310 OUTPUT_REG (vec
, tdep
->arg2
),
1315 = (CORE_ADDR
) extract_unsigned_integer (iov
,
1319 = (int) extract_unsigned_integer (iov
+ tdep
->size_pointer
,
1322 if (record_full_arch_list_add_mem (tmpaddr
, tmpint
))
1324 vec
+= tdep
->size_iovec
;
1330 case gdb_sys_writev
:
1331 case gdb_sys_getsid
:
1332 case gdb_sys_fdatasync
:
1333 case gdb_sys_sysctl
:
1335 case gdb_sys_munlock
:
1336 case gdb_sys_mlockall
:
1337 case gdb_sys_munlockall
:
1338 case gdb_sys_sched_setparam
:
1341 case gdb_sys_sched_getparam
:
1342 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
))
1346 case gdb_sys_sched_setscheduler
:
1347 case gdb_sys_sched_getscheduler
:
1348 case gdb_sys_sched_yield
:
1349 case gdb_sys_sched_get_priority_max
:
1350 case gdb_sys_sched_get_priority_min
:
1353 case gdb_sys_sched_rr_get_interval
:
1354 case gdb_sys_nanosleep
:
1355 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_timespec
))
1359 case gdb_sys_mremap
:
1360 case gdb_sys_setresuid16
:
1363 case gdb_sys_getresuid16
:
1364 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_old_uid_t
)
1365 || record_mem_at_reg (regcache
, tdep
->arg2
,
1366 tdep
->size_old_uid_t
)
1367 || record_mem_at_reg (regcache
, tdep
->arg3
,
1368 tdep
->size_old_uid_t
))
1373 case gdb_sys_ni_syscall167
:
1377 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1382 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nfds
);
1383 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1384 tdep
->size_pollfd
* nfds
))
1389 case gdb_sys_nfsservctl
:
1390 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1391 if (tmpulongest
== 7 || tmpulongest
== 8)
1395 if (tmpulongest
== 7)
1396 rsize
= tdep
->size_NFS_FHSIZE
;
1398 rsize
= tdep
->size_knfsd_fh
;
1399 if (record_mem_at_reg (regcache
, tdep
->arg3
, rsize
))
1404 case gdb_sys_setresgid16
:
1407 case gdb_sys_getresgid16
:
1408 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_old_gid_t
)
1409 || record_mem_at_reg (regcache
, tdep
->arg2
,
1410 tdep
->size_old_gid_t
)
1411 || record_mem_at_reg (regcache
, tdep
->arg3
,
1412 tdep
->size_old_gid_t
))
1417 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1418 switch (tmpulongest
)
1421 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
))
1425 if (record_mem_at_reg (regcache
, tdep
->arg2
,
1426 tdep
->size_TASK_COMM_LEN
))
1432 case gdb_sys_rt_sigreturn
:
1435 case gdb_sys_rt_sigaction
:
1436 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_sigaction
))
1440 case gdb_sys_rt_sigprocmask
:
1441 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_sigset_t
))
1445 case gdb_sys_rt_sigpending
:
1446 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1449 ULONGEST sigsetsize
;
1451 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,&sigsetsize
);
1452 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1458 case gdb_sys_rt_sigtimedwait
:
1459 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_siginfo_t
))
1463 case gdb_sys_rt_sigqueueinfo
:
1464 case gdb_sys_rt_sigsuspend
:
1467 case gdb_sys_pread64
:
1468 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1473 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,&count
);
1474 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1480 case gdb_sys_pwrite64
:
1481 case gdb_sys_chown16
:
1484 case gdb_sys_getcwd
:
1485 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1490 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &size
);
1491 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1497 case gdb_sys_capget
:
1498 if (record_mem_at_reg (regcache
, tdep
->arg2
,
1499 tdep
->size_cap_user_data_t
))
1503 case gdb_sys_capset
:
1506 case gdb_sys_sigaltstack
:
1507 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_stack_t
))
1511 case gdb_sys_sendfile
:
1512 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_off_t
))
1516 case gdb_sys_ni_syscall188
:
1517 case gdb_sys_ni_syscall189
:
1521 case gdb_sys_getrlimit
:
1522 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_rlimit
))
1529 case gdb_sys_truncate64
:
1530 case gdb_sys_ftruncate64
:
1533 case gdb_sys_stat64
:
1534 case gdb_sys_lstat64
:
1535 case gdb_sys_fstat64
:
1536 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_stat64
))
1540 case gdb_sys_lchown
:
1541 case gdb_sys_getuid
:
1542 case gdb_sys_getgid
:
1543 case gdb_sys_geteuid
:
1544 case gdb_sys_getegid
:
1545 case gdb_sys_setreuid
:
1546 case gdb_sys_setregid
:
1549 case gdb_sys_getgroups
:
1550 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1553 ULONGEST gidsetsize
;
1555 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
1557 tmpint
= tdep
->size_gid_t
* (int) gidsetsize
;
1558 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
1563 case gdb_sys_setgroups
:
1564 case gdb_sys_fchown
:
1565 case gdb_sys_setresuid
:
1568 case gdb_sys_getresuid
:
1569 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_uid_t
)
1570 || record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_uid_t
)
1571 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_uid_t
))
1575 case gdb_sys_setresgid
:
1578 case gdb_sys_getresgid
:
1579 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_gid_t
)
1580 || record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_gid_t
)
1581 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_gid_t
))
1586 case gdb_sys_setuid
:
1587 case gdb_sys_setgid
:
1588 case gdb_sys_setfsuid
:
1589 case gdb_sys_setfsgid
:
1590 case gdb_sys_pivot_root
:
1593 case gdb_sys_mincore
:
1594 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_PAGE_SIZE
))
1598 case gdb_sys_madvise
:
1601 case gdb_sys_fcntl64
:
1602 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1603 if (tmpulongest
== tdep
->fcntl_F_GETLK64
)
1605 if (record_mem_at_reg (regcache
, tdep
->arg3
,
1606 tdep
->size_flock64
))
1609 else if (tmpulongest
!= tdep
->fcntl_F_SETLK64
1610 && tmpulongest
!= tdep
->fcntl_F_SETLKW64
)
1616 case gdb_sys_ni_syscall222
:
1617 case gdb_sys_ni_syscall223
:
1618 case gdb_sys_gettid
:
1619 case gdb_sys_readahead
:
1620 case gdb_sys_setxattr
:
1621 case gdb_sys_lsetxattr
:
1622 case gdb_sys_fsetxattr
:
1625 case gdb_sys_getxattr
:
1626 case gdb_sys_lgetxattr
:
1627 case gdb_sys_fgetxattr
:
1628 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1633 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &size
);
1634 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1640 case gdb_sys_listxattr
:
1641 case gdb_sys_llistxattr
:
1642 case gdb_sys_flistxattr
:
1643 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1648 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &size
);
1649 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1655 case gdb_sys_removexattr
:
1656 case gdb_sys_lremovexattr
:
1657 case gdb_sys_fremovexattr
:
1661 case gdb_sys_sendfile64
:
1662 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_loff_t
))
1667 case gdb_sys_sched_setaffinity
:
1670 case gdb_sys_sched_getaffinity
:
1671 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1676 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &len
);
1677 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1683 case gdb_sys_set_thread_area
:
1684 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_int
))
1688 case gdb_sys_get_thread_area
:
1689 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_user_desc
))
1693 case gdb_sys_io_setup
:
1694 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_long
))
1698 case gdb_sys_io_destroy
:
1701 case gdb_sys_io_getevents
:
1702 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1707 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &nr
);
1708 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1709 nr
* tdep
->size_io_event
))
1714 case gdb_sys_io_submit
:
1715 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1721 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nr
);
1722 iocbp
= (gdb_byte
*) alloca (nr
* tdep
->size_pointer
);
1723 if (target_read_memory ((CORE_ADDR
) tmpulongest
, iocbp
,
1724 nr
* tdep
->size_pointer
))
1727 gdb_printf (gdb_stdlog
,
1728 "Process record: error reading memory "
1729 "at addr = 0x%s len = %u.\n",
1730 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
1731 (int) (nr
* tdep
->size_pointer
));
1734 for (i
= 0; i
< nr
; i
++)
1737 = (CORE_ADDR
) extract_unsigned_integer (iocbp
,
1740 if (record_full_arch_list_add_mem (tmpaddr
, tdep
->size_iocb
))
1742 iocbp
+= tdep
->size_pointer
;
1747 case gdb_sys_io_cancel
:
1748 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_io_event
))
1752 case gdb_sys_fadvise64
:
1753 case gdb_sys_ni_syscall251
:
1756 case gdb_sys_exit_group
:
1757 if (yquery (_("The next instruction is syscall exit_group. "
1758 "It will make the program exit. "
1759 "Do you want to stop the program?")))
1763 case gdb_sys_lookup_dcookie
:
1764 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1769 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &len
);
1770 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1776 case gdb_sys_epoll_create
:
1777 case gdb_sys_epoll_ctl
:
1780 case gdb_sys_epoll_wait
:
1781 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1786 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxevents
);
1787 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1789 * tdep
->size_epoll_event
)))
1794 case gdb_sys_remap_file_pages
:
1795 case gdb_sys_set_tid_address
:
1798 case gdb_sys_timer_create
:
1799 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_int
))
1803 case gdb_sys_timer_settime
:
1804 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_itimerspec
))
1808 case gdb_sys_timer_gettime
:
1809 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_itimerspec
))
1813 case gdb_sys_timer_getoverrun
:
1814 case gdb_sys_timer_delete
:
1815 case gdb_sys_clock_settime
:
1818 case gdb_sys_clock_gettime
:
1819 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_timespec
))
1823 case gdb_sys_clock_getres
:
1824 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_timespec
))
1828 case gdb_sys_clock_nanosleep
:
1829 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_timespec
))
1833 case gdb_sys_statfs64
:
1834 case gdb_sys_fstatfs64
:
1835 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_statfs64
))
1839 case gdb_sys_tgkill
:
1840 case gdb_sys_utimes
:
1841 case gdb_sys_fadvise64_64
:
1842 case gdb_sys_ni_syscall273
:
1846 case gdb_sys_get_mempolicy
:
1847 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_int
))
1849 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1854 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxnode
);
1855 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1856 maxnode
* tdep
->size_long
))
1861 case gdb_sys_set_mempolicy
:
1862 case gdb_sys_mq_open
:
1863 case gdb_sys_mq_unlink
:
1864 case gdb_sys_mq_timedsend
:
1867 case gdb_sys_mq_timedreceive
:
1868 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1873 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &msg_len
);
1874 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1878 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_int
))
1882 case gdb_sys_mq_notify
:
1885 case gdb_sys_mq_getsetattr
:
1886 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_mq_attr
))
1890 case gdb_sys_kexec_load
:
1893 case gdb_sys_waitid
:
1894 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_siginfo_t
)
1895 || record_mem_at_reg (regcache
, tdep
->arg5
, tdep
->size_rusage
))
1899 case gdb_sys_ni_syscall285
:
1900 case gdb_sys_add_key
:
1901 case gdb_sys_request_key
:
1904 case gdb_sys_keyctl
:
1905 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1906 if (tmpulongest
== 6 || tmpulongest
== 11)
1908 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
1914 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &buflen
);
1915 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1922 case gdb_sys_ioprio_set
:
1923 case gdb_sys_ioprio_get
:
1924 case gdb_sys_inotify_init
:
1925 case gdb_sys_inotify_add_watch
:
1926 case gdb_sys_inotify_rm_watch
:
1927 case gdb_sys_migrate_pages
:
1928 case gdb_sys_openat
:
1929 case gdb_sys_mkdirat
:
1930 case gdb_sys_mknodat
:
1931 case gdb_sys_fchownat
:
1932 case gdb_sys_futimesat
:
1935 case gdb_sys_fstatat64
:
1936 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_stat64
))
1940 case gdb_sys_unlinkat
:
1941 case gdb_sys_renameat
:
1942 case gdb_sys_linkat
:
1943 case gdb_sys_symlinkat
:
1946 case gdb_sys_readlinkat
:
1947 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1952 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &bufsiz
);
1953 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1959 case gdb_sys_fchmodat
:
1960 case gdb_sys_faccessat
:
1963 case gdb_sys_pselect6
:
1964 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_fd_set
)
1965 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_fd_set
)
1966 || record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_fd_set
)
1967 || record_mem_at_reg (regcache
, tdep
->arg5
, tdep
->size_timespec
))
1972 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1977 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nfds
);
1978 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1979 tdep
->size_pollfd
* nfds
))
1982 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_timespec
))
1986 case gdb_sys_unshare
:
1987 case gdb_sys_set_robust_list
:
1990 case gdb_sys_get_robust_list
:
1991 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
)
1992 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_int
))
1996 case gdb_sys_splice
:
1997 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_loff_t
)
1998 || record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_loff_t
))
2002 case gdb_sys_sync_file_range
:
2004 case gdb_sys_vmsplice
:
2007 case gdb_sys_move_pages
:
2008 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
2013 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nr_pages
);
2014 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2015 nr_pages
* tdep
->size_int
))
2020 case gdb_sys_getcpu
:
2021 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_int
)
2022 || record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
)
2023 || record_mem_at_reg (regcache
, tdep
->arg3
,
2024 tdep
->size_ulong
* 2))
2028 case gdb_sys_epoll_pwait
:
2029 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2034 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxevents
);
2035 tmpint
= (int) maxevents
* tdep
->size_epoll_event
;
2036 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
2041 case gdb_sys_fallocate
:
2042 case gdb_sys_eventfd2
:
2043 case gdb_sys_epoll_create1
:
2047 case gdb_sys_inotify_init1
:
2051 gdb_printf (gdb_stderr
,
2052 _("Process record and replay target doesn't "
2053 "support syscall number %d\n"), syscall
);