]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/linux-record.c
gdb/linux-record: Fix sizes of sigaction and sigset_t
[thirdparty/binutils-gdb.git] / gdb / linux-record.c
CommitLineData
b7f6bf22
HZ
1/* Process record and replay target code for GNU/Linux.
2
32d0add0 3 Copyright (C) 2008-2015 Free Software Foundation, Inc.
b7f6bf22
HZ
4
5 This file is part of GDB.
6
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.
11
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.
16
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/>. */
19
20#include "defs.h"
21#include "target.h"
2c543fc4 22#include "gdbtypes.h"
b7f6bf22
HZ
23#include "regcache.h"
24#include "record.h"
d02ed0bb 25#include "record-full.h"
b7f6bf22
HZ
26#include "linux-record.h"
27
28/* These macros are the values of the first argument of system call
29 "sys_ptrace". The values of these macros were obtained from Linux
30 Kernel source. */
31
32#define RECORD_PTRACE_PEEKTEXT 1
33#define RECORD_PTRACE_PEEKDATA 2
34#define RECORD_PTRACE_PEEKUSR 3
35
36/* These macros are the values of the first argument of system call
37 "sys_socketcall". The values of these macros were obtained from
38 Linux Kernel source. */
39
40#define RECORD_SYS_SOCKET 1
41#define RECORD_SYS_BIND 2
42#define RECORD_SYS_CONNECT 3
43#define RECORD_SYS_LISTEN 4
44#define RECORD_SYS_ACCEPT 5
45#define RECORD_SYS_GETSOCKNAME 6
46#define RECORD_SYS_GETPEERNAME 7
47#define RECORD_SYS_SOCKETPAIR 8
48#define RECORD_SYS_SEND 9
49#define RECORD_SYS_RECV 10
50#define RECORD_SYS_SENDTO 11
51#define RECORD_SYS_RECVFROM 12
52#define RECORD_SYS_SHUTDOWN 13
53#define RECORD_SYS_SETSOCKOPT 14
54#define RECORD_SYS_GETSOCKOPT 15
55#define RECORD_SYS_SENDMSG 16
56#define RECORD_SYS_RECVMSG 17
57
58/* These macros are the values of the first argument of system call
59 "sys_ipc". The values of these macros were obtained from Linux
60 Kernel source. */
61
62#define RECORD_SEMOP 1
63#define RECORD_SEMGET 2
64#define RECORD_SEMCTL 3
65#define RECORD_SEMTIMEDOP 4
66#define RECORD_MSGSND 11
67#define RECORD_MSGRCV 12
68#define RECORD_MSGGET 13
69#define RECORD_MSGCTL 14
70#define RECORD_SHMAT 21
71#define RECORD_SHMDT 22
72#define RECORD_SHMGET 23
73#define RECORD_SHMCTL 24
74
75/* These macros are the values of the first argument of system call
76 "sys_quotactl". The values of these macros were obtained from Linux
77 Kernel source. */
78
79#define RECORD_Q_GETFMT 0x800004
80#define RECORD_Q_GETINFO 0x800005
81#define RECORD_Q_GETQUOTA 0x800007
82#define RECORD_Q_XGETQSTAT (('5' << 8) + 5)
83#define RECORD_Q_XGETQUOTA (('3' << 8) + 3)
84
2c543fc4
HZ
85#define OUTPUT_REG(val, num) phex_nz ((val), \
86 TYPE_LENGTH (gdbarch_register_type (get_regcache_arch (regcache), (num))))
87
88static int
89record_linux_sockaddr (struct regcache *regcache,
90 struct linux_record_tdep *tdep, ULONGEST addr,
91 ULONGEST len)
92{
93 gdb_byte *a;
94 int addrlen;
95 struct gdbarch *gdbarch = get_regcache_arch (regcache);
96 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
97
98 if (!addr)
99 return 0;
100
224c3ddb 101 a = (gdb_byte *) alloca (tdep->size_int);
2c543fc4 102
25ea693b 103 if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
2c543fc4
HZ
104 return -1;
105
106 /* Get the addrlen. */
107 if (target_read_memory ((CORE_ADDR) len, a, tdep->size_int))
108 {
109 if (record_debug)
110 fprintf_unfiltered (gdb_stdlog,
111 "Process record: error reading "
112 "memory at addr = 0x%s len = %d.\n",
113 phex_nz (len, tdep->size_pointer),
114 tdep->size_int);
115 return -1;
116 }
117 addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order);
118 if (addrlen <= 0 || addrlen > tdep->size_sockaddr)
119 addrlen = tdep->size_sockaddr;
120
25ea693b 121 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, addrlen))
2c543fc4
HZ
122 return -1;
123
124 return 0;
125}
126
127static int
128record_linux_msghdr (struct regcache *regcache,
129 struct linux_record_tdep *tdep, ULONGEST addr)
130{
131 gdb_byte *a;
132 struct gdbarch *gdbarch = get_regcache_arch (regcache);
133 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
134 CORE_ADDR tmpaddr;
135 int tmpint;
136
137 if (!addr)
138 return 0;
139
25ea693b 140 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
2c543fc4
HZ
141 return -1;
142
224c3ddb 143 a = (gdb_byte *) alloca (tdep->size_msghdr);
2c543fc4
HZ
144 if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
145 {
146 if (record_debug)
147 fprintf_unfiltered (gdb_stdlog,
148 "Process record: error reading "
149 "memory at addr = 0x%s "
150 "len = %d.\n",
151 phex_nz (addr, tdep->size_pointer),
152 tdep->size_msghdr);
153 return -1;
154 }
155
156 /* msg_name msg_namelen */
157 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
158 a += tdep->size_pointer;
25ea693b
MM
159 if (record_full_arch_list_add_mem
160 ((CORE_ADDR) addr,
161 (int) extract_unsigned_integer (a,
162 tdep->size_int,
163 byte_order)))
2c543fc4
HZ
164 return -1;
165 a += tdep->size_int;
166
167 /* msg_iov msg_iovlen */
168 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
169 a += tdep->size_pointer;
170 if (addr)
171 {
172 ULONGEST i;
173 ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
174 byte_order);
224c3ddb 175 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
2c543fc4
HZ
176
177 for (i = 0; i < len; i++)
178 {
179 if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
180 {
181 if (record_debug)
182 fprintf_unfiltered (gdb_stdlog,
183 "Process record: error "
184 "reading memory at "
185 "addr = 0x%s "
186 "len = %d.\n",
187 phex_nz (addr,tdep->size_pointer),
188 tdep->size_iovec);
189 return -1;
190 }
191 tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
192 tdep->size_pointer,
193 byte_order);
194 tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
195 tdep->size_size_t,
196 byte_order);
25ea693b 197 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
2c543fc4
HZ
198 return -1;
199 addr += tdep->size_iovec;
200 }
201 }
202 a += tdep->size_size_t;
203
204 /* msg_control msg_controllen */
205 addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
206 a += tdep->size_pointer;
207 tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
25ea693b 208 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
2c543fc4
HZ
209 return -1;
210
211 return 0;
212}
213
b7f6bf22
HZ
214/* When the architecture process record get a Linux syscall
215 instruction, it will get a Linux syscall number of this
216 architecture and convert it to the Linux syscall number "num" which
217 is internal to GDB. Most Linux syscalls across architectures in
218 Linux would be similar and mostly differ by sizes of types and
219 structures. This sizes are put to "tdep".
220
221 Record the values of the registers and memory that will be changed
222 in current system call.
223
224 Return -1 if something wrong. */
225
226int
13b6d1d4
MS
227record_linux_system_call (enum gdb_syscall syscall,
228 struct regcache *regcache,
2c543fc4 229 struct linux_record_tdep *tdep)
b7f6bf22 230{
5af949e3 231 struct gdbarch *gdbarch = get_regcache_arch (regcache);
2c543fc4
HZ
232 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
233 ULONGEST tmpulongest;
234 CORE_ADDR tmpaddr;
235 int tmpint;
b7f6bf22 236
13b6d1d4 237 switch (syscall)
b7f6bf22 238 {
13b6d1d4 239 case gdb_sys_restart_syscall:
b7f6bf22
HZ
240 break;
241
13b6d1d4 242 case gdb_sys_exit:
b7f6bf22 243 {
2c543fc4 244 int q;
e0881a8e 245
2c543fc4
HZ
246 target_terminal_ours ();
247 q = yquery (_("The next instruction is syscall exit. "
248 "It will make the program exit. "
249 "Do you want to stop the program?"));
250 target_terminal_inferior ();
251 if (q)
252 return 1;
b7f6bf22
HZ
253 }
254 break;
255
13b6d1d4 256 case gdb_sys_fork:
b7f6bf22
HZ
257 break;
258
13b6d1d4 259 case gdb_sys_read:
b7f6bf22 260 {
2c543fc4 261 ULONGEST addr, count;
e0881a8e 262
2c543fc4
HZ
263 regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
264 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
25ea693b 265 if (record_full_arch_list_add_mem ((CORE_ADDR) addr, (int) count))
2c543fc4 266 return -1;
b7f6bf22
HZ
267 }
268 break;
269
13b6d1d4
MS
270 case gdb_sys_write:
271 case gdb_sys_open:
272 case gdb_sys_close:
273 case gdb_sys_waitpid:
274 case gdb_sys_creat:
275 case gdb_sys_link:
276 case gdb_sys_unlink:
277 case gdb_sys_execve:
278 case gdb_sys_chdir:
279 case gdb_sys_time:
280 case gdb_sys_mknod:
281 case gdb_sys_chmod:
282 case gdb_sys_lchown16:
283 case gdb_sys_ni_syscall17:
284 break;
285
286 case gdb_sys_stat:
287 case gdb_sys_fstat:
288 case gdb_sys_lstat:
2c543fc4 289 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
290 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
291 tdep->size__old_kernel_stat))
2c543fc4 292 return -1;
b7f6bf22
HZ
293 break;
294
13b6d1d4
MS
295 case gdb_sys_lseek:
296 case gdb_sys_getpid:
297 case gdb_sys_mount:
298 case gdb_sys_oldumount:
299 case gdb_sys_setuid16:
300 case gdb_sys_getuid16:
301 case gdb_sys_stime:
b7f6bf22
HZ
302 break;
303
13b6d1d4 304 case gdb_sys_ptrace:
2c543fc4
HZ
305 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
306 if (tmpulongest == RECORD_PTRACE_PEEKTEXT
307 || tmpulongest == RECORD_PTRACE_PEEKDATA
308 || tmpulongest == RECORD_PTRACE_PEEKUSR)
309 {
310 regcache_raw_read_unsigned (regcache, tdep->arg4,
311 &tmpulongest);
25ea693b 312 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
2c543fc4
HZ
313 return -1;
314 }
b7f6bf22
HZ
315 break;
316
13b6d1d4
MS
317 case gdb_sys_alarm:
318 case gdb_sys_pause:
319 case gdb_sys_utime:
320 case gdb_sys_ni_syscall31:
321 case gdb_sys_ni_syscall32:
322 case gdb_sys_access:
323 case gdb_sys_nice:
324 case gdb_sys_ni_syscall35:
325 case gdb_sys_sync:
326 case gdb_sys_kill:
327 case gdb_sys_rename:
328 case gdb_sys_mkdir:
329 case gdb_sys_rmdir:
330 case gdb_sys_dup:
331 case gdb_sys_pipe:
332 break;
333
334 case gdb_sys_times:
2c543fc4 335 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
336 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
337 tdep->size_tms))
2c543fc4 338 return -1;
b7f6bf22
HZ
339 break;
340
13b6d1d4
MS
341 case gdb_sys_ni_syscall44:
342 case gdb_sys_brk:
343 case gdb_sys_setgid16:
344 case gdb_sys_getgid16:
345 case gdb_sys_signal:
346 case gdb_sys_geteuid16:
347 case gdb_sys_getegid16:
348 case gdb_sys_acct:
349 case gdb_sys_umount:
350 case gdb_sys_ni_syscall53:
351 break;
352
353 case gdb_sys_ioctl:
b7f6bf22 354 /* XXX Need to add a lot of support of other ioctl requests. */
2c543fc4
HZ
355 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
356 if (tmpulongest == tdep->ioctl_FIOCLEX
357 || tmpulongest == tdep->ioctl_FIONCLEX
358 || tmpulongest == tdep->ioctl_FIONBIO
359 || tmpulongest == tdep->ioctl_FIOASYNC
360 || tmpulongest == tdep->ioctl_TCSETS
361 || tmpulongest == tdep->ioctl_TCSETSW
362 || tmpulongest == tdep->ioctl_TCSETSF
363 || tmpulongest == tdep->ioctl_TCSETA
364 || tmpulongest == tdep->ioctl_TCSETAW
365 || tmpulongest == tdep->ioctl_TCSETAF
366 || tmpulongest == tdep->ioctl_TCSBRK
367 || tmpulongest == tdep->ioctl_TCXONC
368 || tmpulongest == tdep->ioctl_TCFLSH
369 || tmpulongest == tdep->ioctl_TIOCEXCL
370 || tmpulongest == tdep->ioctl_TIOCNXCL
371 || tmpulongest == tdep->ioctl_TIOCSCTTY
372 || tmpulongest == tdep->ioctl_TIOCSPGRP
373 || tmpulongest == tdep->ioctl_TIOCSTI
374 || tmpulongest == tdep->ioctl_TIOCSWINSZ
375 || tmpulongest == tdep->ioctl_TIOCMBIS
376 || tmpulongest == tdep->ioctl_TIOCMBIC
377 || tmpulongest == tdep->ioctl_TIOCMSET
378 || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
379 || tmpulongest == tdep->ioctl_TIOCCONS
380 || tmpulongest == tdep->ioctl_TIOCSSERIAL
381 || tmpulongest == tdep->ioctl_TIOCPKT
382 || tmpulongest == tdep->ioctl_TIOCNOTTY
383 || tmpulongest == tdep->ioctl_TIOCSETD
384 || tmpulongest == tdep->ioctl_TCSBRKP
385 || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
386 || tmpulongest == tdep->ioctl_TIOCSBRK
387 || tmpulongest == tdep->ioctl_TIOCCBRK
388 || tmpulongest == tdep->ioctl_TCSETS2
389 || tmpulongest == tdep->ioctl_TCSETSW2
390 || tmpulongest == tdep->ioctl_TCSETSF2
391 || tmpulongest == tdep->ioctl_TIOCSPTLCK
392 || tmpulongest == tdep->ioctl_TIOCSERCONFIG
393 || tmpulongest == tdep->ioctl_TIOCSERGWILD
394 || tmpulongest == tdep->ioctl_TIOCSERSWILD
395 || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
396 || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
397 || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
398 || tmpulongest == tdep->ioctl_TIOCMIWAIT
399 || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
400 {
401 /* Nothing to do. */
402 }
403 else if (tmpulongest == tdep->ioctl_TCGETS
404 || tmpulongest == tdep->ioctl_TCGETA
405 || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
406 {
407 regcache_raw_read_unsigned (regcache, tdep->arg3,
408 &tmpulongest);
25ea693b
MM
409 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
410 tdep->size_termios))
2c543fc4
HZ
411 return -1;
412 }
413 else if (tmpulongest == tdep->ioctl_TIOCGPGRP
414 || tmpulongest == tdep->ioctl_TIOCGSID)
415 {
416 regcache_raw_read_unsigned (regcache, tdep->arg3,
417 &tmpulongest);
25ea693b
MM
418 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
419 tdep->size_pid_t))
2c543fc4
HZ
420 return -1;
421 }
422 else if (tmpulongest == tdep->ioctl_TIOCOUTQ
423 || tmpulongest == tdep->ioctl_TIOCMGET
424 || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
425 || tmpulongest == tdep->ioctl_FIONREAD
426 || tmpulongest == tdep->ioctl_TIOCINQ
427 || tmpulongest == tdep->ioctl_TIOCGETD
428 || tmpulongest == tdep->ioctl_TIOCGPTN
429 || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
430 {
431 regcache_raw_read_unsigned (regcache, tdep->arg3,
432 &tmpulongest);
25ea693b
MM
433 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
434 tdep->size_int))
2c543fc4
HZ
435 return -1;
436 }
437 else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
438 {
439 regcache_raw_read_unsigned (regcache, tdep->arg3,
440 &tmpulongest);
25ea693b
MM
441 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
442 tdep->size_winsize))
2c543fc4
HZ
443 return -1;
444 }
445 else if (tmpulongest == tdep->ioctl_TIOCLINUX)
446 {
447 regcache_raw_read_unsigned (regcache, tdep->arg3,
448 &tmpulongest);
13b6d1d4 449 /* This syscall affects a char-size memory. */
25ea693b 450 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
2c543fc4
HZ
451 return -1;
452 }
453 else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
454 {
455 regcache_raw_read_unsigned (regcache, tdep->arg3,
456 &tmpulongest);
25ea693b
MM
457 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
458 tdep->size_serial_struct))
2c543fc4
HZ
459 return -1;
460 }
461 else if (tmpulongest == tdep->ioctl_TCGETS2)
462 {
463 regcache_raw_read_unsigned (regcache, tdep->arg3,
464 &tmpulongest);
25ea693b
MM
465 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
466 tdep->size_termios2))
2c543fc4
HZ
467 return -1;
468 }
469 else if (tmpulongest == tdep->ioctl_FIOQSIZE)
470 {
471 regcache_raw_read_unsigned (regcache, tdep->arg3,
472 &tmpulongest);
25ea693b
MM
473 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
474 tdep->size_loff_t))
2c543fc4
HZ
475 return -1;
476 }
477 else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
478 {
479 regcache_raw_read_unsigned (regcache, tdep->arg3,
480 &tmpulongest);
25ea693b
MM
481 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
482 tdep->size_serial_icounter_struct))
2c543fc4
HZ
483 return -1;
484 }
485 else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
486 {
487 regcache_raw_read_unsigned (regcache, tdep->arg3,
488 &tmpulongest);
25ea693b
MM
489 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
490 tdep->size_hayes_esp_config))
2c543fc4
HZ
491 return -1;
492 }
493 else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
494 {
495 printf_unfiltered (_("Process record and replay target doesn't "
496 "support ioctl request TIOCSERGSTRUCT\n"));
497 return 1;
498 }
b7f6bf22 499 else
2c543fc4
HZ
500 {
501 printf_unfiltered (_("Process record and replay target doesn't "
502 "support ioctl request 0x%s.\n"),
503 OUTPUT_REG (tmpulongest, tdep->arg2));
504 return 1;
505 }
b7f6bf22
HZ
506 break;
507
13b6d1d4 508 case gdb_sys_fcntl:
b7f6bf22 509 /* XXX */
2c543fc4 510 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
b7f6bf22 511 sys_fcntl:
2c543fc4
HZ
512 if (tmpulongest == tdep->fcntl_F_GETLK)
513 {
514 regcache_raw_read_unsigned (regcache, tdep->arg3,
515 &tmpulongest);
25ea693b
MM
516 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
517 tdep->size_flock))
2c543fc4
HZ
518 return -1;
519 }
b7f6bf22
HZ
520 break;
521
13b6d1d4
MS
522 case gdb_sys_ni_syscall56:
523 case gdb_sys_setpgid:
524 case gdb_sys_ni_syscall58:
b7f6bf22
HZ
525 break;
526
13b6d1d4 527 case gdb_sys_olduname:
2c543fc4 528 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
529 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
530 tdep->size_oldold_utsname))
2c543fc4 531 return -1;
b7f6bf22
HZ
532 break;
533
13b6d1d4
MS
534 case gdb_sys_umask:
535 case gdb_sys_chroot:
b7f6bf22
HZ
536 break;
537
13b6d1d4 538 case gdb_sys_ustat:
2c543fc4 539 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
540 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
541 tdep->size_ustat))
2c543fc4 542 return -1;
b7f6bf22
HZ
543 break;
544
13b6d1d4
MS
545 case gdb_sys_dup2:
546 case gdb_sys_getppid:
547 case gdb_sys_getpgrp:
548 case gdb_sys_setsid:
b7f6bf22
HZ
549 break;
550
13b6d1d4 551 case gdb_sys_sigaction:
2c543fc4 552 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
553 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
554 tdep->size_old_sigaction))
2c543fc4 555 return -1;
b7f6bf22
HZ
556 break;
557
13b6d1d4
MS
558 case gdb_sys_sgetmask:
559 case gdb_sys_ssetmask:
560 case gdb_sys_setreuid16:
561 case gdb_sys_setregid16:
562 case gdb_sys_sigsuspend:
b7f6bf22
HZ
563 break;
564
13b6d1d4 565 case gdb_sys_sigpending:
2c543fc4 566 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
567 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
568 tdep->size_old_sigset_t))
2c543fc4 569 return -1;
b7f6bf22
HZ
570 break;
571
13b6d1d4
MS
572 case gdb_sys_sethostname:
573 case gdb_sys_setrlimit:
b7f6bf22
HZ
574 break;
575
13b6d1d4 576 case gdb_sys_old_getrlimit:
2c543fc4 577 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
578 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
579 tdep->size_rlimit))
2c543fc4 580 return -1;
b7f6bf22
HZ
581 break;
582
13b6d1d4 583 case gdb_sys_getrusage:
2c543fc4 584 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
585 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
586 tdep->size_rusage))
2c543fc4 587 return -1;
b7f6bf22
HZ
588 break;
589
13b6d1d4 590 case gdb_sys_gettimeofday:
2c543fc4 591 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
592 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
593 tdep->size_timeval))
2c543fc4
HZ
594 return -1;
595 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
596 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
597 tdep->size_timezone))
2c543fc4 598 return -1;
b7f6bf22
HZ
599 break;
600
13b6d1d4 601 case gdb_sys_settimeofday:
b7f6bf22
HZ
602 break;
603
13b6d1d4 604 case gdb_sys_getgroups16:
2c543fc4 605 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
606 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
607 tdep->size_old_gid_t))
2c543fc4 608 return -1;
b7f6bf22
HZ
609 break;
610
13b6d1d4 611 case gdb_sys_setgroups16:
2c543fc4 612 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
613 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
614 tdep->size_old_gid_t))
2c543fc4 615 return -1;
b7f6bf22
HZ
616 break;
617
13b6d1d4 618 case gdb_old_select:
b7f6bf22 619 {
2c543fc4
HZ
620 struct sel_arg_struct
621 {
622 CORE_ADDR n;
623 CORE_ADDR inp;
624 CORE_ADDR outp;
625 CORE_ADDR exp;
626 CORE_ADDR tvp;
627 } sel;
628
629 regcache_raw_read_unsigned (regcache, tdep->arg1,
630 &tmpulongest);
631 if (tmpulongest)
632 {
633 if (target_read_memory (tmpulongest, (gdb_byte *) &sel,
634 sizeof(sel)))
635 {
636 if (record_debug)
637 fprintf_unfiltered (gdb_stdlog,
638 "Process record: error reading memory "
639 "at addr = 0x%s len = %lu.\n",
640 OUTPUT_REG (tmpulongest, tdep->arg1),
641 (unsigned long) sizeof (sel));
642 return -1;
643 }
25ea693b 644 if (record_full_arch_list_add_mem (sel.inp, tdep->size_fd_set))
2c543fc4 645 return -1;
25ea693b 646 if (record_full_arch_list_add_mem (sel.outp, tdep->size_fd_set))
2c543fc4 647 return -1;
25ea693b 648 if (record_full_arch_list_add_mem (sel.exp, tdep->size_fd_set))
2c543fc4 649 return -1;
25ea693b 650 if (record_full_arch_list_add_mem (sel.tvp, tdep->size_timeval))
2c543fc4
HZ
651 return -1;
652 }
b7f6bf22
HZ
653 }
654 break;
655
13b6d1d4 656 case gdb_sys_symlink:
b7f6bf22
HZ
657 break;
658
13b6d1d4 659 case gdb_sys_readlink:
b7f6bf22 660 {
2c543fc4 661 ULONGEST len;
e0881a8e 662
2c543fc4
HZ
663 regcache_raw_read_unsigned (regcache, tdep->arg2,
664 &tmpulongest);
665 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
25ea693b 666 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
2c543fc4 667 return -1;
b7f6bf22
HZ
668 }
669 break;
670
13b6d1d4
MS
671 case gdb_sys_uselib:
672 case gdb_sys_swapon:
b7f6bf22
HZ
673 break;
674
13b6d1d4 675 case gdb_sys_reboot:
b7f6bf22 676 {
2c543fc4 677 int q;
e0881a8e 678
2c543fc4 679 target_terminal_ours ();
e0881a8e
MS
680 q = yquery (_("The next instruction is syscall reboot. "
681 "It will restart the computer. "
682 "Do you want to stop the program?"));
2c543fc4
HZ
683 target_terminal_inferior ();
684 if (q)
685 return 1;
b7f6bf22
HZ
686 }
687 break;
688
13b6d1d4 689 case gdb_old_readdir:
2c543fc4 690 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
691 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
692 tdep->size_dirent))
2c543fc4 693 return -1;
b7f6bf22
HZ
694 break;
695
13b6d1d4 696 case gdb_old_mmap:
b7f6bf22
HZ
697 break;
698
13b6d1d4 699 case gdb_sys_munmap:
b7f6bf22 700 {
2c543fc4
HZ
701 ULONGEST len;
702
703 regcache_raw_read_unsigned (regcache, tdep->arg1,
704 &tmpulongest);
705 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
25ea693b 706 if (record_full_memory_query)
bb08c432
HZ
707 {
708 int q;
709
710 target_terminal_ours ();
711 q = yquery (_("\
712The next instruction is syscall munmap.\n\
713It will free the memory addr = 0x%s len = %u.\n\
714It will make record target cannot record some memory change.\n\
715Do you want to stop the program?"),
716 OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
717 target_terminal_inferior ();
718 if (q)
719 return 1;
720 }
b7f6bf22
HZ
721 }
722 break;
723
13b6d1d4
MS
724 case gdb_sys_truncate:
725 case gdb_sys_ftruncate:
726 case gdb_sys_fchmod:
727 case gdb_sys_fchown16:
728 case gdb_sys_getpriority:
729 case gdb_sys_setpriority:
730 case gdb_sys_ni_syscall98:
731 break;
732
733 case gdb_sys_statfs:
734 case gdb_sys_fstatfs:
2c543fc4 735 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
736 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
737 tdep->size_statfs))
2c543fc4 738 return -1;
b7f6bf22
HZ
739 break;
740
13b6d1d4 741 case gdb_sys_ioperm:
b7f6bf22
HZ
742 break;
743
13b6d1d4
MS
744 case gdb_sys_socket:
745 case gdb_sys_sendto:
746 case gdb_sys_sendmsg:
747 case gdb_sys_shutdown:
748 case gdb_sys_bind:
749 case gdb_sys_connect:
750 case gdb_sys_listen:
751 case gdb_sys_setsockopt:
2c543fc4
HZ
752 break;
753
13b6d1d4
MS
754 case gdb_sys_accept:
755 case gdb_sys_getsockname:
756 case gdb_sys_getpeername:
2c543fc4
HZ
757 {
758 ULONGEST len;
e0881a8e 759
2c543fc4
HZ
760 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
761 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
762 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
763 return -1;
764 }
765 break;
766
13b6d1d4 767 case gdb_sys_recvfrom:
2c543fc4
HZ
768 {
769 ULONGEST len;
e0881a8e 770
2c543fc4
HZ
771 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
772 regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
773 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
774 return -1;
775 }
907b7f4f
MS
776 break;
777
13b6d1d4 778 case gdb_sys_recv:
2c543fc4
HZ
779 {
780 ULONGEST size;
e0881a8e 781
2c543fc4
HZ
782 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
783 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
25ea693b
MM
784 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
785 (int) size))
2c543fc4
HZ
786 return -1;
787 }
788 break;
789
13b6d1d4 790 case gdb_sys_recvmsg:
2c543fc4
HZ
791 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
792 if (record_linux_msghdr (regcache, tdep, tmpulongest))
793 return -1;
794 break;
795
13b6d1d4 796 case gdb_sys_socketpair:
2c543fc4 797 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
798 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
799 tdep->size_int))
2c543fc4
HZ
800 return -1;
801 break;
802
13b6d1d4 803 case gdb_sys_getsockopt:
2c543fc4
HZ
804 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
805 if (tmpulongest)
806 {
807 ULONGEST optvalp;
224c3ddb 808 gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
e0881a8e 809
2c543fc4
HZ
810 if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
811 tdep->size_int))
812 {
813 if (record_debug)
814 fprintf_unfiltered (gdb_stdlog,
815 "Process record: error reading "
816 "memory at addr = 0x%s "
817 "len = %d.\n",
818 OUTPUT_REG (tmpulongest, tdep->arg5),
819 tdep->size_int);
820 return -1;
821 }
822 regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
823 tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
824 byte_order);
25ea693b 825 if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
2c543fc4 826 return -1;
25ea693b
MM
827 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
828 tdep->size_int))
2c543fc4
HZ
829 return -1;
830 }
831 break;
832
13b6d1d4 833 case gdb_sys_socketcall:
2c543fc4
HZ
834 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
835 switch (tmpulongest)
836 {
837 case RECORD_SYS_SOCKET:
838 case RECORD_SYS_BIND:
839 case RECORD_SYS_CONNECT:
840 case RECORD_SYS_LISTEN:
841 break;
842 case RECORD_SYS_ACCEPT:
843 case RECORD_SYS_GETSOCKNAME:
844 case RECORD_SYS_GETPEERNAME:
845 {
846 regcache_raw_read_unsigned (regcache, tdep->arg2,
847 &tmpulongest);
848 if (tmpulongest)
849 {
224c3ddb 850 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
2c543fc4
HZ
851 ULONGEST len;
852
853 tmpulongest += tdep->size_ulong;
854 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
855 tdep->size_ulong * 2))
856 {
857 if (record_debug)
858 fprintf_unfiltered (gdb_stdlog,
859 "Process record: error reading "
860 "memory at addr = 0x%s len = %d.\n",
861 OUTPUT_REG (tmpulongest, tdep->arg2),
862 tdep->size_ulong * 2);
863 return -1;
864 }
865 tmpulongest = extract_unsigned_integer (a,
866 tdep->size_ulong,
867 byte_order);
868 len = extract_unsigned_integer (a + tdep->size_ulong,
869 tdep->size_ulong, byte_order);
870 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
871 return -1;
872 }
873 }
874 break;
875
876 case RECORD_SYS_SOCKETPAIR:
877 {
224c3ddb 878 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
e0881a8e 879
2c543fc4
HZ
880 regcache_raw_read_unsigned (regcache, tdep->arg2,
881 &tmpulongest);
882 if (tmpulongest)
883 {
884 tmpulongest += tdep->size_ulong * 3;
885 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
886 tdep->size_ulong))
887 {
888 if (record_debug)
889 fprintf_unfiltered (gdb_stdlog,
890 "Process record: error reading "
891 "memory at addr = 0x%s len = %d.\n",
892 OUTPUT_REG (tmpulongest, tdep->arg2),
893 tdep->size_ulong);
894 return -1;
895 }
896 tmpaddr
897 = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
898 byte_order);
25ea693b 899 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
2c543fc4
HZ
900 return -1;
901 }
902 }
903 break;
904 case RECORD_SYS_SEND:
905 case RECORD_SYS_SENDTO:
906 break;
907 case RECORD_SYS_RECVFROM:
908 regcache_raw_read_unsigned (regcache, tdep->arg2,
909 &tmpulongest);
910 if (tmpulongest)
911 {
224c3ddb 912 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
2c543fc4
HZ
913 ULONGEST len;
914
915 tmpulongest += tdep->size_ulong * 4;
916 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
917 tdep->size_ulong * 2))
918 {
919 if (record_debug)
920 fprintf_unfiltered (gdb_stdlog,
921 "Process record: error reading "
922 "memory at addr = 0x%s len = %d.\n",
923 OUTPUT_REG (tmpulongest, tdep->arg2),
924 tdep->size_ulong * 2);
925 return -1;
926 }
927 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
928 byte_order);
929 len = extract_unsigned_integer (a + tdep->size_ulong,
930 tdep->size_ulong, byte_order);
931 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
932 return -1;
933 }
934 case RECORD_SYS_RECV:
935 regcache_raw_read_unsigned (regcache, tdep->arg2,
936 &tmpulongest);
937 if (tmpulongest)
938 {
224c3ddb 939 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
2c543fc4
HZ
940
941 tmpulongest += tdep->size_ulong;
942 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
943 tdep->size_ulong))
944 {
945 if (record_debug)
946 fprintf_unfiltered (gdb_stdlog,
947 "Process record: error reading "
948 "memory at addr = 0x%s len = %d.\n",
949 OUTPUT_REG (tmpulongest, tdep->arg2),
950 tdep->size_ulong);
951 return -1;
952 }
953 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
954 byte_order);
955 if (tmpulongest)
956 {
957 a += tdep->size_ulong;
958 tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
959 byte_order);
25ea693b
MM
960 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
961 tmpint))
2c543fc4
HZ
962 return -1;
963 }
964 }
965 break;
966 case RECORD_SYS_SHUTDOWN:
967 case RECORD_SYS_SETSOCKOPT:
968 break;
969 case RECORD_SYS_GETSOCKOPT:
970 {
224c3ddb
SM
971 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
972 gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
2c543fc4
HZ
973
974 regcache_raw_read_unsigned (regcache, tdep->arg2,
975 &tmpulongest);
976 if (tmpulongest)
977 {
978 tmpulongest += tdep->size_ulong * 3;
979 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
980 tdep->size_ulong * 2))
981 {
982 if (record_debug)
983 fprintf_unfiltered (gdb_stdlog,
984 "Process record: error reading "
985 "memory at addr = 0x%s len = %d.\n",
986 OUTPUT_REG (tmpulongest, tdep->arg2),
987 tdep->size_ulong * 2);
988 return -1;
989 }
990 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
991 tdep->size_ulong,
992 byte_order);
993 if (tmpulongest)
994 {
995 if (target_read_memory ((CORE_ADDR) tmpulongest, av,
996 tdep->size_int))
997 {
998 if (record_debug)
999 fprintf_unfiltered (gdb_stdlog,
1000 "Process record: error reading "
1001 "memory at addr = 0x%s "
1002 "len = %d.\n",
1003 phex_nz (tmpulongest,
1004 tdep->size_ulong),
1005 tdep->size_int);
1006 return -1;
1007 }
1008 tmpaddr
1009 = (CORE_ADDR) extract_unsigned_integer (a,
1010 tdep->size_ulong,
1011 byte_order);
1012 tmpint = (int) extract_unsigned_integer (av,
1013 tdep->size_int,
1014 byte_order);
25ea693b 1015 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
2c543fc4
HZ
1016 return -1;
1017 a += tdep->size_ulong;
1018 tmpaddr
1019 = (CORE_ADDR) extract_unsigned_integer (a,
1020 tdep->size_ulong,
1021 byte_order);
25ea693b
MM
1022 if (record_full_arch_list_add_mem (tmpaddr,
1023 tdep->size_int))
2c543fc4
HZ
1024 return -1;
1025 }
1026 }
1027 }
1028 break;
1029 case RECORD_SYS_SENDMSG:
1030 break;
1031 case RECORD_SYS_RECVMSG:
1032 {
224c3ddb 1033 gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
2c543fc4
HZ
1034
1035 regcache_raw_read_unsigned (regcache, tdep->arg2,
1036 &tmpulongest);
1037 if (tmpulongest)
1038 {
1039 tmpulongest += tdep->size_ulong;
1040 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
1041 tdep->size_ulong))
1042 {
1043 if (record_debug)
1044 fprintf_unfiltered (gdb_stdlog,
1045 "Process record: error reading "
1046 "memory at addr = 0x%s len = %d.\n",
1047 OUTPUT_REG (tmpulongest, tdep->arg2),
1048 tdep->size_ulong);
1049 return -1;
1050 }
1051 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
1052 byte_order);
1053 if (record_linux_msghdr (regcache, tdep, tmpulongest))
1054 return -1;
1055 }
1056 }
1057 break;
1058 default:
1059 printf_unfiltered (_("Process record and replay target "
1060 "doesn't support socketcall call 0x%s\n"),
1061 OUTPUT_REG (tmpulongest, tdep->arg1));
1062 return -1;
1063 break;
1064 }
b7f6bf22
HZ
1065 break;
1066
13b6d1d4 1067 case gdb_sys_syslog:
b7f6bf22
HZ
1068 break;
1069
13b6d1d4 1070 case gdb_sys_setitimer:
2c543fc4 1071 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1072 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1073 tdep->size_itimerval))
2c543fc4 1074 return -1;
b7f6bf22
HZ
1075 break;
1076
13b6d1d4 1077 case gdb_sys_getitimer:
2c543fc4 1078 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1079 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1080 tdep->size_itimerval))
2c543fc4 1081 return -1;
b7f6bf22
HZ
1082 break;
1083
13b6d1d4
MS
1084 case gdb_sys_newstat:
1085 case gdb_sys_newlstat:
1086 case gdb_sys_newfstat:
1087 case gdb_sys_newfstatat:
2c543fc4 1088 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1089 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1090 tdep->size_stat))
2c543fc4 1091 return -1;
b7f6bf22
HZ
1092 break;
1093
13b6d1d4 1094 case gdb_sys_uname:
2c543fc4 1095 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1096 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1097 tdep->size_old_utsname))
2c543fc4 1098 return -1;
b7f6bf22
HZ
1099 break;
1100
13b6d1d4
MS
1101 case gdb_sys_iopl:
1102 case gdb_sys_vhangup:
1103 case gdb_sys_ni_syscall112:
1104 case gdb_sys_vm86old:
b7f6bf22
HZ
1105 break;
1106
13b6d1d4 1107 case gdb_sys_wait4:
2c543fc4 1108 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1109 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1110 tdep->size_int))
2c543fc4
HZ
1111 return -1;
1112 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
1113 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1114 tdep->size_rusage))
2c543fc4 1115 return -1;
b7f6bf22
HZ
1116 break;
1117
13b6d1d4 1118 case gdb_sys_swapoff:
b7f6bf22
HZ
1119 break;
1120
13b6d1d4 1121 case gdb_sys_sysinfo:
2c543fc4 1122 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1123 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1124 tdep->size_sysinfo))
2c543fc4
HZ
1125 return -1;
1126 break;
1127
13b6d1d4
MS
1128 case gdb_sys_shmget:
1129 case gdb_sys_semget:
1130 case gdb_sys_semop:
1131 case gdb_sys_msgget:
2c543fc4 1132 /* XXX maybe need do some record works with sys_shmdt. */
13b6d1d4
MS
1133 case gdb_sys_shmdt:
1134 case gdb_sys_msgsnd:
1135 case gdb_sys_semtimedop:
2c543fc4
HZ
1136 break;
1137
13b6d1d4 1138 case gdb_sys_shmat:
2c543fc4 1139 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1140 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1141 tdep->size_ulong))
2c543fc4
HZ
1142 return -1;
1143 break;
1144
13b6d1d4 1145 case gdb_sys_shmctl:
2c543fc4 1146 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1147 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1148 tdep->size_shmid_ds))
2c543fc4
HZ
1149 return -1;
1150 break;
1151
13b6d1d4 1152 /* XXX sys_semctl 525 still not supported. */
2c543fc4 1153 /* sys_semctl */
2c543fc4 1154
13b6d1d4 1155 case gdb_sys_msgrcv:
2c543fc4
HZ
1156 {
1157 ULONGEST msgp;
8ac2c12b 1158 LONGEST l;
e0881a8e 1159
8ac2c12b 1160 regcache_raw_read_signed (regcache, tdep->arg3, &l);
2c543fc4 1161 regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
8ac2c12b 1162 tmpint = l + tdep->size_long;
25ea693b 1163 if (record_full_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
2c543fc4
HZ
1164 return -1;
1165 }
1166 break;
1167
13b6d1d4 1168 case gdb_sys_msgctl:
2c543fc4 1169 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1170 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1171 tdep->size_msqid_ds))
2c543fc4 1172 return -1;
b7f6bf22
HZ
1173 break;
1174
13b6d1d4 1175 case gdb_sys_ipc:
2c543fc4
HZ
1176 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1177 tmpulongest &= 0xffff;
1178 switch (tmpulongest)
1179 {
1180 case RECORD_SEMOP:
1181 case RECORD_SEMGET:
1182 case RECORD_SEMTIMEDOP:
1183 case RECORD_MSGSND:
1184 case RECORD_MSGGET:
13b6d1d4 1185 /* XXX maybe need do some record works with RECORD_SHMDT. */
2c543fc4
HZ
1186 case RECORD_SHMDT:
1187 case RECORD_SHMGET:
1188 break;
1189 case RECORD_MSGRCV:
1190 {
8ac2c12b 1191 LONGEST second;
2c543fc4 1192 ULONGEST ptr;
e0881a8e 1193
2c543fc4
HZ
1194 regcache_raw_read_signed (regcache, tdep->arg3, &second);
1195 regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
1196 tmpint = (int) second + tdep->size_long;
25ea693b 1197 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
2c543fc4
HZ
1198 return -1;
1199 }
1200 break;
1201 case RECORD_MSGCTL:
1202 regcache_raw_read_unsigned (regcache, tdep->arg5,
1203 &tmpulongest);
25ea693b
MM
1204 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1205 tdep->size_msqid_ds))
2c543fc4
HZ
1206 return -1;
1207 break;
1208 case RECORD_SHMAT:
1209 regcache_raw_read_unsigned (regcache, tdep->arg4,
1210 &tmpulongest);
25ea693b
MM
1211 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1212 tdep->size_ulong))
2c543fc4
HZ
1213 return -1;
1214 break;
1215 case RECORD_SHMCTL:
1216 regcache_raw_read_unsigned (regcache, tdep->arg5,
1217 &tmpulongest);
25ea693b
MM
1218 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1219 tdep->size_shmid_ds))
2c543fc4
HZ
1220 return -1;
1221 break;
1222 default:
13b6d1d4 1223 /* XXX RECORD_SEMCTL still not supported. */
2c543fc4 1224 printf_unfiltered (_("Process record and replay target doesn't "
13b6d1d4
MS
1225 "support ipc number %s\n"),
1226 pulongest (tmpulongest));
2c543fc4
HZ
1227 break;
1228 }
b7f6bf22
HZ
1229 break;
1230
13b6d1d4
MS
1231 case gdb_sys_fsync:
1232 case gdb_sys_sigreturn:
1233 case gdb_sys_clone:
1234 case gdb_sys_setdomainname:
b7f6bf22
HZ
1235 break;
1236
13b6d1d4 1237 case gdb_sys_newuname:
2c543fc4 1238 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1239 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1240 tdep->size_new_utsname))
2c543fc4 1241 return -1;
b7f6bf22
HZ
1242 break;
1243
13b6d1d4 1244 case gdb_sys_modify_ldt:
2c543fc4
HZ
1245 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1246 if (tmpulongest == 0 || tmpulongest == 2)
1247 {
1248 ULONGEST ptr, bytecount;
e0881a8e 1249
2c543fc4
HZ
1250 regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
1251 regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
25ea693b 1252 if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
2c543fc4
HZ
1253 return -1;
1254 }
b7f6bf22
HZ
1255 break;
1256
13b6d1d4 1257 case gdb_sys_adjtimex:
2c543fc4 1258 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1259 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1260 tdep->size_timex))
2c543fc4 1261 return -1;
b7f6bf22
HZ
1262 break;
1263
13b6d1d4 1264 case gdb_sys_mprotect:
b7f6bf22
HZ
1265 break;
1266
13b6d1d4 1267 case gdb_sys_sigprocmask:
2c543fc4 1268 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1269 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1270 tdep->size_old_sigset_t))
2c543fc4 1271 return -1;
b7f6bf22
HZ
1272 break;
1273
13b6d1d4
MS
1274 case gdb_sys_ni_syscall127:
1275 case gdb_sys_init_module:
1276 case gdb_sys_delete_module:
1277 case gdb_sys_ni_syscall130:
b7f6bf22
HZ
1278 break;
1279
13b6d1d4 1280 case gdb_sys_quotactl:
2c543fc4
HZ
1281 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1282 switch (tmpulongest)
1283 {
1284 case RECORD_Q_GETFMT:
1285 regcache_raw_read_unsigned (regcache, tdep->arg4,
1286 &tmpulongest);
1287 /* __u32 */
25ea693b 1288 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
2c543fc4
HZ
1289 return -1;
1290 break;
1291 case RECORD_Q_GETINFO:
1292 regcache_raw_read_unsigned (regcache, tdep->arg4,
1293 &tmpulongest);
25ea693b
MM
1294 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1295 tdep->size_mem_dqinfo))
2c543fc4
HZ
1296 return -1;
1297 break;
1298 case RECORD_Q_GETQUOTA:
1299 regcache_raw_read_unsigned (regcache, tdep->arg4,
1300 &tmpulongest);
25ea693b
MM
1301 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1302 tdep->size_if_dqblk))
2c543fc4
HZ
1303 return -1;
1304 break;
1305 case RECORD_Q_XGETQSTAT:
1306 case RECORD_Q_XGETQUOTA:
1307 regcache_raw_read_unsigned (regcache, tdep->arg4,
1308 &tmpulongest);
25ea693b
MM
1309 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1310 tdep->size_fs_quota_stat))
2c543fc4
HZ
1311 return -1;
1312 break;
1313 }
b7f6bf22
HZ
1314 break;
1315
13b6d1d4
MS
1316 case gdb_sys_getpgid:
1317 case gdb_sys_fchdir:
1318 case gdb_sys_bdflush:
b7f6bf22
HZ
1319 break;
1320
13b6d1d4 1321 case gdb_sys_sysfs:
2c543fc4
HZ
1322 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1323 if (tmpulongest == 2)
1324 {
1325 regcache_raw_read_unsigned (regcache, tdep->arg3,
1326 &tmpulongest);
13b6d1d4 1327 /*XXX the size of memory is not very clear. */
25ea693b 1328 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
2c543fc4
HZ
1329 return -1;
1330 }
b7f6bf22
HZ
1331 break;
1332
13b6d1d4
MS
1333 case gdb_sys_personality:
1334 case gdb_sys_ni_syscall137:
1335 case gdb_sys_setfsuid16:
1336 case gdb_sys_setfsgid16:
b7f6bf22
HZ
1337 break;
1338
13b6d1d4 1339 case gdb_sys_llseek:
2c543fc4 1340 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
1341 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1342 tdep->size_loff_t))
2c543fc4 1343 return -1;
b7f6bf22
HZ
1344 break;
1345
13b6d1d4 1346 case gdb_sys_getdents:
b7f6bf22 1347 {
2c543fc4 1348 ULONGEST count;
e0881a8e 1349
2c543fc4
HZ
1350 regcache_raw_read_unsigned (regcache, tdep->arg2,
1351 &tmpulongest);
1352 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
25ea693b
MM
1353 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1354 tdep->size_dirent * count))
2c543fc4 1355 return -1;
b7f6bf22
HZ
1356 }
1357 break;
1358
13b6d1d4 1359 case gdb_sys_select:
2c543fc4 1360 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1361 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1362 tdep->size_fd_set))
2c543fc4
HZ
1363 return -1;
1364 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1365 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1366 tdep->size_fd_set))
2c543fc4
HZ
1367 return -1;
1368 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
1369 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1370 tdep->size_fd_set))
2c543fc4
HZ
1371 return -1;
1372 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
25ea693b
MM
1373 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1374 tdep->size_timeval))
2c543fc4 1375 return -1;
b7f6bf22
HZ
1376 break;
1377
13b6d1d4
MS
1378 case gdb_sys_flock:
1379 case gdb_sys_msync:
b7f6bf22
HZ
1380 break;
1381
13b6d1d4 1382 case gdb_sys_readv:
b7f6bf22 1383 {
2c543fc4
HZ
1384 ULONGEST vec, vlen;
1385
1386 regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
1387 if (vec)
1388 {
224c3ddb 1389 gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
2c543fc4
HZ
1390
1391 regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
1392 for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
1393 {
1394 if (target_read_memory ((CORE_ADDR) vec, iov,
1395 tdep->size_iovec))
1396 {
1397 if (record_debug)
1398 fprintf_unfiltered (gdb_stdlog,
1399 "Process record: error reading "
1400 "memory at addr = 0x%s len = %d.\n",
1401 OUTPUT_REG (vec, tdep->arg2),
1402 tdep->size_iovec);
1403 return -1;
1404 }
1405 tmpaddr
1406 = (CORE_ADDR) extract_unsigned_integer (iov,
1407 tdep->size_pointer,
1408 byte_order);
1409 tmpint
1410 = (int) extract_unsigned_integer (iov + tdep->size_pointer,
1411 tdep->size_size_t,
1412 byte_order);
25ea693b 1413 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
2c543fc4
HZ
1414 return -1;
1415 vec += tdep->size_iovec;
1416 }
1417 }
b7f6bf22
HZ
1418 }
1419 break;
1420
13b6d1d4
MS
1421 case gdb_sys_writev:
1422 case gdb_sys_getsid:
1423 case gdb_sys_fdatasync:
1424 case gdb_sys_sysctl:
1425 case gdb_sys_mlock:
1426 case gdb_sys_munlock:
1427 case gdb_sys_mlockall:
1428 case gdb_sys_munlockall:
1429 case gdb_sys_sched_setparam:
1430 break;
1431
1432 case gdb_sys_sched_getparam:
2c543fc4 1433 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1434 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1435 tdep->size_int))
2c543fc4 1436 return -1;
b7f6bf22
HZ
1437 break;
1438
13b6d1d4
MS
1439 case gdb_sys_sched_setscheduler:
1440 case gdb_sys_sched_getscheduler:
1441 case gdb_sys_sched_yield:
1442 case gdb_sys_sched_get_priority_max:
1443 case gdb_sys_sched_get_priority_min:
b7f6bf22
HZ
1444 break;
1445
13b6d1d4
MS
1446 case gdb_sys_sched_rr_get_interval:
1447 case gdb_sys_nanosleep:
2c543fc4 1448 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1449 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1450 tdep->size_timespec))
2c543fc4 1451 return -1;
b7f6bf22
HZ
1452 break;
1453
13b6d1d4
MS
1454 case gdb_sys_mremap:
1455 case gdb_sys_setresuid16:
b7f6bf22
HZ
1456 break;
1457
13b6d1d4 1458 case gdb_sys_getresuid16:
2c543fc4 1459 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1460 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1461 tdep->size_old_uid_t))
2c543fc4
HZ
1462 return -1;
1463 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1464 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1465 tdep->size_old_uid_t))
2c543fc4
HZ
1466 return -1;
1467 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1468 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1469 tdep->size_old_uid_t))
2c543fc4 1470 return -1;
b7f6bf22
HZ
1471 break;
1472
13b6d1d4
MS
1473 case gdb_sys_vm86:
1474 case gdb_sys_ni_syscall167:
b7f6bf22
HZ
1475 break;
1476
13b6d1d4 1477 case gdb_sys_poll:
2c543fc4
HZ
1478 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1479 if (tmpulongest)
1480 {
1481 ULONGEST nfds;
e0881a8e 1482
2c543fc4 1483 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
25ea693b
MM
1484 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1485 tdep->size_pollfd * nfds))
2c543fc4
HZ
1486 return -1;
1487 }
b7f6bf22
HZ
1488 break;
1489
13b6d1d4 1490 case gdb_sys_nfsservctl:
2c543fc4
HZ
1491 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1492 if (tmpulongest == 7 || tmpulongest == 8)
1493 {
1494 int rsize;
e0881a8e 1495
2c543fc4
HZ
1496 if (tmpulongest == 7)
1497 rsize = tdep->size_NFS_FHSIZE;
1498 else
1499 rsize = tdep->size_knfsd_fh;
1500 regcache_raw_read_unsigned (regcache, tdep->arg3,
1501 &tmpulongest);
25ea693b 1502 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
2c543fc4
HZ
1503 return -1;
1504 }
b7f6bf22
HZ
1505 break;
1506
13b6d1d4 1507 case gdb_sys_setresgid16:
b7f6bf22
HZ
1508 break;
1509
13b6d1d4 1510 case gdb_sys_getresgid16:
2c543fc4 1511 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1512 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1513 tdep->size_old_gid_t))
2c543fc4
HZ
1514 return -1;
1515 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1516 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1517 tdep->size_old_gid_t))
2c543fc4
HZ
1518 return -1;
1519 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1520 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1521 tdep->size_old_gid_t))
2c543fc4 1522 return -1;
b7f6bf22
HZ
1523 break;
1524
13b6d1d4 1525 case gdb_sys_prctl:
2c543fc4
HZ
1526 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1527 switch (tmpulongest)
1528 {
1529 case 2:
1530 regcache_raw_read_unsigned (regcache, tdep->arg2,
1531 &tmpulongest);
25ea693b
MM
1532 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1533 tdep->size_int))
2c543fc4
HZ
1534 return -1;
1535 break;
1536 case 16:
1537 regcache_raw_read_unsigned (regcache, tdep->arg2,
1538 &tmpulongest);
25ea693b
MM
1539 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1540 tdep->size_TASK_COMM_LEN))
2c543fc4
HZ
1541 return -1;
1542 break;
1543 }
b7f6bf22
HZ
1544 break;
1545
13b6d1d4 1546 case gdb_sys_rt_sigreturn:
b7f6bf22
HZ
1547 break;
1548
13b6d1d4 1549 case gdb_sys_rt_sigaction:
2c543fc4 1550 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1551 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1552 tdep->size_sigaction))
2c543fc4 1553 return -1;
b7f6bf22
HZ
1554 break;
1555
13b6d1d4 1556 case gdb_sys_rt_sigprocmask:
2c543fc4 1557 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1558 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1559 tdep->size_sigset_t))
2c543fc4 1560 return -1;
b7f6bf22
HZ
1561 break;
1562
13b6d1d4 1563 case gdb_sys_rt_sigpending:
2c543fc4
HZ
1564 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1565 if (tmpulongest)
1566 {
1567 ULONGEST sigsetsize;
e0881a8e 1568
2c543fc4 1569 regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
25ea693b
MM
1570 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1571 (int) sigsetsize))
2c543fc4
HZ
1572 return -1;
1573 }
b7f6bf22
HZ
1574 break;
1575
13b6d1d4 1576 case gdb_sys_rt_sigtimedwait:
2c543fc4 1577 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1578 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1579 tdep->size_siginfo_t))
2c543fc4 1580 return -1;
b7f6bf22
HZ
1581 break;
1582
13b6d1d4
MS
1583 case gdb_sys_rt_sigqueueinfo:
1584 case gdb_sys_rt_sigsuspend:
b7f6bf22
HZ
1585 break;
1586
13b6d1d4 1587 case gdb_sys_pread64:
2c543fc4
HZ
1588 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1589 if (tmpulongest)
1590 {
1591 ULONGEST count;
e0881a8e 1592
2c543fc4 1593 regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
25ea693b
MM
1594 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1595 (int) count))
2c543fc4
HZ
1596 return -1;
1597 }
b7f6bf22
HZ
1598 break;
1599
13b6d1d4
MS
1600 case gdb_sys_pwrite64:
1601 case gdb_sys_chown16:
b7f6bf22
HZ
1602 break;
1603
13b6d1d4 1604 case gdb_sys_getcwd:
2c543fc4
HZ
1605 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
1606 if (tmpulongest)
1607 {
1608 ULONGEST size;
e0881a8e 1609
2c543fc4 1610 regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
25ea693b
MM
1611 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1612 (int) size))
2c543fc4
HZ
1613 return -1;
1614 }
b7f6bf22
HZ
1615 break;
1616
13b6d1d4 1617 case gdb_sys_capget:
2c543fc4 1618 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1619 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1620 tdep->size_cap_user_data_t))
2c543fc4 1621 return -1;
b7f6bf22
HZ
1622 break;
1623
13b6d1d4 1624 case gdb_sys_capset:
b7f6bf22
HZ
1625 break;
1626
13b6d1d4 1627 case gdb_sys_sigaltstack:
2c543fc4 1628 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1629 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1630 tdep->size_stack_t))
2c543fc4 1631 return -1;
b7f6bf22
HZ
1632 break;
1633
13b6d1d4 1634 case gdb_sys_sendfile:
2c543fc4 1635 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1636 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1637 tdep->size_off_t))
2c543fc4 1638 return -1;
b7f6bf22
HZ
1639 break;
1640
13b6d1d4
MS
1641 case gdb_sys_ni_syscall188:
1642 case gdb_sys_ni_syscall189:
1643 case gdb_sys_vfork:
b7f6bf22
HZ
1644 break;
1645
13b6d1d4 1646 case gdb_sys_getrlimit:
2c543fc4 1647 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1648 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1649 tdep->size_rlimit))
2c543fc4 1650 return -1;
b7f6bf22
HZ
1651 break;
1652
13b6d1d4 1653 case gdb_sys_mmap2:
b7f6bf22
HZ
1654 break;
1655
13b6d1d4
MS
1656 case gdb_sys_truncate64:
1657 case gdb_sys_ftruncate64:
b7f6bf22
HZ
1658 break;
1659
13b6d1d4
MS
1660 case gdb_sys_stat64:
1661 case gdb_sys_lstat64:
1662 case gdb_sys_fstat64:
2c543fc4 1663 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1664 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1665 tdep->size_stat64))
2c543fc4 1666 return -1;
b7f6bf22
HZ
1667 break;
1668
13b6d1d4
MS
1669 case gdb_sys_lchown:
1670 case gdb_sys_getuid:
1671 case gdb_sys_getgid:
1672 case gdb_sys_geteuid:
1673 case gdb_sys_getegid:
1674 case gdb_sys_setreuid:
1675 case gdb_sys_setregid:
b7f6bf22
HZ
1676 break;
1677
13b6d1d4 1678 case gdb_sys_getgroups:
2c543fc4
HZ
1679 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1680 if (tmpulongest)
1681 {
1682 ULONGEST gidsetsize;
e0881a8e 1683
2c543fc4
HZ
1684 regcache_raw_read_unsigned (regcache, tdep->arg1,
1685 &gidsetsize);
1686 tmpint = tdep->size_gid_t * (int) gidsetsize;
25ea693b 1687 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2c543fc4
HZ
1688 return -1;
1689 }
b7f6bf22
HZ
1690 break;
1691
13b6d1d4
MS
1692 case gdb_sys_setgroups:
1693 case gdb_sys_fchown:
1694 case gdb_sys_setresuid:
b7f6bf22
HZ
1695 break;
1696
13b6d1d4 1697 case gdb_sys_getresuid:
2c543fc4 1698 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1699 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1700 tdep->size_uid_t))
2c543fc4
HZ
1701 return -1;
1702 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1703 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1704 tdep->size_uid_t))
2c543fc4
HZ
1705 return -1;
1706 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1707 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1708 tdep->size_uid_t))
2c543fc4 1709 return -1;
b7f6bf22
HZ
1710 break;
1711
13b6d1d4 1712 case gdb_sys_setresgid:
b7f6bf22
HZ
1713 break;
1714
13b6d1d4 1715 case gdb_sys_getresgid:
2c543fc4 1716 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1717 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1718 tdep->size_gid_t))
2c543fc4
HZ
1719 return -1;
1720 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1721 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1722 tdep->size_gid_t))
2c543fc4
HZ
1723 return -1;
1724 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1725 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1726 tdep->size_gid_t))
2c543fc4 1727 return -1;
b7f6bf22
HZ
1728 break;
1729
13b6d1d4
MS
1730 case gdb_sys_chown:
1731 case gdb_sys_setuid:
1732 case gdb_sys_setgid:
1733 case gdb_sys_setfsuid:
1734 case gdb_sys_setfsgid:
1735 case gdb_sys_pivot_root:
b7f6bf22
HZ
1736 break;
1737
13b6d1d4 1738 case gdb_sys_mincore:
2c543fc4 1739 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1740 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1741 tdep->size_PAGE_SIZE))
2c543fc4 1742 return -1;
b7f6bf22
HZ
1743 break;
1744
13b6d1d4 1745 case gdb_sys_madvise:
b7f6bf22
HZ
1746 break;
1747
13b6d1d4 1748 case gdb_sys_getdents64:
b7f6bf22 1749 {
2c543fc4 1750 ULONGEST count;
e0881a8e 1751
2c543fc4
HZ
1752 regcache_raw_read_unsigned (regcache, tdep->arg2,
1753 &tmpulongest);
1754 regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
25ea693b
MM
1755 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1756 tdep->size_dirent64 * count))
2c543fc4 1757 return -1;
b7f6bf22
HZ
1758 }
1759 break;
1760
13b6d1d4 1761 case gdb_sys_fcntl64:
2c543fc4
HZ
1762 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1763 if (tmpulongest == tdep->fcntl_F_GETLK64)
50ef67b3 1764 {
2c543fc4
HZ
1765 regcache_raw_read_unsigned (regcache, tdep->arg3,
1766 &tmpulongest);
25ea693b
MM
1767 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1768 tdep->size_flock64))
2c543fc4
HZ
1769 return -1;
1770 }
1771 else if (tmpulongest != tdep->fcntl_F_SETLK64
1772 && tmpulongest != tdep->fcntl_F_SETLKW64)
50ef67b3 1773 {
2c543fc4
HZ
1774 goto sys_fcntl;
1775 }
b7f6bf22
HZ
1776 break;
1777
13b6d1d4
MS
1778 case gdb_sys_ni_syscall222:
1779 case gdb_sys_ni_syscall223:
1780 case gdb_sys_gettid:
1781 case gdb_sys_readahead:
1782 case gdb_sys_setxattr:
1783 case gdb_sys_lsetxattr:
1784 case gdb_sys_fsetxattr:
1785 break;
1786
1787 case gdb_sys_getxattr:
1788 case gdb_sys_lgetxattr:
1789 case gdb_sys_fgetxattr:
2c543fc4
HZ
1790 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1791 if (tmpulongest)
1792 {
1793 ULONGEST size;
e0881a8e 1794
2c543fc4 1795 regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
25ea693b
MM
1796 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1797 (int) size))
2c543fc4
HZ
1798 return -1;
1799 }
b7f6bf22
HZ
1800 break;
1801
13b6d1d4
MS
1802 case gdb_sys_listxattr:
1803 case gdb_sys_llistxattr:
1804 case gdb_sys_flistxattr:
2c543fc4
HZ
1805 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1806 if (tmpulongest)
1807 {
1808 ULONGEST size;
e0881a8e 1809
2c543fc4 1810 regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
25ea693b
MM
1811 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1812 (int) size))
2c543fc4
HZ
1813 return -1;
1814 }
b7f6bf22
HZ
1815 break;
1816
13b6d1d4
MS
1817 case gdb_sys_removexattr:
1818 case gdb_sys_lremovexattr:
1819 case gdb_sys_fremovexattr:
1820 case gdb_sys_tkill:
b7f6bf22
HZ
1821 break;
1822
13b6d1d4 1823 case gdb_sys_sendfile64:
2c543fc4 1824 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1825 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1826 tdep->size_loff_t))
2c543fc4 1827 return -1;
b7f6bf22
HZ
1828 break;
1829
13b6d1d4
MS
1830 case gdb_sys_futex:
1831 case gdb_sys_sched_setaffinity:
b7f6bf22
HZ
1832 break;
1833
13b6d1d4 1834 case gdb_sys_sched_getaffinity:
2c543fc4
HZ
1835 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1836 if (tmpulongest)
1837 {
1838 ULONGEST len;
e0881a8e 1839
2c543fc4 1840 regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
25ea693b
MM
1841 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1842 (int) len))
2c543fc4
HZ
1843 return -1;
1844 }
b7f6bf22
HZ
1845 break;
1846
13b6d1d4 1847 case gdb_sys_set_thread_area:
2c543fc4 1848 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1849 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1850 tdep->size_int))
2c543fc4 1851 return -1;
b7f6bf22
HZ
1852 break;
1853
13b6d1d4 1854 case gdb_sys_get_thread_area:
2c543fc4 1855 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
1856 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1857 tdep->size_user_desc))
2c543fc4 1858 return -1;
b7f6bf22
HZ
1859 break;
1860
13b6d1d4 1861 case gdb_sys_io_setup:
2c543fc4 1862 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1863 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1864 tdep->size_long))
2c543fc4 1865 return -1;
b7f6bf22
HZ
1866 break;
1867
13b6d1d4 1868 case gdb_sys_io_destroy:
b7f6bf22
HZ
1869 break;
1870
13b6d1d4 1871 case gdb_sys_io_getevents:
2c543fc4
HZ
1872 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
1873 if (tmpulongest)
1874 {
1875 ULONGEST nr;
e0881a8e 1876
2c543fc4 1877 regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
25ea693b
MM
1878 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1879 nr * tdep->size_io_event))
2c543fc4
HZ
1880 return -1;
1881 }
b7f6bf22
HZ
1882 break;
1883
13b6d1d4 1884 case gdb_sys_io_submit:
2c543fc4
HZ
1885 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
1886 if (tmpulongest)
1887 {
1888 ULONGEST nr, i;
1889 gdb_byte *iocbp;
1890
1891 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
224c3ddb 1892 iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
2c543fc4
HZ
1893 if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
1894 nr * tdep->size_pointer))
1895 {
1896 if (record_debug)
1897 fprintf_unfiltered (gdb_stdlog,
1898 "Process record: error reading memory "
1899 "at addr = 0x%s len = %u.\n",
1900 OUTPUT_REG (tmpulongest, tdep->arg2),
1901 (int) (nr * tdep->size_pointer));
1902 return -1;
1903 }
1904 for (i = 0; i < nr; i++)
1905 {
1906 tmpaddr
1907 = (CORE_ADDR) extract_unsigned_integer (iocbp,
1908 tdep->size_pointer,
1909 byte_order);
25ea693b 1910 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
2c543fc4
HZ
1911 return -1;
1912 iocbp += tdep->size_pointer;
1913 }
1914 }
b7f6bf22
HZ
1915 break;
1916
13b6d1d4 1917 case gdb_sys_io_cancel:
2c543fc4 1918 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1919 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1920 tdep->size_io_event))
2c543fc4 1921 return -1;
b7f6bf22
HZ
1922 break;
1923
13b6d1d4
MS
1924 case gdb_sys_fadvise64:
1925 case gdb_sys_ni_syscall251:
b7f6bf22
HZ
1926 break;
1927
13b6d1d4 1928 case gdb_sys_exit_group:
b7f6bf22 1929 {
2c543fc4 1930 int q;
e0881a8e 1931
2c543fc4
HZ
1932 target_terminal_ours ();
1933 q = yquery (_("The next instruction is syscall exit_group. "
1934 "It will make the program exit. "
1935 "Do you want to stop the program?"));
1936 target_terminal_inferior ();
1937 if (q)
1938 return 1;
b7f6bf22
HZ
1939 }
1940 break;
1941
13b6d1d4 1942 case gdb_sys_lookup_dcookie:
2c543fc4
HZ
1943 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1944 if (tmpulongest)
1945 {
1946 ULONGEST len;
e0881a8e 1947
2c543fc4 1948 regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
25ea693b
MM
1949 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1950 (int) len))
2c543fc4
HZ
1951 return -1;
1952 }
b7f6bf22
HZ
1953 break;
1954
13b6d1d4
MS
1955 case gdb_sys_epoll_create:
1956 case gdb_sys_epoll_ctl:
b7f6bf22
HZ
1957 break;
1958
13b6d1d4 1959 case gdb_sys_epoll_wait:
2c543fc4
HZ
1960 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
1961 if (tmpulongest)
1962 {
1963 ULONGEST maxevents;
e0881a8e 1964
2c543fc4 1965 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
25ea693b
MM
1966 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1967 (maxevents
1968 * tdep->size_epoll_event)))
2c543fc4
HZ
1969 return -1;
1970 }
b7f6bf22
HZ
1971 break;
1972
13b6d1d4
MS
1973 case gdb_sys_remap_file_pages:
1974 case gdb_sys_set_tid_address:
b7f6bf22
HZ
1975 break;
1976
13b6d1d4 1977 case gdb_sys_timer_create:
2c543fc4 1978 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
1979 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1980 tdep->size_int))
2c543fc4 1981 return -1;
b7f6bf22
HZ
1982 break;
1983
13b6d1d4 1984 case gdb_sys_timer_settime:
2c543fc4 1985 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
1986 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1987 tdep->size_itimerspec))
2c543fc4 1988 return -1;
b7f6bf22
HZ
1989 break;
1990
13b6d1d4 1991 case gdb_sys_timer_gettime:
2c543fc4 1992 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
1993 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
1994 tdep->size_itimerspec))
2c543fc4 1995 return -1;
b7f6bf22
HZ
1996 break;
1997
13b6d1d4
MS
1998 case gdb_sys_timer_getoverrun:
1999 case gdb_sys_timer_delete:
2000 case gdb_sys_clock_settime:
b7f6bf22
HZ
2001 break;
2002
13b6d1d4 2003 case gdb_sys_clock_gettime:
2c543fc4 2004 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
2005 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2006 tdep->size_timespec))
2c543fc4 2007 return -1;
b7f6bf22
HZ
2008 break;
2009
13b6d1d4 2010 case gdb_sys_clock_getres:
2c543fc4 2011 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
2012 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2013 tdep->size_timespec))
2c543fc4 2014 return -1;
b7f6bf22
HZ
2015 break;
2016
13b6d1d4 2017 case gdb_sys_clock_nanosleep:
2c543fc4 2018 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
2019 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2020 tdep->size_timespec))
2c543fc4 2021 return -1;
b7f6bf22
HZ
2022 break;
2023
13b6d1d4
MS
2024 case gdb_sys_statfs64:
2025 case gdb_sys_fstatfs64:
2c543fc4 2026 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
2027 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2028 tdep->size_statfs64))
2c543fc4 2029 return -1;
b7f6bf22
HZ
2030 break;
2031
13b6d1d4
MS
2032 case gdb_sys_tgkill:
2033 case gdb_sys_utimes:
2034 case gdb_sys_fadvise64_64:
2035 case gdb_sys_ni_syscall273:
2036 case gdb_sys_mbind:
b7f6bf22
HZ
2037 break;
2038
13b6d1d4 2039 case gdb_sys_get_mempolicy:
2c543fc4 2040 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
2041 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2042 tdep->size_int))
2c543fc4
HZ
2043 return -1;
2044 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2045 if (tmpulongest)
2046 {
2047 ULONGEST maxnode;
e0881a8e 2048
2c543fc4 2049 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
25ea693b
MM
2050 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2051 maxnode * tdep->size_long))
2c543fc4
HZ
2052 return -1;
2053 }
b7f6bf22
HZ
2054 break;
2055
13b6d1d4
MS
2056 case gdb_sys_set_mempolicy:
2057 case gdb_sys_mq_open:
2058 case gdb_sys_mq_unlink:
2059 case gdb_sys_mq_timedsend:
b7f6bf22
HZ
2060 break;
2061
13b6d1d4 2062 case gdb_sys_mq_timedreceive:
2c543fc4
HZ
2063 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2064 if (tmpulongest)
2065 {
2066 ULONGEST msg_len;
e0881a8e 2067
2c543fc4 2068 regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
25ea693b
MM
2069 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2070 (int) msg_len))
2c543fc4
HZ
2071 return -1;
2072 }
2073 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
2074 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2075 tdep->size_int))
2c543fc4 2076 return -1;
b7f6bf22
HZ
2077 break;
2078
13b6d1d4 2079 case gdb_sys_mq_notify:
b7f6bf22
HZ
2080 break;
2081
13b6d1d4 2082 case gdb_sys_mq_getsetattr:
2c543fc4 2083 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
2084 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2085 tdep->size_mq_attr))
2c543fc4 2086 return -1;
b7f6bf22
HZ
2087 break;
2088
13b6d1d4 2089 case gdb_sys_kexec_load:
b7f6bf22
HZ
2090 break;
2091
13b6d1d4 2092 case gdb_sys_waitid:
2c543fc4 2093 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b 2094 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
aefb52a6 2095 tdep->size_siginfo_t))
2c543fc4
HZ
2096 return -1;
2097 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
25ea693b
MM
2098 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2099 tdep->size_rusage))
2c543fc4 2100 return -1;
b7f6bf22
HZ
2101 break;
2102
13b6d1d4
MS
2103 case gdb_sys_ni_syscall285:
2104 case gdb_sys_add_key:
2105 case gdb_sys_request_key:
b7f6bf22
HZ
2106 break;
2107
13b6d1d4 2108 case gdb_sys_keyctl:
2c543fc4
HZ
2109 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2110 if (tmpulongest == 6 || tmpulongest == 11)
2111 {
2112 regcache_raw_read_unsigned (regcache, tdep->arg3,
2113 &tmpulongest);
2114 if (tmpulongest)
2115 {
2116 ULONGEST buflen;
e0881a8e 2117
2c543fc4 2118 regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
25ea693b
MM
2119 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2120 (int) buflen))
2c543fc4
HZ
2121 return -1;
2122 }
2123 }
b7f6bf22
HZ
2124 break;
2125
13b6d1d4
MS
2126 case gdb_sys_ioprio_set:
2127 case gdb_sys_ioprio_get:
2128 case gdb_sys_inotify_init:
2129 case gdb_sys_inotify_add_watch:
2130 case gdb_sys_inotify_rm_watch:
2131 case gdb_sys_migrate_pages:
2132 case gdb_sys_openat:
2133 case gdb_sys_mkdirat:
2134 case gdb_sys_mknodat:
2135 case gdb_sys_fchownat:
2136 case gdb_sys_futimesat:
2137 break;
2138
2139 case gdb_sys_fstatat64:
2c543fc4 2140 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
2141 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2142 tdep->size_stat64))
2c543fc4 2143 return -1;
b7f6bf22
HZ
2144 break;
2145
13b6d1d4
MS
2146 case gdb_sys_unlinkat:
2147 case gdb_sys_renameat:
2148 case gdb_sys_linkat:
2149 case gdb_sys_symlinkat:
b7f6bf22
HZ
2150 break;
2151
13b6d1d4 2152 case gdb_sys_readlinkat:
2c543fc4
HZ
2153 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
2154 if (tmpulongest)
2155 {
2156 ULONGEST bufsiz;
e0881a8e 2157
2c543fc4 2158 regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
25ea693b
MM
2159 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2160 (int) bufsiz))
2c543fc4
HZ
2161 return -1;
2162 }
b7f6bf22
HZ
2163 break;
2164
13b6d1d4
MS
2165 case gdb_sys_fchmodat:
2166 case gdb_sys_faccessat:
b7f6bf22
HZ
2167 break;
2168
13b6d1d4 2169 case gdb_sys_pselect6:
2c543fc4 2170 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
2171 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2172 tdep->size_fd_set))
2c543fc4
HZ
2173 return -1;
2174 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
2175 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2176 tdep->size_fd_set))
2c543fc4
HZ
2177 return -1;
2178 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
2179 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2180 tdep->size_fd_set))
2c543fc4
HZ
2181 return -1;
2182 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
25ea693b
MM
2183 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2184 tdep->size_timespec))
2c543fc4 2185 return -1;
b7f6bf22
HZ
2186 break;
2187
13b6d1d4 2188 case gdb_sys_ppoll:
2c543fc4
HZ
2189 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
2190 if (tmpulongest)
2191 {
2192 ULONGEST nfds;
e0881a8e 2193
2c543fc4 2194 regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
25ea693b
MM
2195 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2196 tdep->size_pollfd * nfds))
2c543fc4
HZ
2197 return -1;
2198 }
2199 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
2200 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2201 tdep->size_timespec))
2c543fc4 2202 return -1;
b7f6bf22
HZ
2203 break;
2204
13b6d1d4
MS
2205 case gdb_sys_unshare:
2206 case gdb_sys_set_robust_list:
b7f6bf22
HZ
2207 break;
2208
13b6d1d4 2209 case gdb_sys_get_robust_list:
2c543fc4 2210 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
2211 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2212 tdep->size_int))
2c543fc4
HZ
2213 return -1;
2214 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
2215 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2216 tdep->size_int))
2c543fc4 2217 return -1;
b7f6bf22
HZ
2218 break;
2219
13b6d1d4 2220 case gdb_sys_splice:
2c543fc4 2221 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
2222 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2223 tdep->size_loff_t))
2c543fc4
HZ
2224 return -1;
2225 regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
25ea693b
MM
2226 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2227 tdep->size_loff_t))
2c543fc4 2228 return -1;
b7f6bf22
HZ
2229 break;
2230
13b6d1d4
MS
2231 case gdb_sys_sync_file_range:
2232 case gdb_sys_tee:
2233 case gdb_sys_vmsplice:
b7f6bf22
HZ
2234 break;
2235
13b6d1d4 2236 case gdb_sys_move_pages:
2c543fc4
HZ
2237 regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
2238 if (tmpulongest)
2239 {
2240 ULONGEST nr_pages;
e0881a8e 2241
2c543fc4 2242 regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
25ea693b
MM
2243 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2244 nr_pages * tdep->size_int))
2c543fc4
HZ
2245 return -1;
2246 }
b7f6bf22
HZ
2247 break;
2248
13b6d1d4 2249 case gdb_sys_getcpu:
2c543fc4 2250 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
25ea693b
MM
2251 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2252 tdep->size_int))
2c543fc4
HZ
2253 return -1;
2254 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
25ea693b
MM
2255 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2256 tdep->size_int))
2c543fc4
HZ
2257 return -1;
2258 regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
25ea693b
MM
2259 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
2260 tdep->size_ulong * 2))
2c543fc4 2261 return -1;
b7f6bf22
HZ
2262 break;
2263
13b6d1d4 2264 case gdb_sys_epoll_pwait:
2c543fc4
HZ
2265 regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
2266 if (tmpulongest)
2267 {
2268 ULONGEST maxevents;
e0881a8e 2269
2c543fc4
HZ
2270 regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
2271 tmpint = (int) maxevents * tdep->size_epoll_event;
25ea693b 2272 if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
2c543fc4
HZ
2273 return -1;
2274 }
b7f6bf22
HZ
2275 break;
2276
2277 default:
2278 printf_unfiltered (_("Process record and replay target doesn't "
13b6d1d4 2279 "support syscall number %d\n"), syscall);
b7f6bf22
HZ
2280 return -1;
2281 break;
2282 }
2283
2284 return 0;
2285}