diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index a40845a..9a1f688 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -85,6 +85,18 @@
 #define OUTPUT_REG(val, num)      phex_nz ((val), \
     TYPE_LENGTH (gdbarch_register_type (get_regcache_arch (regcache), (num))))
 
+/* Record a memory area of length LEN pointed to by register
+   REGNUM.  */
+
+static int
+record_mem_at_reg (struct regcache *regcache, int regnum, int len)
+{
+  ULONGEST addr;
+
+  regcache_raw_read_unsigned (regcache, regnum, &addr);
+  return record_full_arch_list_add_mem ((CORE_ADDR) addr, len);
+}
+
 static int
 record_linux_sockaddr (struct regcache *regcache,
                        struct linux_record_tdep *tdep, ULONGEST addr,
@@ -259,14 +271,9 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_read:
-      {
-        ULONGEST addr, count;
-
-        regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
-        regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
-        if (record_full_arch_list_add_mem ((CORE_ADDR) addr, (int) count))
-          return -1;
-      }
+      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
+      if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
+	return -1;
       break;
 
     case gdb_sys_write:
@@ -306,9 +313,8 @@ record_linux_system_call (enum gdb_syscall syscall,
     case gdb_sys_stat:
     case gdb_sys_fstat:
     case gdb_sys_lstat:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size__old_kernel_stat))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size__old_kernel_stat))
         return -1;
       break;
 
@@ -327,9 +333,7 @@ record_linux_system_call (enum gdb_syscall syscall,
           || tmpulongest == RECORD_PTRACE_PEEKDATA
           || tmpulongest == RECORD_PTRACE_PEEKUSR)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg4,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
+	  if (record_mem_at_reg (regcache, tdep->arg4, 4))
             return -1;
         }
       break;
@@ -357,9 +361,7 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_times:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_tms))
+      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_tms))
         return -1;
       break;
 
@@ -429,19 +431,15 @@ record_linux_system_call (enum gdb_syscall syscall,
                || tmpulongest == tdep->ioctl_TCGETA
                || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_termios))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_termios))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TIOCGPGRP
                || tmpulongest == tdep->ioctl_TIOCGSID)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_pid_t))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_pid_t))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TIOCOUTQ
@@ -453,66 +451,50 @@ record_linux_system_call (enum gdb_syscall syscall,
                || tmpulongest == tdep->ioctl_TIOCGPTN
                || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_int))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_int))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_winsize))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_winsize))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TIOCLINUX)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
 	  /* This syscall affects a char-size memory.  */
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
+	  if (record_mem_at_reg (regcache, tdep->arg3, 1))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_serial_struct))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_serial_struct))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TCGETS2)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_termios2))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_termios2))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_FIOQSIZE)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_loff_t))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_loff_t))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_serial_icounter_struct))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_serial_icounter_struct))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_hayes_esp_config))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_hayes_esp_config))
             return -1;
         }
       else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
@@ -536,10 +518,8 @@ record_linux_system_call (enum gdb_syscall syscall,
     sys_fcntl:
       if (tmpulongest == tdep->fcntl_F_GETLK)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_flock))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_flock))
             return -1;
         }
       break;
@@ -550,9 +530,8 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_olduname:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_oldold_utsname))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_oldold_utsname))
         return -1;
       break;
 
@@ -561,9 +540,8 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_ustat:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_ustat))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_ustat))
         return -1;
       break;
 
@@ -574,9 +552,8 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_sigaction:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_sigaction))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_old_sigaction))
         return -1;
       break;
 
@@ -588,9 +565,8 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_sigpending:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_sigset_t))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_old_sigset_t))
         return -1;
       break;
 
@@ -599,27 +575,20 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_old_getrlimit:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_rlimit))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
         return -1;
       break;
 
     case gdb_sys_getrusage:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_rusage))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rusage))
         return -1;
       break;
 
     case gdb_sys_gettimeofday:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timeval))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timezone))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_timeval)
+	  || record_mem_at_reg (regcache, tdep->arg2,
+				tdep->size_timezone))
         return -1;
       break;
 
@@ -693,12 +662,9 @@ record_linux_system_call (enum gdb_syscall syscall,
 
     case gdb_sys_readlink:
       {
-        ULONGEST len;
-
-        regcache_raw_read_unsigned (regcache, tdep->arg2,
-                                    &tmpulongest);
-        regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
-        if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
+        regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
+	if (record_mem_at_reg (regcache, tdep->arg2,
+			       (int) tmpulongest))
           return -1;
       }
       break;
@@ -722,9 +688,7 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_old_readdir:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_dirent))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_old_dirent))
         return -1;
       break;
 
@@ -767,9 +731,7 @@ Do you want to stop the program?"),
 
     case gdb_sys_statfs:
     case gdb_sys_fstatfs:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_statfs))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_statfs))
         return -1;
       break;
 
@@ -811,15 +773,9 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_recv:
-      {
-        ULONGEST size;
-
-        regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-        regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
-        if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					   (int) size))
-          return -1;
-      }
+      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
+      if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
+	return -1;
       break;
 
     case gdb_sys_recvmsg:
@@ -829,9 +785,7 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_socketpair:
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
+      if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
         return -1;
       break;
 
@@ -1103,25 +1057,21 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_setitimer:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_itimerval))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_itimerval))
         return -1;
       break;
 
     case gdb_sys_getitimer:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_itimerval))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_itimerval))
         return -1;
       break;
 
     case gdb_sys_newstat:
     case gdb_sys_newlstat:
     case gdb_sys_newfstat:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_stat))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat))
         return -1;
       break;
 
@@ -1133,9 +1083,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_uname:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_utsname))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_old_utsname))
         return -1;
       break;
 
@@ -1146,13 +1095,10 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_wait4:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_rusage))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_int)
+	  || record_mem_at_reg (regcache, tdep->arg4,
+				tdep->size_rusage))
         return -1;
       break;
 
@@ -1160,9 +1106,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_sysinfo:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_sysinfo))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_sysinfo))
         return -1;
       break;
 
@@ -1177,16 +1122,13 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_shmat:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_ulong))
+      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_ulong))
         return -1;
       break;
 
     case gdb_sys_shmctl:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_shmid_ds))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_shmid_ds))
         return -1;
       break;
 
@@ -1195,21 +1137,18 @@ Do you want to stop the program?"),
 
     case gdb_sys_msgrcv:
       {
-        ULONGEST msgp;
         LONGEST l;
 
         regcache_raw_read_signed (regcache, tdep->arg3, &l);
-        regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
         tmpint = l + tdep->size_long;
-        if (record_full_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
+	if (record_mem_at_reg (regcache, tdep->arg2, tmpint))
           return -1;
       }
       break;
 
     case gdb_sys_msgctl:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_msqid_ds))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_msqid_ds))
         return -1;
       break;
 
@@ -1230,34 +1169,26 @@ Do you want to stop the program?"),
         case RECORD_MSGRCV:
           {
             LONGEST second;
-            ULONGEST ptr;
 
             regcache_raw_read_signed (regcache, tdep->arg3, &second);
-            regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
             tmpint = (int) second + tdep->size_long;
-            if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, tmpint))
+	    if (record_mem_at_reg (regcache, tdep->arg5, tmpint))
               return -1;
           }
           break;
         case RECORD_MSGCTL:
-          regcache_raw_read_unsigned (regcache, tdep->arg5,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_msqid_ds))
+	  if (record_mem_at_reg (regcache, tdep->arg5,
+				 tdep->size_msqid_ds))
             return -1;
           break;
         case RECORD_SHMAT:
-          regcache_raw_read_unsigned (regcache, tdep->arg4,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_ulong))
+	  if (record_mem_at_reg (regcache, tdep->arg4,
+				 tdep->size_ulong))
             return -1;
           break;
         case RECORD_SHMCTL:
-          regcache_raw_read_unsigned (regcache, tdep->arg5,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_shmid_ds))
+	  if (record_mem_at_reg (regcache, tdep->arg5,
+				 tdep->size_shmid_ds))
             return -1;
           break;
         default:
@@ -1276,9 +1207,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_newuname:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_new_utsname))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_new_utsname))
         return -1;
       break;
 
@@ -1286,19 +1216,18 @@ Do you want to stop the program?"),
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest == 0 || tmpulongest == 2)
         {
-          ULONGEST ptr, bytecount;
+          ULONGEST bytecount;
 
-          regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
           regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
+	  if (record_mem_at_reg (regcache, tdep->arg2,
+				 (int) bytecount))
             return -1;
         }
       break;
 
     case gdb_sys_adjtimex:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timex))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_timex))
         return -1;
       break;
 
@@ -1306,9 +1235,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_sigprocmask:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_sigset_t))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_old_sigset_t))
         return -1;
       break;
 
@@ -1323,32 +1251,24 @@ Do you want to stop the program?"),
       switch (tmpulongest)
         {
         case RECORD_Q_GETFMT:
-          regcache_raw_read_unsigned (regcache, tdep->arg4,
-                                      &tmpulongest);
           /* __u32 */
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4))
+	  if (record_mem_at_reg (regcache, tdep->arg4, 4))
             return -1;
           break;
         case RECORD_Q_GETINFO:
-          regcache_raw_read_unsigned (regcache, tdep->arg4,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_mem_dqinfo))
+	  if (record_mem_at_reg (regcache, tdep->arg4,
+				 tdep->size_mem_dqinfo))
             return -1;
           break;
         case RECORD_Q_GETQUOTA:
-          regcache_raw_read_unsigned (regcache, tdep->arg4,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_if_dqblk))
+	  if (record_mem_at_reg (regcache, tdep->arg4,
+				 tdep->size_if_dqblk))
             return -1;
           break;
         case RECORD_Q_XGETQSTAT:
         case RECORD_Q_XGETQUOTA:
-          regcache_raw_read_unsigned (regcache, tdep->arg4,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_fs_quota_stat))
+	  if (record_mem_at_reg (regcache, tdep->arg4,
+				 tdep->size_fs_quota_stat))
             return -1;
           break;
         }
@@ -1363,10 +1283,8 @@ Do you want to stop the program?"),
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest == 2)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
 	  /*XXX the size of memory is not very clear.  */
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
+	  if (record_mem_at_reg (regcache, tdep->arg3, 10))
             return -1;
         }
       break;
@@ -1378,41 +1296,27 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_llseek:
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_loff_t))
+      if (record_mem_at_reg (regcache, tdep->arg4,
+			     tdep->size_loff_t))
         return -1;
       break;
 
     case gdb_sys_getdents:
     case gdb_sys_getdents64:
-      {
-        ULONGEST count;
-
-        regcache_raw_read_unsigned (regcache, tdep->arg2,
-                                    &tmpulongest);
-        regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
-        if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, count))
-          return -1;
-      }
+      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
+      if (record_mem_at_reg (regcache, tdep->arg2, tmpulongest))
+	return -1;
       break;
 
     case gdb_sys_select:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_fd_set))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_fd_set))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_fd_set))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timeval))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_fd_set)
+	  || record_mem_at_reg (regcache, tdep->arg3,
+				tdep->size_fd_set)
+	  || record_mem_at_reg (regcache, tdep->arg4,
+				tdep->size_fd_set)
+	  || record_mem_at_reg (regcache, tdep->arg5,
+				tdep->size_timeval))
         return -1;
       break;
 
@@ -1471,9 +1375,7 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_sched_getparam:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
         return -1;
       break;
 
@@ -1486,9 +1388,8 @@ Do you want to stop the program?"),
 
     case gdb_sys_sched_rr_get_interval:
     case gdb_sys_nanosleep:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timespec))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_timespec))
         return -1;
       break;
 
@@ -1497,17 +1398,12 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_getresuid16:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_uid_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_uid_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_uid_t))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_old_uid_t)
+	  || record_mem_at_reg (regcache, tdep->arg2,
+				tdep->size_old_uid_t)
+	  || record_mem_at_reg (regcache, tdep->arg3,
+				tdep->size_old_uid_t))
         return -1;
       break;
 
@@ -1538,9 +1434,7 @@ Do you want to stop the program?"),
             rsize = tdep->size_NFS_FHSIZE;
           else
             rsize = tdep->size_knfsd_fh;
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize))
+	  if (record_mem_at_reg (regcache, tdep->arg3, rsize))
             return -1;
         }
       break;
@@ -1549,17 +1443,12 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_getresgid16:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_gid_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_gid_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_old_gid_t))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_old_gid_t)
+	  || record_mem_at_reg (regcache, tdep->arg2,
+				tdep->size_old_gid_t)
+	  || record_mem_at_reg (regcache, tdep->arg3,
+				tdep->size_old_gid_t))
         return -1;
       break;
 
@@ -1568,17 +1457,13 @@ Do you want to stop the program?"),
       switch (tmpulongest)
         {
         case 2:
-          regcache_raw_read_unsigned (regcache, tdep->arg2,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_int))
+	  if (record_mem_at_reg (regcache, tdep->arg2,
+				 tdep->size_int))
             return -1;
           break;
         case 16:
-          regcache_raw_read_unsigned (regcache, tdep->arg2,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_TASK_COMM_LEN))
+	  if (record_mem_at_reg (regcache, tdep->arg2,
+				 tdep->size_TASK_COMM_LEN))
             return -1;
           break;
         }
@@ -1588,16 +1473,14 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_rt_sigaction:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_sigaction))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_sigaction))
         return -1;
       break;
 
     case gdb_sys_rt_sigprocmask:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_sigset_t))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_sigset_t))
         return -1;
       break;
 
@@ -1615,9 +1498,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_rt_sigtimedwait:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_siginfo_t))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_siginfo_t))
         return -1;
       break;
 
@@ -1656,9 +1538,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_capget:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_cap_user_data_t))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_cap_user_data_t))
         return -1;
       break;
 
@@ -1666,16 +1547,13 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_sigaltstack:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_stack_t))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_stack_t))
         return -1;
       break;
 
     case gdb_sys_sendfile:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_off_t))
+      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_off_t))
         return -1;
       break;
 
@@ -1685,9 +1563,7 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_getrlimit:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_rlimit))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
         return -1;
       break;
 
@@ -1701,9 +1577,7 @@ Do you want to stop the program?"),
     case gdb_sys_stat64:
     case gdb_sys_lstat64:
     case gdb_sys_fstat64:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_stat64))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat64))
         return -1;
       break;
 
@@ -1736,17 +1610,12 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_getresuid:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_uid_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_uid_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_uid_t))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_uid_t)
+	  || record_mem_at_reg (regcache, tdep->arg2,
+				tdep->size_uid_t)
+	  || record_mem_at_reg (regcache, tdep->arg3,
+				tdep->size_uid_t))
         return -1;
       break;
 
@@ -1754,17 +1623,12 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_getresgid:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_gid_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_gid_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_gid_t))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_gid_t)
+	  || record_mem_at_reg (regcache, tdep->arg2,
+				tdep->size_gid_t)
+	  || record_mem_at_reg (regcache, tdep->arg3,
+				tdep->size_gid_t))
         return -1;
       break;
 
@@ -1777,9 +1641,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_mincore:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_PAGE_SIZE))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_PAGE_SIZE))
         return -1;
       break;
 
@@ -1790,10 +1653,8 @@ Do you want to stop the program?"),
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest == tdep->fcntl_F_GETLK64)
         {
-          regcache_raw_read_unsigned (regcache, tdep->arg3,
-                                      &tmpulongest);
-          if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					     tdep->size_flock64))
+	  if (record_mem_at_reg (regcache, tdep->arg3,
+				 tdep->size_flock64))
             return -1;
         }
       else if (tmpulongest != tdep->fcntl_F_SETLK64
@@ -1849,9 +1710,7 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_sendfile64:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_loff_t))
+      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
         return -1;
       break;
 
@@ -1873,23 +1732,18 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_set_thread_area:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
+      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
         return -1;
       break;
 
     case gdb_sys_get_thread_area:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_user_desc))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_user_desc))
         return -1;
       break;
 
     case gdb_sys_io_setup:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_long))
+      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_long))
         return -1;
       break;
 
@@ -1943,9 +1797,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_io_cancel:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_io_event))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_io_event))
         return -1;
       break;
 
@@ -2003,23 +1856,19 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_timer_create:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
+      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
         return -1;
       break;
 
     case gdb_sys_timer_settime:
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_itimerspec))
+      if (record_mem_at_reg (regcache, tdep->arg4,
+			     tdep->size_itimerspec))
         return -1;
       break;
 
     case gdb_sys_timer_gettime:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_itimerspec))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_itimerspec))
         return -1;
       break;
 
@@ -2029,31 +1878,27 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_clock_gettime:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timespec))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_timespec))
         return -1;
       break;
 
     case gdb_sys_clock_getres:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timespec))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_timespec))
         return -1;
       break;
 
     case gdb_sys_clock_nanosleep:
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timespec))
+      if (record_mem_at_reg (regcache, tdep->arg4,
+			     tdep->size_timespec))
         return -1;
       break;
 
     case gdb_sys_statfs64:
     case gdb_sys_fstatfs64:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_statfs64))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_statfs64))
         return -1;
       break;
 
@@ -2065,9 +1910,7 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_get_mempolicy:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
+      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
         return -1;
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest)
@@ -2098,9 +1941,7 @@ Do you want to stop the program?"),
 					     (int) msg_len))
             return -1;
         }
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
+      if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
         return -1;
       break;
 
@@ -2108,9 +1949,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_mq_getsetattr:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_mq_attr))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_mq_attr))
         return -1;
       break;
 
@@ -2118,13 +1958,8 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_waitid:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_siginfo_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_rusage))
+      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_siginfo_t)
+	  || record_mem_at_reg (regcache, tdep->arg5, tdep->size_rusage))
         return -1;
       break;
 
@@ -2165,9 +2000,7 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_fstatat64:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_stat64))
+      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_stat64))
         return -1;
       break;
 
@@ -2195,21 +2028,14 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_pselect6:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_fd_set))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_fd_set))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_fd_set))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timespec))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_fd_set)
+	  || record_mem_at_reg (regcache, tdep->arg3,
+				tdep->size_fd_set)
+	  || record_mem_at_reg (regcache, tdep->arg4,
+				tdep->size_fd_set)
+	  || record_mem_at_reg (regcache, tdep->arg5,
+				tdep->size_timespec))
         return -1;
       break;
 
@@ -2224,9 +2050,8 @@ Do you want to stop the program?"),
 					     tdep->size_pollfd * nfds))
             return -1;
         }
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_timespec))
+      if (record_mem_at_reg (regcache, tdep->arg3,
+			     tdep->size_timespec))
         return -1;
       break;
 
@@ -2235,24 +2060,18 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_get_robust_list:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_int)
+	  || record_mem_at_reg (regcache, tdep->arg3,
+				tdep->size_int))
         return -1;
       break;
 
     case gdb_sys_splice:
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_loff_t))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_loff_t))
+      if (record_mem_at_reg (regcache, tdep->arg2,
+			     tdep->size_loff_t)
+	  || record_mem_at_reg (regcache, tdep->arg4,
+				tdep->size_loff_t))
         return -1;
       break;
 
@@ -2275,17 +2094,12 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_getcpu:
-      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_int))
-        return -1;
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-					 tdep->size_ulong * 2))
+      if (record_mem_at_reg (regcache, tdep->arg1,
+			     tdep->size_int)
+	  || record_mem_at_reg (regcache, tdep->arg2,
+				tdep->size_int)
+	  || record_mem_at_reg (regcache, tdep->arg3,
+				tdep->size_ulong * 2))
         return -1;
       break;
 
