aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-record.c
blob: 59fb33726d91df3ce3e30c3140fd1b6f6c94b926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
/* Process record and replay target code for GNU/Linux.

   Copyright (C) 2008-2017 Free Software Foundation, Inc.

   This file is part of GDB.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include "defs.h"
#include "target.h"
#include "gdbtypes.h"
#include "regcache.h"
#include "record.h"
#include "record-full.h"
#include "linux-record.h"

/* These macros are the values of the first argument of system call
   "sys_ptrace".  The values of these macros were obtained from Linux
   Kernel source.  */

#define RECORD_PTRACE_PEEKTEXT	1
#define RECORD_PTRACE_PEEKDATA	2
#define RECORD_PTRACE_PEEKUSR	3

/* These macros are the values of the first argument of system call
   "sys_socketcall".  The values of these macros were obtained from
   Linux Kernel source.  */

#define RECORD_SYS_SOCKET	1
#define RECORD_SYS_BIND		2
#define RECORD_SYS_CONNECT	3
#define RECORD_SYS_LISTEN	4
#define RECORD_SYS_ACCEPT	5
#define RECORD_SYS_GETSOCKNAME	6
#define RECORD_SYS_GETPEERNAME	7
#define RECORD_SYS_SOCKETPAIR	8
#define RECORD_SYS_SEND		9
#define RECORD_SYS_RECV		10
#define RECORD_SYS_SENDTO	11
#define RECORD_SYS_RECVFROM	12
#define RECORD_SYS_SHUTDOWN	13
#define RECORD_SYS_SETSOCKOPT	14
#define RECORD_SYS_GETSOCKOPT	15
#define RECORD_SYS_SENDMSG	16
#define RECORD_SYS_RECVMSG	17

/* These macros are the values of the first argument of system call
   "sys_ipc".  The values of these macros were obtained from Linux
   Kernel source.  */

#define RECORD_SEMOP		1
#define RECORD_SEMGET		2
#define RECORD_SEMCTL		3
#define RECORD_SEMTIMEDOP	4
#define RECORD_MSGSND		11
#define RECORD_MSGRCV		12
#define RECORD_MSGGET		13
#define RECORD_MSGCTL		14
#define RECORD_SHMAT		21
#define RECORD_SHMDT		22
#define RECORD_SHMGET		23
#define RECORD_SHMCTL		24

/* These macros are the values of the first argument of system call
   "sys_quotactl".  The values of these macros were obtained from Linux
   Kernel source.  */

#define RECORD_Q_GETFMT		0x800004
#define RECORD_Q_GETINFO	0x800005
#define RECORD_Q_GETQUOTA	0x800007
#define RECORD_Q_XGETQSTAT	(('5' << 8) + 5)
#define RECORD_Q_XGETQUOTA	(('3' << 8) + 3)

#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,
		       ULONGEST len)
{
  gdb_byte *a;
  int addrlen;
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);

  if (!addr)
    return 0;

  a = (gdb_byte *) alloca (tdep->size_int);

  if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
    return -1;

  /* Get the addrlen.  */
  if (target_read_memory ((CORE_ADDR) len, a, tdep->size_int))
    {
      if (record_debug)
	fprintf_unfiltered (gdb_stdlog,
			    "Process record: error reading "
			    "memory at addr = 0x%s len = %d.\n",
			    phex_nz (len, tdep->size_pointer),
			    tdep->size_int);
      return -1;
    }
  addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order);
  if (addrlen <= 0 || addrlen > tdep->size_sockaddr)
    addrlen = tdep->size_sockaddr;

  if (record_full_arch_list_add_mem ((CORE_ADDR) addr, addrlen))
    return -1;

  return 0;
}

static int
record_linux_msghdr (struct regcache *regcache,
		     struct linux_record_tdep *tdep, ULONGEST addr)
{
  gdb_byte *a;
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
  CORE_ADDR tmpaddr;
  int tmpint;

  if (!addr)
    return 0;

  if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
    return -1;

  a = (gdb_byte *) alloca (tdep->size_msghdr);
  if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
    {
      if (record_debug)
	fprintf_unfiltered (gdb_stdlog,
			    "Process record: error reading "
			    "memory at addr = 0x%s "
			    "len = %d.\n",
			    phex_nz (addr, tdep->size_pointer),
			    tdep->size_msghdr);
      return -1;
    }

  /* msg_name msg_namelen */
  addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
  a += tdep->size_pointer;
  if (record_full_arch_list_add_mem
      ((CORE_ADDR) addr,
       (int) extract_unsigned_integer (a,
				       tdep->size_int,
				       byte_order)))
    return -1;
  /* We have read an int, but skip size_pointer bytes to account for alignment
     of the next field on 64-bit targets. */
  a += tdep->size_pointer;

  /* msg_iov msg_iovlen */
  addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
  a += tdep->size_pointer;
  if (addr)
    {
      ULONGEST i;
      ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
					       byte_order);
      gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);

      for (i = 0; i < len; i++)
	{
	  if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
	    {
	      if (record_debug)
		fprintf_unfiltered (gdb_stdlog,
				    "Process record: error "
				    "reading memory at "
				    "addr = 0x%s "
				    "len = %d.\n",
				    phex_nz (addr,tdep->size_pointer),
				    tdep->size_iovec);
	      return -1;
	    }
	  tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
							  tdep->size_pointer,
							  byte_order);
	  tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
						   tdep->size_size_t,
						   byte_order);
	  if (record_full_arch_list_add_mem (tmpaddr, tmpint))
	    return -1;
	  addr += tdep->size_iovec;
	}
    }
  a += tdep->size_size_t;

  /* msg_control msg_controllen */
  addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
  a += tdep->size_pointer;
  tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
  if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
    return -1;

  return 0;
}

/* When the architecture process record get a Linux syscall
   instruction, it will get a Linux syscall number of this
   architecture and convert it to the Linux syscall number "num" which
   is internal to GDB.  Most Linux syscalls across architectures in
   Linux would be similar and mostly differ by sizes of types and
   structures.  This sizes are put to "tdep".

   Record the values of the registers and memory that will be changed
   in current system call.

   Return -1 if something wrong.  */

int
record_linux_system_call (enum gdb_syscall syscall,
			  struct regcache *regcache,
			  struct linux_record_tdep *tdep)
{
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
  ULONGEST tmpulongest;
  CORE_ADDR tmpaddr;
  int tmpint;

  switch (syscall)
    {
    case gdb_sys_restart_syscall:
      break;

    case gdb_sys_exit:
      if (yquery (_("The next instruction is syscall exit.  "
		    "It will make the program exit.  "
		    "Do you want to stop the program?")))
	return 1;
      break;

    case gdb_sys_fork:
      break;

    case gdb_sys_read:
    case gdb_sys_readlink:
    case gdb_sys_recv:
      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:
    case gdb_sys_open:
    case gdb_sys_close:
      break;

    case gdb_sys_waitpid:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					   tdep->size_int))
	  return -1;
      break;

    case gdb_sys_creat:
    case gdb_sys_link:
    case gdb_sys_unlink:
    case gdb_sys_execve:
    case gdb_sys_chdir:
      break;

    case gdb_sys_time:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest)
	if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					   tdep->size_time_t))
	  return -1;
      break;

    case gdb_sys_mknod:
    case gdb_sys_chmod:
    case gdb_sys_lchown16:
    case gdb_sys_ni_syscall17:
      break;

    case gdb_sys_stat:
    case gdb_sys_fstat:
    case gdb_sys_lstat:
      if (record_mem_at_reg (regcache, tdep->arg2,
			     tdep->size__old_kernel_stat))
	return -1;
      break;

    case gdb_sys_lseek:
    case gdb_sys_getpid:
    case gdb_sys_mount:
    case gdb_sys_oldumount:
    case gdb_sys_setuid16:
    case gdb_sys_getuid16:
    case gdb_sys_stime:
      break;

    case gdb_sys_ptrace:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest == RECORD_PTRACE_PEEKTEXT
	  || tmpulongest == RECORD_PTRACE_PEEKDATA
	  || tmpulongest == RECORD_PTRACE_PEEKUSR)
	{
	  if (record_mem_at_reg (regcache, tdep->arg4, 4))
	    return -1;
	}
      break;

    case gdb_sys_alarm:
    case gdb_sys_pause:
    case gdb_sys_utime:
    case gdb_sys_ni_syscall31:
    case gdb_sys_ni_syscall32:
    case gdb_sys_access:
    case gdb_sys_nice:
    case gdb_sys_ni_syscall35:
    case gdb_sys_sync:
    case gdb_sys_kill:
    case gdb_sys_rename:
    case gdb_sys_mkdir:
    case gdb_sys_rmdir:
    case gdb_sys_dup:
      break;

    case gdb_sys_pipe:
    case gdb_sys_pipe2:
      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
	return -1;
      break;

    case gdb_sys_times:
      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_tms))
	return -1;
      break;

    case gdb_sys_ni_syscall44:
    case gdb_sys_brk:
    case gdb_sys_setgid16:
    case gdb_sys_getgid16:
    case gdb_sys_signal:
    case gdb_sys_geteuid16:
    case gdb_sys_getegid16:
    case gdb_sys_acct:
    case gdb_sys_umount:
    case gdb_sys_ni_syscall53:
      break;

    case gdb_sys_ioctl:
      /* XXX Need to add a lot of support of other ioctl requests.  */
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest == tdep->ioctl_FIOCLEX
	  || tmpulongest == tdep->ioctl_FIONCLEX
	  || tmpulongest == tdep->ioctl_FIONBIO
	  || tmpulongest == tdep->ioctl_FIOASYNC
	  || tmpulongest == tdep->ioctl_TCSETS
	  || tmpulongest == tdep->ioctl_TCSETSW
	  || tmpulongest == tdep->ioctl_TCSETSF
	  || tmpulongest == tdep->ioctl_TCSETA
	  || tmpulongest == tdep->ioctl_TCSETAW
	  || tmpulongest == tdep->ioctl_TCSETAF
	  || tmpulongest == tdep->ioctl_TCSBRK
	  || tmpulongest == tdep->ioctl_TCXONC
	  || tmpulongest == tdep->ioctl_TCFLSH
	  || tmpulongest == tdep->ioctl_TIOCEXCL
	  || tmpulongest == tdep->ioctl_TIOCNXCL
	  || tmpulongest == tdep->ioctl_TIOCSCTTY
	  || tmpulongest == tdep->ioctl_TIOCSPGRP
	  || tmpulongest == tdep->ioctl_TIOCSTI
	  || tmpulongest == tdep->ioctl_TIOCSWINSZ
	  || tmpulongest == tdep->ioctl_TIOCMBIS
	  || tmpulongest == tdep->ioctl_TIOCMBIC
	  || tmpulongest == tdep->ioctl_TIOCMSET
	  || tmpulongest == tdep->ioctl_TIOCSSOFTCAR
	  || tmpulongest == tdep->ioctl_TIOCCONS
	  || tmpulongest == tdep->ioctl_TIOCSSERIAL
	  || tmpulongest == tdep->ioctl_TIOCPKT
	  || tmpulongest == tdep->ioctl_TIOCNOTTY
	  || tmpulongest == tdep->ioctl_TIOCSETD
	  || tmpulongest == tdep->ioctl_TCSBRKP
	  || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
	  || tmpulongest == tdep->ioctl_TIOCSBRK
	  || tmpulongest == tdep->ioctl_TIOCCBRK
	  || tmpulongest == tdep->ioctl_TCSETS2
	  || tmpulongest == tdep->ioctl_TCSETSW2
	  || tmpulongest == tdep->ioctl_TCSETSF2
	  || tmpulongest == tdep->ioctl_TIOCSPTLCK
	  || tmpulongest == tdep->ioctl_TIOCSERCONFIG
	  || tmpulongest == tdep->ioctl_TIOCSERGWILD
	  || tmpulongest == tdep->ioctl_TIOCSERSWILD
	  || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
	  || tmpulongest == tdep->ioctl_TIOCSERGETMULTI
	  || tmpulongest == tdep->ioctl_TIOCSERSETMULTI
	  || tmpulongest == tdep->ioctl_TIOCMIWAIT
	  || tmpulongest == tdep->ioctl_TIOCSHAYESESP)
	{
	  /* Nothing to do.  */
	}
      else if (tmpulongest == tdep->ioctl_TCGETS
	       || tmpulongest == tdep->ioctl_TCGETA
	       || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3,
				 tdep->size_termios))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TIOCGPGRP
	       || tmpulongest == tdep->ioctl_TIOCGSID)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_pid_t))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TIOCOUTQ
	       || tmpulongest == tdep->ioctl_TIOCMGET
	       || tmpulongest == tdep->ioctl_TIOCGSOFTCAR
	       || tmpulongest == tdep->ioctl_FIONREAD
	       || tmpulongest == tdep->ioctl_TIOCINQ
	       || tmpulongest == tdep->ioctl_TIOCGETD
	       || tmpulongest == tdep->ioctl_TIOCGPTN
	       || tmpulongest == tdep->ioctl_TIOCSERGETLSR)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3,
				 tdep->size_winsize))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TIOCLINUX)
	{
	  /* This syscall affects a char-size memory.  */
	  if (record_mem_at_reg (regcache, tdep->arg3, 1))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3,
				 tdep->size_serial_struct))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TCGETS2)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3,
				 tdep->size_termios2))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_FIOQSIZE)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3,
				 tdep->size_serial_icounter_struct))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3,
				 tdep->size_hayes_esp_config))
	    return -1;
	}
      else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
	{
	  printf_unfiltered (_("Process record and replay target doesn't "
			       "support ioctl request TIOCSERGSTRUCT\n"));
	  return 1;
	}
      else
	{
	  printf_unfiltered (_("Process record and replay target doesn't "
			       "support ioctl request 0x%s.\n"),
			     OUTPUT_REG (tmpulongest, tdep->arg2));
	  return 1;
	}
      break;

    case gdb_sys_fcntl:
      /* XXX */
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
    sys_fcntl:
      if (tmpulongest == tdep->fcntl_F_GETLK)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_flock))
	    return -1;
	}
      break;

    case gdb_sys_ni_syscall56:
    case gdb_sys_setpgid:
    case gdb_sys_ni_syscall58:
      break;

    case gdb_sys_olduname:
      if (record_mem_at_reg (regcache, tdep->arg1,
			     tdep->size_oldold_utsname))
	return -1;
      break;

    case gdb_sys_umask:
    case gdb_sys_chroot:
      break;

    case gdb_sys_ustat:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_ustat))
	return -1;
      break;

    case gdb_sys_dup2:
    case gdb_sys_getppid:
    case gdb_sys_getpgrp:
    case gdb_sys_setsid:
      break;

    case gdb_sys_sigaction:
      if (record_mem_at_reg (regcache, tdep->arg3,
			     tdep->size_old_sigaction))
	return -1;
      break;

    case gdb_sys_sgetmask:
    case gdb_sys_ssetmask:
    case gdb_sys_setreuid16:
    case gdb_sys_setregid16:
    case gdb_sys_sigsuspend:
      break;

    case gdb_sys_sigpending:
      if (record_mem_at_reg (regcache, tdep->arg1,
			     tdep->size_old_sigset_t))
	return -1;
      break;

    case gdb_sys_sethostname:
    case gdb_sys_setrlimit:
      break;

    case gdb_sys_old_getrlimit:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
	return -1;
      break;

    case gdb_sys_getrusage:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rusage))
	return -1;
      break;

    case gdb_sys_gettimeofday:
      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timeval)
	  || record_mem_at_reg (regcache, tdep->arg2, tdep->size_timezone))
	return -1;
      break;

    case gdb_sys_settimeofday:
      break;

    case gdb_sys_getgroups16:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST gidsetsize;

	  regcache_raw_read_unsigned (regcache, tdep->arg1,
				      &gidsetsize);
	  tmpint = tdep->size_old_gid_t * (int) gidsetsize;
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
	    return -1;
	}
      break;

    case gdb_sys_setgroups16:
      break;

    case gdb_old_select:
      {
	unsigned long sz_sel_arg = tdep->size_long + tdep->size_pointer * 4;
	gdb_byte *a = (gdb_byte *) alloca (sz_sel_arg);
	CORE_ADDR inp, outp, exp, tvp;

	regcache_raw_read_unsigned (regcache, tdep->arg1,
				    &tmpulongest);
	if (tmpulongest)
	  {
	    if (target_read_memory (tmpulongest, a, sz_sel_arg))
	      {
		if (record_debug)
		  fprintf_unfiltered (gdb_stdlog,
				      "Process record: error reading memory "
				      "at addr = 0x%s len = %lu.\n",
				      OUTPUT_REG (tmpulongest, tdep->arg1),
				      sz_sel_arg);
		return -1;
	      }
	    /* Skip n. */
	    a += tdep->size_long;
	    inp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
	    a += tdep->size_pointer;
	    outp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
	    a += tdep->size_pointer;
	    exp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
	    a += tdep->size_pointer;
	    tvp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
	    if (inp)
	      if (record_full_arch_list_add_mem (inp, tdep->size_fd_set))
		return -1;
	    if (outp)
	      if (record_full_arch_list_add_mem (outp, tdep->size_fd_set))
		return -1;
	    if (exp)
	      if (record_full_arch_list_add_mem (exp, tdep->size_fd_set))
		return -1;
	    if (tvp)
	      if (record_full_arch_list_add_mem (tvp, tdep->size_timeval))
		return -1;
	  }
      }
      break;

    case gdb_sys_symlink:
      break;

    case gdb_sys_uselib:
    case gdb_sys_swapon:
      break;

    case gdb_sys_reboot:
      if (yquery (_("The next instruction is syscall reboot.  "
		    "It will restart the computer.  "
		    "Do you want to stop the program?")))
	return 1;
      break;

    case gdb_old_readdir:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_old_dirent))
	return -1;
      break;

    case gdb_old_mmap:
      break;

    case gdb_sys_munmap:
      {
	ULONGEST len;

	regcache_raw_read_unsigned (regcache, tdep->arg1,
				    &tmpulongest);
	regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
	if (record_full_memory_query)
	  {
	    if (yquery (_("\
The next instruction is syscall munmap.\n\
It will free the memory addr = 0x%s len = %u.\n\
It will make record target cannot record some memory change.\n\
Do you want to stop the program?"),
			OUTPUT_REG (tmpulongest, tdep->arg1), (int) len))
	      return 1;
	  }
      }
      break;

    case gdb_sys_truncate:
    case gdb_sys_ftruncate:
    case gdb_sys_fchmod:
    case gdb_sys_fchown16:
    case gdb_sys_getpriority:
    case gdb_sys_setpriority:
    case gdb_sys_ni_syscall98:
      break;

    case gdb_sys_statfs:
    case gdb_sys_fstatfs:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_statfs))
	return -1;
      break;

    case gdb_sys_ioperm:
      break;

    case gdb_sys_socket:
    case gdb_sys_sendto:
    case gdb_sys_sendmsg:
    case gdb_sys_shutdown:
    case gdb_sys_bind:
    case gdb_sys_connect:
    case gdb_sys_listen:
    case gdb_sys_setsockopt:
      break;

    case gdb_sys_accept:
    case gdb_sys_getsockname:
    case gdb_sys_getpeername:
      {
	ULONGEST len;

	regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
	regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
	if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
	  return -1;
      }
      break;

    case gdb_sys_recvfrom:
      {
	ULONGEST len;

	regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
	regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
	if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
	  return -1;
      }
      break;

    case gdb_sys_recvmsg:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (record_linux_msghdr (regcache, tdep, tmpulongest))
	return -1;
      break;

    case gdb_sys_socketpair:
      if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
	return -1;
      break;

    case gdb_sys_getsockopt:
      regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST optvalp;
	  gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);

	  if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
				  tdep->size_int))
	    {
	      if (record_debug)
		fprintf_unfiltered (gdb_stdlog,
				    "Process record: error reading "
				    "memory at addr = 0x%s "
				    "len = %d.\n",
				    OUTPUT_REG (tmpulongest, tdep->arg5),
				    tdep->size_int);
	      return -1;
	    }
	  regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
	  tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
						 byte_order);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
	    return -1;
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     tdep->size_int))
	    return -1;
	}
      break;

    case gdb_sys_socketcall:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      switch (tmpulongest)
	{
	case RECORD_SYS_SOCKET:
	case RECORD_SYS_BIND:
	case RECORD_SYS_CONNECT:
	case RECORD_SYS_LISTEN:
	  break;
	case RECORD_SYS_ACCEPT:
	case RECORD_SYS_GETSOCKNAME:
	case RECORD_SYS_GETPEERNAME:
	  {
	    regcache_raw_read_unsigned (regcache, tdep->arg2,
					&tmpulongest);
	    if (tmpulongest)
	      {
		gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
		ULONGEST len;

		tmpulongest += tdep->size_ulong;
		if (target_read_memory ((CORE_ADDR) tmpulongest, a,
					tdep->size_ulong * 2))
		  {
		    if (record_debug)
		      fprintf_unfiltered (gdb_stdlog,
					  "Process record: error reading "
					  "memory at addr = 0x%s len = %d.\n",
					  OUTPUT_REG (tmpulongest, tdep->arg2),
					  tdep->size_ulong * 2);
		    return -1;
		  }
		tmpulongest = extract_unsigned_integer (a,
							tdep->size_ulong,
							byte_order);
		len = extract_unsigned_integer (a + tdep->size_ulong,
						tdep->size_ulong, byte_order);
		if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
		  return -1;
	      }
	  }
	  break;

	case RECORD_SYS_SOCKETPAIR:
	  {
	    gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);

	    regcache_raw_read_unsigned (regcache, tdep->arg2,
					&tmpulongest);
	    if (tmpulongest)
	      {
		tmpulongest += tdep->size_ulong * 3;
		if (target_read_memory ((CORE_ADDR) tmpulongest, a,
					tdep->size_ulong))
		  {
		    if (record_debug)
		      fprintf_unfiltered (gdb_stdlog,
					  "Process record: error reading "
					  "memory at addr = 0x%s len = %d.\n",
					  OUTPUT_REG (tmpulongest, tdep->arg2),
					  tdep->size_ulong);
		    return -1;
		  }
		tmpaddr
		  = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
							  byte_order);
		if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
		  return -1;
	      }
	  }
	  break;
	case RECORD_SYS_SEND:
	case RECORD_SYS_SENDTO:
	  break;
	case RECORD_SYS_RECVFROM:
	  regcache_raw_read_unsigned (regcache, tdep->arg2,
				      &tmpulongest);
	  if (tmpulongest)
	    {
	      gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
	      ULONGEST len;

	      tmpulongest += tdep->size_ulong * 4;
	      if (target_read_memory ((CORE_ADDR) tmpulongest, a,
				      tdep->size_ulong * 2))
		{
		  if (record_debug)
		    fprintf_unfiltered (gdb_stdlog,
					"Process record: error reading "
					"memory at addr = 0x%s len = %d.\n",
					OUTPUT_REG (tmpulongest, tdep->arg2),
					tdep->size_ulong * 2);
		  return -1;
		}
	      tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
						      byte_order);
	      len = extract_unsigned_integer (a + tdep->size_ulong,
					      tdep->size_ulong, byte_order);
	      if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
		return -1;
	    }
	case RECORD_SYS_RECV:
	  regcache_raw_read_unsigned (regcache, tdep->arg2,
				      &tmpulongest);
	  if (tmpulongest)
	    {
	      gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);

	      tmpulongest += tdep->size_ulong;
	      if (target_read_memory ((CORE_ADDR) tmpulongest, a,
				      tdep->size_ulong))
		{
		  if (record_debug)
		    fprintf_unfiltered (gdb_stdlog,
					"Process record: error reading "
					"memory at addr = 0x%s len = %d.\n",
					OUTPUT_REG (tmpulongest, tdep->arg2),
					tdep->size_ulong);
		  return -1;
		}
	      tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
						      byte_order);
	      if (tmpulongest)
		{
		  a += tdep->size_ulong;
		  tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
							   byte_order);
		  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
						     tmpint))
		    return -1;
		}
	    }
	  break;
	case RECORD_SYS_SHUTDOWN:
	case RECORD_SYS_SETSOCKOPT:
	  break;
	case RECORD_SYS_GETSOCKOPT:
	  {
	    gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
	    gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);

	    regcache_raw_read_unsigned (regcache, tdep->arg2,
					&tmpulongest);
	    if (tmpulongest)
	      {
		tmpulongest += tdep->size_ulong * 3;
		if (target_read_memory ((CORE_ADDR) tmpulongest, a,
					tdep->size_ulong * 2))
		  {
		    if (record_debug)
		      fprintf_unfiltered (gdb_stdlog,
					  "Process record: error reading "
					  "memory at addr = 0x%s len = %d.\n",
					  OUTPUT_REG (tmpulongest, tdep->arg2),
					  tdep->size_ulong * 2);
		    return -1;
		  }
		tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
							tdep->size_ulong,
							byte_order);
		if (tmpulongest)
		  {
		    if (target_read_memory ((CORE_ADDR) tmpulongest, av,
					    tdep->size_int))
		      {
			if (record_debug)
			  fprintf_unfiltered (gdb_stdlog,
					      "Process record: error reading "
					      "memory at addr = 0x%s "
					      "len = %d.\n",
					      phex_nz (tmpulongest,
						       tdep->size_ulong),
					      tdep->size_int);
			return -1;
		      }
		    tmpaddr
		      = (CORE_ADDR) extract_unsigned_integer (a,
							      tdep->size_ulong,
							      byte_order);
		    tmpint = (int) extract_unsigned_integer (av,
							     tdep->size_int,
							     byte_order);
		    if (record_full_arch_list_add_mem (tmpaddr, tmpint))
		      return -1;
		    a += tdep->size_ulong;
		    tmpaddr
		      = (CORE_ADDR) extract_unsigned_integer (a,
							      tdep->size_ulong,
							      byte_order);
		    if (record_full_arch_list_add_mem (tmpaddr,
						       tdep->size_int))
		      return -1;
		  }
	      }
	  }
	  break;
	case RECORD_SYS_SENDMSG:
	  break;
	case RECORD_SYS_RECVMSG:
	  {
	    gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);

	    regcache_raw_read_unsigned (regcache, tdep->arg2,
					&tmpulongest);
	    if (tmpulongest)
	      {
		tmpulongest += tdep->size_ulong;
		if (target_read_memory ((CORE_ADDR) tmpulongest, a,
					tdep->size_ulong))
		  {
		    if (record_debug)
		      fprintf_unfiltered (gdb_stdlog,
					  "Process record: error reading "
					  "memory at addr = 0x%s len = %d.\n",
					  OUTPUT_REG (tmpulongest, tdep->arg2),
					  tdep->size_ulong);
		    return -1;
		  }
		tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
							byte_order);
		if (record_linux_msghdr (regcache, tdep, tmpulongest))
		  return -1;
	      }
	  }
	  break;
	default:
	  printf_unfiltered (_("Process record and replay target "
			       "doesn't support socketcall call 0x%s\n"),
			     OUTPUT_REG (tmpulongest, tdep->arg1));
	  return -1;
	  break;
	}
      break;

    case gdb_sys_syslog:
      break;

    case gdb_sys_setitimer:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_itimerval))
	return -1;
      break;

    case gdb_sys_getitimer:
      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:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat))
	return -1;
      break;

    case gdb_sys_newfstatat:
      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					 tdep->size_stat))
	return -1;
      break;

    case gdb_sys_uname:
      if (record_mem_at_reg (regcache, tdep->arg1,
			     tdep->size_old_utsname))
	return -1;
      break;

    case gdb_sys_iopl:
    case gdb_sys_vhangup:
    case gdb_sys_ni_syscall112:
    case gdb_sys_vm86old:
      break;

    case gdb_sys_wait4:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
	  || record_mem_at_reg (regcache, tdep->arg4, tdep->size_rusage))
	return -1;
      break;

    case gdb_sys_swapoff:
      break;

    case gdb_sys_sysinfo:
      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_sysinfo))
	return -1;
      break;

    case gdb_sys_shmget:
    case gdb_sys_semget:
    case gdb_sys_semop:
    case gdb_sys_msgget:
      /* XXX maybe need do some record works with sys_shmdt.  */
    case gdb_sys_shmdt:
    case gdb_sys_msgsnd:
    case gdb_sys_semtimedop:
      break;

    case gdb_sys_shmat:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_ulong))
	return -1;
      break;

    case gdb_sys_shmctl:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_shmid_ds))
	return -1;
      break;

      /* XXX sys_semctl 525 still not supported.  */
      /* sys_semctl */

    case gdb_sys_msgrcv:
      {
	LONGEST l;

	regcache_raw_read_signed (regcache, tdep->arg3, &l);
	tmpint = l + tdep->size_long;
	if (record_mem_at_reg (regcache, tdep->arg2, tmpint))
	  return -1;
      }
      break;

    case gdb_sys_msgctl:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_msqid_ds))
	return -1;
      break;

    case gdb_sys_ipc:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      tmpulongest &= 0xffff;
      switch (tmpulongest)
	{
	case RECORD_SEMOP:
	case RECORD_SEMGET:
	case RECORD_SEMTIMEDOP:
	case RECORD_MSGSND:
	case RECORD_MSGGET:
	  /* XXX maybe need do some record works with RECORD_SHMDT.  */
	case RECORD_SHMDT:
	case RECORD_SHMGET:
	  break;
	case RECORD_MSGRCV:
	  {
	    LONGEST second;

	    regcache_raw_read_signed (regcache, tdep->arg3, &second);
	    tmpint = (int) second + tdep->size_long;
	    if (record_mem_at_reg (regcache, tdep->arg5, tmpint))
	      return -1;
	  }
	  break;
	case RECORD_MSGCTL:
	  if (record_mem_at_reg (regcache, tdep->arg5,
				 tdep->size_msqid_ds))
	    return -1;
	  break;
	case RECORD_SHMAT:
	  if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_ulong))
	    return -1;
	  break;
	case RECORD_SHMCTL:
	  if (record_mem_at_reg (regcache, tdep->arg5,
				 tdep->size_shmid_ds))
	    return -1;
	  break;
	default:
	  /* XXX RECORD_SEMCTL still not supported.  */
	  printf_unfiltered (_("Process record and replay target doesn't "
			       "support ipc number %s\n"),
			     pulongest (tmpulongest));
	  break;
	}
      break;

    case gdb_sys_fsync:
    case gdb_sys_sigreturn:
    case gdb_sys_clone:
    case gdb_sys_setdomainname:
      break;

    case gdb_sys_newuname:
      if (record_mem_at_reg (regcache, tdep->arg1,
			     tdep->size_new_utsname))
	return -1;
      break;

    case gdb_sys_modify_ldt:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest == 0 || tmpulongest == 2)
	{
	  ULONGEST bytecount;

	  regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
	  if (record_mem_at_reg (regcache, tdep->arg2, (int) bytecount))
	    return -1;
	}
      break;

    case gdb_sys_adjtimex:
      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timex))
	return -1;
      break;

    case gdb_sys_mprotect:
      break;

    case gdb_sys_sigprocmask:
      if (record_mem_at_reg (regcache, tdep->arg3,
			     tdep->size_old_sigset_t))
	return -1;
      break;

    case gdb_sys_ni_syscall127:
    case gdb_sys_init_module:
    case gdb_sys_delete_module:
    case gdb_sys_ni_syscall130:
      break;

    case gdb_sys_quotactl:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      switch (tmpulongest)
	{
	case RECORD_Q_GETFMT:
	  /* __u32 */
	  if (record_mem_at_reg (regcache, tdep->arg4, 4))
	    return -1;
	  break;
	case RECORD_Q_GETINFO:
	  if (record_mem_at_reg (regcache, tdep->arg4,
				 tdep->size_mem_dqinfo))
	    return -1;
	  break;
	case RECORD_Q_GETQUOTA:
	  if (record_mem_at_reg (regcache, tdep->arg4,
				 tdep->size_if_dqblk))
	    return -1;
	  break;
	case RECORD_Q_XGETQSTAT:
	case RECORD_Q_XGETQUOTA:
	  if (record_mem_at_reg (regcache, tdep->arg4,
				 tdep->size_fs_quota_stat))
	    return -1;
	  break;
	}
      break;

    case gdb_sys_getpgid:
    case gdb_sys_fchdir:
    case gdb_sys_bdflush:
      break;

    case gdb_sys_sysfs:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest == 2)
	{
	  /*XXX the size of memory is not very clear.  */
	  if (record_mem_at_reg (regcache, tdep->arg3, 10))
	    return -1;
	}
      break;

    case gdb_sys_personality:
    case gdb_sys_ni_syscall137:
    case gdb_sys_setfsuid16:
    case gdb_sys_setfsgid16:
      break;

    case gdb_sys_llseek:
      if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
	return -1;
      break;

    case gdb_sys_getdents:
    case gdb_sys_getdents64:
      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
      if (record_mem_at_reg (regcache, tdep->arg2, tmpulongest))
	return -1;
      break;

    case gdb_sys_select:
      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;

    case gdb_sys_flock:
    case gdb_sys_msync:
      break;

    case gdb_sys_readv:
      {
	ULONGEST vec, vlen;

	regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
	if (vec)
	  {
	    gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);

	    regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
	    for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
	      {
		if (target_read_memory ((CORE_ADDR) vec, iov,
					tdep->size_iovec))
		  {
		    if (record_debug)
		      fprintf_unfiltered (gdb_stdlog,
					  "Process record: error reading "
					  "memory at addr = 0x%s len = %d.\n",
					  OUTPUT_REG (vec, tdep->arg2),
					  tdep->size_iovec);
		    return -1;
		  }
		tmpaddr
		  = (CORE_ADDR) extract_unsigned_integer (iov,
							  tdep->size_pointer,
							  byte_order);
		tmpint
		  = (int) extract_unsigned_integer (iov + tdep->size_pointer,
						    tdep->size_size_t,
						    byte_order);
		if (record_full_arch_list_add_mem (tmpaddr, tmpint))
		  return -1;
		vec += tdep->size_iovec;
	      }
	  }
      }
      break;

    case gdb_sys_writev:
    case gdb_sys_getsid:
    case gdb_sys_fdatasync:
    case gdb_sys_sysctl:
    case gdb_sys_mlock:
    case gdb_sys_munlock:
    case gdb_sys_mlockall:
    case gdb_sys_munlockall:
    case gdb_sys_sched_setparam:
      break;

    case gdb_sys_sched_getparam:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
	return -1;
      break;

    case gdb_sys_sched_setscheduler:
    case gdb_sys_sched_getscheduler:
    case gdb_sys_sched_yield:
    case gdb_sys_sched_get_priority_max:
    case gdb_sys_sched_get_priority_min:
      break;

    case gdb_sys_sched_rr_get_interval:
    case gdb_sys_nanosleep:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
	return -1;
      break;

    case gdb_sys_mremap:
    case gdb_sys_setresuid16:
      break;

    case gdb_sys_getresuid16:
      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;

    case gdb_sys_vm86:
    case gdb_sys_ni_syscall167:
      break;

    case gdb_sys_poll:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST nfds;

	  regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     tdep->size_pollfd * nfds))
	    return -1;
	}
      break;

    case gdb_sys_nfsservctl:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest == 7 || tmpulongest == 8)
	{
	  int rsize;

	  if (tmpulongest == 7)
	    rsize = tdep->size_NFS_FHSIZE;
	  else
	    rsize = tdep->size_knfsd_fh;
	  if (record_mem_at_reg (regcache, tdep->arg3, rsize))
	    return -1;
	}
      break;

    case gdb_sys_setresgid16:
      break;

    case gdb_sys_getresgid16:
      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;

    case gdb_sys_prctl:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      switch (tmpulongest)
	{
	case 2:
	  if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
	    return -1;
	  break;
	case 16:
	  if (record_mem_at_reg (regcache, tdep->arg2,
				 tdep->size_TASK_COMM_LEN))
	    return -1;
	  break;
	}
      break;

    case gdb_sys_rt_sigreturn:
      break;

    case gdb_sys_rt_sigaction:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigaction))
	return -1;
      break;

    case gdb_sys_rt_sigprocmask:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigset_t))
	return -1;
      break;

    case gdb_sys_rt_sigpending:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST sigsetsize;

	  regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) sigsetsize))
	    return -1;
	}
      break;

    case gdb_sys_rt_sigtimedwait:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_siginfo_t))
	return -1;
      break;

    case gdb_sys_rt_sigqueueinfo:
    case gdb_sys_rt_sigsuspend:
      break;

    case gdb_sys_pread64:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST count;

	  regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) count))
	    return -1;
	}
      break;

    case gdb_sys_pwrite64:
    case gdb_sys_chown16:
      break;

    case gdb_sys_getcwd:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST size;

	  regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) size))
	    return -1;
	}
      break;

    case gdb_sys_capget:
      if (record_mem_at_reg (regcache, tdep->arg2,
			     tdep->size_cap_user_data_t))
	return -1;
      break;

    case gdb_sys_capset:
      break;

    case gdb_sys_sigaltstack:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stack_t))
	return -1;
      break;

    case gdb_sys_sendfile:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_off_t))
	return -1;
      break;

    case gdb_sys_ni_syscall188:
    case gdb_sys_ni_syscall189:
    case gdb_sys_vfork:
      break;

    case gdb_sys_getrlimit:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
	return -1;
      break;

    case gdb_sys_mmap2:
      break;

    case gdb_sys_truncate64:
    case gdb_sys_ftruncate64:
      break;

    case gdb_sys_stat64:
    case gdb_sys_lstat64:
    case gdb_sys_fstat64:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat64))
	return -1;
      break;

    case gdb_sys_lchown:
    case gdb_sys_getuid:
    case gdb_sys_getgid:
    case gdb_sys_geteuid:
    case gdb_sys_getegid:
    case gdb_sys_setreuid:
    case gdb_sys_setregid:
      break;

    case gdb_sys_getgroups:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST gidsetsize;

	  regcache_raw_read_unsigned (regcache, tdep->arg1,
				      &gidsetsize);
	  tmpint = tdep->size_gid_t * (int) gidsetsize;
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
	    return -1;
	}
      break;

    case gdb_sys_setgroups:
    case gdb_sys_fchown:
    case gdb_sys_setresuid:
      break;

    case gdb_sys_getresuid:
      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;

    case gdb_sys_setresgid:
      break;

    case gdb_sys_getresgid:
      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;

    case gdb_sys_chown:
    case gdb_sys_setuid:
    case gdb_sys_setgid:
    case gdb_sys_setfsuid:
    case gdb_sys_setfsgid:
    case gdb_sys_pivot_root:
      break;

    case gdb_sys_mincore:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_PAGE_SIZE))
	return -1;
      break;

    case gdb_sys_madvise:
      break;

    case gdb_sys_fcntl64:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest == tdep->fcntl_F_GETLK64)
	{
	  if (record_mem_at_reg (regcache, tdep->arg3,
				 tdep->size_flock64))
	    return -1;
	}
      else if (tmpulongest != tdep->fcntl_F_SETLK64
	       && tmpulongest != tdep->fcntl_F_SETLKW64)
	{
	  goto sys_fcntl;
	}
      break;

    case gdb_sys_ni_syscall222:
    case gdb_sys_ni_syscall223:
    case gdb_sys_gettid:
    case gdb_sys_readahead:
    case gdb_sys_setxattr:
    case gdb_sys_lsetxattr:
    case gdb_sys_fsetxattr:
      break;

    case gdb_sys_getxattr:
    case gdb_sys_lgetxattr:
    case gdb_sys_fgetxattr:
      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST size;

	  regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) size))
	    return -1;
	}
      break;

    case gdb_sys_listxattr:
    case gdb_sys_llistxattr:
    case gdb_sys_flistxattr:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST size;

	  regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) size))
	    return -1;
	}
      break;

    case gdb_sys_removexattr:
    case gdb_sys_lremovexattr:
    case gdb_sys_fremovexattr:
    case gdb_sys_tkill:
      break;

    case gdb_sys_sendfile64:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
	return -1;
      break;

    case gdb_sys_futex:
    case gdb_sys_sched_setaffinity:
      break;

    case gdb_sys_sched_getaffinity:
      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST len;

	  regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) len))
	    return -1;
	}
      break;

    case gdb_sys_set_thread_area:
      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
	return -1;
      break;

    case gdb_sys_get_thread_area:
      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_user_desc))
	return -1;
      break;

    case gdb_sys_io_setup:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_long))
	return -1;
      break;

    case gdb_sys_io_destroy:
      break;

    case gdb_sys_io_getevents:
      regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST nr;

	  regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     nr * tdep->size_io_event))
	    return -1;
	}
      break;

    case gdb_sys_io_submit:
      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST nr, i;
	  gdb_byte *iocbp;

	  regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
	  iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
	  if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
				  nr * tdep->size_pointer))
	    {
	      if (record_debug)
		fprintf_unfiltered (gdb_stdlog,
				    "Process record: error reading memory "
				    "at addr = 0x%s len = %u.\n",
				    OUTPUT_REG (tmpulongest, tdep->arg2),
				    (int) (nr * tdep->size_pointer));
	      return -1;
	    }
	  for (i = 0; i < nr; i++)
	    {
	      tmpaddr
		= (CORE_ADDR) extract_unsigned_integer (iocbp,
							tdep->size_pointer,
							byte_order);
	      if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
		return -1;
	      iocbp += tdep->size_pointer;
	    }
	}
      break;

    case gdb_sys_io_cancel:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_io_event))
	return -1;
      break;

    case gdb_sys_fadvise64:
    case gdb_sys_ni_syscall251:
      break;

    case gdb_sys_exit_group:
      if (yquery (_("The next instruction is syscall exit_group.  "
		    "It will make the program exit.  "
		    "Do you want to stop the program?")))
	return 1;
      break;

    case gdb_sys_lookup_dcookie:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST len;

	  regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) len))
	    return -1;
	}
      break;

    case gdb_sys_epoll_create:
    case gdb_sys_epoll_ctl:
      break;

    case gdb_sys_epoll_wait:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST maxevents;

	  regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (maxevents
					      * tdep->size_epoll_event)))
	    return -1;
	}
      break;

    case gdb_sys_remap_file_pages:
    case gdb_sys_set_tid_address:
      break;

    case gdb_sys_timer_create:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
	return -1;
      break;

    case gdb_sys_timer_settime:
      if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_itimerspec))
	return -1;
      break;

    case gdb_sys_timer_gettime:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerspec))
	return -1;
      break;

    case gdb_sys_timer_getoverrun:
    case gdb_sys_timer_delete:
    case gdb_sys_clock_settime:
      break;

    case gdb_sys_clock_gettime:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
	return -1;
      break;

    case gdb_sys_clock_getres:
      if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
	return -1;
      break;

    case gdb_sys_clock_nanosleep:
      if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_timespec))
	return -1;
      break;

    case gdb_sys_statfs64:
    case gdb_sys_fstatfs64:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_statfs64))
	return -1;
      break;

    case gdb_sys_tgkill:
    case gdb_sys_utimes:
    case gdb_sys_fadvise64_64:
    case gdb_sys_ni_syscall273:
    case gdb_sys_mbind:
      break;

    case gdb_sys_get_mempolicy:
      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
	return -1;
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST maxnode;

	  regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     maxnode * tdep->size_long))
	    return -1;
	}
      break;

    case gdb_sys_set_mempolicy:
    case gdb_sys_mq_open:
    case gdb_sys_mq_unlink:
    case gdb_sys_mq_timedsend:
      break;

    case gdb_sys_mq_timedreceive:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST msg_len;

	  regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) msg_len))
	    return -1;
	}
      if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
	return -1;
      break;

    case gdb_sys_mq_notify:
      break;

    case gdb_sys_mq_getsetattr:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_mq_attr))
	return -1;
      break;

    case gdb_sys_kexec_load:
      break;

    case gdb_sys_waitid:
      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;

    case gdb_sys_ni_syscall285:
    case gdb_sys_add_key:
    case gdb_sys_request_key:
      break;

    case gdb_sys_keyctl:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest == 6 || tmpulongest == 11)
	{
	  regcache_raw_read_unsigned (regcache, tdep->arg3,
				      &tmpulongest);
	  if (tmpulongest)
	    {
	      ULONGEST buflen;

	      regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
	      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
						 (int) buflen))
		return -1;
	    }
	}
      break;

    case gdb_sys_ioprio_set:
    case gdb_sys_ioprio_get:
    case gdb_sys_inotify_init:
    case gdb_sys_inotify_add_watch:
    case gdb_sys_inotify_rm_watch:
    case gdb_sys_migrate_pages:
    case gdb_sys_openat:
    case gdb_sys_mkdirat:
    case gdb_sys_mknodat:
    case gdb_sys_fchownat:
    case gdb_sys_futimesat:
      break;

    case gdb_sys_fstatat64:
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_stat64))
	return -1;
      break;

    case gdb_sys_unlinkat:
    case gdb_sys_renameat:
    case gdb_sys_linkat:
    case gdb_sys_symlinkat:
      break;

    case gdb_sys_readlinkat:
      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST bufsiz;

	  regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     (int) bufsiz))
	    return -1;
	}
      break;

    case gdb_sys_fchmodat:
    case gdb_sys_faccessat:
      break;

    case gdb_sys_pselect6:
      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;

    case gdb_sys_ppoll:
      regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST nfds;

	  regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     tdep->size_pollfd * nfds))
	    return -1;
	}
      if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_timespec))
	return -1;
      break;

    case gdb_sys_unshare:
    case gdb_sys_set_robust_list:
      break;

    case gdb_sys_get_robust_list:
      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:
      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;

    case gdb_sys_sync_file_range:
    case gdb_sys_tee:
    case gdb_sys_vmsplice:
      break;

    case gdb_sys_move_pages:
      regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST nr_pages;

	  regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
					     nr_pages * tdep->size_int))
	    return -1;
	}
      break;

    case gdb_sys_getcpu:
      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;

    case gdb_sys_epoll_pwait:
      regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
      if (tmpulongest)
	{
	  ULONGEST maxevents;

	  regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
	  tmpint = (int) maxevents * tdep->size_epoll_event;
	  if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
	    return -1;
	}
      break;

    case gdb_sys_fallocate:
    case gdb_sys_eventfd2:
    case gdb_sys_epoll_create1:
    case gdb_sys_dup3:
      break;

    case gdb_sys_inotify_init1:
      break;

    default:
      printf_unfiltered (_("Process record and replay target doesn't "
			   "support syscall number %d\n"), syscall);
      return -1;
      break;
    }

  return 0;
}