2009-09-08 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Tue, 8 Sep 2009 22:50:59 +0000 (22:50 +0000)
committerMichael Snyder <msnyder@vmware.com>
Tue, 8 Sep 2009 22:50:59 +0000 (22:50 +0000)
* amd64-linux-tdep.h (enum amd64_syscall): New enum consts,
to replace literal consts used in amd64-linux-tdep.c
* linux-record.h (enum gdb_syscall): New enum consts, to replace
literal consts used in amd64-linux-tdep.c and linux-record.c.
* amd64-linux-tdep.c (amd64_canonicalize_syscall): New function,
translate from native amd64 Linux syscall id to internal gdb id.
(amd64_linux_syscall_record): Switch statement abstracted out
and replaced with a call to amd64_canonicalize_syscall.
* linux-record.c (record_linux_system_call): Replace literal
consts with enum consts.
* i386-linux-tdep.c (i386_canonicalize_syscall): New function,
trivially translate from native i386 Linux syscalls to gdb syscalls.
(i386_linux_intx80_sysenter_record):

gdb/ChangeLog
gdb/amd64-linux-tdep.c
gdb/amd64-linux-tdep.h
gdb/i386-linux-tdep.c
gdb/linux-record.c
gdb/linux-record.h

index 595281100f8082b4a310d6ae3a522dc8bfcf38b3..21500ec5ba52c2b8f2ee8f69bb2a44215a58fb7d 100644 (file)
@@ -1,3 +1,19 @@
+2009-09-08  Michael Snyder  <msnyder@vmware.com>
+
+       * amd64-linux-tdep.h (enum amd64_syscall): New enum consts, 
+       to replace literal consts used in amd64-linux-tdep.c
+       * linux-record.h (enum gdb_syscall): New enum consts, to replace
+       literal consts used in amd64-linux-tdep.c and linux-record.c.
+       * amd64-linux-tdep.c (amd64_canonicalize_syscall): New function,
+       translate from native amd64 Linux syscall id to internal gdb id.
+       (amd64_linux_syscall_record): Switch statement abstracted out 
+       and replaced with a call to amd64_canonicalize_syscall.
+       * linux-record.c (record_linux_system_call): Replace literal
+       consts with enum consts.
+       * i386-linux-tdep.c (i386_canonicalize_syscall): New function,
+       trivially translate from native i386 Linux syscalls to gdb syscalls.
+       (i386_linux_intx80_sysenter_record): 
+
 2009-09-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * gdb/Makefile.in (check//%): Parse 'config.status --version'
index dcfdb38fedfe7f1a94fc4437f562043febbc4311..791e2c4b804de2b8af483f638fbca5b60147675c 100644 (file)
@@ -274,1106 +274,863 @@ static struct linux_record_tdep amd64_linux_record_tdep;
 #define RECORD_ARCH_GET_FS     0x1003
 #define RECORD_ARCH_GET_GS     0x1004
 
+/* amd64_canonicalize_syscall maps from the native amd64 Linux set 
+   of syscall ids into a canonical set of syscall ids used by 
+   process record.  */
+
+static enum gdb_syscall
+amd64_canonicalize_syscall (enum amd64_syscall syscall)
+{
+  switch (syscall) {
+  case amd64_sys_read:
+    return gdb_sys_read;
+
+  case amd64_sys_write:
+    return gdb_sys_write;
+
+  case amd64_sys_open:
+    return gdb_sys_open;
+
+  case amd64_sys_close:
+    return gdb_sys_close;
+
+  case amd64_sys_newstat:
+    return gdb_sys_newstat;
+
+  case amd64_sys_newfstat:
+    return gdb_sys_newfstat;
+
+  case amd64_sys_newlstat:
+    return gdb_sys_newlstat;
+
+  case amd64_sys_poll:
+    return gdb_sys_poll;
+
+  case amd64_sys_lseek:
+    return gdb_sys_lseek;
+
+  case amd64_sys_mmap:
+    return gdb_sys_mmap2;
+
+  case amd64_sys_mprotect:
+    return gdb_sys_mprotect;
+
+  case amd64_sys_munmap:
+    return gdb_sys_munmap;
+
+  case amd64_sys_brk:
+    return gdb_sys_brk;
+
+  case amd64_sys_rt_sigaction:
+    return gdb_sys_rt_sigaction;
+
+  case amd64_sys_rt_sigprocmask:
+    return gdb_sys_rt_sigprocmask;
+
+  case amd64_sys_rt_sigreturn:
+    return gdb_sys_rt_sigreturn;
+
+  case amd64_sys_ioctl:
+    return gdb_sys_ioctl;
+
+  case amd64_sys_pread64:
+    return gdb_sys_pread64;
+
+  case amd64_sys_pwrite64:
+    return gdb_sys_pwrite64;
+
+  case amd64_sys_readv:
+    return gdb_sys_readv;
+
+  case amd64_sys_writev:
+    return gdb_sys_writev;
+
+  case amd64_sys_access:
+    return gdb_sys_access;
+
+  case amd64_sys_pipe:
+    return gdb_sys_pipe;
+
+  case amd64_sys_select:
+    return gdb_sys_select;
+
+  case amd64_sys_sched_yield:
+    return gdb_sys_sched_yield;
+
+  case amd64_sys_mremap:
+    return gdb_sys_mremap;
+
+  case amd64_sys_msync:
+    return gdb_sys_msync;
+
+  case amd64_sys_mincore:
+    return gdb_sys_mincore;
+
+  case amd64_sys_madvise:
+    return gdb_sys_madvise;
+
+  case amd64_sys_shmget:
+    return gdb_sys_shmget;
+
+  case amd64_sys_shmat:
+    return gdb_sys_shmat;
+
+  case amd64_sys_shmctl:
+    return gdb_sys_shmctl;
+
+  case amd64_sys_dup:
+    return gdb_sys_dup;
+
+  case amd64_sys_dup2:
+    return gdb_sys_dup2;
+
+  case amd64_sys_pause:
+    return gdb_sys_pause;
+
+  case amd64_sys_nanosleep:
+    return gdb_sys_nanosleep;
+
+  case amd64_sys_getitimer:
+    return gdb_sys_getitimer;
+
+  case amd64_sys_alarm:
+    return gdb_sys_alarm;
+
+  case amd64_sys_setitimer:
+    return gdb_sys_setitimer;
+
+  case amd64_sys_getpid:
+    return gdb_sys_getpid;
+
+  case amd64_sys_sendfile64:
+    return gdb_sys_sendfile64;
+
+  case amd64_sys_socket:
+    return gdb_sys_socket;
+
+  case amd64_sys_connect:
+    return gdb_sys_connect;
+
+  case amd64_sys_accept:
+    return gdb_sys_accept;
+
+  case amd64_sys_sendto:
+    return gdb_sys_sendto;
+
+  case amd64_sys_recvfrom:
+    return gdb_sys_recvfrom;
+
+  case amd64_sys_sendmsg:
+    return gdb_sys_sendmsg;
+
+  case amd64_sys_recvmsg:
+    return gdb_sys_recvmsg;
+
+  case amd64_sys_shutdown:
+    return gdb_sys_shutdown;
+
+  case amd64_sys_bind:
+    return gdb_sys_bind;
+
+  case amd64_sys_listen:
+    return gdb_sys_listen;
+
+  case amd64_sys_getsockname:
+    return gdb_sys_getsockname;
+
+  case amd64_sys_getpeername:
+    return gdb_sys_getpeername;
+
+  case amd64_sys_socketpair:
+    return gdb_sys_socketpair;
+
+  case amd64_sys_setsockopt:
+    return gdb_sys_setsockopt;
+
+  case amd64_sys_getsockopt:
+    return gdb_sys_getsockopt;
+
+  case amd64_sys_clone:
+    return gdb_sys_clone;
+
+  case amd64_sys_fork:
+    return gdb_sys_fork;
+
+  case amd64_sys_vfork:
+    return gdb_sys_vfork;
+
+  case amd64_sys_execve:
+    return gdb_sys_execve;
+
+  case amd64_sys_exit:
+    return gdb_sys_exit;
+
+  case amd64_sys_wait4:
+    return gdb_sys_wait4;
+
+  case amd64_sys_kill:
+    return gdb_sys_kill;
+
+  case amd64_sys_uname:
+    return gdb_sys_uname;
+
+  case amd64_sys_semget:
+    return gdb_sys_semget;
+
+  case amd64_sys_semop:
+    return gdb_sys_semop;
+
+  case amd64_sys_semctl:
+    return gdb_sys_semctl;
+
+  case amd64_sys_shmdt:
+    return gdb_sys_shmdt;
+
+  case amd64_sys_msgget:
+    return gdb_sys_msgget;
+
+  case amd64_sys_msgsnd:
+    return gdb_sys_msgsnd;
+
+  case amd64_sys_msgrcv:
+    return gdb_sys_msgrcv;
+
+  case amd64_sys_msgctl:
+    return gdb_sys_msgctl;
+
+  case amd64_sys_fcntl:
+    return gdb_sys_fcntl;
+
+  case amd64_sys_flock:
+    return gdb_sys_flock;
+
+  case amd64_sys_fsync:
+    return gdb_sys_fsync;
+
+  case amd64_sys_fdatasync:
+    return gdb_sys_fdatasync;
+
+  case amd64_sys_truncate:
+    return gdb_sys_truncate;
+
+  case amd64_sys_ftruncate:
+    return gdb_sys_ftruncate;
+
+  case amd64_sys_getdents:
+    return gdb_sys_getdents;
+
+  case amd64_sys_getcwd:
+    return gdb_sys_getcwd;
+
+  case amd64_sys_chdir:
+    return gdb_sys_chdir;
+
+  case amd64_sys_fchdir:
+    return gdb_sys_fchdir;
+
+  case amd64_sys_rename:
+    return gdb_sys_rename;
+
+  case amd64_sys_mkdir:
+    return gdb_sys_mkdir;
+
+  case amd64_sys_rmdir:
+    return gdb_sys_rmdir;
+
+  case amd64_sys_creat:
+    return gdb_sys_creat;
+
+  case amd64_sys_link:
+    return gdb_sys_link;
+
+  case amd64_sys_unlink:
+    return gdb_sys_unlink;
+
+  case amd64_sys_symlink:
+    return gdb_sys_symlink;
+
+  case amd64_sys_readlink:
+    return gdb_sys_readlink;
+
+  case amd64_sys_chmod:
+    return gdb_sys_chmod;
+
+  case amd64_sys_fchmod:
+    return gdb_sys_fchmod;
+
+  case amd64_sys_chown:
+    return gdb_sys_chown;
+
+  case amd64_sys_fchown:
+    return gdb_sys_fchown;
+
+  case amd64_sys_lchown:
+    return gdb_sys_lchown;
+
+  case amd64_sys_umask:
+    return gdb_sys_umask;
+
+  case amd64_sys_gettimeofday:
+    return gdb_sys_gettimeofday;
+
+  case amd64_sys_getrlimit:
+    return gdb_sys_getrlimit;
+
+  case amd64_sys_getrusage:
+    return gdb_sys_getrusage;
+
+  case amd64_sys_sysinfo:
+    return gdb_sys_sysinfo;
+
+  case amd64_sys_times:
+    return gdb_sys_times;
+
+  case amd64_sys_ptrace:
+    return gdb_sys_ptrace;
+
+  case amd64_sys_getuid:
+    return gdb_sys_getuid;
+
+  case amd64_sys_syslog:
+    return gdb_sys_syslog;
+
+  case amd64_sys_getgid:
+    return gdb_sys_getgid;
+
+  case amd64_sys_setuid:
+    return gdb_sys_setuid;
+
+  case amd64_sys_setgid:
+    return gdb_sys_setgid;
+
+  case amd64_sys_geteuid:
+    return gdb_sys_geteuid;
+
+  case amd64_sys_getegid:
+    return gdb_sys_getegid;
+
+  case amd64_sys_setpgid:
+    return gdb_sys_setpgid;
+
+  case amd64_sys_getppid:
+    return gdb_sys_getppid;
+
+  case amd64_sys_getpgrp:
+    return gdb_sys_getpgrp;
+
+  case amd64_sys_setsid:
+    return gdb_sys_setsid;
+
+  case amd64_sys_setreuid:
+    return gdb_sys_setreuid;
+
+  case amd64_sys_setregid:
+    return gdb_sys_setregid;
+
+  case amd64_sys_getgroups:
+    return gdb_sys_getgroups;
+
+  case amd64_sys_setgroups:
+    return gdb_sys_setgroups;
+
+  case amd64_sys_setresuid:
+    return gdb_sys_setresuid;
+
+  case amd64_sys_getresuid:
+    return gdb_sys_getresuid;
+
+  case amd64_sys_setresgid:
+    return gdb_sys_setresgid;
+
+  case amd64_sys_getresgid:
+    return gdb_sys_getresgid;
+
+  case amd64_sys_getpgid:
+    return gdb_sys_getpgid;
+
+  case amd64_sys_setfsuid:
+    return gdb_sys_setfsuid;
+
+  case amd64_sys_setfsgid:
+    return gdb_sys_setfsgid;
+
+  case amd64_sys_getsid:
+    return gdb_sys_getsid;
+
+  case amd64_sys_capget:
+    return gdb_sys_capget;
+
+  case amd64_sys_capset:
+    return gdb_sys_capset;
+
+  case amd64_sys_rt_sigpending:
+    return gdb_sys_rt_sigpending;
+
+  case amd64_sys_rt_sigtimedwait:
+    return gdb_sys_rt_sigtimedwait;
+
+  case amd64_sys_rt_sigqueueinfo:
+    return gdb_sys_rt_sigqueueinfo;
+
+  case amd64_sys_rt_sigsuspend:
+    return gdb_sys_rt_sigsuspend;
+
+  case amd64_sys_sigaltstack:
+    return gdb_sys_sigaltstack;
+
+  case amd64_sys_utime:
+    return gdb_sys_utime;
+
+  case amd64_sys_mknod:
+    return gdb_sys_mknod;
+
+  case amd64_sys_personality:
+    return gdb_sys_personality;
+
+  case amd64_sys_ustat:
+    return gdb_sys_ustat;
+
+  case amd64_sys_statfs:
+    return gdb_sys_statfs;
+
+  case amd64_sys_fstatfs:
+    return gdb_sys_fstatfs;
+
+  case amd64_sys_sysfs:
+    return gdb_sys_sysfs;
+
+  case amd64_sys_getpriority:
+    return gdb_sys_getpriority;
+
+  case amd64_sys_setpriority:
+    return gdb_sys_setpriority;
+
+  case amd64_sys_sched_setparam:
+    return gdb_sys_sched_setparam;
+
+  case amd64_sys_sched_getparam:
+    return gdb_sys_sched_getparam;
+
+  case amd64_sys_sched_setscheduler:
+    return gdb_sys_sched_setscheduler;
+
+  case amd64_sys_sched_getscheduler:
+    return gdb_sys_sched_getscheduler;
+
+  case amd64_sys_sched_get_priority_max:
+    return gdb_sys_sched_get_priority_max;
+
+  case amd64_sys_sched_get_priority_min:
+    return gdb_sys_sched_get_priority_min;
+
+  case amd64_sys_sched_rr_get_interval:
+    return gdb_sys_sched_rr_get_interval;
+
+  case amd64_sys_mlock:
+    return gdb_sys_mlock;
+
+  case amd64_sys_munlock:
+    return gdb_sys_munlock;
+
+  case amd64_sys_mlockall:
+    return gdb_sys_mlockall;
+
+  case amd64_sys_munlockall:
+    return gdb_sys_munlockall;
+
+  case amd64_sys_vhangup:
+    return gdb_sys_vhangup;
+
+  case amd64_sys_modify_ldt:
+    return gdb_sys_modify_ldt;
+
+  case amd64_sys_pivot_root:
+    return gdb_sys_pivot_root;
+
+  case amd64_sys_sysctl:
+    return gdb_sys_sysctl;
+
+  case amd64_sys_prctl:
+    return gdb_sys_prctl;
+
+  case amd64_sys_arch_prctl:
+    return -1; /* Note */
+
+  case amd64_sys_adjtimex:
+    return gdb_sys_adjtimex;
+
+  case amd64_sys_setrlimit:
+    return gdb_sys_setrlimit;
+
+  case amd64_sys_chroot:
+    return gdb_sys_chroot;
+
+  case amd64_sys_sync:
+    return gdb_sys_sync;
+
+  case amd64_sys_acct:
+    return gdb_sys_acct;
+
+  case amd64_sys_settimeofday:
+    return gdb_sys_settimeofday;
+
+  case amd64_sys_mount:
+    return gdb_sys_mount;
+
+  case amd64_sys_umount:
+    return gdb_sys_umount;
+
+  case amd64_sys_swapon:
+    return gdb_sys_swapon;
+
+  case amd64_sys_swapoff:
+    return gdb_sys_swapoff;
+
+  case amd64_sys_reboot:
+    return gdb_sys_reboot;
+
+  case amd64_sys_sethostname:
+    return gdb_sys_sethostname;
+
+  case amd64_sys_setdomainname:
+    return gdb_sys_setdomainname;
+
+  case amd64_sys_iopl:
+    return gdb_sys_iopl;
+
+  case amd64_sys_ioperm:
+    return gdb_sys_ioperm;
+
+  case amd64_sys_init_module:
+    return gdb_sys_init_module;
+
+  case amd64_sys_delete_module:
+    return gdb_sys_delete_module;
+
+  case amd64_sys_quotactl:
+    return gdb_sys_quotactl;
+
+  case amd64_sys_nfsservctl:
+    return gdb_sys_nfsservctl;
+
+  case amd64_sys_gettid:
+    return gdb_sys_gettid;
+
+  case amd64_sys_readahead:
+    return gdb_sys_readahead;
+
+  case amd64_sys_setxattr:
+    return gdb_sys_setxattr;
+
+  case amd64_sys_lsetxattr:
+    return gdb_sys_lsetxattr;
+
+  case amd64_sys_fsetxattr:
+    return gdb_sys_fsetxattr;
+
+  case amd64_sys_getxattr:
+    return gdb_sys_getxattr;
+
+  case amd64_sys_lgetxattr:
+    return gdb_sys_lgetxattr;
+
+  case amd64_sys_fgetxattr:
+    return gdb_sys_fgetxattr;
+
+  case amd64_sys_listxattr:
+    return gdb_sys_listxattr;
+
+  case amd64_sys_llistxattr:
+    return gdb_sys_llistxattr;
+
+  case amd64_sys_flistxattr:
+    return gdb_sys_flistxattr;
+
+  case amd64_sys_removexattr:
+    return gdb_sys_removexattr;
+
+  case amd64_sys_lremovexattr:
+    return gdb_sys_lremovexattr;
+
+  case amd64_sys_fremovexattr:
+    return gdb_sys_fremovexattr;
+
+  case amd64_sys_tkill:
+    return gdb_sys_tkill;
+
+  case amd64_sys_time:
+    return gdb_sys_time;
+
+  case amd64_sys_futex:
+    return gdb_sys_futex;
+
+  case amd64_sys_sched_setaffinity:
+    return gdb_sys_sched_setaffinity;
+
+  case amd64_sys_sched_getaffinity:
+    return gdb_sys_sched_getaffinity;
+
+  case amd64_sys_io_setup:
+    return gdb_sys_io_setup;
+
+  case amd64_sys_io_destroy:
+    return gdb_sys_io_destroy;
+
+  case amd64_sys_io_getevents:
+    return gdb_sys_io_getevents;
+
+  case amd64_sys_io_submit:
+    return gdb_sys_io_submit;
+
+  case amd64_sys_io_cancel:
+    return gdb_sys_io_cancel;
+
+  case amd64_sys_lookup_dcookie:
+    return gdb_sys_lookup_dcookie;
+
+  case amd64_sys_epoll_create:
+    return gdb_sys_epoll_create;
+
+  case amd64_sys_remap_file_pages:
+    return gdb_sys_remap_file_pages;
+
+  case amd64_sys_getdents64:
+    return gdb_sys_getdents64;
+
+  case amd64_sys_set_tid_address:
+    return gdb_sys_set_tid_address;
+
+  case amd64_sys_restart_syscall:
+    return gdb_sys_restart_syscall;
+
+  case amd64_sys_semtimedop:
+    return gdb_sys_semtimedop;
+
+  case amd64_sys_fadvise64:
+    return gdb_sys_fadvise64;
+
+  case amd64_sys_timer_create:
+    return gdb_sys_timer_create;
+
+  case amd64_sys_timer_settime:
+    return gdb_sys_timer_settime;
+
+  case amd64_sys_timer_gettime:
+    return gdb_sys_timer_gettime;
+
+  case amd64_sys_timer_getoverrun:
+    return gdb_sys_timer_getoverrun;
+
+  case amd64_sys_timer_delete:
+    return gdb_sys_timer_delete;
+
+  case amd64_sys_clock_settime:
+    return gdb_sys_clock_settime;
+
+  case amd64_sys_clock_gettime:
+    return gdb_sys_clock_gettime;
+
+  case amd64_sys_clock_getres:
+    return gdb_sys_clock_getres;
+
+  case amd64_sys_clock_nanosleep:
+    return gdb_sys_clock_nanosleep;
+
+  case amd64_sys_exit_group:
+    return gdb_sys_exit_group;
+
+  case amd64_sys_epoll_wait:
+    return gdb_sys_epoll_wait;
+
+  case amd64_sys_epoll_ctl:
+    return gdb_sys_epoll_ctl;
+
+  case amd64_sys_tgkill:
+    return gdb_sys_tgkill;
+
+  case amd64_sys_utimes:
+    return gdb_sys_utimes;
+
+  case amd64_sys_mbind:
+    return gdb_sys_mbind;
+
+  case amd64_sys_set_mempolicy:
+    return gdb_sys_set_mempolicy;
+
+  case amd64_sys_get_mempolicy:
+    return gdb_sys_get_mempolicy;
+
+  case amd64_sys_mq_open:
+    return gdb_sys_mq_open;
+
+  case amd64_sys_mq_unlink:
+    return gdb_sys_mq_unlink;
+
+  case amd64_sys_mq_timedsend:
+    return gdb_sys_mq_timedsend;
+
+  case amd64_sys_mq_timedreceive:
+    return gdb_sys_mq_timedreceive;
+
+  case amd64_sys_mq_notify:
+    return gdb_sys_mq_notify;
+
+  case amd64_sys_mq_getsetattr:
+    return gdb_sys_mq_getsetattr;
+
+  case amd64_sys_kexec_load:
+    return gdb_sys_kexec_load;
+
+  case amd64_sys_waitid:
+    return gdb_sys_waitid;
+
+  case amd64_sys_add_key:
+    return gdb_sys_add_key;
+
+  case amd64_sys_request_key:
+    return gdb_sys_request_key;
+
+  case amd64_sys_keyctl:
+    return gdb_sys_keyctl;
+
+  case amd64_sys_ioprio_set:
+    return gdb_sys_ioprio_set;
+
+  case amd64_sys_ioprio_get:
+    return gdb_sys_ioprio_get;
+
+  case amd64_sys_inotify_init:
+    return gdb_sys_inotify_init;
+
+  case amd64_sys_inotify_add_watch:
+    return gdb_sys_inotify_add_watch;
+
+  case amd64_sys_inotify_rm_watch:
+    return gdb_sys_inotify_rm_watch;
+
+  case amd64_sys_migrate_pages:
+    return gdb_sys_migrate_pages;
+
+  case amd64_sys_openat:
+    return gdb_sys_openat;
+
+  case amd64_sys_mkdirat:
+    return gdb_sys_mkdirat;
+
+  case amd64_sys_mknodat:
+    return gdb_sys_mknodat;
+
+  case amd64_sys_fchownat:
+    return gdb_sys_fchownat;
+
+  case amd64_sys_futimesat:
+    return gdb_sys_futimesat;
+
+  case amd64_sys_newfstatat:
+    return gdb_sys_newfstatat;
+
+  case amd64_sys_unlinkat:
+    return gdb_sys_unlinkat;
+
+  case amd64_sys_renameat:
+    return gdb_sys_renameat;
+
+  case amd64_sys_linkat:
+    return gdb_sys_linkat;
+
+  case amd64_sys_symlinkat:
+    return gdb_sys_symlinkat;
+
+  case amd64_sys_readlinkat:
+    return gdb_sys_readlinkat;
+
+  case amd64_sys_fchmodat:
+    return gdb_sys_fchmodat;
+
+  case amd64_sys_faccessat:
+    return gdb_sys_faccessat;
+
+  case amd64_sys_pselect6:
+    return gdb_sys_pselect6;
+
+  case amd64_sys_ppoll:
+    return gdb_sys_ppoll;
+
+  case amd64_sys_unshare:
+    return gdb_sys_unshare;
+
+  case amd64_sys_set_robust_list:
+    return gdb_sys_set_robust_list;
+
+  case amd64_sys_get_robust_list:
+    return gdb_sys_get_robust_list;
+
+  case amd64_sys_splice:
+    return gdb_sys_splice;
+
+  case amd64_sys_tee:
+    return gdb_sys_tee;
+
+  case amd64_sys_sync_file_range:
+    return gdb_sys_sync_file_range;
+
+  case amd64_sys_vmsplice:
+    return gdb_sys_vmsplice;
+
+  case amd64_sys_move_pages:
+    return gdb_sys_move_pages;
+
+  default:
+    return -1;
+  }
+}
+
 static int
 amd64_linux_syscall_record (struct regcache *regcache)
 {
-  int ret, num = -1;
-  ULONGEST tmpulongest;
+  int ret;
+  ULONGEST syscall_native;
+  enum gdb_syscall syscall_gdb = -1;
 
-  regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &tmpulongest);
+  regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &syscall_native);
 
-  /* Convert tmpulongest to number in record_linux_system_call.  */
-  switch (tmpulongest)
+  syscall_gdb = amd64_canonicalize_syscall (syscall_native);
+
+  if (syscall_native == amd64_sys_arch_prctl) 
     {
-      /* sys_read */
-    case 0:
-      num = 3;
-      break;
-      /* sys_write */
-    case 1:
-      num = 4;
-      break;
-      /* sys_open */
-    case 2:
-      num = 5;
-      break;
-      /* sys_close */
-    case 3:
-      num = 6;
-      break;
-      /* sys_newstat */
-    case 4:
-      num = 106;
-      break;
-      /* sys_newfstat */
-    case 5:
-      num = 108;
-      break;
-      /* sys_newlstat */
-    case 6:
-      num = 107;
-      break;
-      /* sys_poll */
-    case 7:
-      num = 168;
-      break;
-      /* sys_lseek */
-    case 8:
-      num = 19;
-      break;
-      /* sys_mmap */
-    case 9:
-      num = 192;
-      break;
-      /* sys_mprotect */
-    case 10:
-      num = 125;
-      break;
-      /* sys_munmap */
-    case 11:
-      num = 91;
-      break;
-      /* sys_brk */
-    case 12:
-      num = 45;
-      break;
-      /* sys_rt_sigaction */
-    case 13:
-      num = 174;
-      break;
-      /* sys_rt_sigprocmask */
-    case 14:
-      num = 175;
-      break;
-      /* sys_rt_sigreturn */
-    case 15:
-      num = 173;
-      break;
-      /* sys_ioctl */
-    case 16:
-      num = 54;
-      break;
-      /* sys_pread64 */
-    case 17:
-      num = 180;
-      break;
-      /* sys_pwrite64 */
-    case 18:
-      num = 181;
-      break;
-      /* sys_readv */
-    case 19:
-      num = 145;
-      break;
-      /* sys_writev */
-    case 20:
-      num = 146;
-      break;
-      /* sys_access */
-    case 21:
-      num = 33;
-      break;
-      /* sys_pipe */
-    case 22:
-      num = 42;
-      break;
-      /* sys_select */
-    case 23:
-      num = 142;
-      break;
-      /* sys_sched_yield */
-    case 24:
-      num = 158;
-      break;
-      /* sys_mremap */
-    case 25:
-      num = 163;
-      break;
-      /* sys_msync */
-    case 26:
-      num = 144;
-      break;
-      /* sys_mincore */
-    case 27:
-      num = 218;
-      break;
-      /* sys_madvise */
-    case 28:
-      num = 219;
-      break;
-      /* sys_shmget */
-    case 29:
-      num = 520;
-      break;
-      /* sys_shmat */
-    case 30:
-      num = 521;
-      break;
-      /* sys_shmctl */
-    case 31:
-      num = 522;
-      break;
-      /* sys_dup */
-    case 32:
-      num = 41;
-      break;
-      /* sys_dup2 */
-    case 33:
-      num = 63;
-      break;
-      /* sys_pause */
-    case 34:
-      num = 29;
-      break;
-      /* sys_nanosleep */
-    case 35:
-      num = 162;
-      break;
-      /* sys_getitimer */
-    case 36:
-      num = 105;
-      break;
-      /* sys_alarm */
-    case 37:
-      num = 27;
-      break;
-      /* sys_setitimer */
-    case 38:
-      num = 104;
-      break;
-      /* sys_getpid */
-    case 39:
-      num = 20;
-      break;
-      /* sys_sendfile64 */
-    case 40:
-      num = 239;
-      break;
-      /* sys_socket */
-    case 41:
-      num = 500;
-      break;
-      /* sys_connect */
-    case 42:
-      num = 501;
-      break;
-      /* sys_accept */
-    case 43:
-      num = 502;
-      break;
-      /* sys_sendto */
-    case 44:
-      num = 503;
-      break;
-      /* sys_recvfrom */
-    case 45:
-      num = 504;
-      break;
-      /* sys_sendmsg */
-    case 46:
-      num = 505;
-      break;
-      /* sys_recvmsg */
-    case 47:
-      num = 506;
-      break;
-      /* sys_shutdown */
-    case 48:
-      num = 507;
-      break;
-      /* sys_bind */
-    case 49:
-      num = 508;
-      break;
-      /* sys_listen */
-    case 50:
-      num = 509;
-      break;
-      /* sys_getsockname */
-    case 51:
-      num = 510;
-      break;
-      /* sys_getpeername */
-    case 52:
-      num = 511;
-      break;
-      /* sys_socketpair */
-    case 53:
-      num = 512;
-      break;
-      /* sys_setsockopt */
-    case 54:
-      num = 513;
-      break;
-      /* sys_getsockopt */
-    case 55:
-      num = 514;
-      break;
-      /* sys_clone */
-    case 56:
-      num = 120;
-      break;
-      /* sys_fork */
-    case 57:
-      num = 2;
-      break;
-      /* sys_vfork */
-    case 58:
-      num = 190;
-      break;
-      /* sys_execve */
-    case 59:
-      num = 11;
-      break;
-      /* sys_exit */
-    case 60:
-      num = 1;
-      break;
-      /* sys_wait4 */
-    case 61:
-      num = 114;
-      break;
-      /* sys_kill */
-    case 62:
-      num = 37;
-      break;
-      /* sys_uname */
-    case 63:
-      num = 109;
-      break;
-      /* sys_semget */
-    case 64:
-      num = 523;
-      break;
-      /* sys_semop */
-    case 65:
-      num = 524;
-      break;
-      /* sys_semctl */
-    case 66:
-      num = 525;
-      break;
-      /* sys_shmdt */
-    case 67:
-      num = 527;
-      break;
-      /* sys_msgget */
-    case 68:
-      num = 528;
-      break;
-      /* sys_msgsnd */
-    case 69:
-      num = 529;
-      break;
-      /* sys_msgrcv */
-    case 70:
-      num = 530;
-      break;
-      /* sys_msgctl */
-    case 71:
-      num = 531;
-      break;
-      /* sys_fcntl */
-    case 72:
-      num = 55;
-      break;
-      /* sys_flock */
-    case 73:
-      num = 143;
-      break;
-      /* sys_fsync */
-    case 74:
-      num = 118;
-      break;
-      /* sys_fdatasync */
-    case 75:
-      num = 148;
-      break;
-      /* sys_truncate */
-    case 76:
-      num = 92;
-      break;
-      /* sys_ftruncate */
-    case 77:
-      num = 93;
-      break;
-      /* sys_getdents */
-    case 78:
-      num = 141;
-      break;
-      /* sys_getcwd */
-    case 79:
-      num = 183;
-      break;
-      /* sys_chdir */
-    case 80:
-      num = 12;
-      break;
-      /* sys_fchdir */
-    case 81:
-      num = 133;
-      break;
-      /* sys_rename */
-    case 82:
-      num = 38;
-      break;
-      /* sys_mkdir */
-    case 83:
-      num = 39;
-      break;
-      /* sys_rmdir */
-    case 84:
-      num = 40;
-      break;
-      /* sys_creat */
-    case 85:
-      num = 8;
-      break;
-      /* sys_link */
-    case 86:
-      num = 9;
-      break;
-      /* sys_unlink */
-    case 87:
-      num = 10;
-      break;
-      /* sys_symlink */
-    case 88:
-      num = 83;
-      break;
-      /* sys_readlink */
-    case 89:
-      num = 85;
-      break;
-      /* sys_chmod */
-    case 90:
-      num = 15;
-      break;
-      /* sys_fchmod */
-    case 91:
-      num = 94;
-      break;
-      /* sys_chown */
-    case 92:
-      num = 212;
-      break;
-      /* sys_fchown */
-    case 93:
-      num = 207;
-      break;
-      /* sys_lchown */
-    case 94:
-      num = 198;
-      break;
-      /* sys_umask */
-    case 95:
-      num = 60;
-      break;
-      /* sys_gettimeofday */
-    case 96:
-      num = 78;
-      break;
-      /* sys_getrlimit */
-    case 97:
-      num = 191;
-      break;
-      /* sys_getrusage */
-    case 98:
-      num = 77;
-      break;
-      /* sys_sysinfo */
-    case 99:
-      num = 116;
-      break;
-      /* sys_times */
-    case 100:
-      num = 43;
-      break;
-      /* sys_ptrace */
-    case 101:
-      num = 26;
-      break;
-      /* sys_getuid */
-    case 102:
-      num = 199;
-      break;
-      /* sys_syslog */
-    case 103:
-      num = 103;
-      break;
-      /* sys_getgid */
-    case 104:
-      num = 200;
-      break;
-      /* sys_setuid */
-    case 105:
-      num = 213;
-      break;
-      /* sys_setgid */
-    case 106:
-      num = 214;
-      break;
-      /* sys_geteuid */
-    case 107:
-      num = 201;
-      break;
-      /* sys_getegid */
-    case 108:
-      num = 202;
-      break;
-      /* sys_setpgid */
-    case 109:
-      num = 57;
-      break;
-      /* sys_getppid */
-    case 110:
-      num = 64;
-      break;
-      /* sys_getpgrp */
-    case 111:
-      num = 65;
-      break;
-      /* sys_setsid */
-    case 112:
-      num = 66;
-      break;
-      /* sys_setreuid */
-    case 113:
-      num = 203;
-      break;
-      /* sys_setregid */
-    case 114:
-      num = 204;
-      break;
-      /* sys_getgroups */
-    case 115:
-      num = 205;
-      break;
-      /* sys_setgroups */
-    case 116:
-      num = 206;
-      break;
-      /* sys_setresuid */
-    case 117:
-      num = 208;
-      break;
-      /* sys_getresuid */
-    case 118:
-      num = 209;
-      break;
-      /* sys_setresgid */
-    case 119:
-      num = 210;
-      break;
-      /* sys_getresgid */
-    case 120:
-      num = 211;
-      break;
-      /* sys_getpgid */
-    case 121:
-      num = 132;
-      break;
-      /* sys_setfsuid */
-    case 122:
-      num = 215;
-      break;
-      /* sys_setfsgid */
-    case 123:
-      num = 216;
-      break;
-      /* sys_getsid */
-    case 124:
-      num = 147;
-      break;
-      /* sys_capget */
-    case 125:
-      num = 184;
-      break;
-      /* sys_capset */
-    case 126:
-      num = 185;
-      break;
-      /* sys_rt_sigpending */
-    case 127:
-      num = 176;
-      break;
-      /* sys_rt_sigtimedwait */
-    case 128:
-      num = 177;
-      break;
-      /* sys_rt_sigqueueinfo */
-    case 129:
-      num = 178;
-      break;
-      /* sys_rt_sigsuspend */
-    case 130:
-      num = 179;
-      break;
-      /* sys_sigaltstack */
-    case 131:
-      num = 186;
-      break;
-      /* sys_utime */
-    case 132:
-      num = 30;
-      break;
-      /* sys_mknod */
-    case 133:
-      num = 14;
-      break;
-      /* sys_personality */
-    case 135:
-      num = 136;
-      break;
-      /* sys_ustat */
-    case 136:
-      num = 62;
-      break;
-      /* sys_statfs */
-    case 137:
-      num = 99;
-      break;
-      /* sys_fstatfs */
-    case 138:
-      num = 100;
-      break;
-      /* sys_sysfs */
-    case 139:
-      num = 135;
-      break;
-      /* sys_getpriority */
-    case 140:
-      num = 96;
-      break;
-      /* sys_setpriority */
-    case 141:
-      num = 97;
-      break;
-      /* sys_sched_setparam */
-    case 142:
-      num = 154;
-      break;
-      /* sys_sched_getparam */
-    case 143:
-      num = 155;
-      break;
-      /* sys_sched_setscheduler */
-    case 144:
-      num = 156;
-      break;
-      /* sys_sched_getscheduler */
-    case 145:
-      num = 157;
-      break;
-      /* sys_sched_get_priority_max */
-    case 146:
-      num = 159;
-      break;
-      /* sys_sched_get_priority_min */
-    case 147:
-      num = 160;
-      break;
-      /* sys_sched_rr_get_interval */
-    case 148:
-      num = 161;
-      break;
-      /* sys_mlock */
-    case 149:
-      num = 150;
-      break;
-      /* sys_munlock */
-    case 150:
-      num = 151;
-      break;
-      /* sys_mlockall */
-    case 151:
-      num = 152;
-      break;
-      /* sys_munlockall */
-    case 152:
-      num = 153;
-      break;
-      /* sys_vhangup */
-    case 153:
-      num = 111;
-      break;
-      /* sys_modify_ldt */
-    case 154:
-      num = 123;
-      break;
-      /* sys_pivot_root */
-    case 155:
-      num = 217;
-      break;
-      /* sys_sysctl */
-    case 156:
-      num = 149;
-      break;
-      /* sys_prctl */
-    case 157:
-      num = 172;
-      break;
-      /* sys_arch_prctl */
-    case 158:
+      ULONGEST arg3;
+
       regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg3,
-                                  &tmpulongest);
-      if (tmpulongest == RECORD_ARCH_GET_FS
-          || tmpulongest == RECORD_ARCH_GET_GS)
-        {
-          regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg2,
-                                      &tmpulongest);
-          if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
-                                        amd64_linux_record_tdep.size_ulong))
-            return -1;
-        }
-      break;
-      /* sys_adjtimex */
-    case 159:
-      num = 124;
-      break;
-      /* sys_setrlimit */
-    case 160:
-      num = 75;
-      break;
-      /* sys_chroot */
-    case 161:
-      num = 61;
-      break;
-      /* sys_sync */
-    case 162:
-      num = 36;
-      break;
-      /* sys_acct */
-    case 163:
-      num = 51;
-      break;
-      /* sys_settimeofday */
-    case 164:
-      num = 79;
-      break;
-      /* sys_mount */
-    case 165:
-      num = 21;
-      break;
-      /* sys_umount */
-    case 166:
-      num = 52;
-      break;
-      /* sys_swapon */
-    case 167:
-      num = 87;
-      break;
-      /* sys_swapoff */
-    case 168:
-      num = 115;
-      break;
-      /* sys_reboot */
-    case 169:
-      num = 88;
-      break;
-      /* sys_sethostname */
-    case 170:
-      num = 74;
-      break;
-      /* sys_setdomainname */
-    case 171:
-      num = 121;
-      break;
-      /* sys_iopl */
-    case 172:
-      num = 110;
-      break;
-      /* sys_ioperm */
-    case 173:
-      num = 101;
-      break;
-      /* sys_init_module */
-    case 175:
-      num = 128;
-      break;
-      /* sys_delete_module */
-    case 176:
-      num = 129;
-      break;
-      /* sys_quotactl */
-    case 179:
-      num = 131;
-      break;
-      /* sys_nfsservctl */
-    case 180:
-      num = 169;
-      break;
-      /* sys_gettid */
-    case 186:
-      num = 224;
-      break;
-      /* sys_readahead */
-    case 187:
-      num = 225;
-      break;
-      /* sys_setxattr */
-    case 188:
-      num = 226;
-      break;
-      /* sys_lsetxattr */
-    case 189:
-      num = 227;
-      break;
-      /* sys_fsetxattr */
-    case 190:
-      num = 228;
-      break;
-      /* sys_getxattr */
-    case 191:
-      num = 229;
-      break;
-      /* sys_lgetxattr */
-    case 192:
-      num = 230;
-      break;
-      /* sys_fgetxattr */
-    case 193:
-      num = 231;
-      break;
-      /* sys_listxattr */
-    case 194:
-      num = 232;
-      break;
-      /* sys_llistxattr */
-    case 195:
-      num = 233;
-      break;
-      /* sys_flistxattr */
-    case 196:
-      num = 234;
-      break;
-      /* sys_removexattr */
-    case 197:
-      num = 235;
-      break;
-      /* sys_lremovexattr */
-    case 198:
-      num = 236;
-      break;
-      /* sys_fremovexattr */
-    case 199:
-      num = 237;
-      break;
-      /* sys_tkill */
-    case 200:
-      num = 238;
-      break;
-      /* sys_time */
-    case 201:
-      num = 13;
-      break;
-      /* sys_futex */
-    case 202:
-      num = 240;
-      break;
-      /* sys_sched_setaffinity */
-    case 203:
-      num = 241;
-      break;
-      /* sys_sched_getaffinity */
-    case 204:
-      num = 242;
-      break;
-      /* sys_io_setup */
-    case 206:
-      num = 245;
-      break;
-      /* sys_io_destroy */
-    case 207:
-      num = 246;
-      break;
-      /* sys_io_getevents */
-    case 208:
-      num = 247;
-      break;
-      /* sys_io_submit */
-    case 209:
-      num = 248;
-      break;
-      /* sys_io_cancel */
-    case 210:
-      num = 249;
-      break;
-      /* sys_lookup_dcookie */
-    case 212:
-      num = 253;
-      break;
-      /* sys_epoll_create */
-    case 213:
-      num = 254;
-      break;
-      /* sys_remap_file_pages */
-    case 216:
-      num = 257;
-      break;
-      /* sys_getdents64 */
-    case 217:
-      num = 220;
-      break;
-      /* sys_set_tid_address */
-    case 218:
-      num = 258;
-      break;
-      /* sys_restart_syscall */
-    case 219:
-      num = 0;
-      break;
-      /* sys_semtimedop */
-    case 220:
-      num = 532;
-      break;
-      /* sys_fadvise64 */
-    case 221:
-      num = 250;
-      break;
-      /* sys_timer_create */
-    case 222:
-      num = 259;
-      break;
-      /* sys_timer_settime */
-    case 223:
-      num = 260;
-      break;
-      /* sys_timer_gettime */
-    case 224:
-      num = 261;
-      break;
-      /* sys_timer_getoverrun */
-    case 225:
-      num = 262;
-      break;
-      /* sys_timer_delete */
-    case 226:
-      num = 263;
-      break;
-      /* sys_clock_settime */
-    case 227:
-      num = 264;
-      break;
-      /* sys_clock_gettime */
-    case 228:
-      num = 265;
-      break;
-      /* sys_clock_getres */
-    case 229:
-      num = 266;
-      break;
-      /* sys_clock_nanosleep */
-    case 230:
-      num = 267;
-      break;
-      /* sys_exit_group */
-    case 231:
-      num = 252;
-      break;
-      /* sys_epoll_wait */
-    case 232:
-      num = 256;
-      break;
-      /* sys_epoll_ctl */
-    case 233:
-      num = 255;
-      break;
-      /* sys_tgkill */
-    case 234:
-      num = 270;
-      break;
-      /* sys_utimes */
-    case 235:
-      num = 271;
-      break;
-      /* sys_mbind */
-    case 237:
-      num = 274;
-      break;
-      /* sys_set_mempolicy */
-    case 238:
-      num = 276;
-      break;
-      /* sys_get_mempolicy */
-    case 239:
-      num = 275;
-      break;
-      /* sys_mq_open */
-    case 240:
-      num = 277;
-      break;
-      /* sys_mq_unlink */
-    case 241:
-      num = 278;
-      break;
-      /* sys_mq_timedsend */
-    case 242:
-      num = 279;
-      break;
-      /* sys_mq_timedreceive */
-    case 243:
-      num = 280;
-      break;
-      /* sys_mq_notify */
-    case 244:
-      num = 281;
-      break;
-      /* sys_mq_getsetattr */
-    case 245:
-      num = 282;
-      break;
-      /* sys_kexec_load */
-    case 246:
-      num = 283;
-      break;
-      /* sys_waitid */
-    case 247:
-      num = 284;
-      break;
-      /* sys_add_key */
-    case 248:
-      num = 286;
-      break;
-      /* sys_request_key */
-    case 249:
-      num = 287;
-      break;
-      /* sys_keyctl */
-    case 250:
-      num = 288;
-      break;
-      /* sys_ioprio_set */
-    case 251:
-      num = 289;
-      break;
-      /* sys_ioprio_get */
-    case 252:
-      num = 290;
-      break;
-      /* sys_inotify_init */
-    case 253:
-      num = 291;
-      break;
-      /* sys_inotify_add_watch */
-    case 254:
-      num = 292;
-      break;
-      /* sys_inotify_rm_watch */
-    case 255:
-      num = 293;
-      break;
-      /* sys_migrate_pages */
-    case 256:
-      num = 294;
-      break;
-      /* sys_openat */
-    case 257:
-      num = 295;
-      break;
-      /* sys_mkdirat */
-    case 258:
-      num = 296;
-      break;
-      /* sys_mknodat */
-    case 259:
-      num = 297;
-      break;
-      /* sys_fchownat */
-    case 260:
-      num = 298;
-      break;
-      /* sys_futimesat */
-    case 261:
-      num = 299;
-      break;
-      /* sys_newfstatat */
-    case 262:
-      num = 540;
-      break;
-      /* sys_unlinkat */
-    case 263:
-      num = 301;
-      break;
-      /* sys_renameat */
-    case 264:
-      num = 302;
-      break;
-      /* sys_linkat */
-    case 265:
-      num = 303;
-      break;
-      /* sys_symlinkat */
-    case 266:
-      num = 304;
-      break;
-      /* sys_readlinkat */
-    case 267:
-      num = 305;
-      break;
-      /* sys_fchmodat */
-    case 268:
-      num = 306;
-      break;
-      /* sys_faccessat */
-    case 269:
-      num = 307;
-      break;
-      /* sys_pselect6 */
-    case 270:
-      num = 308;
-      break;
-      /* sys_ppoll */
-    case 271:
-      num = 309;
-      break;
-      /* sys_unshare */
-    case 272:
-      num = 310;
-      break;
-      /* sys_set_robust_list */
-    case 273:
-      num = 311;
-      break;
-      /* sys_get_robust_list */
-    case 274:
-      num = 312;
-      break;
-      /* sys_splice */
-    case 275:
-      num = 313;
-      break;
-      /* sys_tee */
-    case 276:
-      num = 315;
-      break;
-      /* sys_sync_file_range */
-    case 277:
-      num = 314;
-      break;
-      /* sys_vmsplice */
-    case 278:
-      num = 316;
-      break;
-      /* sys_move_pages */
-    case 279:
-      num = 317;
-      break;
-    default:
+                                 &arg3);
+      if (arg3 == RECORD_ARCH_GET_FS || arg3 == RECORD_ARCH_GET_GS)
+      {
+       CORE_ADDR addr;
+
+       regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg2,
+                                   &addr);
+       if (record_arch_list_add_mem (addr, 
+                                     amd64_linux_record_tdep.size_ulong))
+         return -1;
+      }
+      goto record_regs;
+    }
+
+  if (syscall_gdb < 0)
+    {
       printf_unfiltered (_("Process record and replay target doesn't "
-                           "support syscall number %d\n"), (int) tmpulongest);
+                           "support syscall number %s\n"), 
+                        pulongest (syscall_native));
       return -1;
-      break;
     }
-
-  if (num >= 0)
+  else
     {
-      ret = record_linux_system_call (num, regcache,
+      ret = record_linux_system_call (syscall_gdb, regcache,
                                       &amd64_linux_record_tdep);
       if (ret)
         return ret;
     }
 
+ record_regs:
   /* Record the return value of the system call.  */
   if (record_arch_list_add_reg (regcache, AMD64_RCX_REGNUM))
     return -1;
index f0f155e4aeca5af0276fd64d4beab8884f6c1283..e0e713513171f5e624a3e266aad6b0fe300a7bfa 100644 (file)
 /* Total number of registers for GNU/Linux.  */
 #define AMD64_LINUX_NUM_REGS (AMD64_LINUX_ORIG_RAX_REGNUM + 1)
 
+/* Enum that defines the syscall identifiers for amd64 linux.
+   Used for process record/replay, these will be translated into
+   a gdb-canonical set of syscall ids in linux-record.c.  */
+
+enum amd64_syscall {
+  amd64_sys_read = 0,
+  amd64_sys_write = 1,
+  amd64_sys_open = 2,
+  amd64_sys_close = 3,
+  amd64_sys_newstat = 4,
+  amd64_sys_newfstat = 5,
+  amd64_sys_newlstat = 6,
+  amd64_sys_poll = 7,
+  amd64_sys_lseek = 8,
+  amd64_sys_mmap = 9,
+  amd64_sys_mprotect = 10,
+  amd64_sys_munmap = 11,
+  amd64_sys_brk = 12,
+  amd64_sys_rt_sigaction = 13,
+  amd64_sys_rt_sigprocmask = 14,
+  amd64_sys_rt_sigreturn = 15,
+  amd64_sys_ioctl = 16,
+  amd64_sys_pread64 = 17,
+  amd64_sys_pwrite64 = 18,
+  amd64_sys_readv = 19,
+  amd64_sys_writev = 20,
+  amd64_sys_access = 21,
+  amd64_sys_pipe = 22,
+  amd64_sys_select = 23,
+  amd64_sys_sched_yield = 24,
+  amd64_sys_mremap = 25,
+  amd64_sys_msync = 26,
+  amd64_sys_mincore = 27,
+  amd64_sys_madvise = 28,
+  amd64_sys_shmget = 29,
+  amd64_sys_shmat = 30,
+  amd64_sys_shmctl = 31,
+  amd64_sys_dup = 32,
+  amd64_sys_dup2 = 33,
+  amd64_sys_pause = 34,
+  amd64_sys_nanosleep = 35,
+  amd64_sys_getitimer = 36,
+  amd64_sys_alarm = 37,
+  amd64_sys_setitimer = 38,
+  amd64_sys_getpid = 39,
+  amd64_sys_sendfile64 = 40,
+  amd64_sys_socket = 41,
+  amd64_sys_connect = 42,
+  amd64_sys_accept = 43,
+  amd64_sys_sendto = 44,
+  amd64_sys_recvfrom = 45,
+  amd64_sys_sendmsg = 46,
+  amd64_sys_recvmsg = 47,
+  amd64_sys_shutdown = 48,
+  amd64_sys_bind = 49,
+  amd64_sys_listen = 50,
+  amd64_sys_getsockname = 51,
+  amd64_sys_getpeername = 52,
+  amd64_sys_socketpair = 53,
+  amd64_sys_setsockopt = 54,
+  amd64_sys_getsockopt = 55,
+  amd64_sys_clone = 56,
+  amd64_sys_fork = 57,
+  amd64_sys_vfork = 58,
+  amd64_sys_execve = 59,
+  amd64_sys_exit = 60,
+  amd64_sys_wait4 = 61,
+  amd64_sys_kill = 62,
+  amd64_sys_uname = 63,
+  amd64_sys_semget = 64,
+  amd64_sys_semop = 65,
+  amd64_sys_semctl = 66,
+  amd64_sys_shmdt = 67,
+  amd64_sys_msgget = 68,
+  amd64_sys_msgsnd = 69,
+  amd64_sys_msgrcv = 70,
+  amd64_sys_msgctl = 71,
+  amd64_sys_fcntl = 72,
+  amd64_sys_flock = 73,
+  amd64_sys_fsync = 74,
+  amd64_sys_fdatasync = 75,
+  amd64_sys_truncate = 76,
+  amd64_sys_ftruncate = 77,
+  amd64_sys_getdents = 78,
+  amd64_sys_getcwd = 79,
+  amd64_sys_chdir = 80,
+  amd64_sys_fchdir = 81,
+  amd64_sys_rename = 82,
+  amd64_sys_mkdir = 83,
+  amd64_sys_rmdir = 84,
+  amd64_sys_creat = 85,
+  amd64_sys_link = 86,
+  amd64_sys_unlink = 87,
+  amd64_sys_symlink = 88,
+  amd64_sys_readlink = 89,
+  amd64_sys_chmod = 90,
+  amd64_sys_fchmod = 91,
+  amd64_sys_chown = 92,
+  amd64_sys_fchown = 93,
+  amd64_sys_lchown = 94,
+  amd64_sys_umask = 95,
+  amd64_sys_gettimeofday = 96,
+  amd64_sys_getrlimit = 97,
+  amd64_sys_getrusage = 98,
+  amd64_sys_sysinfo = 99,
+  amd64_sys_times = 100,
+  amd64_sys_ptrace = 101,
+  amd64_sys_getuid = 102,
+  amd64_sys_syslog = 103,
+  amd64_sys_getgid = 104,
+  amd64_sys_setuid = 105,
+  amd64_sys_setgid = 106,
+  amd64_sys_geteuid = 107,
+  amd64_sys_getegid = 108,
+  amd64_sys_setpgid = 109,
+  amd64_sys_getppid = 110,
+  amd64_sys_getpgrp = 111,
+  amd64_sys_setsid = 112,
+  amd64_sys_setreuid = 113,
+  amd64_sys_setregid = 114,
+  amd64_sys_getgroups = 115,
+  amd64_sys_setgroups = 116,
+  amd64_sys_setresuid = 117,
+  amd64_sys_getresuid = 118,
+  amd64_sys_setresgid = 119,
+  amd64_sys_getresgid = 120,
+  amd64_sys_getpgid = 121,
+  amd64_sys_setfsuid = 122,
+  amd64_sys_setfsgid = 123,
+  amd64_sys_getsid = 124,
+  amd64_sys_capget = 125,
+  amd64_sys_capset = 126,
+  amd64_sys_rt_sigpending = 127,
+  amd64_sys_rt_sigtimedwait = 128,
+  amd64_sys_rt_sigqueueinfo = 129,
+  amd64_sys_rt_sigsuspend = 130,
+  amd64_sys_sigaltstack = 131,
+  amd64_sys_utime = 132,
+  amd64_sys_mknod = 133,
+  amd64_sys_personality = 135,
+  amd64_sys_ustat = 136,
+  amd64_sys_statfs = 137,
+  amd64_sys_fstatfs = 138,
+  amd64_sys_sysfs = 139,
+  amd64_sys_getpriority = 140,
+  amd64_sys_setpriority = 141,
+  amd64_sys_sched_setparam = 142,
+  amd64_sys_sched_getparam = 143,
+  amd64_sys_sched_setscheduler = 144,
+  amd64_sys_sched_getscheduler = 145,
+  amd64_sys_sched_get_priority_max = 146,
+  amd64_sys_sched_get_priority_min = 147,
+  amd64_sys_sched_rr_get_interval = 148,
+  amd64_sys_mlock = 149,
+  amd64_sys_munlock = 150,
+  amd64_sys_mlockall = 151,
+  amd64_sys_munlockall = 152,
+  amd64_sys_vhangup = 153,
+  amd64_sys_modify_ldt = 154,
+  amd64_sys_pivot_root = 155,
+  amd64_sys_sysctl = 156,
+  amd64_sys_prctl = 157,
+  amd64_sys_arch_prctl = 158,
+  amd64_sys_adjtimex = 159,
+  amd64_sys_setrlimit = 160,
+  amd64_sys_chroot = 161,
+  amd64_sys_sync = 162,
+  amd64_sys_acct = 163,
+  amd64_sys_settimeofday = 164,
+  amd64_sys_mount = 165,
+  amd64_sys_umount = 166,
+  amd64_sys_swapon = 167,
+  amd64_sys_swapoff = 168,
+  amd64_sys_reboot = 169,
+  amd64_sys_sethostname = 170,
+  amd64_sys_setdomainname = 171,
+  amd64_sys_iopl = 172,
+  amd64_sys_ioperm = 173,
+  amd64_sys_init_module = 175,
+  amd64_sys_delete_module = 176,
+  amd64_sys_quotactl = 179,
+  amd64_sys_nfsservctl = 180,
+  amd64_sys_gettid = 186,
+  amd64_sys_readahead = 187,
+  amd64_sys_setxattr = 188,
+  amd64_sys_lsetxattr = 189,
+  amd64_sys_fsetxattr = 190,
+  amd64_sys_getxattr = 191,
+  amd64_sys_lgetxattr = 192,
+  amd64_sys_fgetxattr = 193,
+  amd64_sys_listxattr = 194,
+  amd64_sys_llistxattr = 195,
+  amd64_sys_flistxattr = 196,
+  amd64_sys_removexattr = 197,
+  amd64_sys_lremovexattr = 198,
+  amd64_sys_fremovexattr = 199,
+  amd64_sys_tkill = 200,
+  amd64_sys_time = 201,
+  amd64_sys_futex = 202,
+  amd64_sys_sched_setaffinity = 203,
+  amd64_sys_sched_getaffinity = 204,
+  amd64_sys_io_setup = 206,
+  amd64_sys_io_destroy = 207,
+  amd64_sys_io_getevents = 208,
+  amd64_sys_io_submit = 209,
+  amd64_sys_io_cancel = 210,
+  amd64_sys_lookup_dcookie = 212,
+  amd64_sys_epoll_create = 213,
+  amd64_sys_remap_file_pages = 216,
+  amd64_sys_getdents64 = 217,
+  amd64_sys_set_tid_address = 218,
+  amd64_sys_restart_syscall = 219,
+  amd64_sys_semtimedop = 220,
+  amd64_sys_fadvise64 = 221,
+  amd64_sys_timer_create = 222,
+  amd64_sys_timer_settime = 223,
+  amd64_sys_timer_gettime = 224,
+  amd64_sys_timer_getoverrun = 225,
+  amd64_sys_timer_delete = 226,
+  amd64_sys_clock_settime = 227,
+  amd64_sys_clock_gettime = 228,
+  amd64_sys_clock_getres = 229,
+  amd64_sys_clock_nanosleep = 230,
+  amd64_sys_exit_group = 231,
+  amd64_sys_epoll_wait = 232,
+  amd64_sys_epoll_ctl = 233,
+  amd64_sys_tgkill = 234,
+  amd64_sys_utimes = 235,
+  amd64_sys_mbind = 237,
+  amd64_sys_set_mempolicy = 238,
+  amd64_sys_get_mempolicy = 239,
+  amd64_sys_mq_open = 240,
+  amd64_sys_mq_unlink = 241,
+  amd64_sys_mq_timedsend = 242,
+  amd64_sys_mq_timedreceive = 243,
+  amd64_sys_mq_notify = 244,
+  amd64_sys_mq_getsetattr = 245,
+  amd64_sys_kexec_load = 246,
+  amd64_sys_waitid = 247,
+  amd64_sys_add_key = 248,
+  amd64_sys_request_key = 249,
+  amd64_sys_keyctl = 250,
+  amd64_sys_ioprio_set = 251,
+  amd64_sys_ioprio_get = 252,
+  amd64_sys_inotify_init = 253,
+  amd64_sys_inotify_add_watch = 254,
+  amd64_sys_inotify_rm_watch = 255,
+  amd64_sys_migrate_pages = 256,
+  amd64_sys_openat = 257,
+  amd64_sys_mkdirat = 258,
+  amd64_sys_mknodat = 259,
+  amd64_sys_fchownat = 260,
+  amd64_sys_futimesat = 261,
+  amd64_sys_newfstatat = 262,
+  amd64_sys_unlinkat = 263,
+  amd64_sys_renameat = 264,
+  amd64_sys_linkat = 265,
+  amd64_sys_symlinkat = 266,
+  amd64_sys_readlinkat = 267,
+  amd64_sys_fchmodat = 268,
+  amd64_sys_faccessat = 269,
+  amd64_sys_pselect6 = 270,
+  amd64_sys_ppoll = 271,
+  amd64_sys_unshare = 272,
+  amd64_sys_set_robust_list = 273,
+  amd64_sys_get_robust_list = 274,
+  amd64_sys_splice = 275,
+  amd64_sys_tee = 276,
+  amd64_sys_sync_file_range = 277,
+  amd64_sys_vmsplice = 278,
+  amd64_sys_move_pages = 279,
+};
+
 #endif /* amd64-linux-tdep.h */
index ecc634fcfb4f6e42cf217cd3b827967d25874ec1..748fda05caaefb7322c9728cdd214f894897e2ff 100644 (file)
@@ -354,6 +354,24 @@ i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
   regcache_cooked_write_unsigned (regcache, I386_LINUX_ORIG_EAX_REGNUM, -1);
 }
 
+static struct linux_record_tdep i386_linux_record_tdep;
+
+/* i386_canonicalize_syscall maps from the native i386 Linux set
+   of syscall ids into a canonical set of syscall ids used by
+   process record (a mostly trivial mapping, since the canonical
+   set was originally taken from the i386 set).  */
+
+static enum gdb_syscall
+i386_canonicalize_syscall (int syscall)
+{
+  enum { i386_syscall_max = 499 };
+
+  if (syscall <= i386_syscall_max)
+    return syscall;
+  else
+    return -1;
+}
+
 /* Parse the arguments of current system call instruction and record
    the values of the registers and memory that will be changed into
    "record_arch_list".  This instruction is "int 0x80" (Linux
@@ -361,24 +379,26 @@ i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
 
    Return -1 if something wrong.  */
 
-static struct linux_record_tdep i386_linux_record_tdep;
-
 static int
 i386_linux_intx80_sysenter_record (struct regcache *regcache)
 {
   int ret;
-  uint32_t tmpu32;
+  LONGEST syscall_native;
+  enum gdb_syscall syscall_gdb;
+
+  regcache_raw_read_signed (regcache, I386_EAX_REGNUM, &syscall_native);
 
-  regcache_raw_read (regcache, I386_EAX_REGNUM, (gdb_byte *) &tmpu32);
+  syscall_gdb = i386_canonicalize_syscall (syscall_native);
 
-  if (tmpu32 > 499)
+  if (syscall_gdb < 0)
     {
       printf_unfiltered (_("Process record and replay target doesn't "
-                           "support syscall number %u\n"), tmpu32);
+                           "support syscall number %s\n"), 
+                        plongest (syscall_native));
       return -1;
     }
 
-  ret = record_linux_system_call (tmpu32, regcache,
+  ret = record_linux_system_call (syscall_gdb, regcache,
                                  &i386_linux_record_tdep);
   if (ret)
     return ret;
index 46f904cb1c704ef65a7870aeff9a54fe373b9ce0..af862800e1eda25a84f4b6cb88174b0452186e32 100644 (file)
@@ -222,7 +222,8 @@ record_linux_msghdr (struct regcache *regcache,
    Return -1 if something wrong.  */
 
 int
-record_linux_system_call (int num, struct regcache *regcache,
+record_linux_system_call (enum gdb_syscall syscall, 
+                         struct regcache *regcache,
                           struct linux_record_tdep *tdep)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -231,14 +232,12 @@ record_linux_system_call (int num, struct regcache *regcache,
   CORE_ADDR tmpaddr;
   int tmpint;
 
-  switch (num)
+  switch (syscall)
     {
-      /* sys_restart_syscall */
-    case 0:
+    case gdb_sys_restart_syscall:
       break;
 
-      /* sys_exit */
-    case 1:
+    case gdb_sys_exit:
       {
         int q;
         target_terminal_ours ();
@@ -251,12 +250,10 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_fork */
-    case 2:
+    case gdb_sys_fork:
       break;
 
-      /* sys_read */
-    case 3:
+    case gdb_sys_read:
       {
         ULONGEST addr, count;
         regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
@@ -266,66 +263,41 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_write */
-    case 4:
-      /* sys_open */
-    case 5:
-      /* sys_close */
-    case 6:
-      /* sys_waitpid */
-    case 7:
-      /* sys_creat */
-    case 8:
-      /* sys_link */
-    case 9:
-      /* sys_unlink */
-    case 10:
-      /* sys_execve */
-    case 11:
-      /* sys_chdir */
-    case 12:
-      /* sys_time */
-    case 13:
-      /* sys_mknod */
-    case 14:
-      /* sys_chmod */
-    case 15:
-      /* sys_lchown16 */
-    case 16:
-      /* sys_ni_syscall */
-    case 17:
-      break;
-
-      /* sys_stat */
-    case 18:
-      /* sys_fstat */
-    case 28:
-      /* sys_lstat */
-    case 84:
+    case gdb_sys_write:
+    case gdb_sys_open:
+    case gdb_sys_close:
+    case gdb_sys_waitpid:
+    case gdb_sys_creat:
+    case gdb_sys_link:
+    case gdb_sys_unlink:
+    case gdb_sys_execve:
+    case gdb_sys_chdir:
+    case gdb_sys_time:
+    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:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size__old_kernel_stat))
         return -1;
       break;
 
-      /* sys_lseek */
-    case 19:
-      /* sys_getpid */
-    case 20:
-      /* sys_mount */
-    case 21:
-      /* sys_oldumount */
-    case 22:
-      /* sys_setuid16 */
-    case 23:
-      /* sys_getuid16 */
-    case 24:
-      /* sys_stime */
-    case 25:
+    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;
 
-      /* sys_ptrace */
-    case 26:
+    case gdb_sys_ptrace:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest == RECORD_PTRACE_PEEKTEXT
           || tmpulongest == RECORD_PTRACE_PEEKDATA
@@ -338,69 +310,42 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_alarm */
-    case 27:
-      /* sys_pause */
-    case 29:
-      /* sys_utime    */
-    case 30:
-      /* sys_ni_syscall */
-    case 31:
-      /* sys_ni_syscall */
-    case 32:
-      /* sys_access */
-    case 33:
-      /* sys_nice */
-    case 34:
-      /* sys_ni_syscall */
-    case 35:
-      /* sys_sync */
-    case 36:
-      /* sys_kill */
-    case 37:
-      /* sys_rename */
-    case 38:
-      /* sys_mkdir */
-    case 39:
-      /* sys_rmdir */
-    case 40:
-      /* sys_dup */
-    case 41:
-      /* sys_pipe */
-    case 42:
-      break;
-
-      /* sys_times */
-    case 43:
+    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:
+    case gdb_sys_pipe:
+      break;
+
+    case gdb_sys_times:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_tms))
         return -1;
       break;
 
-      /* sys_ni_syscall */
-    case 44:
-      /* sys_brk */
-    case 45:
-      /* sys_setgid16 */
-    case 46:
-      /* sys_getgid16 */
-    case 47:
-      /* sys_signal */
-    case 48:
-      /* sys_geteuid16 */
-    case 49:
-      /* sys_getegid16 */
-    case 50:
-      /* sys_acct */
-    case 51:
-      /* sys_umount */
-    case 52:
-      /* sys_ni_syscall */
-    case 53:
-      break;
-
-      /* sys_ioctl */
-    case 54:
+    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
@@ -496,7 +441,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         {
           regcache_raw_read_unsigned (regcache, tdep->arg3,
                                       &tmpulongest);
-          /* This syscall affect a char size memory.  */
+         /* This syscall affects a char-size memory.  */
           if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1))
             return -1;
         }
@@ -555,8 +500,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_fcntl */
-    case 55:
+    case gdb_sys_fcntl:
       /* XXX */
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
     sys_fcntl:
@@ -570,98 +514,75 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_ni_syscall */
-    case 56:
-      /* sys_setpgid */
-    case 57:
-      /* sys_ni_syscall */
-    case 58:
+    case gdb_sys_ni_syscall56:
+    case gdb_sys_setpgid:
+    case gdb_sys_ni_syscall58:
       break;
 
-      /* sys_olduname */
-    case 59:
+    case gdb_sys_olduname:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_oldold_utsname))
         return -1;
       break;
 
-      /* sys_umask */
-    case 60:
-      /* sys_chroot */
-    case 61:
+    case gdb_sys_umask:
+    case gdb_sys_chroot:
       break;
 
-      /* sys_ustat */
-    case 62:
+    case gdb_sys_ustat:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_ustat))
         return -1;
       break;
 
-      /* sys_dup2 */
-    case 63:
-      /* sys_getppid */
-    case 64:
-      /* sys_getpgrp */
-    case 65:
-      /* sys_setsid */
-    case 66:
+    case gdb_sys_dup2:
+    case gdb_sys_getppid:
+    case gdb_sys_getpgrp:
+    case gdb_sys_setsid:
       break;
 
-      /* sys_sigaction */
-    case 67:
+    case gdb_sys_sigaction:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_old_sigaction))
         return -1;
       break;
 
-      /* sys_sgetmask */
-    case 68:
-      /* sys_ssetmask */
-    case 69:
-      /* sys_setreuid16 */
-    case 70:
-      /* sys_setregid16 */
-    case 71:
-      /* sys_sigsuspend */
-    case 72:
+    case gdb_sys_sgetmask:
+    case gdb_sys_ssetmask:
+    case gdb_sys_setreuid16:
+    case gdb_sys_setregid16:
+    case gdb_sys_sigsuspend:
       break;
 
-      /* sys_sigpending */
-    case 73:
+    case gdb_sys_sigpending:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_old_sigset_t))
         return -1;
       break;
 
-      /* sys_sethostname */
-    case 74:
-      /* sys_setrlimit */
-    case 75:
+    case gdb_sys_sethostname:
+    case gdb_sys_setrlimit:
       break;
 
-      /* sys_old_getrlimit */
-    case 76:
+    case gdb_sys_old_getrlimit:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_rlimit))
         return -1;
       break;
 
-      /* sys_getrusage */
-    case 77:
+    case gdb_sys_getrusage:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_rusage))
         return -1;
       break;
 
-      /* sys_gettimeofday */
-    case 78:
+    case gdb_sys_gettimeofday:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_timeval))
@@ -672,28 +593,24 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_settimeofday */
-    case 79:
+    case gdb_sys_settimeofday:
       break;
 
-      /* sys_getgroups16 */
-    case 80:
+    case gdb_sys_getgroups16:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_old_gid_t))
         return -1;
       break;
 
-      /* sys_setgroups16 */
-    case 81:
+    case gdb_sys_setgroups16:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_old_gid_t))
         return -1;
       break;
 
-      /* old_select */
-    case 82:
+    case gdb_old_select:
       {
         struct sel_arg_struct
         {
@@ -731,12 +648,10 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_symlink */
-    case 83:
+    case gdb_sys_symlink:
       break;
 
-      /* sys_readlink */
-    case 85:
+    case gdb_sys_readlink:
       {
         ULONGEST len;
         regcache_raw_read_unsigned (regcache, tdep->arg2,
@@ -747,14 +662,11 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_uselib */
-    case 86:
-      /* sys_swapon */
-    case 87:
+    case gdb_sys_uselib:
+    case gdb_sys_swapon:
       break;
 
-      /* sys_reboot */
-    case 88:
+    case gdb_sys_reboot:
       {
         int q;
         target_terminal_ours ();
@@ -768,20 +680,17 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* old_readdir */
-    case 89:
+    case gdb_old_readdir:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_dirent))
         return -1;
       break;
 
-      /* old_mmap */
-    case 90:
+    case gdb_old_mmap:
       break;
 
-      /* sys_munmap */
-    case 91:
+    case gdb_sys_munmap:
       {
         int q;
         ULONGEST len;
@@ -801,60 +710,39 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_truncate */
-    case 92:
-      /* sys_ftruncate */
-    case 93:
-      /* sys_fchmod */
-    case 94:
-      /* sys_fchown16 */
-    case 95:
-      /* sys_getpriority */
-    case 96:
-      /* sys_setpriority */
-    case 97:
-      /* sys_ni_syscall */
-    case 98:
-      break;
-
-      /* sys_statfs */
-    case 99:
-      /* sys_fstatfs */
-    case 100:
+    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:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_statfs))
         return -1;
       break;
 
-      /* sys_ioperm */
-    case 101:
+    case gdb_sys_ioperm:
       break;
 
-      /* sys_socket */
-    case 500:
-      /* sys_sendto */
-    case 503:
-      /* sys_sendmsg */
-    case 505:
-      /* sys_shutdown */
-    case 507:
-      /* sys_bind */
-    case 508:
-      /* sys_connect */
-    case 501:
-      /* sys_listen */
-    case 509:
-      /* sys_setsockopt */
-    case 513:
+    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;
 
-      /* sys_accept */
-    case 502:
-      /* sys_getsockname */
-    case 510:
-      /* sys_getpeername */
-    case 511:
+    case gdb_sys_accept:
+    case gdb_sys_getsockname:
+    case gdb_sys_getpeername:
       {
         ULONGEST len;
         regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
@@ -864,8 +752,7 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_recvfrom */
-    case 504:
+    case gdb_sys_recvfrom:
       {
         ULONGEST len;
         regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
@@ -873,8 +760,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
           return -1;
       }
-      /* sys_recv */
-    case 515:
+    case gdb_sys_recv:
       {
         ULONGEST size;
         regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
@@ -884,22 +770,19 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_recvmsg */
-    case 506:
+    case gdb_sys_recvmsg:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_linux_msghdr (regcache, tdep, tmpulongest))
         return -1;
       break;
 
-      /* sys_socketpair */
-    case 512:
+    case gdb_sys_socketpair:
       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
         return -1;
       break;
 
-      /* sys_getsockopt */
-    case 514:
+    case gdb_sys_getsockopt:
       regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
       if (tmpulongest)
         {
@@ -928,8 +811,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_socketcall */
-    case 102:
+    case gdb_sys_socketcall:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       switch (tmpulongest)
         {
@@ -1165,59 +1047,46 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_syslog */
-    case 103:
+    case gdb_sys_syslog:
       break;
 
-      /* sys_setitimer */
-    case 104:
+    case gdb_sys_setitimer:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_itimerval))
         return -1;
       break;
 
-      /* sys_getitimer */
-    case 105:
+    case gdb_sys_getitimer:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_itimerval))
         return -1;
       break;
 
-      /* sys_newstat */
-    case 106:
-      /* sys_newlstat */
-    case 107:
-      /* sys_newfstat */
-    case 108:
-      /* sys_newfstatat */
-    case 540:
+    case gdb_sys_newstat:
+    case gdb_sys_newlstat:
+    case gdb_sys_newfstat:
+    case gdb_sys_newfstatat:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_stat))
         return -1;
       break;
 
-      /* sys_uname */
-    case 109:
+    case gdb_sys_uname:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_old_utsname))
         return -1;
       break;
 
-      /* sys_iopl */
-    case 110:
-      /* sys_vhangup */
-    case 111:
-      /* sys_ni_syscall */
-    case 112:
-      /* sys_vm86old */
-    case 113:
+    case gdb_sys_iopl:
+    case gdb_sys_vhangup:
+    case gdb_sys_ni_syscall112:
+    case gdb_sys_vm86old:
       break;
 
-      /* sys_wait4 */
-    case 114:
+    case gdb_sys_wait4:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_int))
@@ -1228,56 +1097,44 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_swapoff */
-    case 115:
+    case gdb_sys_swapoff:
       break;
 
-      /* sys_sysinfo */
-    case 116:
+    case gdb_sys_sysinfo:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_sysinfo))
         return -1;
       break;
 
-      /* sys_shmget */
-    case 520:
-      /* sys_semget */
-    case 523:
-      /* sys_semop */
-    case 524:
-      /* sys_msgget */
-    case 528:
-      /* sys_shmdt */
+    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 527:
-      /* sys_msgsnd */
-    case 529:
-      /* sys_semtimedop */
-    case 532:
+    case gdb_sys_shmdt:
+    case gdb_sys_msgsnd:
+    case gdb_sys_semtimedop:
       break;
 
-      /* sys_shmat */
-    case 521:
+    case gdb_sys_shmat:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_ulong))
         return -1;
       break;
 
-      /* sys_shmctl */
-    case 522:
+    case gdb_sys_shmctl:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_shmid_ds))
         return -1;
       break;
 
+      /* XXX sys_semctl 525 still not supported.  */
       /* sys_semctl */
-      /* XXX sys_semctl 525 still not support.  */
 
-      /* sys_msgrcv */
-    case 530:
+    case gdb_sys_msgrcv:
       {
         ULONGEST msgp;
         regcache_raw_read_signed (regcache, tdep->arg3, &tmpulongest);
@@ -1288,16 +1145,14 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_msgctl */
-    case 531:
+    case gdb_sys_msgctl:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_msqid_ds))
         return -1;
       break;
 
-      /* sys_ipc */
-    case 117:
+    case gdb_sys_ipc:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       tmpulongest &= 0xffff;
       switch (tmpulongest)
@@ -1307,7 +1162,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         case RECORD_SEMTIMEDOP:
         case RECORD_MSGSND:
         case RECORD_MSGGET:
-          /* XXX maybe need do some record works with RECORD_SHMDT.  */
+         /* XXX maybe need do some record works with RECORD_SHMDT.  */
         case RECORD_SHMDT:
         case RECORD_SHMGET:
           break;
@@ -1344,33 +1199,28 @@ record_linux_system_call (int num, struct regcache *regcache,
             return -1;
           break;
         default:
-          /* XXX RECORD_SEMCTL still not support.  */
+         /* XXX RECORD_SEMCTL still not supported.  */
           printf_unfiltered (_("Process record and replay target doesn't "
-                               "support ipc number %d\n"), (int) tmpulongest);
+                               "support ipc number %s\n"), 
+                            pulongest (tmpulongest));
           break;
         }
       break;
 
-      /* sys_fsync */
-    case 118:
-      /* sys_sigreturn */
-    case 119:
-      /* sys_clone */
-    case 120:
-      /* sys_setdomainname */
-    case 121:
+    case gdb_sys_fsync:
+    case gdb_sys_sigreturn:
+    case gdb_sys_clone:
+    case gdb_sys_setdomainname:
       break;
 
-      /* sys_newuname */
-    case 122:
+    case gdb_sys_newuname:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_new_utsname))
         return -1;
       break;
 
-      /* sys_modify_ldt */
-    case 123:
+    case gdb_sys_modify_ldt:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest == 0 || tmpulongest == 2)
         {
@@ -1382,37 +1232,29 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_adjtimex */
-    case 124:
+    case gdb_sys_adjtimex:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_timex))
         return -1;
       break;
 
-      /* sys_mprotect */
-    case 125:
+    case gdb_sys_mprotect:
       break;
 
-      /* sys_sigprocmask */
-    case 126:
+    case gdb_sys_sigprocmask:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_old_sigset_t))
         return -1;
       break;
 
-      /* sys_ni_syscall */
-    case 127:
-      /* sys_init_module */
-    case 128:
-      /* sys_delete_module */
-    case 129:
-      /* sys_ni_syscall */
-    case 130:
+    case gdb_sys_ni_syscall127:
+    case gdb_sys_init_module:
+    case gdb_sys_delete_module:
+    case gdb_sys_ni_syscall130:
       break;
 
-      /* sys_quotactl */
-    case 131:
+    case gdb_sys_quotactl:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       switch (tmpulongest)
         {
@@ -1448,47 +1290,37 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_getpgid */
-    case 132:
-      /* sys_fchdir */
-    case 133:
-      /* sys_bdflush */
-    case 134:
+    case gdb_sys_getpgid:
+    case gdb_sys_fchdir:
+    case gdb_sys_bdflush:
       break;
 
-      /* sys_sysfs */
-    case 135:
+    case gdb_sys_sysfs:
       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.  */
+         /*XXX the size of memory is not very clear.  */
           if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10))
             return -1;
         }
       break;
 
-      /* sys_personality */
-    case 136:
-      /* sys_ni_syscall */
-    case 137:
-      /* sys_setfsuid16 */
-    case 138:
-      /* sys_setfsgid16 */
-    case 139:
+    case gdb_sys_personality:
+    case gdb_sys_ni_syscall137:
+    case gdb_sys_setfsuid16:
+    case gdb_sys_setfsgid16:
       break;
 
-      /* sys_llseek */
-    case 140:
+    case gdb_sys_llseek:
       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_loff_t))
         return -1;
       break;
 
-      /* sys_getdents */
-    case 141:
+    case gdb_sys_getdents:
       {
         ULONGEST count;
         regcache_raw_read_unsigned (regcache, tdep->arg2,
@@ -1500,8 +1332,7 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_select */
-    case 142:
+    case gdb_sys_select:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_fd_set))
@@ -1520,14 +1351,11 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_flock */
-    case 143:
-      /* sys_msync */
-    case 144:
+    case gdb_sys_flock:
+    case gdb_sys_msync:
       break;
 
-      /* sys_readv */
-    case 145:
+    case gdb_sys_readv:
       {
         ULONGEST vec, vlen;
 
@@ -1566,63 +1394,43 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_writev */
-    case 146:
-      /* sys_getsid */
-    case 147:
-      /* sys_fdatasync */
-    case 148:
-      /* sys_sysctl */
-    case 149:
-      /* sys_mlock */
-    case 150:
-      /* sys_munlock */
-    case 151:
-      /* sys_mlockall */
-    case 152:
-      /* sys_munlockall */
-    case 153:
-      /* sys_sched_setparam */
-    case 154:
-      break;
-
-      /* sys_sched_getparam */
-    case 155:
+    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:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
         return -1;
       break;
 
-      /* sys_sched_setscheduler */
-    case 156:
-      /* sys_sched_getscheduler */
-    case 157:
-      /* sys_sched_yield */
-    case 158:
-      /* sys_sched_get_priority_max */
-    case 159:
-      /* sys_sched_get_priority_min */
-    case 160:
+    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;
 
-      /* sys_sched_rr_get_interval */
-    case 161:
-      /* sys_nanosleep */
-    case 162:
+    case gdb_sys_sched_rr_get_interval:
+    case gdb_sys_nanosleep:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_timespec))
         return -1;
       break;
 
-      /* sys_mremap */
-    case 163:
-      /* sys_setresuid16 */
-    case 164:
+    case gdb_sys_mremap:
+    case gdb_sys_setresuid16:
       break;
 
-      /* sys_getresuid16 */
-    case 165:
+    case gdb_sys_getresuid16:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_old_uid_t))
@@ -1637,14 +1445,11 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_vm86 */
-    case 166:
-      /* sys_ni_syscall */
-    case 167:
+    case gdb_sys_vm86:
+    case gdb_sys_ni_syscall167:
       break;
 
-      /* sys_poll */
-    case 168:
+    case gdb_sys_poll:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest)
         {
@@ -1656,8 +1461,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_nfsservctl */
-    case 169:
+    case gdb_sys_nfsservctl:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest == 7 || tmpulongest == 8)
         {
@@ -1673,12 +1477,10 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_setresgid16 */
-    case 170:
+    case gdb_sys_setresgid16:
       break;
 
-      /* sys_getresgid16 */
-    case 171:
+    case gdb_sys_getresgid16:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_old_gid_t))
@@ -1693,8 +1495,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_prctl */
-    case 172:
+    case gdb_sys_prctl:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       switch (tmpulongest)
         {
@@ -1715,28 +1516,24 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_rt_sigreturn */
-    case 173:
+    case gdb_sys_rt_sigreturn:
       break;
 
-      /* sys_rt_sigaction */
-    case 174:
+    case gdb_sys_rt_sigaction:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_sigaction))
         return -1;
       break;
 
-      /* sys_rt_sigprocmask */
-    case 175:
+    case gdb_sys_rt_sigprocmask:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_sigset_t))
         return -1;
       break;
 
-      /* sys_rt_sigpending */
-    case 176:
+    case gdb_sys_rt_sigpending:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest)
         {
@@ -1748,22 +1545,18 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_rt_sigtimedwait */
-    case 177:
+    case gdb_sys_rt_sigtimedwait:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_siginfo_t))
         return -1;
       break;
 
-      /* sys_rt_sigqueueinfo */
-    case 178:
-      /* sys_rt_sigsuspend */
-    case 179:
+    case gdb_sys_rt_sigqueueinfo:
+    case gdb_sys_rt_sigsuspend:
       break;
 
-      /* sys_pread64 */
-    case 180:
+    case gdb_sys_pread64:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest)
         {
@@ -1774,14 +1567,11 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_pwrite64 */
-    case 181:
-      /* sys_chown16 */
-    case 182:
+    case gdb_sys_pwrite64:
+    case gdb_sys_chown16:
       break;
 
-      /* sys_getcwd */
-    case 183:
+    case gdb_sys_getcwd:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest)
         {
@@ -1792,90 +1582,68 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_capget */
-    case 184:
+    case gdb_sys_capget:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_cap_user_data_t))
         return -1;
       break;
 
-      /* sys_capset */
-    case 185:
+    case gdb_sys_capset:
       break;
 
-      /* sys_sigaltstack */
-    case 186:
+    case gdb_sys_sigaltstack:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_stack_t))
         return -1;
       break;
 
-      /* sys_sendfile */
-    case 187:
+    case gdb_sys_sendfile:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_off_t))
         return -1;
       break;
 
-      /* sys_ni_syscall */
-    case 188:
-      /* sys_ni_syscall */
-    case 189:
-      /* sys_vfork */
-    case 190:
+    case gdb_sys_ni_syscall188:
+    case gdb_sys_ni_syscall189:
+    case gdb_sys_vfork:
       break;
 
-      /* sys_getrlimit */
-    case 191:
+    case gdb_sys_getrlimit:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_rlimit))
         return -1;
       break;
 
-      /* sys_mmap2 */
-    case 192:
+    case gdb_sys_mmap2:
       break;
 
-      /* sys_truncate64 */
-    case 193:
-      /* sys_ftruncate64 */
-    case 194:
+    case gdb_sys_truncate64:
+    case gdb_sys_ftruncate64:
       break;
 
-      /* sys_stat64 */
-    case 195:
-      /* sys_lstat64 */
-    case 196:
-      /* sys_fstat64 */
-    case 197:
+    case gdb_sys_stat64:
+    case gdb_sys_lstat64:
+    case gdb_sys_fstat64:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_stat64))
         return -1;
       break;
 
-      /* sys_lchown */
-    case 198:
-      /* sys_getuid */
-    case 199:
-      /* sys_getgid */
-    case 200:
-      /* sys_geteuid */
-    case 201:
-      /* sys_getegid */
-    case 202:
-      /* sys_setreuid */
-    case 203:
-      /* sys_setregid */
-    case 204:
+    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;
 
-      /* sys_getgroups */
-    case 205:
+    case gdb_sys_getgroups:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest)
         {
@@ -1888,16 +1656,12 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_setgroups */
-    case 206:
-      /* sys_fchown */
-    case 207:
-      /* sys_setresuid */
-    case 208:
+    case gdb_sys_setgroups:
+    case gdb_sys_fchown:
+    case gdb_sys_setresuid:
       break;
 
-      /* sys_getresuid */
-    case 209:
+    case gdb_sys_getresuid:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t))
         return -1;
@@ -1909,12 +1673,10 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_setresgid */
-    case 210:
+    case gdb_sys_setresgid:
       break;
 
-      /* sys_getresgid */
-    case 211:
+    case gdb_sys_getresgid:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t))
         return -1;
@@ -1926,34 +1688,25 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_chown */
-    case 212:
-      /* sys_setuid */
-    case 213:
-      /* sys_setgid */
-    case 214:
-      /* sys_setfsuid */
-    case 215:
-      /* sys_setfsgid */
-    case 216:
-      /* sys_pivot_root */
-    case 217:
+    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;
 
-      /* sys_mincore */
-    case 218:
+    case gdb_sys_mincore:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_PAGE_SIZE))
         return -1;
       break;
 
-      /* sys_madvise */
-    case 219:
+    case gdb_sys_madvise:
       break;
 
-      /* sys_getdents64 */
-    case 220:
+    case gdb_sys_getdents64:
       {
         ULONGEST count;
         regcache_raw_read_unsigned (regcache, tdep->arg2,
@@ -1965,8 +1718,7 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_fcntl64 */
-    case 221:
+    case gdb_sys_fcntl64:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest == tdep->fcntl_F_GETLK64)
         {
@@ -1983,28 +1735,18 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_ni_syscall */
-    case 222:
-      /* sys_ni_syscall */
-    case 223:
-      /* sys_gettid */
-    case 224:
-      /* sys_readahead */
-    case 225:
-      /* sys_setxattr */
-    case 226:
-      /* sys_lsetxattr */
-    case 227:
-      /* sys_fsetxattr */
-    case 228:
-      break;
-
-      /* sys_getxattr */
-    case 229:
-      /* sys_lgetxattr */
-    case 230:
-      /* sys_fgetxattr */
-    case 231:
+    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)
         {
@@ -2015,12 +1757,9 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_listxattr */
-    case 232:
-      /* sys_llistxattr */
-    case 233:
-      /* sys_flistxattr */
-    case 234:
+    case gdb_sys_listxattr:
+    case gdb_sys_llistxattr:
+    case gdb_sys_flistxattr:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest)
         {
@@ -2031,32 +1770,24 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_removexattr */
-    case 235:
-      /* sys_lremovexattr */
-    case 236:
-      /* sys_fremovexattr */
-    case 237:
-      /* sys_tkill */
-    case 238:
+    case gdb_sys_removexattr:
+    case gdb_sys_lremovexattr:
+    case gdb_sys_fremovexattr:
+    case gdb_sys_tkill:
       break;
 
-      /* sys_sendfile64 */
-    case 239:
+    case gdb_sys_sendfile64:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_loff_t))
         return -1;
       break;
 
-      /* sys_futex */
-    case 240:
-      /* sys_sched_setaffinity */
-    case 241:
+    case gdb_sys_futex:
+    case gdb_sys_sched_setaffinity:
       break;
 
-      /* sys_sched_getaffinity */
-    case 242:
+    case gdb_sys_sched_getaffinity:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (tmpulongest)
         {
@@ -2067,34 +1798,29 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_set_thread_area */
-    case 243:
+    case gdb_sys_set_thread_area:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
         return -1;
       break;
 
-      /* sys_get_thread_area */
-    case 244:
+    case gdb_sys_get_thread_area:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_user_desc))
         return -1;
       break;
 
-      /* sys_io_setup */
-    case 245:
+    case gdb_sys_io_setup:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_long))
         return -1;
       break;
 
-      /* sys_io_destroy */
-    case 246:
+    case gdb_sys_io_destroy:
       break;
 
-      /* sys_io_getevents */
-    case 247:
+    case gdb_sys_io_getevents:
       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
       if (tmpulongest)
         {
@@ -2106,8 +1832,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_io_submit */
-    case 248:
+    case gdb_sys_io_submit:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (tmpulongest)
         {
@@ -2140,22 +1865,18 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_io_cancel */
-    case 249:
+    case gdb_sys_io_cancel:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_io_event))
         return -1;
       break;
 
-      /* sys_fadvise64 */
-    case 250:
-      /* sys_ni_syscall */
-    case 251:
+    case gdb_sys_fadvise64:
+    case gdb_sys_ni_syscall251:
       break;
 
-      /* sys_exit_group */
-    case 252:
+    case gdb_sys_exit_group:
       {
         int q;
         target_terminal_ours ();
@@ -2168,8 +1889,7 @@ record_linux_system_call (int num, struct regcache *regcache,
       }
       break;
 
-      /* sys_lookup_dcookie */
-    case 253:
+    case gdb_sys_lookup_dcookie:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest)
         {
@@ -2180,14 +1900,11 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_epoll_create */
-    case 254:
-      /* sys_epoll_ctl */
-    case 255:
+    case gdb_sys_epoll_create:
+    case gdb_sys_epoll_ctl:
       break;
 
-      /* sys_epoll_wait */
-    case 256:
+    case gdb_sys_epoll_wait:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest)
         {
@@ -2199,91 +1916,72 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_remap_file_pages */
-    case 257:
-      /* sys_set_tid_address */
-    case 258:
+    case gdb_sys_remap_file_pages:
+    case gdb_sys_set_tid_address:
       break;
 
-      /* sys_timer_create */
-    case 259:
+    case gdb_sys_timer_create:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
         return -1;
       break;
 
-      /* sys_timer_settime */
-    case 260:
+    case gdb_sys_timer_settime:
       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_itimerspec))
         return -1;
       break;
 
-      /* sys_timer_gettime */
-    case 261:
+    case gdb_sys_timer_gettime:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_itimerspec))
         return -1;
       break;
 
-      /* sys_timer_getoverrun */
-    case 262:
-      /* sys_timer_delete */
-    case 263:
-      /* sys_clock_settime */
-    case 264:
+    case gdb_sys_timer_getoverrun:
+    case gdb_sys_timer_delete:
+    case gdb_sys_clock_settime:
       break;
 
-      /* sys_clock_gettime */
-    case 265:
+    case gdb_sys_clock_gettime:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_timespec))
         return -1;
       break;
 
-      /* sys_clock_getres */
-    case 266:
+    case gdb_sys_clock_getres:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_timespec))
         return -1;
       break;
 
-      /* sys_clock_nanosleep */
-    case 267:
+    case gdb_sys_clock_nanosleep:
       regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_timespec))
         return -1;
       break;
 
-      /* sys_statfs64 */
-    case 268:
-      /* sys_fstatfs64 */
-    case 269:
+    case gdb_sys_statfs64:
+    case gdb_sys_fstatfs64:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_statfs64))
         return -1;
       break;
 
-      /* sys_tgkill */
-    case 270:
-      /* sys_utimes */
-    case 271:
-      /* sys_fadvise64_64 */
-    case 272:
-      /* sys_ni_syscall */
-    case 273:
-      /* sys_mbind */
-    case 274:
+    case gdb_sys_tgkill:
+    case gdb_sys_utimes:
+    case gdb_sys_fadvise64_64:
+    case gdb_sys_ni_syscall273:
+    case gdb_sys_mbind:
       break;
 
-      /* sys_get_mempolicy */
-    case 275:
+    case gdb_sys_get_mempolicy:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
         return -1;
@@ -2298,18 +1996,13 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_set_mempolicy */
-    case 276:
-      /* sys_mq_open */
-    case 277:
-      /* sys_mq_unlink */
-    case 278:
-      /* sys_mq_timedsend */
-    case 279:
+    case gdb_sys_set_mempolicy:
+    case gdb_sys_mq_open:
+    case gdb_sys_mq_unlink:
+    case gdb_sys_mq_timedsend:
       break;
 
-      /* sys_mq_timedreceive */
-    case 280:
+    case gdb_sys_mq_timedreceive:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest)
         {
@@ -2324,24 +2017,20 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_mq_notify */
-    case 281:
+    case gdb_sys_mq_notify:
       break;
 
-      /* sys_mq_getsetattr */
-    case 282:
+    case gdb_sys_mq_getsetattr:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_mq_attr))
         return -1;
       break;
 
-      /* sys_kexec_load */
-    case 283:
+    case gdb_sys_kexec_load:
       break;
 
-      /* sys_waitid */
-    case 284:
+    case gdb_sys_waitid:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_siginfo))
@@ -2352,16 +2041,12 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_ni_syscall */
-    case 285:
-      /* sys_add_key */
-    case 286:
-      /* sys_request_key */
-    case 287:
+    case gdb_sys_ni_syscall285:
+    case gdb_sys_add_key:
+    case gdb_sys_request_key:
       break;
 
-      /* sys_keyctl */
-    case 288:
+    case gdb_sys_keyctl:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest == 6 || tmpulongest == 11)
         {
@@ -2378,50 +2063,33 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_ioprio_set */
-    case 289:
-      /* sys_ioprio_get */
-    case 290:
-      /* sys_inotify_init */
-    case 291:
-      /* sys_inotify_add_watch */
-    case 292:
-      /* sys_inotify_rm_watch */
-    case 293:
-      /* sys_migrate_pages */
-    case 294:
-      /* sys_openat */
-    case 295:
-      /* sys_mkdirat */
-    case 296:
-      /* sys_mknodat */
-    case 297:
-      /* sys_fchownat */
-    case 298:
-      /* sys_futimesat */
-    case 299:
-      break;
-
-      /* sys_fstatat64 */
-    case 300:
+    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:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_stat64))
         return -1;
       break;
 
-      /* sys_unlinkat */
-    case 301:
-      /* sys_renameat */
-    case 302:
-      /* sys_linkat */
-    case 303:
-      /* sys_symlinkat */
-    case 304:
+    case gdb_sys_unlinkat:
+    case gdb_sys_renameat:
+    case gdb_sys_linkat:
+    case gdb_sys_symlinkat:
       break;
 
-      /* sys_readlinkat */
-    case 305:
+    case gdb_sys_readlinkat:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (tmpulongest)
         {
@@ -2432,14 +2100,11 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_fchmodat */
-    case 306:
-      /* sys_faccessat */
-    case 307:
+    case gdb_sys_fchmodat:
+    case gdb_sys_faccessat:
       break;
 
-      /* sys_pselect6 */
-    case 308:
+    case gdb_sys_pselect6:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_fd_set))
@@ -2458,8 +2123,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_ppoll */
-    case 309:
+    case gdb_sys_ppoll:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (tmpulongest)
         {
@@ -2475,14 +2139,11 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_unshare */
-    case 310:
-      /* sys_set_robust_list */
-    case 311:
+    case gdb_sys_unshare:
+    case gdb_sys_set_robust_list:
       break;
 
-      /* sys_get_robust_list */
-    case 312:
+    case gdb_sys_get_robust_list:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
         return -1;
@@ -2491,8 +2152,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_splice */
-    case 313:
+    case gdb_sys_splice:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
                                     tdep->size_loff_t))
@@ -2503,16 +2163,12 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_sync_file_range */
-    case 314:
-      /* sys_tee */
-    case 315:
-      /* sys_vmsplice */
-    case 316:
+    case gdb_sys_sync_file_range:
+    case gdb_sys_tee:
+    case gdb_sys_vmsplice:
       break;
 
-      /* sys_move_pages */
-    case 317:
+    case gdb_sys_move_pages:
       regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
       if (tmpulongest)
         {
@@ -2524,8 +2180,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         }
       break;
 
-      /* sys_getcpu */
-    case 318:
+    case gdb_sys_getcpu:
       regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
       if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int))
         return -1;
@@ -2538,8 +2193,7 @@ record_linux_system_call (int num, struct regcache *regcache,
         return -1;
       break;
 
-      /* sys_epoll_pwait */
-    case 319:
+    case gdb_sys_epoll_pwait:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (tmpulongest)
         {
@@ -2553,7 +2207,7 @@ record_linux_system_call (int num, struct regcache *regcache,
 
     default:
       printf_unfiltered (_("Process record and replay target doesn't "
-                           "support syscall number %u\n"), num);
+                           "support syscall number %d\n"), syscall);
       return -1;
       break;
     }
index c10d91f7c8731aa6ae73f0118486cfeb16464312..7315863749df8ffe61ac4ebf61dc8809901ab448 100644 (file)
@@ -176,7 +176,365 @@ struct linux_record_tdep
   int arg6;
 };
 
-extern int record_linux_system_call (int num, struct regcache *regcache,
-                                    struct linux_record_tdep *tdep);
+/* Enum that defines the gdb-canonical set of Linux syscall identifiers.
+   Different architectures will have different sets of syscall ids, and
+   each must provide a mapping from their set to this one.  */
+
+enum gdb_syscall {
+  gdb_sys_restart_syscall = 0,
+  gdb_sys_exit = 1,
+  gdb_sys_fork = 2,
+  gdb_sys_read = 3,
+  gdb_sys_write = 4,
+  gdb_sys_open = 5,
+  gdb_sys_close = 6,
+  gdb_sys_waitpid = 7,
+  gdb_sys_creat = 8,
+  gdb_sys_link = 9,
+  gdb_sys_unlink = 10,
+  gdb_sys_execve = 11,
+  gdb_sys_chdir = 12,
+  gdb_sys_time = 13,
+  gdb_sys_mknod = 14,
+  gdb_sys_chmod = 15,
+  gdb_sys_lchown16 = 16,
+  gdb_sys_ni_syscall17 = 17,
+  gdb_sys_stat = 18,
+  gdb_sys_lseek = 19,
+  gdb_sys_getpid = 20,
+  gdb_sys_mount = 21,
+  gdb_sys_oldumount = 22,
+  gdb_sys_setuid16 = 23,
+  gdb_sys_getuid16 = 24,
+  gdb_sys_stime = 25,
+  gdb_sys_ptrace = 26,
+  gdb_sys_alarm = 27,
+  gdb_sys_fstat = 28,
+  gdb_sys_pause = 29,
+  gdb_sys_utime = 30,
+  gdb_sys_ni_syscall31 = 31,
+  gdb_sys_ni_syscall32 = 32,
+  gdb_sys_access = 33,
+  gdb_sys_nice = 34,
+  gdb_sys_ni_syscall35 = 35,
+  gdb_sys_sync = 36,
+  gdb_sys_kill = 37,
+  gdb_sys_rename = 38,
+  gdb_sys_mkdir = 39,
+  gdb_sys_rmdir = 40,
+  gdb_sys_dup = 41,
+  gdb_sys_pipe = 42,
+  gdb_sys_times = 43,
+  gdb_sys_ni_syscall44 = 44,
+  gdb_sys_brk = 45,
+  gdb_sys_setgid16 = 46,
+  gdb_sys_getgid16 = 47,
+  gdb_sys_signal = 48,
+  gdb_sys_geteuid16 = 49,
+  gdb_sys_getegid16 = 50,
+  gdb_sys_acct = 51,
+  gdb_sys_umount = 52,
+  gdb_sys_ni_syscall53 = 53,
+  gdb_sys_ioctl = 54,
+  gdb_sys_fcntl = 55,
+  gdb_sys_ni_syscall56 = 56,
+  gdb_sys_setpgid = 57,
+  gdb_sys_ni_syscall58 = 58,
+  gdb_sys_olduname = 59,
+  gdb_sys_umask = 60,
+  gdb_sys_chroot = 61,
+  gdb_sys_ustat = 62,
+  gdb_sys_dup2 = 63,
+  gdb_sys_getppid = 64,
+  gdb_sys_getpgrp = 65,
+  gdb_sys_setsid = 66,
+  gdb_sys_sigaction = 67,
+  gdb_sys_sgetmask = 68,
+  gdb_sys_ssetmask = 69,
+  gdb_sys_setreuid16 = 70,
+  gdb_sys_setregid16 = 71,
+  gdb_sys_sigsuspend = 72,
+  gdb_sys_sigpending = 73,
+  gdb_sys_sethostname = 74,
+  gdb_sys_setrlimit = 75,
+  gdb_sys_old_getrlimit = 76,
+  gdb_sys_getrusage = 77,
+  gdb_sys_gettimeofday = 78,
+  gdb_sys_settimeofday = 79,
+  gdb_sys_getgroups16 = 80,
+  gdb_sys_setgroups16 = 81,
+  gdb_old_select = 82,
+  gdb_sys_symlink = 83,
+  gdb_sys_lstat = 84,
+  gdb_sys_readlink = 85,
+  gdb_sys_uselib = 86,
+  gdb_sys_swapon = 87,
+  gdb_sys_reboot = 88,
+  gdb_old_readdir = 89,
+  gdb_old_mmap = 90,
+  gdb_sys_munmap = 91,
+  gdb_sys_truncate = 92,
+  gdb_sys_ftruncate = 93,
+  gdb_sys_fchmod = 94,
+  gdb_sys_fchown16 = 95,
+  gdb_sys_getpriority = 96,
+  gdb_sys_setpriority = 97,
+  gdb_sys_ni_syscall98 = 98,
+  gdb_sys_statfs = 99,
+  gdb_sys_fstatfs = 100,
+  gdb_sys_ioperm = 101,
+  gdb_sys_socketcall = 102,
+  gdb_sys_syslog = 103,
+  gdb_sys_setitimer = 104,
+  gdb_sys_getitimer = 105,
+  gdb_sys_newstat = 106,
+  gdb_sys_newlstat = 107,
+  gdb_sys_newfstat = 108,
+  gdb_sys_uname = 109,
+  gdb_sys_iopl = 110,
+  gdb_sys_vhangup = 111,
+  gdb_sys_ni_syscall112 = 112,
+  gdb_sys_vm86old = 113,
+  gdb_sys_wait4 = 114,
+  gdb_sys_swapoff = 115,
+  gdb_sys_sysinfo = 116,
+  gdb_sys_ipc = 117,
+  gdb_sys_fsync = 118,
+  gdb_sys_sigreturn = 119,
+  gdb_sys_clone = 120,
+  gdb_sys_setdomainname = 121,
+  gdb_sys_newuname = 122,
+  gdb_sys_modify_ldt = 123,
+  gdb_sys_adjtimex = 124,
+  gdb_sys_mprotect = 125,
+  gdb_sys_sigprocmask = 126,
+  gdb_sys_ni_syscall127 = 127,
+  gdb_sys_init_module = 128,
+  gdb_sys_delete_module = 129,
+  gdb_sys_ni_syscall130 = 130,
+  gdb_sys_quotactl = 131,
+  gdb_sys_getpgid = 132,
+  gdb_sys_fchdir = 133,
+  gdb_sys_bdflush = 134,
+  gdb_sys_sysfs = 135,
+  gdb_sys_personality = 136,
+  gdb_sys_ni_syscall137 = 137,
+  gdb_sys_setfsuid16 = 138,
+  gdb_sys_setfsgid16 = 139,
+  gdb_sys_llseek = 140,
+  gdb_sys_getdents = 141,
+  gdb_sys_select = 142,
+  gdb_sys_flock = 143,
+  gdb_sys_msync = 144,
+  gdb_sys_readv = 145,
+  gdb_sys_writev = 146,
+  gdb_sys_getsid = 147,
+  gdb_sys_fdatasync = 148,
+  gdb_sys_sysctl = 149,
+  gdb_sys_mlock = 150,
+  gdb_sys_munlock = 151,
+  gdb_sys_mlockall = 152,
+  gdb_sys_munlockall = 153,
+  gdb_sys_sched_setparam = 154,
+  gdb_sys_sched_getparam = 155,
+  gdb_sys_sched_setscheduler = 156,
+  gdb_sys_sched_getscheduler = 157,
+  gdb_sys_sched_yield = 158,
+  gdb_sys_sched_get_priority_max = 159,
+  gdb_sys_sched_get_priority_min = 160,
+  gdb_sys_sched_rr_get_interval = 161,
+  gdb_sys_nanosleep = 162,
+  gdb_sys_mremap = 163,
+  gdb_sys_setresuid16 = 164,
+  gdb_sys_getresuid16 = 165,
+  gdb_sys_vm86 = 166,
+  gdb_sys_ni_syscall167 = 167,
+  gdb_sys_poll = 168,
+  gdb_sys_nfsservctl = 169,
+  gdb_sys_setresgid16 = 170,
+  gdb_sys_getresgid16 = 171,
+  gdb_sys_prctl = 172,
+  gdb_sys_rt_sigreturn = 173,
+  gdb_sys_rt_sigaction = 174,
+  gdb_sys_rt_sigprocmask = 175,
+  gdb_sys_rt_sigpending = 176,
+  gdb_sys_rt_sigtimedwait = 177,
+  gdb_sys_rt_sigqueueinfo = 178,
+  gdb_sys_rt_sigsuspend = 179,
+  gdb_sys_pread64 = 180,
+  gdb_sys_pwrite64 = 181,
+  gdb_sys_chown16 = 182,
+  gdb_sys_getcwd = 183,
+  gdb_sys_capget = 184,
+  gdb_sys_capset = 185,
+  gdb_sys_sigaltstack = 186,
+  gdb_sys_sendfile = 187,
+  gdb_sys_ni_syscall188 = 188,
+  gdb_sys_ni_syscall189 = 189,
+  gdb_sys_vfork = 190,
+  gdb_sys_getrlimit = 191,
+  gdb_sys_mmap2 = 192,
+  gdb_sys_truncate64 = 193,
+  gdb_sys_ftruncate64 = 194,
+  gdb_sys_stat64 = 195,
+  gdb_sys_lstat64 = 196,
+  gdb_sys_fstat64 = 197,
+  gdb_sys_lchown = 198,
+  gdb_sys_getuid = 199,
+  gdb_sys_getgid = 200,
+  gdb_sys_geteuid = 201,
+  gdb_sys_getegid = 202,
+  gdb_sys_setreuid = 203,
+  gdb_sys_setregid = 204,
+  gdb_sys_getgroups = 205,
+  gdb_sys_setgroups = 206,
+  gdb_sys_fchown = 207,
+  gdb_sys_setresuid = 208,
+  gdb_sys_getresuid = 209,
+  gdb_sys_setresgid = 210,
+  gdb_sys_getresgid = 211,
+  gdb_sys_chown = 212,
+  gdb_sys_setuid = 213,
+  gdb_sys_setgid = 214,
+  gdb_sys_setfsuid = 215,
+  gdb_sys_setfsgid = 216,
+  gdb_sys_pivot_root = 217,
+  gdb_sys_mincore = 218,
+  gdb_sys_madvise = 219,
+  gdb_sys_getdents64 = 220,
+  gdb_sys_fcntl64 = 221,
+  gdb_sys_ni_syscall222 = 222,
+  gdb_sys_ni_syscall223 = 223,
+  gdb_sys_gettid = 224,
+  gdb_sys_readahead = 225,
+  gdb_sys_setxattr = 226,
+  gdb_sys_lsetxattr = 227,
+  gdb_sys_fsetxattr = 228,
+  gdb_sys_getxattr = 229,
+  gdb_sys_lgetxattr = 230,
+  gdb_sys_fgetxattr = 231,
+  gdb_sys_listxattr = 232,
+  gdb_sys_llistxattr = 233,
+  gdb_sys_flistxattr = 234,
+  gdb_sys_removexattr = 235,
+  gdb_sys_lremovexattr = 236,
+  gdb_sys_fremovexattr = 237,
+  gdb_sys_tkill = 238,
+  gdb_sys_sendfile64 = 239,
+  gdb_sys_futex = 240,
+  gdb_sys_sched_setaffinity = 241,
+  gdb_sys_sched_getaffinity = 242,
+  gdb_sys_set_thread_area = 243,
+  gdb_sys_get_thread_area = 244,
+  gdb_sys_io_setup = 245,
+  gdb_sys_io_destroy = 246,
+  gdb_sys_io_getevents = 247,
+  gdb_sys_io_submit = 248,
+  gdb_sys_io_cancel = 249,
+  gdb_sys_fadvise64 = 250,
+  gdb_sys_ni_syscall251 = 251,
+  gdb_sys_exit_group = 252,
+  gdb_sys_lookup_dcookie = 253,
+  gdb_sys_epoll_create = 254,
+  gdb_sys_epoll_ctl = 255,
+  gdb_sys_epoll_wait = 256,
+  gdb_sys_remap_file_pages = 257,
+  gdb_sys_set_tid_address = 258,
+  gdb_sys_timer_create = 259,
+  gdb_sys_timer_settime = 260,
+  gdb_sys_timer_gettime = 261,
+  gdb_sys_timer_getoverrun = 262,
+  gdb_sys_timer_delete = 263,
+  gdb_sys_clock_settime = 264,
+  gdb_sys_clock_gettime = 265,
+  gdb_sys_clock_getres = 266,
+  gdb_sys_clock_nanosleep = 267,
+  gdb_sys_statfs64 = 268,
+  gdb_sys_fstatfs64 = 269,
+  gdb_sys_tgkill = 270,
+  gdb_sys_utimes = 271,
+  gdb_sys_fadvise64_64 = 272,
+  gdb_sys_ni_syscall273 = 273,
+  gdb_sys_mbind = 274,
+  gdb_sys_get_mempolicy = 275,
+  gdb_sys_set_mempolicy = 276,
+  gdb_sys_mq_open = 277,
+  gdb_sys_mq_unlink = 278,
+  gdb_sys_mq_timedsend = 279,
+  gdb_sys_mq_timedreceive = 280,
+  gdb_sys_mq_notify = 281,
+  gdb_sys_mq_getsetattr = 282,
+  gdb_sys_kexec_load = 283,
+  gdb_sys_waitid = 284,
+  gdb_sys_ni_syscall285 = 285,
+  gdb_sys_add_key = 286,
+  gdb_sys_request_key = 287,
+  gdb_sys_keyctl = 288,
+  gdb_sys_ioprio_set = 289,
+  gdb_sys_ioprio_get = 290,
+  gdb_sys_inotify_init = 291,
+  gdb_sys_inotify_add_watch = 292,
+  gdb_sys_inotify_rm_watch = 293,
+  gdb_sys_migrate_pages = 294,
+  gdb_sys_openat = 295,
+  gdb_sys_mkdirat = 296,
+  gdb_sys_mknodat = 297,
+  gdb_sys_fchownat = 298,
+  gdb_sys_futimesat = 299,
+  gdb_sys_fstatat64 = 300,
+  gdb_sys_unlinkat = 301,
+  gdb_sys_renameat = 302,
+  gdb_sys_linkat = 303,
+  gdb_sys_symlinkat = 304,
+  gdb_sys_readlinkat = 305,
+  gdb_sys_fchmodat = 306,
+  gdb_sys_faccessat = 307,
+  gdb_sys_pselect6 = 308,
+  gdb_sys_ppoll = 309,
+  gdb_sys_unshare = 310,
+  gdb_sys_set_robust_list = 311,
+  gdb_sys_get_robust_list = 312,
+  gdb_sys_splice = 313,
+  gdb_sys_sync_file_range = 314,
+  gdb_sys_tee = 315,
+  gdb_sys_vmsplice = 316,
+  gdb_sys_move_pages = 317,
+  gdb_sys_getcpu = 318,
+  gdb_sys_epoll_pwait = 319,
+  gdb_sys_socket = 500,
+  gdb_sys_connect = 501,
+  gdb_sys_accept = 502,
+  gdb_sys_sendto = 503,
+  gdb_sys_recvfrom = 504,
+  gdb_sys_sendmsg = 505,
+  gdb_sys_recvmsg = 506,
+  gdb_sys_shutdown = 507,
+  gdb_sys_bind = 508,
+  gdb_sys_listen = 509,
+  gdb_sys_getsockname = 510,
+  gdb_sys_getpeername = 511,
+  gdb_sys_socketpair = 512,
+  gdb_sys_setsockopt = 513,
+  gdb_sys_getsockopt = 514,
+  gdb_sys_recv = 515,
+  gdb_sys_shmget = 520,
+  gdb_sys_shmat = 521,
+  gdb_sys_shmctl = 522,
+  gdb_sys_semget = 523,
+  gdb_sys_semop = 524,
+  gdb_sys_semctl = 525,
+  gdb_sys_shmdt = 527,
+  gdb_sys_msgget = 528,
+  gdb_sys_msgsnd = 529,
+  gdb_sys_msgrcv = 530,
+  gdb_sys_msgctl = 531,
+  gdb_sys_semtimedop = 532,
+  gdb_sys_newfstatat = 540,
+};
 
+/* Record a linux syscall.  */
+
+extern int record_linux_system_call (enum gdb_syscall num, 
+                                    struct regcache *regcache,
+                                    struct linux_record_tdep *tdep);
 #endif /* _LINUX_RECORD_H_ */