GDB (API)
/home/stan/gdb/src/gdb/linux-record.c
Go to the documentation of this file.
00001 /* Process record and replay target code for GNU/Linux.
00002 
00003    Copyright (C) 2008-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #include "defs.h"
00021 #include "target.h"
00022 #include "gdbtypes.h"
00023 #include "regcache.h"
00024 #include "record.h"
00025 #include "record-full.h"
00026 #include "linux-record.h"
00027 
00028 /* These macros are the values of the first argument of system call
00029    "sys_ptrace".  The values of these macros were obtained from Linux
00030    Kernel source.  */
00031 
00032 #define RECORD_PTRACE_PEEKTEXT  1
00033 #define RECORD_PTRACE_PEEKDATA  2
00034 #define RECORD_PTRACE_PEEKUSR   3
00035 
00036 /* These macros are the values of the first argument of system call
00037    "sys_socketcall".  The values of these macros were obtained from
00038    Linux Kernel source.  */
00039 
00040 #define RECORD_SYS_SOCKET       1
00041 #define RECORD_SYS_BIND         2
00042 #define RECORD_SYS_CONNECT      3
00043 #define RECORD_SYS_LISTEN       4
00044 #define RECORD_SYS_ACCEPT       5
00045 #define RECORD_SYS_GETSOCKNAME  6
00046 #define RECORD_SYS_GETPEERNAME  7
00047 #define RECORD_SYS_SOCKETPAIR   8
00048 #define RECORD_SYS_SEND         9
00049 #define RECORD_SYS_RECV         10
00050 #define RECORD_SYS_SENDTO       11
00051 #define RECORD_SYS_RECVFROM     12
00052 #define RECORD_SYS_SHUTDOWN     13
00053 #define RECORD_SYS_SETSOCKOPT   14
00054 #define RECORD_SYS_GETSOCKOPT   15
00055 #define RECORD_SYS_SENDMSG      16
00056 #define RECORD_SYS_RECVMSG      17
00057 
00058 /* These macros are the values of the first argument of system call
00059    "sys_ipc".  The values of these macros were obtained from Linux
00060    Kernel source.  */
00061 
00062 #define RECORD_SEMOP            1
00063 #define RECORD_SEMGET           2
00064 #define RECORD_SEMCTL           3
00065 #define RECORD_SEMTIMEDOP       4
00066 #define RECORD_MSGSND           11
00067 #define RECORD_MSGRCV           12
00068 #define RECORD_MSGGET           13
00069 #define RECORD_MSGCTL           14
00070 #define RECORD_SHMAT            21
00071 #define RECORD_SHMDT            22
00072 #define RECORD_SHMGET           23
00073 #define RECORD_SHMCTL           24
00074 
00075 /* These macros are the values of the first argument of system call
00076    "sys_quotactl".  The values of these macros were obtained from Linux
00077    Kernel source.  */
00078 
00079 #define RECORD_Q_GETFMT         0x800004
00080 #define RECORD_Q_GETINFO        0x800005
00081 #define RECORD_Q_GETQUOTA       0x800007
00082 #define RECORD_Q_XGETQSTAT      (('5' << 8) + 5)
00083 #define RECORD_Q_XGETQUOTA      (('3' << 8) + 3)
00084 
00085 #define OUTPUT_REG(val, num)      phex_nz ((val), \
00086     TYPE_LENGTH (gdbarch_register_type (get_regcache_arch (regcache), (num))))
00087 
00088 static int
00089 record_linux_sockaddr (struct regcache *regcache,
00090                        struct linux_record_tdep *tdep, ULONGEST addr,
00091                        ULONGEST len)
00092 {
00093   gdb_byte *a;
00094   int addrlen;
00095   struct gdbarch *gdbarch = get_regcache_arch (regcache);
00096   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
00097 
00098   if (!addr)
00099     return 0;
00100 
00101   a = alloca (tdep->size_int);
00102 
00103   if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
00104     return -1;
00105 
00106   /* Get the addrlen.  */
00107   if (target_read_memory ((CORE_ADDR) len, a, tdep->size_int))
00108     {
00109       if (record_debug)
00110         fprintf_unfiltered (gdb_stdlog,
00111                             "Process record: error reading "
00112                             "memory at addr = 0x%s len = %d.\n",
00113                             phex_nz (len, tdep->size_pointer),
00114                             tdep->size_int);
00115         return -1;
00116     }
00117   addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order);
00118   if (addrlen <= 0 || addrlen > tdep->size_sockaddr)
00119     addrlen = tdep->size_sockaddr;
00120 
00121   if (record_full_arch_list_add_mem ((CORE_ADDR) addr, addrlen))
00122     return -1;
00123 
00124   return 0;
00125 }
00126 
00127 static int
00128 record_linux_msghdr (struct regcache *regcache,
00129                      struct linux_record_tdep *tdep, ULONGEST addr)
00130 {
00131   gdb_byte *a;
00132   struct gdbarch *gdbarch = get_regcache_arch (regcache);
00133   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
00134   CORE_ADDR tmpaddr;
00135   int tmpint;
00136 
00137   if (!addr)
00138     return 0;
00139 
00140   if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
00141     return -1;
00142 
00143   a = alloca (tdep->size_msghdr);
00144   if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
00145     {
00146       if (record_debug)
00147         fprintf_unfiltered (gdb_stdlog,
00148                             "Process record: error reading "
00149                             "memory at addr = 0x%s "
00150                             "len = %d.\n",
00151                             phex_nz (addr, tdep->size_pointer),
00152                             tdep->size_msghdr);
00153         return -1;
00154     }
00155 
00156   /* msg_name msg_namelen */
00157   addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
00158   a += tdep->size_pointer;
00159   if (record_full_arch_list_add_mem
00160       ((CORE_ADDR) addr,
00161        (int) extract_unsigned_integer (a,
00162                                        tdep->size_int,
00163                                        byte_order)))
00164     return -1;
00165   a += tdep->size_int;
00166 
00167   /* msg_iov msg_iovlen */
00168   addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
00169   a += tdep->size_pointer;
00170   if (addr)
00171     {
00172       ULONGEST i;
00173       ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
00174                                                byte_order);
00175       gdb_byte *iov = alloca (tdep->size_iovec);
00176 
00177       for (i = 0; i < len; i++)
00178         {
00179           if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
00180             {
00181               if (record_debug)
00182                 fprintf_unfiltered (gdb_stdlog,
00183                                     "Process record: error "
00184                                     "reading memory at "
00185                                     "addr = 0x%s "
00186                                     "len = %d.\n",
00187                                     phex_nz (addr,tdep->size_pointer),
00188                                     tdep->size_iovec);
00189                 return -1;
00190             }
00191           tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
00192                                                           tdep->size_pointer,
00193                                                           byte_order);
00194           tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
00195                                                    tdep->size_size_t,
00196                                                    byte_order);
00197           if (record_full_arch_list_add_mem (tmpaddr, tmpint))
00198             return -1;
00199           addr += tdep->size_iovec;
00200         }
00201     }
00202   a += tdep->size_size_t;
00203 
00204   /* msg_control msg_controllen */
00205   addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
00206   a += tdep->size_pointer;
00207   tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
00208   if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
00209     return -1;
00210 
00211   return 0;
00212 }
00213 
00214 /* When the architecture process record get a Linux syscall
00215    instruction, it will get a Linux syscall number of this
00216    architecture and convert it to the Linux syscall number "num" which
00217    is internal to GDB.  Most Linux syscalls across architectures in
00218    Linux would be similar and mostly differ by sizes of types and
00219    structures.  This sizes are put to "tdep".
00220 
00221    Record the values of the registers and memory that will be changed
00222    in current system call.
00223 
00224    Return -1 if something wrong.  */
00225 
00226 int
00227 record_linux_system_call (enum gdb_syscall syscall, 
00228                           struct regcache *regcache,
00229                           struct linux_record_tdep *tdep)
00230 {
00231   struct gdbarch *gdbarch = get_regcache_arch (regcache);
00232   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
00233   ULONGEST tmpulongest;
00234   CORE_ADDR tmpaddr;
00235   int tmpint;
00236 
00237   switch (syscall)
00238     {
00239     case gdb_sys_restart_syscall:
00240       break;
00241 
00242     case gdb_sys_exit:
00243       {
00244         int q;
00245 
00246         target_terminal_ours ();
00247         q = yquery (_("The next instruction is syscall exit.  "
00248                       "It will make the program exit.  "
00249                       "Do you want to stop the program?"));
00250         target_terminal_inferior ();
00251         if (q)
00252           return 1;
00253       }
00254       break;
00255 
00256     case gdb_sys_fork:
00257       break;
00258 
00259     case gdb_sys_read:
00260       {
00261         ULONGEST addr, count;
00262 
00263         regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
00264         regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
00265         if (record_full_arch_list_add_mem ((CORE_ADDR) addr, (int) count))
00266           return -1;
00267       }
00268       break;
00269 
00270     case gdb_sys_write:
00271     case gdb_sys_open:
00272     case gdb_sys_close:
00273     case gdb_sys_waitpid:
00274     case gdb_sys_creat:
00275     case gdb_sys_link:
00276     case gdb_sys_unlink:
00277     case gdb_sys_execve:
00278     case gdb_sys_chdir:
00279     case gdb_sys_time:
00280     case gdb_sys_mknod:
00281     case gdb_sys_chmod:
00282     case gdb_sys_lchown16:
00283     case gdb_sys_ni_syscall17:
00284       break;
00285 
00286     case gdb_sys_stat:
00287     case gdb_sys_fstat:
00288     case gdb_sys_lstat:
00289       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00290       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00291                                          tdep->size__old_kernel_stat))
00292         return -1;
00293       break;
00294 
00295     case gdb_sys_lseek:
00296     case gdb_sys_getpid:
00297     case gdb_sys_mount:
00298     case gdb_sys_oldumount:
00299     case gdb_sys_setuid16:
00300     case gdb_sys_getuid16:
00301     case gdb_sys_stime:
00302       break;
00303 
00304     case gdb_sys_ptrace:
00305       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
00306       if (tmpulongest == RECORD_PTRACE_PEEKTEXT
00307           || tmpulongest == RECORD_PTRACE_PEEKDATA
00308           || tmpulongest == RECORD_PTRACE_PEEKUSR)
00309         {
00310           regcache_raw_read_unsigned (regcache, tdep->arg4,
00311                                       &tmpulongest);
00312           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
00313             return -1;
00314         }
00315       break;
00316 
00317     case gdb_sys_alarm:
00318     case gdb_sys_pause:
00319     case gdb_sys_utime:
00320     case gdb_sys_ni_syscall31:
00321     case gdb_sys_ni_syscall32:
00322     case gdb_sys_access:
00323     case gdb_sys_nice:
00324     case gdb_sys_ni_syscall35:
00325     case gdb_sys_sync:
00326     case gdb_sys_kill:
00327     case gdb_sys_rename:
00328     case gdb_sys_mkdir:
00329     case gdb_sys_rmdir:
00330     case gdb_sys_dup:
00331     case gdb_sys_pipe:
00332       break;
00333 
00334     case gdb_sys_times:
00335       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
00336       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00337                                          tdep->size_tms))
00338         return -1;
00339       break;
00340 
00341     case gdb_sys_ni_syscall44:
00342     case gdb_sys_brk:
00343     case gdb_sys_setgid16:
00344     case gdb_sys_getgid16:
00345     case gdb_sys_signal:
00346     case gdb_sys_geteuid16:
00347     case gdb_sys_getegid16:
00348     case gdb_sys_acct:
00349     case gdb_sys_umount:
00350     case gdb_sys_ni_syscall53:
00351       break;
00352 
00353     case gdb_sys_ioctl:
00354       /* XXX Need to add a lot of support of other ioctl requests.  */
00355       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00356       if (tmpulongest == tdep->ioctl_FIOCLEX
00357           || tmpulongest == tdep->ioctl_FIONCLEX
00358           || tmpulongest == tdep->ioctl_FIONBIO
00359           || tmpulongest == tdep->ioctl_FIOASYNC
00360           || tmpulongest == tdep->ioctl_TCSETS
00361           || tmpulongest == tdep->ioctl_TCSETSW
00362           || tmpulongest == tdep->ioctl_TCSETSF
00363           || tmpulongest == tdep->ioctl_TCSETA
00364           || tmpulongest == tdep->ioctl_TCSETAW
00365           || tmpulongest == tdep->ioctl_TCSETAF
00366           || tmpulongest == tdep->ioctl_TCSBRK
00367           || tmpulongest == tdep->ioctl_TCXONC
00368           || tmpulongest == tdep->ioctl_TCFLSH
00369           || tmpulongest == tdep->ioctl_TIOCEXCL
00370           || tmpulongest == tdep->ioctl_TIOCNXCL
00371           || tmpulongest == tdep->ioctl_TIOCSCTTY
00372           || tmpulongest == tdep->ioctl_TIOCSPGRP
00373           || tmpulongest == tdep->ioctl_TIOCSTI
00374           || tmpulongest == tdep->ioctl_TIOCSWINSZ
00375           || tmpulongest == tdep->ioctl_TIOCMBIS
00376           || tmpulongest == tdep->ioctl_TIOCMBIC
00377           || tmpulongest == tdep->ioctl_TIOCMSET
00378           || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
00379           || tmpulongest == tdep->ioctl_TIOCCONS
00380           || tmpulongest == tdep->ioctl_TIOCSSERIAL
00381           || tmpulongest == tdep->ioctl_TIOCPKT
00382           || tmpulongest == tdep->ioctl_TIOCNOTTY
00383           || tmpulongest == tdep->ioctl_TIOCSETD
00384           || tmpulongest == tdep->ioctl_TCSBRKP
00385           || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
00386           || tmpulongest == tdep->ioctl_TIOCSBRK
00387           || tmpulongest == tdep->ioctl_TIOCCBRK
00388           || tmpulongest == tdep->ioctl_TCSETS2
00389           || tmpulongest == tdep->ioctl_TCSETSW2
00390           || tmpulongest == tdep->ioctl_TCSETSF2
00391           || tmpulongest == tdep->ioctl_TIOCSPTLCK
00392           || tmpulongest == tdep->ioctl_TIOCSERCONFIG
00393           || tmpulongest == tdep->ioctl_TIOCSERGWILD
00394           || tmpulongest == tdep->ioctl_TIOCSERSWILD
00395           || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
00396           || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
00397           || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
00398           || tmpulongest == tdep->ioctl_TIOCMIWAIT
00399           || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
00400         {
00401           /* Nothing to do.  */
00402         }
00403       else if (tmpulongest == tdep->ioctl_TCGETS
00404                || tmpulongest == tdep->ioctl_TCGETA
00405                || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
00406         {
00407           regcache_raw_read_unsigned (regcache, tdep->arg3,
00408                                       &tmpulongest);
00409           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00410                                              tdep->size_termios))
00411             return -1;
00412         }
00413       else if (tmpulongest == tdep->ioctl_TIOCGPGRP
00414                || tmpulongest == tdep->ioctl_TIOCGSID)
00415         {
00416           regcache_raw_read_unsigned (regcache, tdep->arg3,
00417                                       &tmpulongest);
00418           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00419                                              tdep->size_pid_t))
00420             return -1;
00421         }
00422       else if (tmpulongest == tdep->ioctl_TIOCOUTQ
00423                || tmpulongest == tdep->ioctl_TIOCMGET
00424                || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
00425                || tmpulongest == tdep->ioctl_FIONREAD
00426                || tmpulongest == tdep->ioctl_TIOCINQ
00427                || tmpulongest == tdep->ioctl_TIOCGETD
00428                || tmpulongest == tdep->ioctl_TIOCGPTN
00429                || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
00430         {
00431           regcache_raw_read_unsigned (regcache, tdep->arg3,
00432                                       &tmpulongest);
00433           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00434                                              tdep->size_int))
00435             return -1;
00436         }
00437       else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
00438         {
00439           regcache_raw_read_unsigned (regcache, tdep->arg3,
00440                                       &tmpulongest);
00441           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00442                                              tdep->size_winsize))
00443             return -1;
00444         }
00445       else if (tmpulongest == tdep->ioctl_TIOCLINUX)
00446         {
00447           regcache_raw_read_unsigned (regcache, tdep->arg3,
00448                                       &tmpulongest);
00449           /* This syscall affects a char-size memory.  */
00450           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
00451             return -1;
00452         }
00453       else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
00454         {
00455           regcache_raw_read_unsigned (regcache, tdep->arg3,
00456                                       &tmpulongest);
00457           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00458                                              tdep->size_serial_struct))
00459             return -1;
00460         }
00461       else if (tmpulongest == tdep->ioctl_TCGETS2)
00462         {
00463           regcache_raw_read_unsigned (regcache, tdep->arg3,
00464                                       &tmpulongest);
00465           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00466                                              tdep->size_termios2))
00467             return -1;
00468         }
00469       else if (tmpulongest == tdep->ioctl_FIOQSIZE)
00470         {
00471           regcache_raw_read_unsigned (regcache, tdep->arg3,
00472                                       &tmpulongest);
00473           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00474                                              tdep->size_loff_t))
00475             return -1;
00476         }
00477       else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
00478         {
00479           regcache_raw_read_unsigned (regcache, tdep->arg3,
00480                                       &tmpulongest);
00481           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00482                                              tdep->size_serial_icounter_struct))
00483             return -1;
00484         }
00485       else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
00486         {
00487           regcache_raw_read_unsigned (regcache, tdep->arg3,
00488                                       &tmpulongest);
00489           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00490                                              tdep->size_hayes_esp_config))
00491             return -1;
00492         }
00493       else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
00494         {
00495           printf_unfiltered (_("Process record and replay target doesn't "
00496                                "support ioctl request TIOCSERGSTRUCT\n"));
00497           return 1;
00498         }
00499       else
00500         {
00501           printf_unfiltered (_("Process record and replay target doesn't "
00502                                "support ioctl request 0x%s.\n"),
00503                              OUTPUT_REG (tmpulongest, tdep->arg2));
00504           return 1;
00505         }
00506       break;
00507 
00508     case gdb_sys_fcntl:
00509       /* XXX */
00510       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00511     sys_fcntl:
00512       if (tmpulongest == tdep->fcntl_F_GETLK)
00513         {
00514           regcache_raw_read_unsigned (regcache, tdep->arg3,
00515                                       &tmpulongest);
00516           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00517                                              tdep->size_flock))
00518             return -1;
00519         }
00520       break;
00521 
00522     case gdb_sys_ni_syscall56:
00523     case gdb_sys_setpgid:
00524     case gdb_sys_ni_syscall58:
00525       break;
00526 
00527     case gdb_sys_olduname:
00528       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
00529       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00530                                          tdep->size_oldold_utsname))
00531         return -1;
00532       break;
00533 
00534     case gdb_sys_umask:
00535     case gdb_sys_chroot:
00536       break;
00537 
00538     case gdb_sys_ustat:
00539       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00540       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00541                                          tdep->size_ustat))
00542         return -1;
00543       break;
00544 
00545     case gdb_sys_dup2:
00546     case gdb_sys_getppid:
00547     case gdb_sys_getpgrp:
00548     case gdb_sys_setsid:
00549       break;
00550 
00551     case gdb_sys_sigaction:
00552       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
00553       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00554                                          tdep->size_old_sigaction))
00555         return -1;
00556       break;
00557 
00558     case gdb_sys_sgetmask:
00559     case gdb_sys_ssetmask:
00560     case gdb_sys_setreuid16:
00561     case gdb_sys_setregid16:
00562     case gdb_sys_sigsuspend:
00563       break;
00564 
00565     case gdb_sys_sigpending:
00566       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
00567       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00568                                          tdep->size_old_sigset_t))
00569         return -1;
00570       break;
00571 
00572     case gdb_sys_sethostname:
00573     case gdb_sys_setrlimit:
00574       break;
00575 
00576     case gdb_sys_old_getrlimit:
00577       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00578       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00579                                          tdep->size_rlimit))
00580         return -1;
00581       break;
00582 
00583     case gdb_sys_getrusage:
00584       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00585       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00586                                          tdep->size_rusage))
00587         return -1;
00588       break;
00589 
00590     case gdb_sys_gettimeofday:
00591       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
00592       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00593                                          tdep->size_timeval))
00594         return -1;
00595       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00596       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00597                                          tdep->size_timezone))
00598         return -1;
00599       break;
00600 
00601     case gdb_sys_settimeofday:
00602       break;
00603 
00604     case gdb_sys_getgroups16:
00605       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00606       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00607                                          tdep->size_old_gid_t))
00608         return -1;
00609       break;
00610 
00611     case gdb_sys_setgroups16:
00612       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00613       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00614                                          tdep->size_old_gid_t))
00615         return -1;
00616       break;
00617 
00618     case gdb_old_select:
00619       {
00620         struct sel_arg_struct
00621         {
00622           CORE_ADDR n;
00623           CORE_ADDR inp;
00624           CORE_ADDR outp;
00625           CORE_ADDR exp;
00626           CORE_ADDR tvp;
00627         } sel;
00628 
00629         regcache_raw_read_unsigned (regcache, tdep->arg1,
00630                                     &tmpulongest);
00631         if (tmpulongest)
00632           {
00633             if (target_read_memory (tmpulongest, (gdb_byte *) &sel,
00634                                     sizeof(sel)))
00635               {
00636                 if (record_debug)
00637                   fprintf_unfiltered (gdb_stdlog,
00638                                       "Process record: error reading memory "
00639                                       "at addr = 0x%s len = %lu.\n",
00640                                       OUTPUT_REG (tmpulongest, tdep->arg1),
00641                                       (unsigned long) sizeof (sel));
00642                 return -1;
00643               }
00644             if (record_full_arch_list_add_mem (sel.inp, tdep->size_fd_set))
00645               return -1;
00646             if (record_full_arch_list_add_mem (sel.outp, tdep->size_fd_set))
00647               return -1;
00648             if (record_full_arch_list_add_mem (sel.exp, tdep->size_fd_set))
00649               return -1;
00650             if (record_full_arch_list_add_mem (sel.tvp, tdep->size_timeval))
00651               return -1;
00652           }
00653       }
00654       break;
00655 
00656     case gdb_sys_symlink:
00657       break;
00658 
00659     case gdb_sys_readlink:
00660       {
00661         ULONGEST len;
00662 
00663         regcache_raw_read_unsigned (regcache, tdep->arg2,
00664                                     &tmpulongest);
00665         regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
00666         if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
00667           return -1;
00668       }
00669       break;
00670 
00671     case gdb_sys_uselib:
00672     case gdb_sys_swapon:
00673       break;
00674 
00675     case gdb_sys_reboot:
00676       {
00677         int q;
00678 
00679         target_terminal_ours ();
00680         q = yquery (_("The next instruction is syscall reboot.  "
00681                       "It will restart the computer.  "
00682                       "Do you want to stop the program?"));
00683         target_terminal_inferior ();
00684         if (q)
00685           return 1;
00686       }
00687       break;
00688 
00689     case gdb_old_readdir:
00690       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00691       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00692                                          tdep->size_dirent))
00693         return -1;
00694       break;
00695 
00696     case gdb_old_mmap:
00697       break;
00698 
00699     case gdb_sys_munmap:
00700       {
00701         ULONGEST len;
00702 
00703         regcache_raw_read_unsigned (regcache, tdep->arg1,
00704                                     &tmpulongest);
00705         regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
00706         if (record_full_memory_query)
00707           {
00708             int q;
00709 
00710             target_terminal_ours ();
00711             q = yquery (_("\
00712 The next instruction is syscall munmap.\n\
00713 It will free the memory addr = 0x%s len = %u.\n\
00714 It will make record target cannot record some memory change.\n\
00715 Do you want to stop the program?"),
00716                         OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
00717             target_terminal_inferior ();
00718             if (q)
00719               return 1;
00720           }
00721       }
00722       break;
00723 
00724     case gdb_sys_truncate:
00725     case gdb_sys_ftruncate:
00726     case gdb_sys_fchmod:
00727     case gdb_sys_fchown16:
00728     case gdb_sys_getpriority:
00729     case gdb_sys_setpriority:
00730     case gdb_sys_ni_syscall98:
00731       break;
00732 
00733     case gdb_sys_statfs:
00734     case gdb_sys_fstatfs:
00735       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00736       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00737                                          tdep->size_statfs))
00738         return -1;
00739       break;
00740 
00741     case gdb_sys_ioperm:
00742       break;
00743 
00744     case gdb_sys_socket:
00745     case gdb_sys_sendto:
00746     case gdb_sys_sendmsg:
00747     case gdb_sys_shutdown:
00748     case gdb_sys_bind:
00749     case gdb_sys_connect:
00750     case gdb_sys_listen:
00751     case gdb_sys_setsockopt:
00752       break;
00753 
00754     case gdb_sys_accept:
00755     case gdb_sys_getsockname:
00756     case gdb_sys_getpeername:
00757       {
00758         ULONGEST len;
00759 
00760         regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00761         regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
00762         if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
00763           return -1;
00764       }
00765       break;
00766 
00767     case gdb_sys_recvfrom:
00768       {
00769         ULONGEST len;
00770 
00771         regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
00772         regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
00773         if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
00774           return -1;
00775       }
00776       break;
00777 
00778     case gdb_sys_recv:
00779       {
00780         ULONGEST size;
00781 
00782         regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00783         regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
00784         if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00785                                            (int) size))
00786           return -1;
00787       }
00788       break;
00789 
00790     case gdb_sys_recvmsg:
00791       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
00792       if (record_linux_msghdr (regcache, tdep, tmpulongest))
00793         return -1;
00794       break;
00795 
00796     case gdb_sys_socketpair:
00797       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
00798       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00799                                          tdep->size_int))
00800         return -1;
00801       break;
00802 
00803     case gdb_sys_getsockopt:
00804       regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
00805       if (tmpulongest)
00806         {
00807           ULONGEST optvalp;
00808           gdb_byte *optlenp = alloca (tdep->size_int);
00809 
00810           if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
00811                                   tdep->size_int))
00812             {
00813               if (record_debug)
00814                 fprintf_unfiltered (gdb_stdlog,
00815                                     "Process record: error reading "
00816                                     "memory at addr = 0x%s "
00817                                     "len = %d.\n",
00818                                     OUTPUT_REG (tmpulongest, tdep->arg5),
00819                                     tdep->size_int);
00820               return -1;
00821             }
00822           regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
00823           tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
00824                                                  byte_order);
00825           if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
00826             return -1;
00827           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00828                                              tdep->size_int))
00829             return -1;
00830         }
00831       break;
00832 
00833     case gdb_sys_socketcall:
00834       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
00835       switch (tmpulongest)
00836         {
00837         case RECORD_SYS_SOCKET:
00838         case RECORD_SYS_BIND:
00839         case RECORD_SYS_CONNECT:
00840         case RECORD_SYS_LISTEN:
00841           break;
00842         case RECORD_SYS_ACCEPT:
00843         case RECORD_SYS_GETSOCKNAME:
00844         case RECORD_SYS_GETPEERNAME:
00845           {
00846             regcache_raw_read_unsigned (regcache, tdep->arg2,
00847                                         &tmpulongest);
00848             if (tmpulongest)
00849               {
00850                 gdb_byte *a = alloca (tdep->size_ulong * 2);
00851                 ULONGEST len;
00852 
00853                 tmpulongest += tdep->size_ulong;
00854                 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
00855                                         tdep->size_ulong * 2))
00856                   {
00857                     if (record_debug)
00858                       fprintf_unfiltered (gdb_stdlog,
00859                                           "Process record: error reading "
00860                                           "memory at addr = 0x%s len = %d.\n",
00861                                           OUTPUT_REG (tmpulongest, tdep->arg2),
00862                                           tdep->size_ulong * 2);
00863                     return -1;
00864                   }
00865                 tmpulongest = extract_unsigned_integer (a,
00866                                                         tdep->size_ulong,
00867                                                         byte_order);
00868                 len = extract_unsigned_integer (a + tdep->size_ulong,
00869                                                 tdep->size_ulong, byte_order);
00870                 if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
00871                   return -1;
00872               }
00873           }
00874           break;
00875 
00876         case RECORD_SYS_SOCKETPAIR:
00877           {
00878             gdb_byte *a = alloca (tdep->size_ulong);
00879 
00880             regcache_raw_read_unsigned (regcache, tdep->arg2,
00881                                         &tmpulongest);
00882             if (tmpulongest)
00883               {
00884                 tmpulongest += tdep->size_ulong * 3;
00885                 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
00886                                         tdep->size_ulong))
00887                   {
00888                     if (record_debug)
00889                       fprintf_unfiltered (gdb_stdlog,
00890                                           "Process record: error reading "
00891                                           "memory at addr = 0x%s len = %d.\n",
00892                                           OUTPUT_REG (tmpulongest, tdep->arg2),
00893                                           tdep->size_ulong);
00894                     return -1;
00895                   }
00896                 tmpaddr
00897                   = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
00898                                                           byte_order);
00899                 if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
00900                   return -1;
00901               }
00902           }
00903           break;
00904         case RECORD_SYS_SEND:
00905         case RECORD_SYS_SENDTO:
00906           break;
00907         case RECORD_SYS_RECVFROM:
00908           regcache_raw_read_unsigned (regcache, tdep->arg2,
00909                                       &tmpulongest);
00910           if (tmpulongest)
00911             {
00912               gdb_byte *a = alloca (tdep->size_ulong * 2);
00913               ULONGEST len;
00914 
00915               tmpulongest += tdep->size_ulong * 4;
00916               if (target_read_memory ((CORE_ADDR) tmpulongest, a,
00917                                       tdep->size_ulong * 2))
00918                 {
00919                   if (record_debug)
00920                     fprintf_unfiltered (gdb_stdlog,
00921                                         "Process record: error reading "
00922                                         "memory at addr = 0x%s len = %d.\n",
00923                                         OUTPUT_REG (tmpulongest, tdep->arg2),
00924                                         tdep->size_ulong * 2);
00925                   return -1;
00926                 }
00927               tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
00928                                                       byte_order);
00929               len = extract_unsigned_integer (a + tdep->size_ulong,
00930                                               tdep->size_ulong, byte_order);
00931               if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
00932                 return -1;
00933             }
00934         case RECORD_SYS_RECV:
00935           regcache_raw_read_unsigned (regcache, tdep->arg2,
00936                                       &tmpulongest);
00937           if (tmpulongest)
00938             {
00939               gdb_byte *a = alloca (tdep->size_ulong * 2);
00940 
00941               tmpulongest += tdep->size_ulong;
00942               if (target_read_memory ((CORE_ADDR) tmpulongest, a,
00943                                       tdep->size_ulong))
00944                 {
00945                   if (record_debug)
00946                     fprintf_unfiltered (gdb_stdlog,
00947                                         "Process record: error reading "
00948                                         "memory at addr = 0x%s len = %d.\n",
00949                                         OUTPUT_REG (tmpulongest, tdep->arg2),
00950                                         tdep->size_ulong);
00951                     return -1;
00952                 }
00953               tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
00954                                                       byte_order);
00955               if (tmpulongest)
00956                 {
00957                   a += tdep->size_ulong;
00958                   tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
00959                                                            byte_order);
00960                   if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
00961                                                      tmpint))
00962                     return -1;
00963                 }
00964             }
00965           break;
00966         case RECORD_SYS_SHUTDOWN:
00967         case RECORD_SYS_SETSOCKOPT:
00968           break;
00969         case RECORD_SYS_GETSOCKOPT:
00970           {
00971             gdb_byte *a = alloca (tdep->size_ulong * 2);
00972             gdb_byte *av = alloca (tdep->size_int);
00973 
00974             regcache_raw_read_unsigned (regcache, tdep->arg2,
00975                                         &tmpulongest);
00976             if (tmpulongest)
00977               {
00978                 tmpulongest += tdep->size_ulong * 3;
00979                 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
00980                                         tdep->size_ulong * 2))
00981                   {
00982                     if (record_debug)
00983                       fprintf_unfiltered (gdb_stdlog,
00984                                           "Process record: error reading "
00985                                           "memory at addr = 0x%s len = %d.\n",
00986                                           OUTPUT_REG (tmpulongest, tdep->arg2),
00987                                           tdep->size_ulong * 2);
00988                     return -1;
00989                   }
00990                 tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
00991                                                         tdep->size_ulong,
00992                                                         byte_order);
00993                 if (tmpulongest)
00994                   {
00995                     if (target_read_memory ((CORE_ADDR) tmpulongest, av,
00996                                             tdep->size_int))
00997                       {
00998                         if (record_debug)
00999                           fprintf_unfiltered (gdb_stdlog,
01000                                               "Process record: error reading "
01001                                               "memory at addr = 0x%s "
01002                                               "len = %d.\n",
01003                                               phex_nz (tmpulongest,
01004                                                        tdep->size_ulong),
01005                                               tdep->size_int);
01006                         return -1;
01007                       }
01008                     tmpaddr
01009                       = (CORE_ADDR) extract_unsigned_integer (a,
01010                                                               tdep->size_ulong,
01011                                                               byte_order);
01012                     tmpint = (int) extract_unsigned_integer (av,
01013                                                              tdep->size_int,
01014                                                              byte_order);
01015                     if (record_full_arch_list_add_mem (tmpaddr, tmpint))
01016                       return -1;
01017                     a += tdep->size_ulong;
01018                     tmpaddr
01019                       = (CORE_ADDR) extract_unsigned_integer (a,
01020                                                               tdep->size_ulong,
01021                                                               byte_order);
01022                     if (record_full_arch_list_add_mem (tmpaddr,
01023                                                        tdep->size_int))
01024                       return -1;
01025                   }
01026               }
01027           }
01028           break;
01029         case RECORD_SYS_SENDMSG:
01030           break;
01031         case RECORD_SYS_RECVMSG:
01032           {
01033             gdb_byte *a = alloca (tdep->size_ulong);
01034 
01035             regcache_raw_read_unsigned (regcache, tdep->arg2,
01036                                         &tmpulongest);
01037             if (tmpulongest)
01038               {
01039                 tmpulongest += tdep->size_ulong;
01040                 if (target_read_memory ((CORE_ADDR) tmpulongest, a,
01041                                         tdep->size_ulong))
01042                   {
01043                     if (record_debug)
01044                       fprintf_unfiltered (gdb_stdlog,
01045                                           "Process record: error reading "
01046                                           "memory at addr = 0x%s len = %d.\n",
01047                                           OUTPUT_REG (tmpulongest, tdep->arg2),
01048                                           tdep->size_ulong);
01049                     return -1;
01050                   }
01051                 tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
01052                                                         byte_order);
01053                 if (record_linux_msghdr (regcache, tdep, tmpulongest))
01054                   return -1;
01055               }
01056           }
01057           break;
01058         default:
01059           printf_unfiltered (_("Process record and replay target "
01060                                "doesn't support socketcall call 0x%s\n"),
01061                              OUTPUT_REG (tmpulongest, tdep->arg1));
01062           return -1;
01063           break;
01064         }
01065       break;
01066 
01067     case gdb_sys_syslog:
01068       break;
01069 
01070     case gdb_sys_setitimer:
01071       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01072       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01073                                          tdep->size_itimerval))
01074         return -1;
01075       break;
01076 
01077     case gdb_sys_getitimer:
01078       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01079       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01080                                          tdep->size_itimerval))
01081         return -1;
01082       break;
01083 
01084     case gdb_sys_newstat:
01085     case gdb_sys_newlstat:
01086     case gdb_sys_newfstat:
01087     case gdb_sys_newfstatat:
01088       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01089       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01090                                          tdep->size_stat))
01091         return -1;
01092       break;
01093 
01094     case gdb_sys_uname:
01095       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01096       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01097                                          tdep->size_old_utsname))
01098         return -1;
01099       break;
01100 
01101     case gdb_sys_iopl:
01102     case gdb_sys_vhangup:
01103     case gdb_sys_ni_syscall112:
01104     case gdb_sys_vm86old:
01105       break;
01106 
01107     case gdb_sys_wait4:
01108       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01109       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01110                                          tdep->size_int))
01111         return -1;
01112       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
01113       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01114                                          tdep->size_rusage))
01115         return -1;
01116       break;
01117 
01118     case gdb_sys_swapoff:
01119       break;
01120 
01121     case gdb_sys_sysinfo:
01122       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01123       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01124                                          tdep->size_sysinfo))
01125         return -1;
01126       break;
01127 
01128     case gdb_sys_shmget:
01129     case gdb_sys_semget:
01130     case gdb_sys_semop:
01131     case gdb_sys_msgget:
01132       /* XXX maybe need do some record works with sys_shmdt.  */
01133     case gdb_sys_shmdt:
01134     case gdb_sys_msgsnd:
01135     case gdb_sys_semtimedop:
01136       break;
01137 
01138     case gdb_sys_shmat:
01139       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01140       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01141                                          tdep->size_ulong))
01142         return -1;
01143       break;
01144 
01145     case gdb_sys_shmctl:
01146       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01147       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01148                                          tdep->size_shmid_ds))
01149         return -1;
01150       break;
01151 
01152       /* XXX sys_semctl 525 still not supported.  */
01153       /* sys_semctl */
01154 
01155     case gdb_sys_msgrcv:
01156       {
01157         ULONGEST msgp;
01158         LONGEST l;
01159 
01160         regcache_raw_read_signed (regcache, tdep->arg3, &l);
01161         regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
01162         tmpint = l + tdep->size_long;
01163         if (record_full_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
01164           return -1;
01165       }
01166       break;
01167 
01168     case gdb_sys_msgctl:
01169       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01170       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01171                                          tdep->size_msqid_ds))
01172         return -1;
01173       break;
01174 
01175     case gdb_sys_ipc:
01176       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01177       tmpulongest &= 0xffff;
01178       switch (tmpulongest)
01179         {
01180         case RECORD_SEMOP:
01181         case RECORD_SEMGET:
01182         case RECORD_SEMTIMEDOP:
01183         case RECORD_MSGSND:
01184         case RECORD_MSGGET:
01185           /* XXX maybe need do some record works with RECORD_SHMDT.  */
01186         case RECORD_SHMDT:
01187         case RECORD_SHMGET:
01188           break;
01189         case RECORD_MSGRCV:
01190           {
01191             LONGEST second;
01192             ULONGEST ptr;
01193 
01194             regcache_raw_read_signed (regcache, tdep->arg3, &second);
01195             regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
01196             tmpint = (int) second + tdep->size_long;
01197             if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
01198               return -1;
01199           }
01200           break;
01201         case RECORD_MSGCTL:
01202           regcache_raw_read_unsigned (regcache, tdep->arg5,
01203                                       &tmpulongest);
01204           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01205                                              tdep->size_msqid_ds))
01206             return -1;
01207           break;
01208         case RECORD_SHMAT:
01209           regcache_raw_read_unsigned (regcache, tdep->arg4,
01210                                       &tmpulongest);
01211           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01212                                              tdep->size_ulong))
01213             return -1;
01214           break;
01215         case RECORD_SHMCTL:
01216           regcache_raw_read_unsigned (regcache, tdep->arg5,
01217                                       &tmpulongest);
01218           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01219                                              tdep->size_shmid_ds))
01220             return -1;
01221           break;
01222         default:
01223           /* XXX RECORD_SEMCTL still not supported.  */
01224           printf_unfiltered (_("Process record and replay target doesn't "
01225                                "support ipc number %s\n"), 
01226                              pulongest (tmpulongest));
01227           break;
01228         }
01229       break;
01230 
01231     case gdb_sys_fsync:
01232     case gdb_sys_sigreturn:
01233     case gdb_sys_clone:
01234     case gdb_sys_setdomainname:
01235       break;
01236 
01237     case gdb_sys_newuname:
01238       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01239       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01240                                          tdep->size_new_utsname))
01241         return -1;
01242       break;
01243 
01244     case gdb_sys_modify_ldt:
01245       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01246       if (tmpulongest == 0 || tmpulongest == 2)
01247         {
01248           ULONGEST ptr, bytecount;
01249 
01250           regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
01251           regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
01252           if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
01253             return -1;
01254         }
01255       break;
01256 
01257     case gdb_sys_adjtimex:
01258       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01259       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01260                                          tdep->size_timex))
01261         return -1;
01262       break;
01263 
01264     case gdb_sys_mprotect:
01265       break;
01266 
01267     case gdb_sys_sigprocmask:
01268       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01269       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01270                                          tdep->size_old_sigset_t))
01271         return -1;
01272       break;
01273 
01274     case gdb_sys_ni_syscall127:
01275     case gdb_sys_init_module:
01276     case gdb_sys_delete_module:
01277     case gdb_sys_ni_syscall130:
01278       break;
01279 
01280     case gdb_sys_quotactl:
01281       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01282       switch (tmpulongest)
01283         {
01284         case RECORD_Q_GETFMT:
01285           regcache_raw_read_unsigned (regcache, tdep->arg4,
01286                                       &tmpulongest);
01287           /* __u32 */
01288           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
01289             return -1;
01290           break;
01291         case RECORD_Q_GETINFO:
01292           regcache_raw_read_unsigned (regcache, tdep->arg4,
01293                                       &tmpulongest);
01294           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01295                                              tdep->size_mem_dqinfo))
01296             return -1;
01297           break;
01298         case RECORD_Q_GETQUOTA:
01299           regcache_raw_read_unsigned (regcache, tdep->arg4,
01300                                       &tmpulongest);
01301           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01302                                              tdep->size_if_dqblk))
01303             return -1;
01304           break;
01305         case RECORD_Q_XGETQSTAT:
01306         case RECORD_Q_XGETQUOTA:
01307           regcache_raw_read_unsigned (regcache, tdep->arg4,
01308                                       &tmpulongest);
01309           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01310                                              tdep->size_fs_quota_stat))
01311             return -1;
01312           break;
01313         }
01314       break;
01315 
01316     case gdb_sys_getpgid:
01317     case gdb_sys_fchdir:
01318     case gdb_sys_bdflush:
01319       break;
01320 
01321     case gdb_sys_sysfs:
01322       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01323       if (tmpulongest == 2)
01324         {
01325           regcache_raw_read_unsigned (regcache, tdep->arg3,
01326                                       &tmpulongest);
01327           /*XXX the size of memory is not very clear.  */
01328           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
01329             return -1;
01330         }
01331       break;
01332 
01333     case gdb_sys_personality:
01334     case gdb_sys_ni_syscall137:
01335     case gdb_sys_setfsuid16:
01336     case gdb_sys_setfsgid16:
01337       break;
01338 
01339     case gdb_sys_llseek:
01340       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
01341       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01342                                          tdep->size_loff_t))
01343         return -1;
01344       break;
01345 
01346     case gdb_sys_getdents:
01347       {
01348         ULONGEST count;
01349 
01350         regcache_raw_read_unsigned (regcache, tdep->arg2,
01351                                     &tmpulongest);
01352         regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
01353         if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01354                                            tdep->size_dirent * count))
01355           return -1;
01356       }
01357       break;
01358 
01359     case gdb_sys_select:
01360       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01361       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01362                                          tdep->size_fd_set))
01363         return -1;
01364       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01365       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01366                                          tdep->size_fd_set))
01367         return -1;
01368       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
01369       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01370                                          tdep->size_fd_set))
01371         return -1;
01372       regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
01373       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01374                                          tdep->size_timeval))
01375         return -1;
01376       break;
01377 
01378     case gdb_sys_flock:
01379     case gdb_sys_msync:
01380       break;
01381 
01382     case gdb_sys_readv:
01383       {
01384         ULONGEST vec, vlen;
01385 
01386         regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
01387         if (vec)
01388           {
01389             gdb_byte *iov = alloca (tdep->size_iovec);
01390 
01391             regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
01392             for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
01393               {
01394                 if (target_read_memory ((CORE_ADDR) vec, iov,
01395                                         tdep->size_iovec))
01396                   {
01397                     if (record_debug)
01398                       fprintf_unfiltered (gdb_stdlog,
01399                                           "Process record: error reading "
01400                                           "memory at addr = 0x%s len = %d.\n",
01401                                           OUTPUT_REG (vec, tdep->arg2),
01402                                           tdep->size_iovec);
01403                     return -1;
01404                   }
01405                 tmpaddr
01406                   = (CORE_ADDR) extract_unsigned_integer (iov,
01407                                                           tdep->size_pointer,
01408                                                           byte_order);
01409                 tmpint
01410                   = (int) extract_unsigned_integer (iov + tdep->size_pointer,
01411                                                     tdep->size_size_t,
01412                                                     byte_order);
01413                 if (record_full_arch_list_add_mem (tmpaddr, tmpint))
01414                   return -1;
01415                 vec += tdep->size_iovec;
01416               }
01417           }
01418       }
01419       break;
01420 
01421     case gdb_sys_writev:
01422     case gdb_sys_getsid:
01423     case gdb_sys_fdatasync:
01424     case gdb_sys_sysctl:
01425     case gdb_sys_mlock:
01426     case gdb_sys_munlock:
01427     case gdb_sys_mlockall:
01428     case gdb_sys_munlockall:
01429     case gdb_sys_sched_setparam:
01430       break;
01431 
01432     case gdb_sys_sched_getparam:
01433       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01434       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01435                                          tdep->size_int))
01436         return -1;
01437       break;
01438 
01439     case gdb_sys_sched_setscheduler:
01440     case gdb_sys_sched_getscheduler:
01441     case gdb_sys_sched_yield:
01442     case gdb_sys_sched_get_priority_max:
01443     case gdb_sys_sched_get_priority_min:
01444       break;
01445 
01446     case gdb_sys_sched_rr_get_interval:
01447     case gdb_sys_nanosleep:
01448       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01449       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01450                                          tdep->size_timespec))
01451         return -1;
01452       break;
01453 
01454     case gdb_sys_mremap:
01455     case gdb_sys_setresuid16:
01456       break;
01457 
01458     case gdb_sys_getresuid16:
01459       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01460       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01461                                          tdep->size_old_uid_t))
01462         return -1;
01463       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01464       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01465                                          tdep->size_old_uid_t))
01466         return -1;
01467       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01468       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01469                                          tdep->size_old_uid_t))
01470         return -1;
01471       break;
01472 
01473     case gdb_sys_vm86:
01474     case gdb_sys_ni_syscall167:
01475       break;
01476 
01477     case gdb_sys_poll:
01478       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01479       if (tmpulongest)
01480         {
01481           ULONGEST nfds;
01482 
01483           regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
01484           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01485                                              tdep->size_pollfd * nfds))
01486             return -1;
01487         }
01488       break;
01489 
01490     case gdb_sys_nfsservctl:
01491       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01492       if (tmpulongest == 7 || tmpulongest == 8)
01493         {
01494           int rsize;
01495 
01496           if (tmpulongest == 7)
01497             rsize = tdep->size_NFS_FHSIZE;
01498           else
01499             rsize = tdep->size_knfsd_fh;
01500           regcache_raw_read_unsigned (regcache, tdep->arg3,
01501                                       &tmpulongest);
01502           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
01503             return -1;
01504         }
01505       break;
01506 
01507     case gdb_sys_setresgid16:
01508       break;
01509 
01510     case gdb_sys_getresgid16:
01511       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01512       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01513                                          tdep->size_old_gid_t))
01514         return -1;
01515       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01516       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01517                                          tdep->size_old_gid_t))
01518         return -1;
01519       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01520       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01521                                          tdep->size_old_gid_t))
01522         return -1;
01523       break;
01524 
01525     case gdb_sys_prctl:
01526       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01527       switch (tmpulongest)
01528         {
01529         case 2:
01530           regcache_raw_read_unsigned (regcache, tdep->arg2,
01531                                       &tmpulongest);
01532           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01533                                              tdep->size_int))
01534             return -1;
01535           break;
01536         case 16:
01537           regcache_raw_read_unsigned (regcache, tdep->arg2,
01538                                       &tmpulongest);
01539           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01540                                              tdep->size_TASK_COMM_LEN))
01541             return -1;
01542           break;
01543         }
01544       break;
01545 
01546     case gdb_sys_rt_sigreturn:
01547       break;
01548 
01549     case gdb_sys_rt_sigaction:
01550       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01551       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01552                                          tdep->size_sigaction))
01553         return -1;
01554       break;
01555 
01556     case gdb_sys_rt_sigprocmask:
01557       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01558       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01559                                          tdep->size_sigset_t))
01560         return -1;
01561       break;
01562 
01563     case gdb_sys_rt_sigpending:
01564       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01565       if (tmpulongest)
01566         {
01567           ULONGEST sigsetsize;
01568 
01569           regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
01570           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01571                                              (int) sigsetsize))
01572             return -1;
01573         }
01574       break;
01575 
01576     case gdb_sys_rt_sigtimedwait:
01577       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01578       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01579                                          tdep->size_siginfo_t))
01580         return -1;
01581       break;
01582 
01583     case gdb_sys_rt_sigqueueinfo:
01584     case gdb_sys_rt_sigsuspend:
01585       break;
01586 
01587     case gdb_sys_pread64:
01588       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01589       if (tmpulongest)
01590         {
01591           ULONGEST count;
01592 
01593           regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
01594           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01595                                              (int) count))
01596             return -1;
01597         }
01598       break;
01599 
01600     case gdb_sys_pwrite64:
01601     case gdb_sys_chown16:
01602       break;
01603 
01604     case gdb_sys_getcwd:
01605       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01606       if (tmpulongest)
01607         {
01608           ULONGEST size;
01609 
01610           regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
01611           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01612                                              (int) size))
01613             return -1;
01614         }
01615       break;
01616 
01617     case gdb_sys_capget:
01618       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01619       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01620                                          tdep->size_cap_user_data_t))
01621         return -1;
01622       break;
01623 
01624     case gdb_sys_capset:
01625       break;
01626 
01627     case gdb_sys_sigaltstack:
01628       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01629       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01630                                          tdep->size_stack_t))
01631         return -1;
01632       break;
01633 
01634     case gdb_sys_sendfile:
01635       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01636       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01637                                          tdep->size_off_t))
01638         return -1;
01639       break;
01640 
01641     case gdb_sys_ni_syscall188:
01642     case gdb_sys_ni_syscall189:
01643     case gdb_sys_vfork:
01644       break;
01645 
01646     case gdb_sys_getrlimit:
01647       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01648       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01649                                          tdep->size_rlimit))
01650         return -1;
01651       break;
01652 
01653     case gdb_sys_mmap2:
01654       break;
01655 
01656     case gdb_sys_truncate64:
01657     case gdb_sys_ftruncate64:
01658       break;
01659 
01660     case gdb_sys_stat64:
01661     case gdb_sys_lstat64:
01662     case gdb_sys_fstat64:
01663       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01664       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01665                                          tdep->size_stat64))
01666         return -1;
01667       break;
01668 
01669     case gdb_sys_lchown:
01670     case gdb_sys_getuid:
01671     case gdb_sys_getgid:
01672     case gdb_sys_geteuid:
01673     case gdb_sys_getegid:
01674     case gdb_sys_setreuid:
01675     case gdb_sys_setregid:
01676       break;
01677 
01678     case gdb_sys_getgroups:
01679       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01680       if (tmpulongest)
01681         {
01682           ULONGEST gidsetsize;
01683 
01684           regcache_raw_read_unsigned (regcache, tdep->arg1,
01685                                       &gidsetsize);
01686           tmpint = tdep->size_gid_t * (int) gidsetsize;
01687           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
01688             return -1;
01689         }
01690       break;
01691 
01692     case gdb_sys_setgroups:
01693     case gdb_sys_fchown:
01694     case gdb_sys_setresuid:
01695       break;
01696 
01697     case gdb_sys_getresuid:
01698       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01699       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01700                                          tdep->size_uid_t))
01701         return -1;
01702       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01703       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01704                                          tdep->size_uid_t))
01705         return -1;
01706       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01707       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01708                                          tdep->size_uid_t))
01709         return -1;
01710       break;
01711 
01712     case gdb_sys_setresgid:
01713       break;
01714 
01715     case gdb_sys_getresgid:
01716       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01717       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01718                                          tdep->size_gid_t))
01719         return -1;
01720       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01721       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01722                                          tdep->size_gid_t))
01723         return -1;
01724       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01725       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01726                                          tdep->size_gid_t))
01727         return -1;
01728       break;
01729 
01730     case gdb_sys_chown:
01731     case gdb_sys_setuid:
01732     case gdb_sys_setgid:
01733     case gdb_sys_setfsuid:
01734     case gdb_sys_setfsgid:
01735     case gdb_sys_pivot_root:
01736       break;
01737 
01738     case gdb_sys_mincore:
01739       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01740       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01741                                          tdep->size_PAGE_SIZE))
01742         return -1;
01743       break;
01744 
01745     case gdb_sys_madvise:
01746       break;
01747 
01748     case gdb_sys_getdents64:
01749       {
01750         ULONGEST count;
01751 
01752         regcache_raw_read_unsigned (regcache, tdep->arg2,
01753                                     &tmpulongest);
01754         regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
01755         if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01756                                            tdep->size_dirent64 * count))
01757           return -1;
01758       }
01759       break;
01760 
01761     case gdb_sys_fcntl64:
01762       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01763       if (tmpulongest == tdep->fcntl_F_GETLK64)
01764         {
01765           regcache_raw_read_unsigned (regcache, tdep->arg3,
01766                                       &tmpulongest);
01767           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01768                                              tdep->size_flock64))
01769             return -1;
01770         }
01771       else if (tmpulongest != tdep->fcntl_F_SETLK64
01772                && tmpulongest != tdep->fcntl_F_SETLKW64)
01773         {
01774           goto sys_fcntl;
01775         }
01776       break;
01777 
01778     case gdb_sys_ni_syscall222:
01779     case gdb_sys_ni_syscall223:
01780     case gdb_sys_gettid:
01781     case gdb_sys_readahead:
01782     case gdb_sys_setxattr:
01783     case gdb_sys_lsetxattr:
01784     case gdb_sys_fsetxattr:
01785       break;
01786 
01787     case gdb_sys_getxattr:
01788     case gdb_sys_lgetxattr:
01789     case gdb_sys_fgetxattr:
01790       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01791       if (tmpulongest)
01792         {
01793           ULONGEST size;
01794 
01795           regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
01796           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01797                                              (int) size))
01798             return -1;
01799         }
01800       break;
01801 
01802     case gdb_sys_listxattr:
01803     case gdb_sys_llistxattr:
01804     case gdb_sys_flistxattr:
01805       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01806       if (tmpulongest)
01807         {
01808           ULONGEST size;
01809 
01810           regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
01811           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01812                                              (int) size))
01813             return -1;
01814         }
01815       break;
01816 
01817     case gdb_sys_removexattr:
01818     case gdb_sys_lremovexattr:
01819     case gdb_sys_fremovexattr:
01820     case gdb_sys_tkill:
01821       break;
01822 
01823     case gdb_sys_sendfile64:
01824       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01825       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01826                                          tdep->size_loff_t))
01827         return -1;
01828       break;
01829 
01830     case gdb_sys_futex:
01831     case gdb_sys_sched_setaffinity:
01832       break;
01833 
01834     case gdb_sys_sched_getaffinity:
01835       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01836       if (tmpulongest)
01837         {
01838           ULONGEST len;
01839 
01840           regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
01841           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01842                                              (int) len))
01843             return -1;
01844         }
01845       break;
01846 
01847     case gdb_sys_set_thread_area:
01848       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01849       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01850                                          tdep->size_int))
01851         return -1;
01852       break;
01853 
01854     case gdb_sys_get_thread_area:
01855       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
01856       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01857                                          tdep->size_user_desc))
01858         return -1;
01859       break;
01860 
01861     case gdb_sys_io_setup:
01862       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01863       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01864                                          tdep->size_long))
01865         return -1;
01866       break;
01867 
01868     case gdb_sys_io_destroy:
01869       break;
01870 
01871     case gdb_sys_io_getevents:
01872       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
01873       if (tmpulongest)
01874         {
01875           ULONGEST nr;
01876 
01877           regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
01878           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01879                                              nr * tdep->size_io_event))
01880             return -1;
01881         }
01882       break;
01883 
01884     case gdb_sys_io_submit:
01885       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01886       if (tmpulongest)
01887         {
01888           ULONGEST nr, i;
01889           gdb_byte *iocbp;
01890 
01891           regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
01892           iocbp = alloca (nr * tdep->size_pointer);
01893           if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
01894                                   nr * tdep->size_pointer))
01895             {
01896               if (record_debug)
01897                 fprintf_unfiltered (gdb_stdlog,
01898                                     "Process record: error reading memory "
01899                                     "at addr = 0x%s len = %u.\n",
01900                                     OUTPUT_REG (tmpulongest, tdep->arg2),
01901                                     (int) (nr * tdep->size_pointer));
01902               return -1;
01903             }
01904           for (i = 0; i < nr; i++)
01905             {
01906               tmpaddr
01907                 = (CORE_ADDR) extract_unsigned_integer (iocbp,
01908                                                         tdep->size_pointer,
01909                                                         byte_order);
01910               if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
01911                 return -1;
01912               iocbp += tdep->size_pointer;
01913             }
01914         }
01915       break;
01916 
01917     case gdb_sys_io_cancel:
01918       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01919       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01920                                          tdep->size_io_event))
01921         return -1;
01922       break;
01923 
01924     case gdb_sys_fadvise64:
01925     case gdb_sys_ni_syscall251:
01926       break;
01927 
01928     case gdb_sys_exit_group:
01929       {
01930         int q;
01931 
01932         target_terminal_ours ();
01933         q = yquery (_("The next instruction is syscall exit_group.  "
01934                       "It will make the program exit.  "
01935                       "Do you want to stop the program?"));
01936         target_terminal_inferior ();
01937         if (q)
01938           return 1;
01939       }
01940       break;
01941 
01942     case gdb_sys_lookup_dcookie:
01943       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01944       if (tmpulongest)
01945         {
01946           ULONGEST len;
01947 
01948           regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
01949           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01950                                              (int) len))
01951             return -1;
01952         }
01953       break;
01954 
01955     case gdb_sys_epoll_create:
01956     case gdb_sys_epoll_ctl:
01957       break;
01958 
01959     case gdb_sys_epoll_wait:
01960       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01961       if (tmpulongest)
01962         {
01963           ULONGEST maxevents;
01964 
01965           regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
01966           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01967                                              (maxevents
01968                                               * tdep->size_epoll_event)))
01969             return -1;
01970         }
01971       break;
01972 
01973     case gdb_sys_remap_file_pages:
01974     case gdb_sys_set_tid_address:
01975       break;
01976 
01977     case gdb_sys_timer_create:
01978       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
01979       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01980                                          tdep->size_int))
01981         return -1;
01982       break;
01983 
01984     case gdb_sys_timer_settime:
01985       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
01986       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01987                                          tdep->size_itimerspec))
01988         return -1;
01989       break;
01990 
01991     case gdb_sys_timer_gettime:
01992       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
01993       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
01994                                          tdep->size_itimerspec))
01995         return -1;
01996       break;
01997 
01998     case gdb_sys_timer_getoverrun:
01999     case gdb_sys_timer_delete:
02000     case gdb_sys_clock_settime:
02001       break;
02002 
02003     case gdb_sys_clock_gettime:
02004       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02005       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02006                                          tdep->size_timespec))
02007         return -1;
02008       break;
02009 
02010     case gdb_sys_clock_getres:
02011       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02012       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02013                                          tdep->size_timespec))
02014         return -1;
02015       break;
02016 
02017     case gdb_sys_clock_nanosleep:
02018       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
02019       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02020                                          tdep->size_timespec))
02021         return -1;
02022       break;
02023 
02024     case gdb_sys_statfs64:
02025     case gdb_sys_fstatfs64:
02026       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02027       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02028                                          tdep->size_statfs64))
02029         return -1;
02030       break;
02031 
02032     case gdb_sys_tgkill:
02033     case gdb_sys_utimes:
02034     case gdb_sys_fadvise64_64:
02035     case gdb_sys_ni_syscall273:
02036     case gdb_sys_mbind:
02037       break;
02038 
02039     case gdb_sys_get_mempolicy:
02040       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
02041       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02042                                          tdep->size_int))
02043         return -1;
02044       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02045       if (tmpulongest)
02046         {
02047           ULONGEST maxnode;
02048 
02049           regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
02050           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02051                                              maxnode * tdep->size_long))
02052             return -1;
02053         }
02054       break;
02055 
02056     case gdb_sys_set_mempolicy:
02057     case gdb_sys_mq_open:
02058     case gdb_sys_mq_unlink:
02059     case gdb_sys_mq_timedsend:
02060       break;
02061 
02062     case gdb_sys_mq_timedreceive:
02063       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02064       if (tmpulongest)
02065         {
02066           ULONGEST msg_len;
02067 
02068           regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
02069           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02070                                              (int) msg_len))
02071             return -1;
02072         }
02073       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
02074       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02075                                          tdep->size_int))
02076         return -1;
02077       break;
02078 
02079     case gdb_sys_mq_notify:
02080       break;
02081 
02082     case gdb_sys_mq_getsetattr:
02083       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02084       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02085                                          tdep->size_mq_attr))
02086         return -1;
02087       break;
02088 
02089     case gdb_sys_kexec_load:
02090       break;
02091 
02092     case gdb_sys_waitid:
02093       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02094       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02095                                          tdep->size_siginfo))
02096         return -1;
02097       regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
02098       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02099                                          tdep->size_rusage))
02100         return -1;
02101       break;
02102 
02103     case gdb_sys_ni_syscall285:
02104     case gdb_sys_add_key:
02105     case gdb_sys_request_key:
02106       break;
02107 
02108     case gdb_sys_keyctl:
02109       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
02110       if (tmpulongest == 6 || tmpulongest == 11)
02111         {
02112           regcache_raw_read_unsigned (regcache, tdep->arg3,
02113                                       &tmpulongest);
02114           if (tmpulongest)
02115             {
02116               ULONGEST buflen;
02117 
02118               regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
02119               if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02120                                                  (int) buflen))
02121                 return -1;
02122             }
02123         }
02124       break;
02125 
02126     case gdb_sys_ioprio_set:
02127     case gdb_sys_ioprio_get:
02128     case gdb_sys_inotify_init:
02129     case gdb_sys_inotify_add_watch:
02130     case gdb_sys_inotify_rm_watch:
02131     case gdb_sys_migrate_pages:
02132     case gdb_sys_openat:
02133     case gdb_sys_mkdirat:
02134     case gdb_sys_mknodat:
02135     case gdb_sys_fchownat:
02136     case gdb_sys_futimesat:
02137       break;
02138 
02139     case gdb_sys_fstatat64:
02140       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02141       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02142                                          tdep->size_stat64))
02143         return -1;
02144       break;
02145 
02146     case gdb_sys_unlinkat:
02147     case gdb_sys_renameat:
02148     case gdb_sys_linkat:
02149     case gdb_sys_symlinkat:
02150       break;
02151 
02152     case gdb_sys_readlinkat:
02153       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02154       if (tmpulongest)
02155         {
02156           ULONGEST bufsiz;
02157 
02158           regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
02159           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02160                                              (int) bufsiz))
02161             return -1;
02162         }
02163       break;
02164 
02165     case gdb_sys_fchmodat:
02166     case gdb_sys_faccessat:
02167       break;
02168 
02169     case gdb_sys_pselect6:
02170       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02171       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02172                                          tdep->size_fd_set))
02173         return -1;
02174       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02175       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02176                                          tdep->size_fd_set))
02177         return -1;
02178       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
02179       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02180                                          tdep->size_fd_set))
02181         return -1;
02182       regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
02183       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02184                                          tdep->size_timespec))
02185         return -1;
02186       break;
02187 
02188     case gdb_sys_ppoll:
02189       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
02190       if (tmpulongest)
02191         {
02192           ULONGEST nfds;
02193 
02194           regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
02195           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02196                                              tdep->size_pollfd * nfds))
02197             return -1;
02198         }
02199       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02200       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02201                                          tdep->size_timespec))
02202         return -1;
02203       break;
02204 
02205     case gdb_sys_unshare:
02206     case gdb_sys_set_robust_list:
02207       break;
02208 
02209     case gdb_sys_get_robust_list:
02210       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02211       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02212                                          tdep->size_int))
02213         return -1;
02214       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02215       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02216                                          tdep->size_int))
02217         return -1;
02218       break;
02219 
02220     case gdb_sys_splice:
02221       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02222       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02223                                          tdep->size_loff_t))
02224         return -1;
02225       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
02226       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02227                                          tdep->size_loff_t))
02228         return -1;
02229       break;
02230 
02231     case gdb_sys_sync_file_range:
02232     case gdb_sys_tee:
02233     case gdb_sys_vmsplice:
02234       break;
02235 
02236     case gdb_sys_move_pages:
02237       regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
02238       if (tmpulongest)
02239         {
02240           ULONGEST nr_pages;
02241 
02242           regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
02243           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02244                                              nr_pages * tdep->size_int))
02245             return -1;
02246         }
02247       break;
02248 
02249     case gdb_sys_getcpu:
02250       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
02251       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02252                                          tdep->size_int))
02253         return -1;
02254       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02255       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02256                                          tdep->size_int))
02257         return -1;
02258       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
02259       if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
02260                                          tdep->size_ulong * 2))
02261         return -1;
02262       break;
02263 
02264     case gdb_sys_epoll_pwait:
02265       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
02266       if (tmpulongest)
02267         {
02268           ULONGEST maxevents;
02269 
02270           regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
02271           tmpint = (int) maxevents * tdep->size_epoll_event;
02272           if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
02273             return -1;
02274         }
02275       break;
02276 
02277     default:
02278       printf_unfiltered (_("Process record and replay target doesn't "
02279                            "support syscall number %d\n"), syscall);
02280       return -1;
02281       break;
02282     }
02283 
02284   return 0;
02285 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines