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);
836 tmpulongest
+= tdep
->size_ulong
;
837 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
838 tdep
->size_ulong
* 2))
841 fprintf_unfiltered (gdb_stdlog
,
842 "Process record: error reading "
843 "memory at addr = 0x%s len = %d.\n",
844 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
845 tdep
->size_ulong
* 2);
848 tmpulongest
= extract_unsigned_integer (a
,
851 len
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
852 tdep
->size_ulong
, byte_order
);
853 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
859 case RECORD_SYS_SOCKETPAIR
:
861 gdb_byte
*a
= alloca (tdep
->size_ulong
);
862 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
866 tmpulongest
+= tdep
->size_ulong
* 3;
867 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
871 fprintf_unfiltered (gdb_stdlog
,
872 "Process record: error reading "
873 "memory at addr = 0x%s len = %d.\n",
874 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
879 = (CORE_ADDR
) extract_unsigned_integer (a
, tdep
->size_ulong
,
881 if (record_arch_list_add_mem (tmpaddr
, tdep
->size_int
))
886 case RECORD_SYS_SEND
:
887 case RECORD_SYS_SENDTO
:
889 case RECORD_SYS_RECVFROM
:
890 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
894 gdb_byte
*a
= alloca (tdep
->size_ulong
* 2);
899 tmpulongest
+= tdep
->size_ulong
* 4;
900 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
901 tdep
->size_ulong
* 2))
904 fprintf_unfiltered (gdb_stdlog
,
905 "Process record: error reading "
906 "memory at addr = 0x%s len = %d.\n",
907 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
908 tdep
->size_ulong
* 2);
911 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
913 len
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
914 tdep
->size_ulong
, byte_order
);
915 if (record_linux_sockaddr (regcache
, tdep
, tmpulongest
, len
))
918 case RECORD_SYS_RECV
:
919 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
923 gdb_byte
*a
= alloca (tdep
->size_ulong
* 2);
925 tmpulongest
+= tdep
->size_ulong
;
926 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
930 fprintf_unfiltered (gdb_stdlog
,
931 "Process record: error reading "
932 "memory at addr = 0x%s len = %d.\n",
933 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
937 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
941 a
+= tdep
->size_ulong
;
942 tmpint
= (int) extract_unsigned_integer (a
, tdep
->size_ulong
,
944 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
950 case RECORD_SYS_SHUTDOWN
:
951 case RECORD_SYS_SETSOCKOPT
:
953 case RECORD_SYS_GETSOCKOPT
:
955 gdb_byte
*a
= alloca (tdep
->size_ulong
* 2);
956 gdb_byte
*av
= alloca (tdep
->size_int
);
958 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
962 tmpulongest
+= tdep
->size_ulong
* 3;
963 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
964 tdep
->size_ulong
* 2))
967 fprintf_unfiltered (gdb_stdlog
,
968 "Process record: error reading "
969 "memory at addr = 0x%s len = %d.\n",
970 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
971 tdep
->size_ulong
* 2);
974 tmpulongest
= extract_unsigned_integer (a
+ tdep
->size_ulong
,
979 if (target_read_memory ((CORE_ADDR
) tmpulongest
, av
,
983 fprintf_unfiltered (gdb_stdlog
,
984 "Process record: error reading "
985 "memory at addr = 0x%s "
987 phex_nz (tmpulongest
,
993 = (CORE_ADDR
) extract_unsigned_integer (a
,
996 tmpint
= (int) extract_unsigned_integer (av
,
999 if (record_arch_list_add_mem (tmpaddr
, tmpint
))
1001 a
+= tdep
->size_ulong
;
1003 = (CORE_ADDR
) extract_unsigned_integer (a
,
1006 if (record_arch_list_add_mem (tmpaddr
, tdep
->size_int
))
1012 case RECORD_SYS_SENDMSG
:
1014 case RECORD_SYS_RECVMSG
:
1016 gdb_byte
*a
= alloca (tdep
->size_ulong
);
1018 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1022 tmpulongest
+= tdep
->size_ulong
;
1023 if (target_read_memory ((CORE_ADDR
) tmpulongest
, a
,
1027 fprintf_unfiltered (gdb_stdlog
,
1028 "Process record: error reading "
1029 "memory at addr = 0x%s len = %d.\n",
1030 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
1034 tmpulongest
= extract_unsigned_integer (a
, tdep
->size_ulong
,
1036 if (record_linux_msghdr (regcache
, tdep
, tmpulongest
))
1042 printf_unfiltered (_("Process record and replay target "
1043 "doesn't support socketcall call 0x%s\n"),
1044 OUTPUT_REG (tmpulongest
, tdep
->arg1
));
1050 case gdb_sys_syslog
:
1053 case gdb_sys_setitimer
:
1054 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1055 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1056 tdep
->size_itimerval
))
1060 case gdb_sys_getitimer
:
1061 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1062 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1063 tdep
->size_itimerval
))
1067 case gdb_sys_newstat
:
1068 case gdb_sys_newlstat
:
1069 case gdb_sys_newfstat
:
1070 case gdb_sys_newfstatat
:
1071 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1072 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_stat
))
1077 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1078 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1079 tdep
->size_old_utsname
))
1084 case gdb_sys_vhangup
:
1085 case gdb_sys_ni_syscall112
:
1086 case gdb_sys_vm86old
:
1090 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1091 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1094 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1095 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1100 case gdb_sys_swapoff
:
1103 case gdb_sys_sysinfo
:
1104 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1105 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1106 tdep
->size_sysinfo
))
1110 case gdb_sys_shmget
:
1111 case gdb_sys_semget
:
1113 case gdb_sys_msgget
:
1114 /* XXX maybe need do some record works with sys_shmdt. */
1116 case gdb_sys_msgsnd
:
1117 case gdb_sys_semtimedop
:
1121 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1122 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1127 case gdb_sys_shmctl
:
1128 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1129 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1130 tdep
->size_shmid_ds
))
1134 /* XXX sys_semctl 525 still not supported. */
1137 case gdb_sys_msgrcv
:
1140 regcache_raw_read_signed (regcache
, tdep
->arg3
, &tmpulongest
);
1141 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &msgp
);
1142 tmpint
= (int) tmpulongest
+ tdep
->size_long
;
1143 if (record_arch_list_add_mem ((CORE_ADDR
) msgp
, tmpint
))
1148 case gdb_sys_msgctl
:
1149 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1150 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1151 tdep
->size_msqid_ds
))
1156 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1157 tmpulongest
&= 0xffff;
1158 switch (tmpulongest
)
1162 case RECORD_SEMTIMEDOP
:
1165 /* XXX maybe need do some record works with RECORD_SHMDT. */
1173 regcache_raw_read_signed (regcache
, tdep
->arg3
, &second
);
1174 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &ptr
);
1175 tmpint
= (int) second
+ tdep
->size_long
;
1176 if (record_arch_list_add_mem ((CORE_ADDR
) ptr
, tmpint
))
1181 regcache_raw_read_unsigned (regcache
, tdep
->arg5
,
1183 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1184 tdep
->size_msqid_ds
))
1188 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1190 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1195 regcache_raw_read_unsigned (regcache
, tdep
->arg5
,
1197 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1198 tdep
->size_shmid_ds
))
1202 /* XXX RECORD_SEMCTL still not supported. */
1203 printf_unfiltered (_("Process record and replay target doesn't "
1204 "support ipc number %s\n"),
1205 pulongest (tmpulongest
));
1211 case gdb_sys_sigreturn
:
1213 case gdb_sys_setdomainname
:
1216 case gdb_sys_newuname
:
1217 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1218 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1219 tdep
->size_new_utsname
))
1223 case gdb_sys_modify_ldt
:
1224 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1225 if (tmpulongest
== 0 || tmpulongest
== 2)
1227 ULONGEST ptr
, bytecount
;
1228 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &ptr
);
1229 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &bytecount
);
1230 if (record_arch_list_add_mem ((CORE_ADDR
) ptr
, (int) bytecount
))
1235 case gdb_sys_adjtimex
:
1236 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1237 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_timex
))
1241 case gdb_sys_mprotect
:
1244 case gdb_sys_sigprocmask
:
1245 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1246 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1247 tdep
->size_old_sigset_t
))
1251 case gdb_sys_ni_syscall127
:
1252 case gdb_sys_init_module
:
1253 case gdb_sys_delete_module
:
1254 case gdb_sys_ni_syscall130
:
1257 case gdb_sys_quotactl
:
1258 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1259 switch (tmpulongest
)
1261 case RECORD_Q_GETFMT
:
1262 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1265 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, 4))
1268 case RECORD_Q_GETINFO
:
1269 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1271 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1272 tdep
->size_mem_dqinfo
))
1275 case RECORD_Q_GETQUOTA
:
1276 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1278 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1279 tdep
->size_if_dqblk
))
1282 case RECORD_Q_XGETQSTAT
:
1283 case RECORD_Q_XGETQUOTA
:
1284 regcache_raw_read_unsigned (regcache
, tdep
->arg4
,
1286 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1287 tdep
->size_fs_quota_stat
))
1293 case gdb_sys_getpgid
:
1294 case gdb_sys_fchdir
:
1295 case gdb_sys_bdflush
:
1299 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1300 if (tmpulongest
== 2)
1302 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
1304 /*XXX the size of memory is not very clear. */
1305 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, 10))
1310 case gdb_sys_personality
:
1311 case gdb_sys_ni_syscall137
:
1312 case gdb_sys_setfsuid16
:
1313 case gdb_sys_setfsgid16
:
1316 case gdb_sys_llseek
:
1317 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1318 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1323 case gdb_sys_getdents
:
1326 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1328 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &count
);
1329 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1330 tdep
->size_dirent
* count
))
1335 case gdb_sys_select
:
1336 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1337 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1340 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1341 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1344 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1345 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1348 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
1349 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1350 tdep
->size_timeval
))
1362 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &vec
);
1365 gdb_byte
*iov
= alloca (tdep
->size_iovec
);
1367 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &vlen
);
1368 for (tmpulongest
= 0; tmpulongest
< vlen
; tmpulongest
++)
1370 if (target_read_memory ((CORE_ADDR
) vec
, iov
,
1374 fprintf_unfiltered (gdb_stdlog
,
1375 "Process record: error reading "
1376 "memory at addr = 0x%s len = %d.\n",
1377 OUTPUT_REG (vec
, tdep
->arg2
),
1382 = (CORE_ADDR
) extract_unsigned_integer (iov
,
1386 = (int) extract_unsigned_integer (iov
+ tdep
->size_pointer
,
1389 if (record_arch_list_add_mem (tmpaddr
, tmpint
))
1391 vec
+= tdep
->size_iovec
;
1397 case gdb_sys_writev
:
1398 case gdb_sys_getsid
:
1399 case gdb_sys_fdatasync
:
1400 case gdb_sys_sysctl
:
1402 case gdb_sys_munlock
:
1403 case gdb_sys_mlockall
:
1404 case gdb_sys_munlockall
:
1405 case gdb_sys_sched_setparam
:
1408 case gdb_sys_sched_getparam
:
1409 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1410 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
1414 case gdb_sys_sched_setscheduler
:
1415 case gdb_sys_sched_getscheduler
:
1416 case gdb_sys_sched_yield
:
1417 case gdb_sys_sched_get_priority_max
:
1418 case gdb_sys_sched_get_priority_min
:
1421 case gdb_sys_sched_rr_get_interval
:
1422 case gdb_sys_nanosleep
:
1423 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1424 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1425 tdep
->size_timespec
))
1429 case gdb_sys_mremap
:
1430 case gdb_sys_setresuid16
:
1433 case gdb_sys_getresuid16
:
1434 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1435 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1436 tdep
->size_old_uid_t
))
1438 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1439 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1440 tdep
->size_old_uid_t
))
1442 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1443 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1444 tdep
->size_old_uid_t
))
1449 case gdb_sys_ni_syscall167
:
1453 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1457 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nfds
);
1458 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1459 tdep
->size_pollfd
* nfds
))
1464 case gdb_sys_nfsservctl
:
1465 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1466 if (tmpulongest
== 7 || tmpulongest
== 8)
1469 if (tmpulongest
== 7)
1470 rsize
= tdep
->size_NFS_FHSIZE
;
1472 rsize
= tdep
->size_knfsd_fh
;
1473 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
1475 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, rsize
))
1480 case gdb_sys_setresgid16
:
1483 case gdb_sys_getresgid16
:
1484 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1485 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1486 tdep
->size_old_gid_t
))
1488 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1489 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1490 tdep
->size_old_gid_t
))
1492 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1493 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1494 tdep
->size_old_gid_t
))
1499 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1500 switch (tmpulongest
)
1503 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1505 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1510 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1512 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1513 tdep
->size_TASK_COMM_LEN
))
1519 case gdb_sys_rt_sigreturn
:
1522 case gdb_sys_rt_sigaction
:
1523 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1524 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1525 tdep
->size_sigaction
))
1529 case gdb_sys_rt_sigprocmask
:
1530 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1531 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1532 tdep
->size_sigset_t
))
1536 case gdb_sys_rt_sigpending
:
1537 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1540 ULONGEST sigsetsize
;
1541 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,&sigsetsize
);
1542 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1548 case gdb_sys_rt_sigtimedwait
:
1549 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1550 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1551 tdep
->size_siginfo_t
))
1555 case gdb_sys_rt_sigqueueinfo
:
1556 case gdb_sys_rt_sigsuspend
:
1559 case gdb_sys_pread64
:
1560 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1564 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,&count
);
1565 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) count
))
1570 case gdb_sys_pwrite64
:
1571 case gdb_sys_chown16
:
1574 case gdb_sys_getcwd
:
1575 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1579 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &size
);
1580 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) size
))
1585 case gdb_sys_capget
:
1586 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1587 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1588 tdep
->size_cap_user_data_t
))
1592 case gdb_sys_capset
:
1595 case gdb_sys_sigaltstack
:
1596 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1597 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1598 tdep
->size_stack_t
))
1602 case gdb_sys_sendfile
:
1603 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1604 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1609 case gdb_sys_ni_syscall188
:
1610 case gdb_sys_ni_syscall189
:
1614 case gdb_sys_getrlimit
:
1615 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1616 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1624 case gdb_sys_truncate64
:
1625 case gdb_sys_ftruncate64
:
1628 case gdb_sys_stat64
:
1629 case gdb_sys_lstat64
:
1630 case gdb_sys_fstat64
:
1631 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1632 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1637 case gdb_sys_lchown
:
1638 case gdb_sys_getuid
:
1639 case gdb_sys_getgid
:
1640 case gdb_sys_geteuid
:
1641 case gdb_sys_getegid
:
1642 case gdb_sys_setreuid
:
1643 case gdb_sys_setregid
:
1646 case gdb_sys_getgroups
:
1647 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1650 ULONGEST gidsetsize
;
1651 regcache_raw_read_unsigned (regcache
, tdep
->arg1
,
1653 tmpint
= tdep
->size_gid_t
* (int) gidsetsize
;
1654 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
1659 case gdb_sys_setgroups
:
1660 case gdb_sys_fchown
:
1661 case gdb_sys_setresuid
:
1664 case gdb_sys_getresuid
:
1665 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1666 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_uid_t
))
1668 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1669 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_uid_t
))
1671 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1672 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_uid_t
))
1676 case gdb_sys_setresgid
:
1679 case gdb_sys_getresgid
:
1680 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1681 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_gid_t
))
1683 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1684 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_gid_t
))
1686 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1687 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_gid_t
))
1692 case gdb_sys_setuid
:
1693 case gdb_sys_setgid
:
1694 case gdb_sys_setfsuid
:
1695 case gdb_sys_setfsgid
:
1696 case gdb_sys_pivot_root
:
1699 case gdb_sys_mincore
:
1700 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1701 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1702 tdep
->size_PAGE_SIZE
))
1706 case gdb_sys_madvise
:
1709 case gdb_sys_getdents64
:
1712 regcache_raw_read_unsigned (regcache
, tdep
->arg2
,
1714 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &count
);
1715 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1716 tdep
->size_dirent64
* count
))
1721 case gdb_sys_fcntl64
:
1722 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1723 if (tmpulongest
== tdep
->fcntl_F_GETLK64
)
1725 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
1727 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1728 tdep
->size_flock64
))
1731 else if (tmpulongest
!= tdep
->fcntl_F_SETLK64
1732 && tmpulongest
!= tdep
->fcntl_F_SETLKW64
)
1738 case gdb_sys_ni_syscall222
:
1739 case gdb_sys_ni_syscall223
:
1740 case gdb_sys_gettid
:
1741 case gdb_sys_readahead
:
1742 case gdb_sys_setxattr
:
1743 case gdb_sys_lsetxattr
:
1744 case gdb_sys_fsetxattr
:
1747 case gdb_sys_getxattr
:
1748 case gdb_sys_lgetxattr
:
1749 case gdb_sys_fgetxattr
:
1750 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1754 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &size
);
1755 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) size
))
1760 case gdb_sys_listxattr
:
1761 case gdb_sys_llistxattr
:
1762 case gdb_sys_flistxattr
:
1763 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1767 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &size
);
1768 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) size
))
1773 case gdb_sys_removexattr
:
1774 case gdb_sys_lremovexattr
:
1775 case gdb_sys_fremovexattr
:
1779 case gdb_sys_sendfile64
:
1780 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1781 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1787 case gdb_sys_sched_setaffinity
:
1790 case gdb_sys_sched_getaffinity
:
1791 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1795 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &len
);
1796 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) len
))
1801 case gdb_sys_set_thread_area
:
1802 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1803 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
1807 case gdb_sys_get_thread_area
:
1808 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1809 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1810 tdep
->size_user_desc
))
1814 case gdb_sys_io_setup
:
1815 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1816 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_long
))
1820 case gdb_sys_io_destroy
:
1823 case gdb_sys_io_getevents
:
1824 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1828 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &nr
);
1829 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1830 nr
* tdep
->size_io_event
))
1835 case gdb_sys_io_submit
:
1836 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1842 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nr
);
1843 iocbp
= alloca (nr
* tdep
->size_pointer
);
1844 if (target_read_memory ((CORE_ADDR
) tmpulongest
, iocbp
,
1845 nr
* tdep
->size_pointer
))
1848 fprintf_unfiltered (gdb_stdlog
,
1849 "Process record: error reading memory "
1850 "at addr = 0x%s len = %u.\n",
1851 OUTPUT_REG (tmpulongest
, tdep
->arg2
),
1852 (int) (nr
* tdep
->size_pointer
));
1855 for (i
= 0; i
< nr
; i
++)
1858 = (CORE_ADDR
) extract_unsigned_integer (iocbp
,
1861 if (record_arch_list_add_mem (tmpaddr
, tdep
->size_iocb
))
1863 iocbp
+= tdep
->size_pointer
;
1868 case gdb_sys_io_cancel
:
1869 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1870 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1871 tdep
->size_io_event
))
1875 case gdb_sys_fadvise64
:
1876 case gdb_sys_ni_syscall251
:
1879 case gdb_sys_exit_group
:
1882 target_terminal_ours ();
1883 q
= yquery (_("The next instruction is syscall exit_group. "
1884 "It will make the program exit. "
1885 "Do you want to stop the program?"));
1886 target_terminal_inferior ();
1892 case gdb_sys_lookup_dcookie
:
1893 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1897 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &len
);
1898 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) len
))
1903 case gdb_sys_epoll_create
:
1904 case gdb_sys_epoll_ctl
:
1907 case gdb_sys_epoll_wait
:
1908 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1912 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxevents
);
1913 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1914 maxevents
* tdep
->size_epoll_event
))
1919 case gdb_sys_remap_file_pages
:
1920 case gdb_sys_set_tid_address
:
1923 case gdb_sys_timer_create
:
1924 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1925 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
1929 case gdb_sys_timer_settime
:
1930 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1931 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1932 tdep
->size_itimerspec
))
1936 case gdb_sys_timer_gettime
:
1937 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1938 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1939 tdep
->size_itimerspec
))
1943 case gdb_sys_timer_getoverrun
:
1944 case gdb_sys_timer_delete
:
1945 case gdb_sys_clock_settime
:
1948 case gdb_sys_clock_gettime
:
1949 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1950 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1951 tdep
->size_timespec
))
1955 case gdb_sys_clock_getres
:
1956 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1957 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1958 tdep
->size_timespec
))
1962 case gdb_sys_clock_nanosleep
:
1963 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
1964 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1965 tdep
->size_timespec
))
1969 case gdb_sys_statfs64
:
1970 case gdb_sys_fstatfs64
:
1971 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
1972 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1973 tdep
->size_statfs64
))
1977 case gdb_sys_tgkill
:
1978 case gdb_sys_utimes
:
1979 case gdb_sys_fadvise64_64
:
1980 case gdb_sys_ni_syscall273
:
1984 case gdb_sys_get_mempolicy
:
1985 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
1986 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
1988 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
1992 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxnode
);
1993 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
1994 maxnode
* tdep
->size_long
))
1999 case gdb_sys_set_mempolicy
:
2000 case gdb_sys_mq_open
:
2001 case gdb_sys_mq_unlink
:
2002 case gdb_sys_mq_timedsend
:
2005 case gdb_sys_mq_timedreceive
:
2006 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2010 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &msg_len
);
2011 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2015 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
2016 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2020 case gdb_sys_mq_notify
:
2023 case gdb_sys_mq_getsetattr
:
2024 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2025 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2026 tdep
->size_mq_attr
))
2030 case gdb_sys_kexec_load
:
2033 case gdb_sys_waitid
:
2034 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2035 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2036 tdep
->size_siginfo
))
2038 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
2039 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2044 case gdb_sys_ni_syscall285
:
2045 case gdb_sys_add_key
:
2046 case gdb_sys_request_key
:
2049 case gdb_sys_keyctl
:
2050 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
2051 if (tmpulongest
== 6 || tmpulongest
== 11)
2053 regcache_raw_read_unsigned (regcache
, tdep
->arg3
,
2058 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &buflen
);
2059 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2066 case gdb_sys_ioprio_set
:
2067 case gdb_sys_ioprio_get
:
2068 case gdb_sys_inotify_init
:
2069 case gdb_sys_inotify_add_watch
:
2070 case gdb_sys_inotify_rm_watch
:
2071 case gdb_sys_migrate_pages
:
2072 case gdb_sys_openat
:
2073 case gdb_sys_mkdirat
:
2074 case gdb_sys_mknodat
:
2075 case gdb_sys_fchownat
:
2076 case gdb_sys_futimesat
:
2079 case gdb_sys_fstatat64
:
2080 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2081 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2086 case gdb_sys_unlinkat
:
2087 case gdb_sys_renameat
:
2088 case gdb_sys_linkat
:
2089 case gdb_sys_symlinkat
:
2092 case gdb_sys_readlinkat
:
2093 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2097 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &bufsiz
);
2098 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, (int) bufsiz
))
2103 case gdb_sys_fchmodat
:
2104 case gdb_sys_faccessat
:
2107 case gdb_sys_pselect6
:
2108 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2109 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2112 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2113 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2116 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
2117 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2120 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
2121 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2122 tdep
->size_timespec
))
2127 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
2131 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nfds
);
2132 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2133 tdep
->size_pollfd
* nfds
))
2136 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2137 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2138 tdep
->size_timespec
))
2142 case gdb_sys_unshare
:
2143 case gdb_sys_set_robust_list
:
2146 case gdb_sys_get_robust_list
:
2147 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2148 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2150 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2151 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2155 case gdb_sys_splice
:
2156 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2157 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2160 regcache_raw_read_unsigned (regcache
, tdep
->arg4
, &tmpulongest
);
2161 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2166 case gdb_sys_sync_file_range
:
2168 case gdb_sys_vmsplice
:
2171 case gdb_sys_move_pages
:
2172 regcache_raw_read_unsigned (regcache
, tdep
->arg5
, &tmpulongest
);
2176 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &nr_pages
);
2177 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2178 nr_pages
* tdep
->size_int
))
2183 case gdb_sys_getcpu
:
2184 regcache_raw_read_unsigned (regcache
, tdep
->arg1
, &tmpulongest
);
2185 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2187 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2188 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tdep
->size_int
))
2190 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &tmpulongest
);
2191 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
,
2192 tdep
->size_ulong
* 2))
2196 case gdb_sys_epoll_pwait
:
2197 regcache_raw_read_unsigned (regcache
, tdep
->arg2
, &tmpulongest
);
2201 regcache_raw_read_unsigned (regcache
, tdep
->arg3
, &maxevents
);
2202 tmpint
= (int) maxevents
* tdep
->size_epoll_event
;
2203 if (record_arch_list_add_mem ((CORE_ADDR
) tmpulongest
, tmpint
))
2209 printf_unfiltered (_("Process record and replay target doesn't "
2210 "support syscall number %d\n"), syscall
);