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))
360 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_tms
))
364 case gdb_sys_ni_syscall44
:
366 case gdb_sys_setgid16
:
367 case gdb_sys_getgid16
:
369 case gdb_sys_geteuid16
:
370 case gdb_sys_getegid16
:
373 case gdb_sys_ni_syscall53
:
377 /* XXX Need to add a lot of support of other ioctl requests. */
378 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
379 if (tmpulongest
== tdep
->ioctl_FIOCLEX
380 || tmpulongest
== tdep
->ioctl_FIONCLEX
381 || tmpulongest
== tdep
->ioctl_FIONBIO
382 || tmpulongest
== tdep
->ioctl_FIOASYNC
383 || tmpulongest
== tdep
->ioctl_TCSETS
384 || tmpulongest
== tdep
->ioctl_TCSETSW
385 || tmpulongest
== tdep
->ioctl_TCSETSF
386 || tmpulongest
== tdep
->ioctl_TCSETA
387 || tmpulongest
== tdep
->ioctl_TCSETAW
388 || tmpulongest
== tdep
->ioctl_TCSETAF
389 || tmpulongest
== tdep
->ioctl_TCSBRK
390 || tmpulongest
== tdep
->ioctl_TCXONC
391 || tmpulongest
== tdep
->ioctl_TCFLSH
392 || tmpulongest
== tdep
->ioctl_TIOCEXCL
393 || tmpulongest
== tdep
->ioctl_TIOCNXCL
394 || tmpulongest
== tdep
->ioctl_TIOCSCTTY
395 || tmpulongest
== tdep
->ioctl_TIOCSPGRP
396 || tmpulongest
== tdep
->ioctl_TIOCSTI
397 || tmpulongest
== tdep
->ioctl_TIOCSWINSZ
398 || tmpulongest
== tdep
->ioctl_TIOCMBIS
399 || tmpulongest
== tdep
->ioctl_TIOCMBIC
400 || tmpulongest
== tdep
->ioctl_TIOCMSET
401 || tmpulongest
== tdep
->ioctl_TIOCSSOFTCAR
402 || tmpulongest
== tdep
->ioctl_TIOCCONS
403 || tmpulongest
== tdep
->ioctl_TIOCSSERIAL
404 || tmpulongest
== tdep
->ioctl_TIOCPKT
405 || tmpulongest
== tdep
->ioctl_TIOCNOTTY
406 || tmpulongest
== tdep
->ioctl_TIOCSETD
407 || tmpulongest
== tdep
->ioctl_TCSBRKP
408 || tmpulongest
== tdep
->ioctl_TIOCTTYGSTRUCT
409 || tmpulongest
== tdep
->ioctl_TIOCSBRK
410 || tmpulongest
== tdep
->ioctl_TIOCCBRK
411 || tmpulongest
== tdep
->ioctl_TCSETS2
412 || tmpulongest
== tdep
->ioctl_TCSETSW2
413 || tmpulongest
== tdep
->ioctl_TCSETSF2
414 || tmpulongest
== tdep
->ioctl_TIOCSPTLCK
415 || tmpulongest
== tdep
->ioctl_TIOCSERCONFIG
416 || tmpulongest
== tdep
->ioctl_TIOCSERGWILD
417 || tmpulongest
== tdep
->ioctl_TIOCSERSWILD
418 || tmpulongest
== tdep
->ioctl_TIOCSLCKTRMIOS
419 || tmpulongest
== tdep
->ioctl_TIOCSERGETMULTI
420 || tmpulongest
== tdep
->ioctl_TIOCSERSETMULTI
421 || tmpulongest
== tdep
->ioctl_TIOCMIWAIT
422 || tmpulongest
== tdep
->ioctl_TIOCSHAYESESP
)
426 else if (tmpulongest
== tdep
->ioctl_TCGETS
427 || tmpulongest
== tdep
->ioctl_TCGETA
428 || tmpulongest
== tdep
->ioctl_TIOCGLCKTRMIOS
)
430 if (record_mem_at_reg (regcache
, tdep
->arg3
,
434 else if (tmpulongest
== tdep
->ioctl_TIOCGPGRP
435 || tmpulongest
== tdep
->ioctl_TIOCGSID
)
437 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_pid_t
))
440 else if (tmpulongest
== tdep
->ioctl_TIOCOUTQ
441 || tmpulongest
== tdep
->ioctl_TIOCMGET
442 || tmpulongest
== tdep
->ioctl_TIOCGSOFTCAR
443 || tmpulongest
== tdep
->ioctl_FIONREAD
444 || tmpulongest
== tdep
->ioctl_TIOCINQ
445 || tmpulongest
== tdep
->ioctl_TIOCGETD
446 || tmpulongest
== tdep
->ioctl_TIOCGPTN
447 || tmpulongest
== tdep
->ioctl_TIOCSERGETLSR
)
449 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_int
))
452 else if (tmpulongest
== tdep
->ioctl_TIOCGWINSZ
)
454 if (record_mem_at_reg (regcache
, tdep
->arg3
,
458 else if (tmpulongest
== tdep
->ioctl_TIOCLINUX
)
460 /* This syscall affects a char-size memory. */
461 if (record_mem_at_reg (regcache
, tdep
->arg3
, 1))
464 else if (tmpulongest
== tdep
->ioctl_TIOCGSERIAL
)
466 if (record_mem_at_reg (regcache
, tdep
->arg3
,
467 tdep
->size_serial_struct
))
470 else if (tmpulongest
== tdep
->ioctl_TCGETS2
)
472 if (record_mem_at_reg (regcache
, tdep
->arg3
,
473 tdep
->size_termios2
))
476 else if (tmpulongest
== tdep
->ioctl_FIOQSIZE
)
478 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_loff_t
))
481 else if (tmpulongest
== tdep
->ioctl_TIOCGICOUNT
)
483 if (record_mem_at_reg (regcache
, tdep
->arg3
,
484 tdep
->size_serial_icounter_struct
))
487 else if (tmpulongest
== tdep
->ioctl_TIOCGHAYESESP
)
489 if (record_mem_at_reg (regcache
, tdep
->arg3
,
490 tdep
->size_hayes_esp_config
))
493 else if (tmpulongest
== tdep
->ioctl_TIOCSERGSTRUCT
)
495 gdb_printf (gdb_stderr
,
496 _("Process record and replay target doesn't "
497 "support ioctl request TIOCSERGSTRUCT\n"));
502 gdb_printf (gdb_stderr
,
503 _("Process record and replay target doesn't "
504 "support ioctl request 0x%s.\n"),
505 OUTPUT_REG (tmpulongest
, tdep
->arg2
));
512 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
514 if (tmpulongest
== tdep
->fcntl_F_GETLK
)
516 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_flock
))
521 case gdb_sys_ni_syscall56
:
522 case gdb_sys_setpgid
:
523 case gdb_sys_ni_syscall58
:
526 case gdb_sys_olduname
:
527 if (record_mem_at_reg (regcache
, tdep
->arg1
,
528 tdep
->size_oldold_utsname
))
537 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_ustat
))
542 case gdb_sys_getppid
:
543 case gdb_sys_getpgrp
:
547 case gdb_sys_sigaction
:
548 if (record_mem_at_reg (regcache
, tdep
->arg3
,
549 tdep
->size_old_sigaction
))
553 case gdb_sys_sgetmask
:
554 case gdb_sys_ssetmask
:
555 case gdb_sys_setreuid16
:
556 case gdb_sys_setregid16
:
557 case gdb_sys_sigsuspend
:
560 case gdb_sys_sigpending
:
561 if (record_mem_at_reg (regcache
, tdep
->arg1
,
562 tdep
->size_old_sigset_t
))
566 case gdb_sys_sethostname
:
567 case gdb_sys_setrlimit
:
570 case gdb_sys_old_getrlimit
:
571 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_rlimit
))
575 case gdb_sys_getrusage
:
576 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_rusage
))
580 case gdb_sys_gettimeofday
:
581 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_timeval
)
582 || record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_timezone
))
586 case gdb_sys_settimeofday
:
589 case gdb_sys_getgroups16
:
590 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
595 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
597 tmpint
= tdep
->size_old_gid_t
* (int) gidsetsize
;
598 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
603 case gdb_sys_setgroups16
:
608 unsigned long sz_sel_arg
= tdep
->size_long
+ tdep
->size_pointer
* 4;
609 gdb_byte
*a
= (gdb_byte
*) alloca (sz_sel_arg
);
610 CORE_ADDR inp
, outp
, exp
, tvp
;
612 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
616 if (target_read_memory (tmpulongest
, a
, sz_sel_arg
))
619 gdb_printf (gdb_stdlog
,
620 "Process record: error reading memory "
621 "at addr = 0x%s len = %lu.\n",
622 OUTPUT_REG (tmpulongest
, tdep
->arg1
),
627 a
+= tdep
->size_long
;
628 inp
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
629 a
+= tdep
->size_pointer
;
630 outp
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
631 a
+= tdep
->size_pointer
;
632 exp
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
633 a
+= tdep
->size_pointer
;
634 tvp
= extract_unsigned_integer (a
, tdep
->size_pointer
, byte_order
);
636 if (record_full_arch_list_add_mem (inp
, tdep
->size_fd_set
))
639 if (record_full_arch_list_add_mem (outp
, tdep
->size_fd_set
))
642 if (record_full_arch_list_add_mem (exp
, tdep
->size_fd_set
))
645 if (record_full_arch_list_add_mem (tvp
, tdep
->size_timeval
))
651 case gdb_sys_symlink
:
659 if (yquery (_("The next instruction is syscall reboot. "
660 "It will restart the computer. "
661 "Do you want to stop the program?")))
665 case gdb_old_readdir
:
666 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_old_dirent
))
677 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
679 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &len
);
680 if (record_full_memory_query
)
683 The next instruction is syscall munmap.\n\
684 It will free the memory addr = 0x%s len = %u.\n\
685 It will make record target cannot record some memory change.\n\
686 Do you want to stop the program?"),
687 OUTPUT_REG (tmpulongest
, tdep
->arg1
), (int) len
))
693 case gdb_sys_truncate
:
694 case gdb_sys_ftruncate
:
696 case gdb_sys_fchown16
:
697 case gdb_sys_getpriority
:
698 case gdb_sys_setpriority
:
699 case gdb_sys_ni_syscall98
:
703 case gdb_sys_fstatfs
:
704 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_statfs
))
713 case gdb_sys_sendmsg
:
714 case gdb_sys_shutdown
:
716 case gdb_sys_connect
:
718 case gdb_sys_setsockopt
:
722 case gdb_sys_getsockname
:
723 case gdb_sys_getpeername
:
727 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
728 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &len
);
729 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
734 case gdb_sys_recvfrom
:
738 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
739 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &len
);
740 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
745 case gdb_sys_recvmsg
:
746 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
747 if (record_linux_msghdr (regcache
, tdep
, tmpulongest
))
751 case gdb_sys_socketpair
:
752 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_int
))
756 case gdb_sys_getsockopt
:
757 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
761 gdb_byte
*optlenp
= (gdb_byte
*) alloca (tdep
->size_int
);
763 if (target_read_memory ((CORE_ADDR
) tmpulongest
, optlenp
,
767 gdb_printf (gdb_stdlog
,
768 "Process record: error reading "
769 "memory at addr = 0x%s "
771 OUTPUT_REG (tmpulongest
, tdep
->arg5
),
775 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &optvalp
);
776 tmpint
= (int) extract_signed_integer (optlenp
, tdep
->size_int
,
778 if (record_full_arch_list_add_mem ((CORE_ADDR
) optvalp
, tmpint
))
780 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
786 case gdb_sys_socketcall
:
787 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
790 case RECORD_SYS_SOCKET
:
791 case RECORD_SYS_BIND
:
792 case RECORD_SYS_CONNECT
:
793 case RECORD_SYS_LISTEN
:
795 case RECORD_SYS_ACCEPT
:
796 case RECORD_SYS_GETSOCKNAME
:
797 case RECORD_SYS_GETPEERNAME
:
799 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
803 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
* 2);
806 tmpulongest
+= tdep
->size_ulong
;
807 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
808 tdep
->size_ulong
* 2))
811 gdb_printf (gdb_stdlog
,
812 "Process record: error reading "
813 "memory at addr = 0x%s len = %d.\n",
814 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
815 tdep
->size_ulong
* 2);
818 tmpulongest
= extract_unsigned_integer (a
,
821 len
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
822 tdep
->size_ulong
, byte_order
);
823 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
829 case RECORD_SYS_SOCKETPAIR
:
831 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
);
833 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
837 tmpulongest
+= tdep
->size_ulong
* 3;
838 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
842 gdb_printf (gdb_stdlog
,
843 "Process record: error reading "
844 "memory at addr = 0x%s len = %d.\n",
845 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
850 = (CORE_ADDR
) extract_unsigned_integer (a
, tdep
->size_ulong
,
852 if (record_full_arch_list_add_mem (tmpaddr
, tdep
->size_int
))
857 case RECORD_SYS_SEND
:
858 case RECORD_SYS_SENDTO
:
860 case RECORD_SYS_RECVFROM
:
861 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
865 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
* 2);
868 tmpulongest
+= tdep
->size_ulong
* 4;
869 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
870 tdep
->size_ulong
* 2))
873 gdb_printf (gdb_stdlog
,
874 "Process record: error reading "
875 "memory at addr = 0x%s len = %d.\n",
876 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
877 tdep
->size_ulong
* 2);
880 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
882 len
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
883 tdep
->size_ulong
, byte_order
);
884 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
888 case RECORD_SYS_RECV
:
889 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
893 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
* 2);
895 tmpulongest
+= tdep
->size_ulong
;
896 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
900 gdb_printf (gdb_stdlog
,
901 "Process record: error reading "
902 "memory at addr = 0x%s len = %d.\n",
903 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
907 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
911 a
+= tdep
->size_ulong
;
912 tmpint
= (int) extract_unsigned_integer (a
, tdep
->size_ulong
,
914 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
920 case RECORD_SYS_SHUTDOWN
:
921 case RECORD_SYS_SETSOCKOPT
:
923 case RECORD_SYS_GETSOCKOPT
:
925 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
* 2);
926 gdb_byte
*av
= (gdb_byte
*) alloca (tdep
->size_int
);
928 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
932 tmpulongest
+= tdep
->size_ulong
* 3;
933 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
934 tdep
->size_ulong
* 2))
937 gdb_printf (gdb_stdlog
,
938 "Process record: error reading "
939 "memory at addr = 0x%s len = %d.\n",
940 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
941 tdep
->size_ulong
* 2);
944 tmpulongest
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
949 if (target_read_memory ((CORE_ADDR
) tmpulongest
, av
,
953 gdb_printf (gdb_stdlog
,
954 "Process record: error reading "
955 "memory at addr = 0x%s "
957 phex_nz (tmpulongest
,
963 = (CORE_ADDR
) extract_unsigned_integer (a
,
966 tmpint
= (int) extract_unsigned_integer (av
,
969 if (record_full_arch_list_add_mem (tmpaddr
, tmpint
))
971 a
+= tdep
->size_ulong
;
973 = (CORE_ADDR
) extract_unsigned_integer (a
,
976 if (record_full_arch_list_add_mem (tmpaddr
,
983 case RECORD_SYS_SENDMSG
:
985 case RECORD_SYS_RECVMSG
:
987 gdb_byte
*a
= (gdb_byte
*) alloca (tdep
->size_ulong
);
989 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
993 tmpulongest
+= tdep
->size_ulong
;
994 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
998 gdb_printf (gdb_stdlog
,
999 "Process record: error reading "
1000 "memory at addr = 0x%s len = %d.\n",
1001 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
1005 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
1007 if (record_linux_msghdr (regcache
, tdep
, tmpulongest
))
1013 gdb_printf (gdb_stderr
,
1014 _("Process record and replay target "
1015 "doesn't support socketcall call 0x%s\n"),
1016 OUTPUT_REG (tmpulongest
, tdep
->arg1
));
1022 case gdb_sys_syslog
:
1025 case gdb_sys_setitimer
:
1026 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_itimerval
))
1030 case gdb_sys_getitimer
:
1031 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_itimerval
))
1035 case gdb_sys_newstat
:
1036 case gdb_sys_newlstat
:
1037 case gdb_sys_newfstat
:
1038 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_stat
))
1042 case gdb_sys_newfstatat
:
1043 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1044 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1050 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
1051 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, 256))
1056 if (record_mem_at_reg (regcache
, tdep
->arg1
,
1057 tdep
->size_old_utsname
))
1062 case gdb_sys_vhangup
:
1063 case gdb_sys_ni_syscall112
:
1064 case gdb_sys_vm86old
:
1068 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
)
1069 || record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_rusage
))
1073 case gdb_sys_swapoff
:
1076 case gdb_sys_sysinfo
:
1077 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_sysinfo
))
1081 case gdb_sys_shmget
:
1082 case gdb_sys_semget
:
1084 case gdb_sys_msgget
:
1085 /* XXX maybe need do some record works with sys_shmdt. */
1087 case gdb_sys_msgsnd
:
1088 case gdb_sys_semtimedop
:
1092 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_ulong
))
1096 case gdb_sys_shmctl
:
1097 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_shmid_ds
))
1101 /* XXX sys_semctl 525 still not supported. */
1104 case gdb_sys_msgrcv
:
1108 regcache_raw_read_signed (regcache
, tdep
->arg3
, &l
);
1109 tmpint
= l
+ tdep
->size_long
;
1110 if (record_mem_at_reg (regcache
, tdep
->arg2
, tmpint
))
1115 case gdb_sys_msgctl
:
1116 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_msqid_ds
))
1121 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1122 tmpulongest
&= 0xffff;
1123 switch (tmpulongest
)
1127 case RECORD_SEMTIMEDOP
:
1130 /* XXX maybe need do some record works with RECORD_SHMDT. */
1138 regcache_raw_read_signed (regcache
, tdep
->arg3
, &second
);
1139 tmpint
= (int) second
+ tdep
->size_long
;
1140 if (record_mem_at_reg (regcache
, tdep
->arg5
, tmpint
))
1145 if (record_mem_at_reg (regcache
, tdep
->arg5
,
1146 tdep
->size_msqid_ds
))
1150 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_ulong
))
1154 if (record_mem_at_reg (regcache
, tdep
->arg5
,
1155 tdep
->size_shmid_ds
))
1159 /* XXX RECORD_SEMCTL still not supported. */
1160 gdb_printf (gdb_stderr
,
1161 _("Process record and replay target doesn't "
1162 "support ipc number %s\n"),
1163 pulongest (tmpulongest
));
1169 case gdb_sys_sigreturn
:
1171 case gdb_sys_setdomainname
:
1174 case gdb_sys_newuname
:
1175 if (record_mem_at_reg (regcache
, tdep
->arg1
,
1176 tdep
->size_new_utsname
))
1180 case gdb_sys_modify_ldt
:
1181 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1182 if (tmpulongest
== 0 || tmpulongest
== 2)
1186 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &bytecount
);
1187 if (record_mem_at_reg (regcache
, tdep
->arg2
, (int) bytecount
))
1192 case gdb_sys_adjtimex
:
1193 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_timex
))
1197 case gdb_sys_mprotect
:
1200 case gdb_sys_sigprocmask
:
1201 if (record_mem_at_reg (regcache
, tdep
->arg3
,
1202 tdep
->size_old_sigset_t
))
1206 case gdb_sys_ni_syscall127
:
1207 case gdb_sys_init_module
:
1208 case gdb_sys_delete_module
:
1209 case gdb_sys_ni_syscall130
:
1212 case gdb_sys_quotactl
:
1213 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1214 switch (tmpulongest
)
1216 case RECORD_Q_GETFMT
:
1218 if (record_mem_at_reg (regcache
, tdep
->arg4
, 4))
1221 case RECORD_Q_GETINFO
:
1222 if (record_mem_at_reg (regcache
, tdep
->arg4
,
1223 tdep
->size_mem_dqinfo
))
1226 case RECORD_Q_GETQUOTA
:
1227 if (record_mem_at_reg (regcache
, tdep
->arg4
,
1228 tdep
->size_if_dqblk
))
1231 case RECORD_Q_XGETQSTAT
:
1232 case RECORD_Q_XGETQUOTA
:
1233 if (record_mem_at_reg (regcache
, tdep
->arg4
,
1234 tdep
->size_fs_quota_stat
))
1240 case gdb_sys_getpgid
:
1241 case gdb_sys_fchdir
:
1242 case gdb_sys_bdflush
:
1246 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1247 if (tmpulongest
== 2)
1249 /*XXX the size of memory is not very clear. */
1250 if (record_mem_at_reg (regcache
, tdep
->arg3
, 10))
1255 case gdb_sys_personality
:
1256 case gdb_sys_ni_syscall137
:
1257 case gdb_sys_setfsuid16
:
1258 case gdb_sys_setfsgid16
:
1261 case gdb_sys_llseek
:
1262 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_loff_t
))
1266 case gdb_sys_getdents
:
1267 case gdb_sys_getdents64
:
1268 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1269 if (record_mem_at_reg (regcache
, tdep
->arg2
, tmpulongest
))
1273 case gdb_sys_select
:
1274 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_fd_set
)
1275 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_fd_set
)
1276 || record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_fd_set
)
1277 || record_mem_at_reg (regcache
, tdep
->arg5
, tdep
->size_timeval
))
1289 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &vec
);
1292 gdb_byte
*iov
= (gdb_byte
*) alloca (tdep
->size_iovec
);
1294 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &vlen
);
1295 for (tmpulongest
= 0; tmpulongest
< vlen
; tmpulongest
++)
1297 if (target_read_memory ((CORE_ADDR
) vec
, iov
,
1301 gdb_printf (gdb_stdlog
,
1302 "Process record: error reading "
1303 "memory at addr = 0x%s len = %d.\n",
1304 OUTPUT_REG (vec
, tdep
->arg2
),
1309 = (CORE_ADDR
) extract_unsigned_integer (iov
,
1313 = (int) extract_unsigned_integer (iov
+ tdep
->size_pointer
,
1316 if (record_full_arch_list_add_mem (tmpaddr
, tmpint
))
1318 vec
+= tdep
->size_iovec
;
1324 case gdb_sys_writev
:
1325 case gdb_sys_getsid
:
1326 case gdb_sys_fdatasync
:
1327 case gdb_sys_sysctl
:
1329 case gdb_sys_munlock
:
1330 case gdb_sys_mlockall
:
1331 case gdb_sys_munlockall
:
1332 case gdb_sys_sched_setparam
:
1335 case gdb_sys_sched_getparam
:
1336 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
))
1340 case gdb_sys_sched_setscheduler
:
1341 case gdb_sys_sched_getscheduler
:
1342 case gdb_sys_sched_yield
:
1343 case gdb_sys_sched_get_priority_max
:
1344 case gdb_sys_sched_get_priority_min
:
1347 case gdb_sys_sched_rr_get_interval
:
1348 case gdb_sys_nanosleep
:
1349 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_timespec
))
1353 case gdb_sys_mremap
:
1354 case gdb_sys_setresuid16
:
1357 case gdb_sys_getresuid16
:
1358 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_old_uid_t
)
1359 || record_mem_at_reg (regcache
, tdep
->arg2
,
1360 tdep
->size_old_uid_t
)
1361 || record_mem_at_reg (regcache
, tdep
->arg3
,
1362 tdep
->size_old_uid_t
))
1367 case gdb_sys_ni_syscall167
:
1371 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1376 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nfds
);
1377 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1378 tdep
->size_pollfd
* nfds
))
1383 case gdb_sys_nfsservctl
:
1384 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1385 if (tmpulongest
== 7 || tmpulongest
== 8)
1389 if (tmpulongest
== 7)
1390 rsize
= tdep
->size_NFS_FHSIZE
;
1392 rsize
= tdep
->size_knfsd_fh
;
1393 if (record_mem_at_reg (regcache
, tdep
->arg3
, rsize
))
1398 case gdb_sys_setresgid16
:
1401 case gdb_sys_getresgid16
:
1402 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_old_gid_t
)
1403 || record_mem_at_reg (regcache
, tdep
->arg2
,
1404 tdep
->size_old_gid_t
)
1405 || record_mem_at_reg (regcache
, tdep
->arg3
,
1406 tdep
->size_old_gid_t
))
1411 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1412 switch (tmpulongest
)
1415 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
))
1419 if (record_mem_at_reg (regcache
, tdep
->arg2
,
1420 tdep
->size_TASK_COMM_LEN
))
1426 case gdb_sys_rt_sigreturn
:
1429 case gdb_sys_rt_sigaction
:
1430 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_sigaction
))
1434 case gdb_sys_rt_sigprocmask
:
1435 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_sigset_t
))
1439 case gdb_sys_rt_sigpending
:
1440 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1443 ULONGEST sigsetsize
;
1445 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,&sigsetsize
);
1446 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1452 case gdb_sys_rt_sigtimedwait
:
1453 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_siginfo_t
))
1457 case gdb_sys_rt_sigqueueinfo
:
1458 case gdb_sys_rt_sigsuspend
:
1461 case gdb_sys_pread64
:
1462 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1467 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,&count
);
1468 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1474 case gdb_sys_pwrite64
:
1475 case gdb_sys_chown16
:
1478 case gdb_sys_getcwd
:
1479 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1484 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &size
);
1485 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1491 case gdb_sys_capget
:
1492 if (record_mem_at_reg (regcache
, tdep
->arg2
,
1493 tdep
->size_cap_user_data_t
))
1497 case gdb_sys_capset
:
1500 case gdb_sys_sigaltstack
:
1501 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_stack_t
))
1505 case gdb_sys_sendfile
:
1506 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_off_t
))
1510 case gdb_sys_ni_syscall188
:
1511 case gdb_sys_ni_syscall189
:
1515 case gdb_sys_getrlimit
:
1516 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_rlimit
))
1523 case gdb_sys_truncate64
:
1524 case gdb_sys_ftruncate64
:
1527 case gdb_sys_stat64
:
1528 case gdb_sys_lstat64
:
1529 case gdb_sys_fstat64
:
1530 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_stat64
))
1534 case gdb_sys_lchown
:
1535 case gdb_sys_getuid
:
1536 case gdb_sys_getgid
:
1537 case gdb_sys_geteuid
:
1538 case gdb_sys_getegid
:
1539 case gdb_sys_setreuid
:
1540 case gdb_sys_setregid
:
1543 case gdb_sys_getgroups
:
1544 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1547 ULONGEST gidsetsize
;
1549 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
1551 tmpint
= tdep
->size_gid_t
* (int) gidsetsize
;
1552 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
1557 case gdb_sys_setgroups
:
1558 case gdb_sys_fchown
:
1559 case gdb_sys_setresuid
:
1562 case gdb_sys_getresuid
:
1563 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_uid_t
)
1564 || record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_uid_t
)
1565 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_uid_t
))
1569 case gdb_sys_setresgid
:
1572 case gdb_sys_getresgid
:
1573 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_gid_t
)
1574 || record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_gid_t
)
1575 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_gid_t
))
1580 case gdb_sys_setuid
:
1581 case gdb_sys_setgid
:
1582 case gdb_sys_setfsuid
:
1583 case gdb_sys_setfsgid
:
1584 case gdb_sys_pivot_root
:
1587 case gdb_sys_mincore
:
1588 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_PAGE_SIZE
))
1592 case gdb_sys_madvise
:
1595 case gdb_sys_fcntl64
:
1596 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1597 if (tmpulongest
== tdep
->fcntl_F_GETLK64
)
1599 if (record_mem_at_reg (regcache
, tdep
->arg3
,
1600 tdep
->size_flock64
))
1603 else if (tmpulongest
!= tdep
->fcntl_F_SETLK64
1604 && tmpulongest
!= tdep
->fcntl_F_SETLKW64
)
1610 case gdb_sys_ni_syscall222
:
1611 case gdb_sys_ni_syscall223
:
1612 case gdb_sys_gettid
:
1613 case gdb_sys_readahead
:
1614 case gdb_sys_setxattr
:
1615 case gdb_sys_lsetxattr
:
1616 case gdb_sys_fsetxattr
:
1619 case gdb_sys_getxattr
:
1620 case gdb_sys_lgetxattr
:
1621 case gdb_sys_fgetxattr
:
1622 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1627 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &size
);
1628 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1634 case gdb_sys_listxattr
:
1635 case gdb_sys_llistxattr
:
1636 case gdb_sys_flistxattr
:
1637 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1642 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &size
);
1643 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1649 case gdb_sys_removexattr
:
1650 case gdb_sys_lremovexattr
:
1651 case gdb_sys_fremovexattr
:
1655 case gdb_sys_sendfile64
:
1656 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_loff_t
))
1661 case gdb_sys_sched_setaffinity
:
1664 case gdb_sys_sched_getaffinity
:
1665 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1670 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &len
);
1671 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1677 case gdb_sys_set_thread_area
:
1678 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_int
))
1682 case gdb_sys_get_thread_area
:
1683 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_user_desc
))
1687 case gdb_sys_io_setup
:
1688 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_long
))
1692 case gdb_sys_io_destroy
:
1695 case gdb_sys_io_getevents
:
1696 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1701 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &nr
);
1702 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1703 nr
* tdep
->size_io_event
))
1708 case gdb_sys_io_submit
:
1709 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1715 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nr
);
1716 iocbp
= (gdb_byte
*) alloca (nr
* tdep
->size_pointer
);
1717 if (target_read_memory ((CORE_ADDR
) tmpulongest
, iocbp
,
1718 nr
* tdep
->size_pointer
))
1721 gdb_printf (gdb_stdlog
,
1722 "Process record: error reading memory "
1723 "at addr = 0x%s len = %u.\n",
1724 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
1725 (int) (nr
* tdep
->size_pointer
));
1728 for (i
= 0; i
< nr
; i
++)
1731 = (CORE_ADDR
) extract_unsigned_integer (iocbp
,
1734 if (record_full_arch_list_add_mem (tmpaddr
, tdep
->size_iocb
))
1736 iocbp
+= tdep
->size_pointer
;
1741 case gdb_sys_io_cancel
:
1742 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_io_event
))
1746 case gdb_sys_fadvise64
:
1747 case gdb_sys_ni_syscall251
:
1750 case gdb_sys_exit_group
:
1751 if (yquery (_("The next instruction is syscall exit_group. "
1752 "It will make the program exit. "
1753 "Do you want to stop the program?")))
1757 case gdb_sys_lookup_dcookie
:
1758 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1763 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &len
);
1764 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1770 case gdb_sys_epoll_create
:
1771 case gdb_sys_epoll_ctl
:
1774 case gdb_sys_epoll_wait
:
1775 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1780 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxevents
);
1781 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1783 * tdep
->size_epoll_event
)))
1788 case gdb_sys_remap_file_pages
:
1789 case gdb_sys_set_tid_address
:
1792 case gdb_sys_timer_create
:
1793 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_int
))
1797 case gdb_sys_timer_settime
:
1798 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_itimerspec
))
1802 case gdb_sys_timer_gettime
:
1803 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_itimerspec
))
1807 case gdb_sys_timer_getoverrun
:
1808 case gdb_sys_timer_delete
:
1809 case gdb_sys_clock_settime
:
1812 case gdb_sys_clock_gettime
:
1813 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_timespec
))
1817 case gdb_sys_clock_getres
:
1818 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_timespec
))
1822 case gdb_sys_clock_nanosleep
:
1823 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_timespec
))
1827 case gdb_sys_statfs64
:
1828 case gdb_sys_fstatfs64
:
1829 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_statfs64
))
1833 case gdb_sys_tgkill
:
1834 case gdb_sys_utimes
:
1835 case gdb_sys_fadvise64_64
:
1836 case gdb_sys_ni_syscall273
:
1840 case gdb_sys_get_mempolicy
:
1841 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_int
))
1843 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1848 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxnode
);
1849 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1850 maxnode
* tdep
->size_long
))
1855 case gdb_sys_set_mempolicy
:
1856 case gdb_sys_mq_open
:
1857 case gdb_sys_mq_unlink
:
1858 case gdb_sys_mq_timedsend
:
1861 case gdb_sys_mq_timedreceive
:
1862 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1867 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &msg_len
);
1868 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1872 if (record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_int
))
1876 case gdb_sys_mq_notify
:
1879 case gdb_sys_mq_getsetattr
:
1880 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_mq_attr
))
1884 case gdb_sys_kexec_load
:
1887 case gdb_sys_waitid
:
1888 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_siginfo_t
)
1889 || record_mem_at_reg (regcache
, tdep
->arg5
, tdep
->size_rusage
))
1893 case gdb_sys_ni_syscall285
:
1894 case gdb_sys_add_key
:
1895 case gdb_sys_request_key
:
1898 case gdb_sys_keyctl
:
1899 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1900 if (tmpulongest
== 6 || tmpulongest
== 11)
1902 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
1908 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &buflen
);
1909 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1916 case gdb_sys_ioprio_set
:
1917 case gdb_sys_ioprio_get
:
1918 case gdb_sys_inotify_init
:
1919 case gdb_sys_inotify_add_watch
:
1920 case gdb_sys_inotify_rm_watch
:
1921 case gdb_sys_migrate_pages
:
1922 case gdb_sys_openat
:
1923 case gdb_sys_mkdirat
:
1924 case gdb_sys_mknodat
:
1925 case gdb_sys_fchownat
:
1926 case gdb_sys_futimesat
:
1929 case gdb_sys_fstatat64
:
1930 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_stat64
))
1934 case gdb_sys_unlinkat
:
1935 case gdb_sys_renameat
:
1936 case gdb_sys_linkat
:
1937 case gdb_sys_symlinkat
:
1940 case gdb_sys_readlinkat
:
1941 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1946 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &bufsiz
);
1947 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1953 case gdb_sys_fchmodat
:
1954 case gdb_sys_faccessat
:
1957 case gdb_sys_pselect6
:
1958 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_fd_set
)
1959 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_fd_set
)
1960 || record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_fd_set
)
1961 || record_mem_at_reg (regcache
, tdep
->arg5
, tdep
->size_timespec
))
1966 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1971 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nfds
);
1972 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1973 tdep
->size_pollfd
* nfds
))
1976 if (record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_timespec
))
1980 case gdb_sys_unshare
:
1981 case gdb_sys_set_robust_list
:
1984 case gdb_sys_get_robust_list
:
1985 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
)
1986 || record_mem_at_reg (regcache
, tdep
->arg3
, tdep
->size_int
))
1990 case gdb_sys_splice
:
1991 if (record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_loff_t
)
1992 || record_mem_at_reg (regcache
, tdep
->arg4
, tdep
->size_loff_t
))
1996 case gdb_sys_sync_file_range
:
1998 case gdb_sys_vmsplice
:
2001 case gdb_sys_move_pages
:
2002 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
2007 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nr_pages
);
2008 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2009 nr_pages
* tdep
->size_int
))
2014 case gdb_sys_getcpu
:
2015 if (record_mem_at_reg (regcache
, tdep
->arg1
, tdep
->size_int
)
2016 || record_mem_at_reg (regcache
, tdep
->arg2
, tdep
->size_int
)
2017 || record_mem_at_reg (regcache
, tdep
->arg3
,
2018 tdep
->size_ulong
* 2))
2022 case gdb_sys_epoll_pwait
:
2023 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2028 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxevents
);
2029 tmpint
= (int) maxevents
* tdep
->size_epoll_event
;
2030 if (record_full_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
2035 case gdb_sys_fallocate
:
2036 case gdb_sys_eventfd2
:
2037 case gdb_sys_epoll_create1
:
2041 case gdb_sys_inotify_init1
:
2045 gdb_printf (gdb_stderr
,
2046 _("Process record and replay target doesn't "
2047 "support syscall number %d\n"), syscall
);