1 /* Process record and replay target code for GNU/Linux.
3 Copyright (C) 2008, 2009, 2010 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
:
243 target_terminal_ours ();
244 q
= yquery (_("The next instruction is syscall exit. "
245 "It will make the program exit. "
246 "Do you want to stop the program?"));
247 target_terminal_inferior ();
258 ULONGEST addr
, count
;
259 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &addr
);
260 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &count
);
261 if (record_arch_list_add_mem ((CORE_ADDR
) addr
, (int) count
))
269 case gdb_sys_waitpid
:
278 case gdb_sys_lchown16
:
279 case gdb_sys_ni_syscall17
:
285 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
286 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
287 tdep
->size__old_kernel_stat
))
294 case gdb_sys_oldumount
:
295 case gdb_sys_setuid16
:
296 case gdb_sys_getuid16
:
301 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
302 if (tmpulongest
== RECORD_PTRACE_PEEKTEXT
303 || tmpulongest
== RECORD_PTRACE_PEEKDATA
304 || tmpulongest
== RECORD_PTRACE_PEEKUSR
)
306 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
308 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, 4))
316 case gdb_sys_ni_syscall31
:
317 case gdb_sys_ni_syscall32
:
320 case gdb_sys_ni_syscall35
:
331 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
332 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_tms
))
336 case gdb_sys_ni_syscall44
:
338 case gdb_sys_setgid16
:
339 case gdb_sys_getgid16
:
341 case gdb_sys_geteuid16
:
342 case gdb_sys_getegid16
:
345 case gdb_sys_ni_syscall53
:
349 /* XXX Need to add a lot of support of other ioctl requests. */
350 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
351 if (tmpulongest
== tdep
->ioctl_FIOCLEX
352 || tmpulongest
== tdep
->ioctl_FIONCLEX
353 || tmpulongest
== tdep
->ioctl_FIONBIO
354 || tmpulongest
== tdep
->ioctl_FIOASYNC
355 || tmpulongest
== tdep
->ioctl_TCSETS
356 || tmpulongest
== tdep
->ioctl_TCSETSW
357 || tmpulongest
== tdep
->ioctl_TCSETSF
358 || tmpulongest
== tdep
->ioctl_TCSETA
359 || tmpulongest
== tdep
->ioctl_TCSETAW
360 || tmpulongest
== tdep
->ioctl_TCSETAF
361 || tmpulongest
== tdep
->ioctl_TCSBRK
362 || tmpulongest
== tdep
->ioctl_TCXONC
363 || tmpulongest
== tdep
->ioctl_TCFLSH
364 || tmpulongest
== tdep
->ioctl_TIOCEXCL
365 || tmpulongest
== tdep
->ioctl_TIOCNXCL
366 || tmpulongest
== tdep
->ioctl_TIOCSCTTY
367 || tmpulongest
== tdep
->ioctl_TIOCSPGRP
368 || tmpulongest
== tdep
->ioctl_TIOCSTI
369 || tmpulongest
== tdep
->ioctl_TIOCSWINSZ
370 || tmpulongest
== tdep
->ioctl_TIOCMBIS
371 || tmpulongest
== tdep
->ioctl_TIOCMBIC
372 || tmpulongest
== tdep
->ioctl_TIOCMSET
373 || tmpulongest
== tdep
->ioctl_TIOCSSOFTCAR
374 || tmpulongest
== tdep
->ioctl_TIOCCONS
375 || tmpulongest
== tdep
->ioctl_TIOCSSERIAL
376 || tmpulongest
== tdep
->ioctl_TIOCPKT
377 || tmpulongest
== tdep
->ioctl_TIOCNOTTY
378 || tmpulongest
== tdep
->ioctl_TIOCSETD
379 || tmpulongest
== tdep
->ioctl_TCSBRKP
380 || tmpulongest
== tdep
->ioctl_TIOCTTYGSTRUCT
381 || tmpulongest
== tdep
->ioctl_TIOCSBRK
382 || tmpulongest
== tdep
->ioctl_TIOCCBRK
383 || tmpulongest
== tdep
->ioctl_TCSETS2
384 || tmpulongest
== tdep
->ioctl_TCSETSW2
385 || tmpulongest
== tdep
->ioctl_TCSETSF2
386 || tmpulongest
== tdep
->ioctl_TIOCSPTLCK
387 || tmpulongest
== tdep
->ioctl_TIOCSERCONFIG
388 || tmpulongest
== tdep
->ioctl_TIOCSERGWILD
389 || tmpulongest
== tdep
->ioctl_TIOCSERSWILD
390 || tmpulongest
== tdep
->ioctl_TIOCSLCKTRMIOS
391 || tmpulongest
== tdep
->ioctl_TIOCSERGETMULTI
392 || tmpulongest
== tdep
->ioctl_TIOCSERSETMULTI
393 || tmpulongest
== tdep
->ioctl_TIOCMIWAIT
394 || tmpulongest
== tdep
->ioctl_TIOCSHAYESESP
)
398 else if (tmpulongest
== tdep
->ioctl_TCGETS
399 || tmpulongest
== tdep
->ioctl_TCGETA
400 || tmpulongest
== tdep
->ioctl_TIOCGLCKTRMIOS
)
402 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
404 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
408 else if (tmpulongest
== tdep
->ioctl_TIOCGPGRP
409 || tmpulongest
== tdep
->ioctl_TIOCGSID
)
411 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
413 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
417 else if (tmpulongest
== tdep
->ioctl_TIOCOUTQ
418 || tmpulongest
== tdep
->ioctl_TIOCMGET
419 || tmpulongest
== tdep
->ioctl_TIOCGSOFTCAR
420 || tmpulongest
== tdep
->ioctl_FIONREAD
421 || tmpulongest
== tdep
->ioctl_TIOCINQ
422 || tmpulongest
== tdep
->ioctl_TIOCGETD
423 || tmpulongest
== tdep
->ioctl_TIOCGPTN
424 || tmpulongest
== tdep
->ioctl_TIOCSERGETLSR
)
426 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
428 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
432 else if (tmpulongest
== tdep
->ioctl_TIOCGWINSZ
)
434 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
436 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
440 else if (tmpulongest
== tdep
->ioctl_TIOCLINUX
)
442 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
444 /* This syscall affects a char-size memory. */
445 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, 1))
448 else if (tmpulongest
== tdep
->ioctl_TIOCGSERIAL
)
450 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
452 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
453 tdep
->size_serial_struct
))
456 else if (tmpulongest
== tdep
->ioctl_TCGETS2
)
458 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
460 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
461 tdep
->size_termios2
))
464 else if (tmpulongest
== tdep
->ioctl_FIOQSIZE
)
466 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
468 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
472 else if (tmpulongest
== tdep
->ioctl_TIOCGICOUNT
)
474 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
476 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
477 tdep
->size_serial_icounter_struct
))
480 else if (tmpulongest
== tdep
->ioctl_TIOCGHAYESESP
)
482 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
484 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
485 tdep
->size_hayes_esp_config
))
488 else if (tmpulongest
== tdep
->ioctl_TIOCSERGSTRUCT
)
490 printf_unfiltered (_("Process record and replay target doesn't "
491 "support ioctl request TIOCSERGSTRUCT\n"));
496 printf_unfiltered (_("Process record and replay target doesn't "
497 "support ioctl request 0x%s.\n"),
498 OUTPUT_REG (tmpulongest
, tdep
->arg2
));
505 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
507 if (tmpulongest
== tdep
->fcntl_F_GETLK
)
509 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
511 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
517 case gdb_sys_ni_syscall56
:
518 case gdb_sys_setpgid
:
519 case gdb_sys_ni_syscall58
:
522 case gdb_sys_olduname
:
523 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
524 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
525 tdep
->size_oldold_utsname
))
534 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
535 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
541 case gdb_sys_getppid
:
542 case gdb_sys_getpgrp
:
546 case gdb_sys_sigaction
:
547 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
548 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
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 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
562 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
563 tdep
->size_old_sigset_t
))
567 case gdb_sys_sethostname
:
568 case gdb_sys_setrlimit
:
571 case gdb_sys_old_getrlimit
:
572 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
573 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
578 case gdb_sys_getrusage
:
579 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
580 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
585 case gdb_sys_gettimeofday
:
586 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
587 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
590 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
591 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
592 tdep
->size_timezone
))
596 case gdb_sys_settimeofday
:
599 case gdb_sys_getgroups16
:
600 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
601 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
602 tdep
->size_old_gid_t
))
606 case gdb_sys_setgroups16
:
607 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
608 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
609 tdep
->size_old_gid_t
))
615 struct sel_arg_struct
624 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
628 if (target_read_memory (tmpulongest
, (gdb_byte
*) &sel
,
632 fprintf_unfiltered (gdb_stdlog
,
633 "Process record: error reading memory "
634 "at addr = 0x%s len = %lu.\n",
635 OUTPUT_REG (tmpulongest
, tdep
->arg1
),
636 (unsigned long) sizeof (sel
));
639 if (record_arch_list_add_mem (sel
.inp
, tdep
->size_fd_set
))
641 if (record_arch_list_add_mem (sel
.outp
, tdep
->size_fd_set
))
643 if (record_arch_list_add_mem (sel
.exp
, tdep
->size_fd_set
))
645 if (record_arch_list_add_mem (sel
.tvp
, tdep
->size_timeval
))
651 case gdb_sys_symlink
:
654 case gdb_sys_readlink
:
657 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
659 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &len
);
660 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) len
))
672 target_terminal_ours ();
674 yquery (_("The next instruction is syscall reboot. "
675 "It will restart the computer. "
676 "Do you want to stop the program?"));
677 target_terminal_inferior ();
683 case gdb_old_readdir
:
684 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
685 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
698 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
700 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &len
);
701 target_terminal_ours ();
702 q
= yquery (_("The next instruction is syscall munmap. "
703 "It will free the memory addr = 0x%s len = %u. "
704 "It will make record target get error. "
705 "Do you want to stop the program?"),
706 OUTPUT_REG (tmpulongest
, tdep
->arg1
), (int) len
);
707 target_terminal_inferior ();
713 case gdb_sys_truncate
:
714 case gdb_sys_ftruncate
:
716 case gdb_sys_fchown16
:
717 case gdb_sys_getpriority
:
718 case gdb_sys_setpriority
:
719 case gdb_sys_ni_syscall98
:
723 case gdb_sys_fstatfs
:
724 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
725 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
735 case gdb_sys_sendmsg
:
736 case gdb_sys_shutdown
:
738 case gdb_sys_connect
:
740 case gdb_sys_setsockopt
:
744 case gdb_sys_getsockname
:
745 case gdb_sys_getpeername
:
748 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
749 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &len
);
750 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
755 case gdb_sys_recvfrom
:
758 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
759 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &len
);
760 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
766 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
767 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &size
);
768 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) size
))
773 case gdb_sys_recvmsg
:
774 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
775 if (record_linux_msghdr (regcache
, tdep
, tmpulongest
))
779 case gdb_sys_socketpair
:
780 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
781 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
785 case gdb_sys_getsockopt
:
786 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
790 gdb_byte
*optlenp
= alloca (tdep
->size_int
);
791 if (target_read_memory ((CORE_ADDR
) tmpulongest
, optlenp
,
795 fprintf_unfiltered (gdb_stdlog
,
796 "Process record: error reading "
797 "memory at addr = 0x%s "
799 OUTPUT_REG (tmpulongest
, tdep
->arg5
),
803 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &optvalp
);
804 tmpint
= (int) extract_signed_integer (optlenp
, tdep
->size_int
,
806 if (record_arch_list_add_mem ((CORE_ADDR
) optvalp
, tmpint
))
808 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
814 case gdb_sys_socketcall
:
815 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
818 case RECORD_SYS_SOCKET
:
819 case RECORD_SYS_BIND
:
820 case RECORD_SYS_CONNECT
:
821 case RECORD_SYS_LISTEN
:
823 case RECORD_SYS_ACCEPT
:
824 case RECORD_SYS_GETSOCKNAME
:
825 case RECORD_SYS_GETPEERNAME
:
827 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
831 gdb_byte
*a
= alloca (tdep
->size_ulong
* 2);
834 tmpulongest
+= tdep
->size_ulong
;
835 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
836 tdep
->size_ulong
* 2))
839 fprintf_unfiltered (gdb_stdlog
,
840 "Process record: error reading "
841 "memory at addr = 0x%s len = %d.\n",
842 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
843 tdep
->size_ulong
* 2);
846 tmpulongest
= extract_unsigned_integer (a
,
849 len
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
850 tdep
->size_ulong
, byte_order
);
851 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
857 case RECORD_SYS_SOCKETPAIR
:
859 gdb_byte
*a
= alloca (tdep
->size_ulong
);
860 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
864 tmpulongest
+= tdep
->size_ulong
* 3;
865 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
869 fprintf_unfiltered (gdb_stdlog
,
870 "Process record: error reading "
871 "memory at addr = 0x%s len = %d.\n",
872 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
877 = (CORE_ADDR
) extract_unsigned_integer (a
, tdep
->size_ulong
,
879 if (record_arch_list_add_mem (tmpaddr
, tdep
->size_int
))
884 case RECORD_SYS_SEND
:
885 case RECORD_SYS_SENDTO
:
887 case RECORD_SYS_RECVFROM
:
888 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
892 gdb_byte
*a
= alloca (tdep
->size_ulong
* 2);
895 tmpulongest
+= tdep
->size_ulong
* 4;
896 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
897 tdep
->size_ulong
* 2))
900 fprintf_unfiltered (gdb_stdlog
,
901 "Process record: error reading "
902 "memory at addr = 0x%s len = %d.\n",
903 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
904 tdep
->size_ulong
* 2);
907 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
909 len
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
910 tdep
->size_ulong
, byte_order
);
911 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
914 case RECORD_SYS_RECV
:
915 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
919 gdb_byte
*a
= alloca (tdep
->size_ulong
* 2);
921 tmpulongest
+= tdep
->size_ulong
;
922 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
926 fprintf_unfiltered (gdb_stdlog
,
927 "Process record: error reading "
928 "memory at addr = 0x%s len = %d.\n",
929 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
933 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
937 a
+= tdep
->size_ulong
;
938 tmpint
= (int) extract_unsigned_integer (a
, tdep
->size_ulong
,
940 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
946 case RECORD_SYS_SHUTDOWN
:
947 case RECORD_SYS_SETSOCKOPT
:
949 case RECORD_SYS_GETSOCKOPT
:
951 gdb_byte
*a
= alloca (tdep
->size_ulong
* 2);
952 gdb_byte
*av
= alloca (tdep
->size_int
);
954 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
958 tmpulongest
+= tdep
->size_ulong
* 3;
959 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
960 tdep
->size_ulong
* 2))
963 fprintf_unfiltered (gdb_stdlog
,
964 "Process record: error reading "
965 "memory at addr = 0x%s len = %d.\n",
966 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
967 tdep
->size_ulong
* 2);
970 tmpulongest
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
975 if (target_read_memory ((CORE_ADDR
) tmpulongest
, av
,
979 fprintf_unfiltered (gdb_stdlog
,
980 "Process record: error reading "
981 "memory at addr = 0x%s "
983 phex_nz (tmpulongest
,
989 = (CORE_ADDR
) extract_unsigned_integer (a
,
992 tmpint
= (int) extract_unsigned_integer (av
,
995 if (record_arch_list_add_mem (tmpaddr
, tmpint
))
997 a
+= tdep
->size_ulong
;
999 = (CORE_ADDR
) extract_unsigned_integer (a
,
1002 if (record_arch_list_add_mem (tmpaddr
, tdep
->size_int
))
1008 case RECORD_SYS_SENDMSG
:
1010 case RECORD_SYS_RECVMSG
:
1012 gdb_byte
*a
= alloca (tdep
->size_ulong
);
1014 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1018 tmpulongest
+= tdep
->size_ulong
;
1019 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
1023 fprintf_unfiltered (gdb_stdlog
,
1024 "Process record: error reading "
1025 "memory at addr = 0x%s len = %d.\n",
1026 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
1030 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
1032 if (record_linux_msghdr (regcache
, tdep
, tmpulongest
))
1038 printf_unfiltered (_("Process record and replay target "
1039 "doesn't support socketcall call 0x%s\n"),
1040 OUTPUT_REG (tmpulongest
, tdep
->arg1
));
1046 case gdb_sys_syslog
:
1049 case gdb_sys_setitimer
:
1050 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1051 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1052 tdep
->size_itimerval
))
1056 case gdb_sys_getitimer
:
1057 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1058 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1059 tdep
->size_itimerval
))
1063 case gdb_sys_newstat
:
1064 case gdb_sys_newlstat
:
1065 case gdb_sys_newfstat
:
1066 case gdb_sys_newfstatat
:
1067 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1068 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_stat
))
1073 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1074 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1075 tdep
->size_old_utsname
))
1080 case gdb_sys_vhangup
:
1081 case gdb_sys_ni_syscall112
:
1082 case gdb_sys_vm86old
:
1086 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1087 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1090 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1091 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1096 case gdb_sys_swapoff
:
1099 case gdb_sys_sysinfo
:
1100 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1101 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1102 tdep
->size_sysinfo
))
1106 case gdb_sys_shmget
:
1107 case gdb_sys_semget
:
1109 case gdb_sys_msgget
:
1110 /* XXX maybe need do some record works with sys_shmdt. */
1112 case gdb_sys_msgsnd
:
1113 case gdb_sys_semtimedop
:
1117 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1118 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1123 case gdb_sys_shmctl
:
1124 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1125 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1126 tdep
->size_shmid_ds
))
1130 /* XXX sys_semctl 525 still not supported. */
1133 case gdb_sys_msgrcv
:
1136 regcache_raw_read_signed (regcache
, tdep
->arg3
, &tmpulongest
);
1137 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &msgp
);
1138 tmpint
= (int) tmpulongest
+ tdep
->size_long
;
1139 if (record_arch_list_add_mem ((CORE_ADDR
) msgp
, tmpint
))
1144 case gdb_sys_msgctl
:
1145 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1146 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1147 tdep
->size_msqid_ds
))
1152 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1153 tmpulongest
&= 0xffff;
1154 switch (tmpulongest
)
1158 case RECORD_SEMTIMEDOP
:
1161 /* XXX maybe need do some record works with RECORD_SHMDT. */
1169 regcache_raw_read_signed (regcache
, tdep
->arg3
, &second
);
1170 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &ptr
);
1171 tmpint
= (int) second
+ tdep
->size_long
;
1172 if (record_arch_list_add_mem ((CORE_ADDR
) ptr
, tmpint
))
1177 regcache_raw_read_unsigned (regcache
, tdep
->arg5
,
1179 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1180 tdep
->size_msqid_ds
))
1184 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1186 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1191 regcache_raw_read_unsigned (regcache
, tdep
->arg5
,
1193 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1194 tdep
->size_shmid_ds
))
1198 /* XXX RECORD_SEMCTL still not supported. */
1199 printf_unfiltered (_("Process record and replay target doesn't "
1200 "support ipc number %s\n"),
1201 pulongest (tmpulongest
));
1207 case gdb_sys_sigreturn
:
1209 case gdb_sys_setdomainname
:
1212 case gdb_sys_newuname
:
1213 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1214 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1215 tdep
->size_new_utsname
))
1219 case gdb_sys_modify_ldt
:
1220 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1221 if (tmpulongest
== 0 || tmpulongest
== 2)
1223 ULONGEST ptr
, bytecount
;
1224 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &ptr
);
1225 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &bytecount
);
1226 if (record_arch_list_add_mem ((CORE_ADDR
) ptr
, (int) bytecount
))
1231 case gdb_sys_adjtimex
:
1232 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1233 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_timex
))
1237 case gdb_sys_mprotect
:
1240 case gdb_sys_sigprocmask
:
1241 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1242 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1243 tdep
->size_old_sigset_t
))
1247 case gdb_sys_ni_syscall127
:
1248 case gdb_sys_init_module
:
1249 case gdb_sys_delete_module
:
1250 case gdb_sys_ni_syscall130
:
1253 case gdb_sys_quotactl
:
1254 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1255 switch (tmpulongest
)
1257 case RECORD_Q_GETFMT
:
1258 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1261 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, 4))
1264 case RECORD_Q_GETINFO
:
1265 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1267 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1268 tdep
->size_mem_dqinfo
))
1271 case RECORD_Q_GETQUOTA
:
1272 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1274 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1275 tdep
->size_if_dqblk
))
1278 case RECORD_Q_XGETQSTAT
:
1279 case RECORD_Q_XGETQUOTA
:
1280 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1282 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1283 tdep
->size_fs_quota_stat
))
1289 case gdb_sys_getpgid
:
1290 case gdb_sys_fchdir
:
1291 case gdb_sys_bdflush
:
1295 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1296 if (tmpulongest
== 2)
1298 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
1300 /*XXX the size of memory is not very clear. */
1301 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, 10))
1306 case gdb_sys_personality
:
1307 case gdb_sys_ni_syscall137
:
1308 case gdb_sys_setfsuid16
:
1309 case gdb_sys_setfsgid16
:
1312 case gdb_sys_llseek
:
1313 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1314 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1319 case gdb_sys_getdents
:
1322 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1324 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &count
);
1325 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1326 tdep
->size_dirent
* count
))
1331 case gdb_sys_select
:
1332 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1333 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1336 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1337 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1340 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1341 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1344 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
1345 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1346 tdep
->size_timeval
))
1358 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &vec
);
1361 gdb_byte
*iov
= alloca (tdep
->size_iovec
);
1363 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &vlen
);
1364 for (tmpulongest
= 0; tmpulongest
< vlen
; tmpulongest
++)
1366 if (target_read_memory ((CORE_ADDR
) vec
, iov
,
1370 fprintf_unfiltered (gdb_stdlog
,
1371 "Process record: error reading "
1372 "memory at addr = 0x%s len = %d.\n",
1373 OUTPUT_REG (vec
, tdep
->arg2
),
1378 = (CORE_ADDR
) extract_unsigned_integer (iov
,
1382 = (int) extract_unsigned_integer (iov
+ tdep
->size_pointer
,
1385 if (record_arch_list_add_mem (tmpaddr
, tmpint
))
1387 vec
+= tdep
->size_iovec
;
1393 case gdb_sys_writev
:
1394 case gdb_sys_getsid
:
1395 case gdb_sys_fdatasync
:
1396 case gdb_sys_sysctl
:
1398 case gdb_sys_munlock
:
1399 case gdb_sys_mlockall
:
1400 case gdb_sys_munlockall
:
1401 case gdb_sys_sched_setparam
:
1404 case gdb_sys_sched_getparam
:
1405 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1406 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
1410 case gdb_sys_sched_setscheduler
:
1411 case gdb_sys_sched_getscheduler
:
1412 case gdb_sys_sched_yield
:
1413 case gdb_sys_sched_get_priority_max
:
1414 case gdb_sys_sched_get_priority_min
:
1417 case gdb_sys_sched_rr_get_interval
:
1418 case gdb_sys_nanosleep
:
1419 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1420 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1421 tdep
->size_timespec
))
1425 case gdb_sys_mremap
:
1426 case gdb_sys_setresuid16
:
1429 case gdb_sys_getresuid16
:
1430 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1431 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1432 tdep
->size_old_uid_t
))
1434 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1435 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1436 tdep
->size_old_uid_t
))
1438 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1439 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1440 tdep
->size_old_uid_t
))
1445 case gdb_sys_ni_syscall167
:
1449 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1453 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nfds
);
1454 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1455 tdep
->size_pollfd
* nfds
))
1460 case gdb_sys_nfsservctl
:
1461 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1462 if (tmpulongest
== 7 || tmpulongest
== 8)
1465 if (tmpulongest
== 7)
1466 rsize
= tdep
->size_NFS_FHSIZE
;
1468 rsize
= tdep
->size_knfsd_fh
;
1469 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
1471 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, rsize
))
1476 case gdb_sys_setresgid16
:
1479 case gdb_sys_getresgid16
:
1480 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1481 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1482 tdep
->size_old_gid_t
))
1484 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1485 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1486 tdep
->size_old_gid_t
))
1488 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1489 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1490 tdep
->size_old_gid_t
))
1495 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1496 switch (tmpulongest
)
1499 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1501 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1506 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1508 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1509 tdep
->size_TASK_COMM_LEN
))
1515 case gdb_sys_rt_sigreturn
:
1518 case gdb_sys_rt_sigaction
:
1519 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1520 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1521 tdep
->size_sigaction
))
1525 case gdb_sys_rt_sigprocmask
:
1526 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1527 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1528 tdep
->size_sigset_t
))
1532 case gdb_sys_rt_sigpending
:
1533 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1536 ULONGEST sigsetsize
;
1537 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,&sigsetsize
);
1538 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1544 case gdb_sys_rt_sigtimedwait
:
1545 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1546 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1547 tdep
->size_siginfo_t
))
1551 case gdb_sys_rt_sigqueueinfo
:
1552 case gdb_sys_rt_sigsuspend
:
1555 case gdb_sys_pread64
:
1556 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1560 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,&count
);
1561 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) count
))
1566 case gdb_sys_pwrite64
:
1567 case gdb_sys_chown16
:
1570 case gdb_sys_getcwd
:
1571 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1575 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &size
);
1576 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) size
))
1581 case gdb_sys_capget
:
1582 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1583 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1584 tdep
->size_cap_user_data_t
))
1588 case gdb_sys_capset
:
1591 case gdb_sys_sigaltstack
:
1592 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1593 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1594 tdep
->size_stack_t
))
1598 case gdb_sys_sendfile
:
1599 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1600 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1605 case gdb_sys_ni_syscall188
:
1606 case gdb_sys_ni_syscall189
:
1610 case gdb_sys_getrlimit
:
1611 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1612 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1620 case gdb_sys_truncate64
:
1621 case gdb_sys_ftruncate64
:
1624 case gdb_sys_stat64
:
1625 case gdb_sys_lstat64
:
1626 case gdb_sys_fstat64
:
1627 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1628 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1633 case gdb_sys_lchown
:
1634 case gdb_sys_getuid
:
1635 case gdb_sys_getgid
:
1636 case gdb_sys_geteuid
:
1637 case gdb_sys_getegid
:
1638 case gdb_sys_setreuid
:
1639 case gdb_sys_setregid
:
1642 case gdb_sys_getgroups
:
1643 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1646 ULONGEST gidsetsize
;
1647 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
1649 tmpint
= tdep
->size_gid_t
* (int) gidsetsize
;
1650 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
1655 case gdb_sys_setgroups
:
1656 case gdb_sys_fchown
:
1657 case gdb_sys_setresuid
:
1660 case gdb_sys_getresuid
:
1661 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1662 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_uid_t
))
1664 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1665 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_uid_t
))
1667 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1668 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_uid_t
))
1672 case gdb_sys_setresgid
:
1675 case gdb_sys_getresgid
:
1676 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1677 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_gid_t
))
1679 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1680 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_gid_t
))
1682 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1683 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_gid_t
))
1688 case gdb_sys_setuid
:
1689 case gdb_sys_setgid
:
1690 case gdb_sys_setfsuid
:
1691 case gdb_sys_setfsgid
:
1692 case gdb_sys_pivot_root
:
1695 case gdb_sys_mincore
:
1696 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1697 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1698 tdep
->size_PAGE_SIZE
))
1702 case gdb_sys_madvise
:
1705 case gdb_sys_getdents64
:
1708 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1710 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &count
);
1711 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1712 tdep
->size_dirent64
* count
))
1717 case gdb_sys_fcntl64
:
1718 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1719 if (tmpulongest
== tdep
->fcntl_F_GETLK64
)
1721 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
1723 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1724 tdep
->size_flock64
))
1727 else if (tmpulongest
!= tdep
->fcntl_F_SETLK64
1728 && tmpulongest
!= tdep
->fcntl_F_SETLKW64
)
1734 case gdb_sys_ni_syscall222
:
1735 case gdb_sys_ni_syscall223
:
1736 case gdb_sys_gettid
:
1737 case gdb_sys_readahead
:
1738 case gdb_sys_setxattr
:
1739 case gdb_sys_lsetxattr
:
1740 case gdb_sys_fsetxattr
:
1743 case gdb_sys_getxattr
:
1744 case gdb_sys_lgetxattr
:
1745 case gdb_sys_fgetxattr
:
1746 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1750 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &size
);
1751 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) size
))
1756 case gdb_sys_listxattr
:
1757 case gdb_sys_llistxattr
:
1758 case gdb_sys_flistxattr
:
1759 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1763 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &size
);
1764 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) size
))
1769 case gdb_sys_removexattr
:
1770 case gdb_sys_lremovexattr
:
1771 case gdb_sys_fremovexattr
:
1775 case gdb_sys_sendfile64
:
1776 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1777 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1783 case gdb_sys_sched_setaffinity
:
1786 case gdb_sys_sched_getaffinity
:
1787 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1791 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &len
);
1792 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) len
))
1797 case gdb_sys_set_thread_area
:
1798 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1799 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
1803 case gdb_sys_get_thread_area
:
1804 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1805 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1806 tdep
->size_user_desc
))
1810 case gdb_sys_io_setup
:
1811 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1812 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_long
))
1816 case gdb_sys_io_destroy
:
1819 case gdb_sys_io_getevents
:
1820 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1824 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &nr
);
1825 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1826 nr
* tdep
->size_io_event
))
1831 case gdb_sys_io_submit
:
1832 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1838 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nr
);
1839 iocbp
= alloca (nr
* tdep
->size_pointer
);
1840 if (target_read_memory ((CORE_ADDR
) tmpulongest
, iocbp
,
1841 nr
* tdep
->size_pointer
))
1844 fprintf_unfiltered (gdb_stdlog
,
1845 "Process record: error reading memory "
1846 "at addr = 0x%s len = %u.\n",
1847 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
1848 (int) (nr
* tdep
->size_pointer
));
1851 for (i
= 0; i
< nr
; i
++)
1854 = (CORE_ADDR
) extract_unsigned_integer (iocbp
,
1857 if (record_arch_list_add_mem (tmpaddr
, tdep
->size_iocb
))
1859 iocbp
+= tdep
->size_pointer
;
1864 case gdb_sys_io_cancel
:
1865 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1866 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1867 tdep
->size_io_event
))
1871 case gdb_sys_fadvise64
:
1872 case gdb_sys_ni_syscall251
:
1875 case gdb_sys_exit_group
:
1878 target_terminal_ours ();
1879 q
= yquery (_("The next instruction is syscall exit_group. "
1880 "It will make the program exit. "
1881 "Do you want to stop the program?"));
1882 target_terminal_inferior ();
1888 case gdb_sys_lookup_dcookie
:
1889 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1893 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &len
);
1894 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) len
))
1899 case gdb_sys_epoll_create
:
1900 case gdb_sys_epoll_ctl
:
1903 case gdb_sys_epoll_wait
:
1904 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1908 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxevents
);
1909 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1910 maxevents
* tdep
->size_epoll_event
))
1915 case gdb_sys_remap_file_pages
:
1916 case gdb_sys_set_tid_address
:
1919 case gdb_sys_timer_create
:
1920 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1921 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
1925 case gdb_sys_timer_settime
:
1926 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1927 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1928 tdep
->size_itimerspec
))
1932 case gdb_sys_timer_gettime
:
1933 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1934 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1935 tdep
->size_itimerspec
))
1939 case gdb_sys_timer_getoverrun
:
1940 case gdb_sys_timer_delete
:
1941 case gdb_sys_clock_settime
:
1944 case gdb_sys_clock_gettime
:
1945 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1946 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1947 tdep
->size_timespec
))
1951 case gdb_sys_clock_getres
:
1952 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1953 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1954 tdep
->size_timespec
))
1958 case gdb_sys_clock_nanosleep
:
1959 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1960 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1961 tdep
->size_timespec
))
1965 case gdb_sys_statfs64
:
1966 case gdb_sys_fstatfs64
:
1967 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1968 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1969 tdep
->size_statfs64
))
1973 case gdb_sys_tgkill
:
1974 case gdb_sys_utimes
:
1975 case gdb_sys_fadvise64_64
:
1976 case gdb_sys_ni_syscall273
:
1980 case gdb_sys_get_mempolicy
:
1981 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1982 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
1984 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1988 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxnode
);
1989 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1990 maxnode
* tdep
->size_long
))
1995 case gdb_sys_set_mempolicy
:
1996 case gdb_sys_mq_open
:
1997 case gdb_sys_mq_unlink
:
1998 case gdb_sys_mq_timedsend
:
2001 case gdb_sys_mq_timedreceive
:
2002 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2006 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &msg_len
);
2007 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2011 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
2012 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2016 case gdb_sys_mq_notify
:
2019 case gdb_sys_mq_getsetattr
:
2020 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2021 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2022 tdep
->size_mq_attr
))
2026 case gdb_sys_kexec_load
:
2029 case gdb_sys_waitid
:
2030 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2031 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2032 tdep
->size_siginfo
))
2034 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
2035 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2040 case gdb_sys_ni_syscall285
:
2041 case gdb_sys_add_key
:
2042 case gdb_sys_request_key
:
2045 case gdb_sys_keyctl
:
2046 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
2047 if (tmpulongest
== 6 || tmpulongest
== 11)
2049 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
2054 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &buflen
);
2055 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2062 case gdb_sys_ioprio_set
:
2063 case gdb_sys_ioprio_get
:
2064 case gdb_sys_inotify_init
:
2065 case gdb_sys_inotify_add_watch
:
2066 case gdb_sys_inotify_rm_watch
:
2067 case gdb_sys_migrate_pages
:
2068 case gdb_sys_openat
:
2069 case gdb_sys_mkdirat
:
2070 case gdb_sys_mknodat
:
2071 case gdb_sys_fchownat
:
2072 case gdb_sys_futimesat
:
2075 case gdb_sys_fstatat64
:
2076 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2077 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2082 case gdb_sys_unlinkat
:
2083 case gdb_sys_renameat
:
2084 case gdb_sys_linkat
:
2085 case gdb_sys_symlinkat
:
2088 case gdb_sys_readlinkat
:
2089 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2093 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &bufsiz
);
2094 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) bufsiz
))
2099 case gdb_sys_fchmodat
:
2100 case gdb_sys_faccessat
:
2103 case gdb_sys_pselect6
:
2104 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2105 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2108 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2109 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2112 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
2113 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2116 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
2117 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2118 tdep
->size_timespec
))
2123 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
2127 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nfds
);
2128 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2129 tdep
->size_pollfd
* nfds
))
2132 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2133 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2134 tdep
->size_timespec
))
2138 case gdb_sys_unshare
:
2139 case gdb_sys_set_robust_list
:
2142 case gdb_sys_get_robust_list
:
2143 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2144 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2146 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2147 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2151 case gdb_sys_splice
:
2152 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2153 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2156 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
2157 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2162 case gdb_sys_sync_file_range
:
2164 case gdb_sys_vmsplice
:
2167 case gdb_sys_move_pages
:
2168 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
2172 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nr_pages
);
2173 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2174 nr_pages
* tdep
->size_int
))
2179 case gdb_sys_getcpu
:
2180 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
2181 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2183 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2184 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2186 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2187 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2188 tdep
->size_ulong
* 2))
2192 case gdb_sys_epoll_pwait
:
2193 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2197 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxevents
);
2198 tmpint
= (int) maxevents
* tdep
->size_epoll_event
;
2199 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
2205 printf_unfiltered (_("Process record and replay target doesn't "
2206 "support syscall number %d\n"), syscall
);