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