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