1 /* Process record and replay target code for GNU/Linux. 2 3 Copyright (C) 2008-2020 Free Software Foundation, Inc. 4 5 This file is part of GDB. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20 #ifndef LINUX_RECORD_H 21 #define LINUX_RECORD_H 22 23 struct linux_record_tdep 24 { 25 /* The size of the type that will be used in a system call. */ 26 int size_pointer; 27 int size__old_kernel_stat; 28 int size_tms; 29 int size_loff_t; 30 int size_flock; 31 int size_oldold_utsname; 32 int size_ustat; 33 int size_old_sigaction; 34 int size_old_sigset_t; 35 int size_rlimit; 36 int size_rusage; 37 int size_timeval; 38 int size_timezone; 39 int size_old_gid_t; 40 int size_old_uid_t; 41 int size_fd_set; 42 int size_old_dirent; 43 int size_statfs; 44 int size_statfs64; 45 int size_sockaddr; 46 int size_int; 47 int size_long; 48 int size_ulong; 49 int size_msghdr; 50 int size_itimerval; 51 int size_stat; 52 int size_old_utsname; 53 int size_sysinfo; 54 int size_msqid_ds; 55 int size_shmid_ds; 56 int size_new_utsname; 57 int size_timex; 58 int size_mem_dqinfo; 59 int size_if_dqblk; 60 int size_fs_quota_stat; 61 int size_timespec; 62 int size_pollfd; 63 int size_NFS_FHSIZE; 64 int size_knfsd_fh; 65 int size_TASK_COMM_LEN; 66 int size_sigaction; 67 int size_sigset_t; 68 int size_siginfo_t; 69 int size_cap_user_data_t; 70 int size_stack_t; 71 int size_off_t; 72 int size_stat64; 73 int size_gid_t; 74 int size_uid_t; 75 int size_PAGE_SIZE; 76 int size_flock64; 77 int size_user_desc; 78 int size_io_event; 79 int size_iocb; 80 int size_epoll_event; 81 int size_itimerspec; 82 int size_mq_attr; 83 int size_termios; 84 int size_termios2; 85 int size_pid_t; 86 int size_winsize; 87 int size_serial_struct; 88 int size_serial_icounter_struct; 89 int size_hayes_esp_config; 90 int size_size_t; 91 int size_iovec; 92 int size_time_t; 93 94 /* The values of the second argument of system call "sys_ioctl". */ 95 int ioctl_TCGETS; 96 int ioctl_TCSETS; 97 int ioctl_TCSETSW; 98 int ioctl_TCSETSF; 99 int ioctl_TCGETA; 100 int ioctl_TCSETA; 101 int ioctl_TCSETAW; 102 int ioctl_TCSETAF; 103 int ioctl_TCSBRK; 104 int ioctl_TCXONC; 105 int ioctl_TCFLSH; 106 int ioctl_TIOCEXCL; 107 int ioctl_TIOCNXCL; 108 int ioctl_TIOCSCTTY; 109 int ioctl_TIOCGPGRP; 110 int ioctl_TIOCSPGRP; 111 int ioctl_TIOCOUTQ; 112 int ioctl_TIOCSTI; 113 int ioctl_TIOCGWINSZ; 114 int ioctl_TIOCSWINSZ; 115 int ioctl_TIOCMGET; 116 int ioctl_TIOCMBIS; 117 int ioctl_TIOCMBIC; 118 int ioctl_TIOCMSET; 119 int ioctl_TIOCGSOFTCAR; 120 int ioctl_TIOCSSOFTCAR; 121 int ioctl_FIONREAD; 122 int ioctl_TIOCINQ; 123 int ioctl_TIOCLINUX; 124 int ioctl_TIOCCONS; 125 int ioctl_TIOCGSERIAL; 126 int ioctl_TIOCSSERIAL; 127 int ioctl_TIOCPKT; 128 int ioctl_FIONBIO; 129 int ioctl_TIOCNOTTY; 130 int ioctl_TIOCSETD; 131 int ioctl_TIOCGETD; 132 int ioctl_TCSBRKP; 133 int ioctl_TIOCTTYGSTRUCT; 134 int ioctl_TIOCSBRK; 135 int ioctl_TIOCCBRK; 136 int ioctl_TIOCGSID; 137 int ioctl_TCGETS2; 138 int ioctl_TCSETS2; 139 int ioctl_TCSETSW2; 140 int ioctl_TCSETSF2; 141 int ioctl_TIOCGPTN; 142 int ioctl_TIOCSPTLCK; 143 int ioctl_FIONCLEX; 144 int ioctl_FIOCLEX; 145 int ioctl_FIOASYNC; 146 int ioctl_TIOCSERCONFIG; 147 int ioctl_TIOCSERGWILD; 148 int ioctl_TIOCSERSWILD; 149 int ioctl_TIOCGLCKTRMIOS; 150 int ioctl_TIOCSLCKTRMIOS; 151 int ioctl_TIOCSERGSTRUCT; 152 int ioctl_TIOCSERGETLSR; 153 int ioctl_TIOCSERGETMULTI; 154 int ioctl_TIOCSERSETMULTI; 155 int ioctl_TIOCMIWAIT; 156 int ioctl_TIOCGICOUNT; 157 int ioctl_TIOCGHAYESESP; 158 int ioctl_TIOCSHAYESESP; 159 int ioctl_FIOQSIZE; 160 161 /* The values of the second argument of system call "sys_fcntl" 162 and "sys_fcntl64". */ 163 int fcntl_F_GETLK; 164 int fcntl_F_GETLK64; 165 int fcntl_F_SETLK64; 166 int fcntl_F_SETLKW64; 167 168 /* The number of the registers that are used as the arguments of 169 a system call. */ 170 int arg1; 171 int arg2; 172 int arg3; 173 int arg4; 174 int arg5; 175 int arg6; 176 int arg7; 177 }; 178 179 /* Enum that defines the gdb-canonical set of Linux syscall identifiers. 180 Different architectures will have different sets of syscall ids, and 181 each must provide a mapping from their set to this one. */ 182 183 enum gdb_syscall { 184 /* An unknown GDB syscall, not a real syscall. */ 185 gdb_sys_no_syscall = -1, 186 187 gdb_sys_restart_syscall = 0, 188 gdb_sys_exit = 1, 189 gdb_sys_fork = 2, 190 gdb_sys_read = 3, 191 gdb_sys_write = 4, 192 gdb_sys_open = 5, 193 gdb_sys_close = 6, 194 gdb_sys_waitpid = 7, 195 gdb_sys_creat = 8, 196 gdb_sys_link = 9, 197 gdb_sys_unlink = 10, 198 gdb_sys_execve = 11, 199 gdb_sys_chdir = 12, 200 gdb_sys_time = 13, 201 gdb_sys_mknod = 14, 202 gdb_sys_chmod = 15, 203 gdb_sys_lchown16 = 16, 204 gdb_sys_ni_syscall17 = 17, 205 gdb_sys_stat = 18, 206 gdb_sys_lseek = 19, 207 gdb_sys_getpid = 20, 208 gdb_sys_mount = 21, 209 gdb_sys_oldumount = 22, 210 gdb_sys_setuid16 = 23, 211 gdb_sys_getuid16 = 24, 212 gdb_sys_stime = 25, 213 gdb_sys_ptrace = 26, 214 gdb_sys_alarm = 27, 215 gdb_sys_fstat = 28, 216 gdb_sys_pause = 29, 217 gdb_sys_utime = 30, 218 gdb_sys_ni_syscall31 = 31, 219 gdb_sys_ni_syscall32 = 32, 220 gdb_sys_access = 33, 221 gdb_sys_nice = 34, 222 gdb_sys_ni_syscall35 = 35, 223 gdb_sys_sync = 36, 224 gdb_sys_kill = 37, 225 gdb_sys_rename = 38, 226 gdb_sys_mkdir = 39, 227 gdb_sys_rmdir = 40, 228 gdb_sys_dup = 41, 229 gdb_sys_pipe = 42, 230 gdb_sys_times = 43, 231 gdb_sys_ni_syscall44 = 44, 232 gdb_sys_brk = 45, 233 gdb_sys_setgid16 = 46, 234 gdb_sys_getgid16 = 47, 235 gdb_sys_signal = 48, 236 gdb_sys_geteuid16 = 49, 237 gdb_sys_getegid16 = 50, 238 gdb_sys_acct = 51, 239 gdb_sys_umount = 52, 240 gdb_sys_ni_syscall53 = 53, 241 gdb_sys_ioctl = 54, 242 gdb_sys_fcntl = 55, 243 gdb_sys_ni_syscall56 = 56, 244 gdb_sys_setpgid = 57, 245 gdb_sys_ni_syscall58 = 58, 246 gdb_sys_olduname = 59, 247 gdb_sys_umask = 60, 248 gdb_sys_chroot = 61, 249 gdb_sys_ustat = 62, 250 gdb_sys_dup2 = 63, 251 gdb_sys_getppid = 64, 252 gdb_sys_getpgrp = 65, 253 gdb_sys_setsid = 66, 254 gdb_sys_sigaction = 67, 255 gdb_sys_sgetmask = 68, 256 gdb_sys_ssetmask = 69, 257 gdb_sys_setreuid16 = 70, 258 gdb_sys_setregid16 = 71, 259 gdb_sys_sigsuspend = 72, 260 gdb_sys_sigpending = 73, 261 gdb_sys_sethostname = 74, 262 gdb_sys_setrlimit = 75, 263 gdb_sys_old_getrlimit = 76, 264 gdb_sys_getrusage = 77, 265 gdb_sys_gettimeofday = 78, 266 gdb_sys_settimeofday = 79, 267 gdb_sys_getgroups16 = 80, 268 gdb_sys_setgroups16 = 81, 269 gdb_old_select = 82, 270 gdb_sys_symlink = 83, 271 gdb_sys_lstat = 84, 272 gdb_sys_readlink = 85, 273 gdb_sys_uselib = 86, 274 gdb_sys_swapon = 87, 275 gdb_sys_reboot = 88, 276 gdb_old_readdir = 89, 277 gdb_old_mmap = 90, 278 gdb_sys_munmap = 91, 279 gdb_sys_truncate = 92, 280 gdb_sys_ftruncate = 93, 281 gdb_sys_fchmod = 94, 282 gdb_sys_fchown16 = 95, 283 gdb_sys_getpriority = 96, 284 gdb_sys_setpriority = 97, 285 gdb_sys_ni_syscall98 = 98, 286 gdb_sys_statfs = 99, 287 gdb_sys_fstatfs = 100, 288 gdb_sys_ioperm = 101, 289 gdb_sys_socketcall = 102, 290 gdb_sys_syslog = 103, 291 gdb_sys_setitimer = 104, 292 gdb_sys_getitimer = 105, 293 gdb_sys_newstat = 106, 294 gdb_sys_newlstat = 107, 295 gdb_sys_newfstat = 108, 296 gdb_sys_uname = 109, 297 gdb_sys_iopl = 110, 298 gdb_sys_vhangup = 111, 299 gdb_sys_ni_syscall112 = 112, 300 gdb_sys_vm86old = 113, 301 gdb_sys_wait4 = 114, 302 gdb_sys_swapoff = 115, 303 gdb_sys_sysinfo = 116, 304 gdb_sys_ipc = 117, 305 gdb_sys_fsync = 118, 306 gdb_sys_sigreturn = 119, 307 gdb_sys_clone = 120, 308 gdb_sys_setdomainname = 121, 309 gdb_sys_newuname = 122, 310 gdb_sys_modify_ldt = 123, 311 gdb_sys_adjtimex = 124, 312 gdb_sys_mprotect = 125, 313 gdb_sys_sigprocmask = 126, 314 gdb_sys_ni_syscall127 = 127, 315 gdb_sys_init_module = 128, 316 gdb_sys_delete_module = 129, 317 gdb_sys_ni_syscall130 = 130, 318 gdb_sys_quotactl = 131, 319 gdb_sys_getpgid = 132, 320 gdb_sys_fchdir = 133, 321 gdb_sys_bdflush = 134, 322 gdb_sys_sysfs = 135, 323 gdb_sys_personality = 136, 324 gdb_sys_ni_syscall137 = 137, 325 gdb_sys_setfsuid16 = 138, 326 gdb_sys_setfsgid16 = 139, 327 gdb_sys_llseek = 140, 328 gdb_sys_getdents = 141, 329 gdb_sys_select = 142, 330 gdb_sys_flock = 143, 331 gdb_sys_msync = 144, 332 gdb_sys_readv = 145, 333 gdb_sys_writev = 146, 334 gdb_sys_getsid = 147, 335 gdb_sys_fdatasync = 148, 336 gdb_sys_sysctl = 149, 337 gdb_sys_mlock = 150, 338 gdb_sys_munlock = 151, 339 gdb_sys_mlockall = 152, 340 gdb_sys_munlockall = 153, 341 gdb_sys_sched_setparam = 154, 342 gdb_sys_sched_getparam = 155, 343 gdb_sys_sched_setscheduler = 156, 344 gdb_sys_sched_getscheduler = 157, 345 gdb_sys_sched_yield = 158, 346 gdb_sys_sched_get_priority_max = 159, 347 gdb_sys_sched_get_priority_min = 160, 348 gdb_sys_sched_rr_get_interval = 161, 349 gdb_sys_nanosleep = 162, 350 gdb_sys_mremap = 163, 351 gdb_sys_setresuid16 = 164, 352 gdb_sys_getresuid16 = 165, 353 gdb_sys_vm86 = 166, 354 gdb_sys_ni_syscall167 = 167, 355 gdb_sys_poll = 168, 356 gdb_sys_nfsservctl = 169, 357 gdb_sys_setresgid16 = 170, 358 gdb_sys_getresgid16 = 171, 359 gdb_sys_prctl = 172, 360 gdb_sys_rt_sigreturn = 173, 361 gdb_sys_rt_sigaction = 174, 362 gdb_sys_rt_sigprocmask = 175, 363 gdb_sys_rt_sigpending = 176, 364 gdb_sys_rt_sigtimedwait = 177, 365 gdb_sys_rt_sigqueueinfo = 178, 366 gdb_sys_rt_sigsuspend = 179, 367 gdb_sys_pread64 = 180, 368 gdb_sys_pwrite64 = 181, 369 gdb_sys_chown16 = 182, 370 gdb_sys_getcwd = 183, 371 gdb_sys_capget = 184, 372 gdb_sys_capset = 185, 373 gdb_sys_sigaltstack = 186, 374 gdb_sys_sendfile = 187, 375 gdb_sys_ni_syscall188 = 188, 376 gdb_sys_ni_syscall189 = 189, 377 gdb_sys_vfork = 190, 378 gdb_sys_getrlimit = 191, 379 gdb_sys_mmap2 = 192, 380 gdb_sys_truncate64 = 193, 381 gdb_sys_ftruncate64 = 194, 382 gdb_sys_stat64 = 195, 383 gdb_sys_lstat64 = 196, 384 gdb_sys_fstat64 = 197, 385 gdb_sys_lchown = 198, 386 gdb_sys_getuid = 199, 387 gdb_sys_getgid = 200, 388 gdb_sys_geteuid = 201, 389 gdb_sys_getegid = 202, 390 gdb_sys_setreuid = 203, 391 gdb_sys_setregid = 204, 392 gdb_sys_getgroups = 205, 393 gdb_sys_setgroups = 206, 394 gdb_sys_fchown = 207, 395 gdb_sys_setresuid = 208, 396 gdb_sys_getresuid = 209, 397 gdb_sys_setresgid = 210, 398 gdb_sys_getresgid = 211, 399 gdb_sys_chown = 212, 400 gdb_sys_setuid = 213, 401 gdb_sys_setgid = 214, 402 gdb_sys_setfsuid = 215, 403 gdb_sys_setfsgid = 216, 404 gdb_sys_pivot_root = 217, 405 gdb_sys_mincore = 218, 406 gdb_sys_madvise = 219, 407 gdb_sys_getdents64 = 220, 408 gdb_sys_fcntl64 = 221, 409 gdb_sys_ni_syscall222 = 222, 410 gdb_sys_ni_syscall223 = 223, 411 gdb_sys_gettid = 224, 412 gdb_sys_readahead = 225, 413 gdb_sys_setxattr = 226, 414 gdb_sys_lsetxattr = 227, 415 gdb_sys_fsetxattr = 228, 416 gdb_sys_getxattr = 229, 417 gdb_sys_lgetxattr = 230, 418 gdb_sys_fgetxattr = 231, 419 gdb_sys_listxattr = 232, 420 gdb_sys_llistxattr = 233, 421 gdb_sys_flistxattr = 234, 422 gdb_sys_removexattr = 235, 423 gdb_sys_lremovexattr = 236, 424 gdb_sys_fremovexattr = 237, 425 gdb_sys_tkill = 238, 426 gdb_sys_sendfile64 = 239, 427 gdb_sys_futex = 240, 428 gdb_sys_sched_setaffinity = 241, 429 gdb_sys_sched_getaffinity = 242, 430 gdb_sys_set_thread_area = 243, 431 gdb_sys_get_thread_area = 244, 432 gdb_sys_io_setup = 245, 433 gdb_sys_io_destroy = 246, 434 gdb_sys_io_getevents = 247, 435 gdb_sys_io_submit = 248, 436 gdb_sys_io_cancel = 249, 437 gdb_sys_fadvise64 = 250, 438 gdb_sys_ni_syscall251 = 251, 439 gdb_sys_exit_group = 252, 440 gdb_sys_lookup_dcookie = 253, 441 gdb_sys_epoll_create = 254, 442 gdb_sys_epoll_ctl = 255, 443 gdb_sys_epoll_wait = 256, 444 gdb_sys_remap_file_pages = 257, 445 gdb_sys_set_tid_address = 258, 446 gdb_sys_timer_create = 259, 447 gdb_sys_timer_settime = 260, 448 gdb_sys_timer_gettime = 261, 449 gdb_sys_timer_getoverrun = 262, 450 gdb_sys_timer_delete = 263, 451 gdb_sys_clock_settime = 264, 452 gdb_sys_clock_gettime = 265, 453 gdb_sys_clock_getres = 266, 454 gdb_sys_clock_nanosleep = 267, 455 gdb_sys_statfs64 = 268, 456 gdb_sys_fstatfs64 = 269, 457 gdb_sys_tgkill = 270, 458 gdb_sys_utimes = 271, 459 gdb_sys_fadvise64_64 = 272, 460 gdb_sys_ni_syscall273 = 273, 461 gdb_sys_mbind = 274, 462 gdb_sys_get_mempolicy = 275, 463 gdb_sys_set_mempolicy = 276, 464 gdb_sys_mq_open = 277, 465 gdb_sys_mq_unlink = 278, 466 gdb_sys_mq_timedsend = 279, 467 gdb_sys_mq_timedreceive = 280, 468 gdb_sys_mq_notify = 281, 469 gdb_sys_mq_getsetattr = 282, 470 gdb_sys_kexec_load = 283, 471 gdb_sys_waitid = 284, 472 gdb_sys_ni_syscall285 = 285, 473 gdb_sys_add_key = 286, 474 gdb_sys_request_key = 287, 475 gdb_sys_keyctl = 288, 476 gdb_sys_ioprio_set = 289, 477 gdb_sys_ioprio_get = 290, 478 gdb_sys_inotify_init = 291, 479 gdb_sys_inotify_add_watch = 292, 480 gdb_sys_inotify_rm_watch = 293, 481 gdb_sys_migrate_pages = 294, 482 gdb_sys_openat = 295, 483 gdb_sys_mkdirat = 296, 484 gdb_sys_mknodat = 297, 485 gdb_sys_fchownat = 298, 486 gdb_sys_futimesat = 299, 487 gdb_sys_fstatat64 = 300, 488 gdb_sys_unlinkat = 301, 489 gdb_sys_renameat = 302, 490 gdb_sys_linkat = 303, 491 gdb_sys_symlinkat = 304, 492 gdb_sys_readlinkat = 305, 493 gdb_sys_fchmodat = 306, 494 gdb_sys_faccessat = 307, 495 gdb_sys_pselect6 = 308, 496 gdb_sys_ppoll = 309, 497 gdb_sys_unshare = 310, 498 gdb_sys_set_robust_list = 311, 499 gdb_sys_get_robust_list = 312, 500 gdb_sys_splice = 313, 501 gdb_sys_sync_file_range = 314, 502 gdb_sys_tee = 315, 503 gdb_sys_vmsplice = 316, 504 gdb_sys_move_pages = 317, 505 gdb_sys_getcpu = 318, 506 gdb_sys_epoll_pwait = 319, 507 gdb_sys_fallocate = 324, 508 gdb_sys_eventfd2 = 328, 509 gdb_sys_epoll_create1 = 329, 510 gdb_sys_dup3 = 330, 511 gdb_sys_pipe2 = 331, 512 gdb_sys_inotify_init1 = 332, 513 gdb_sys_socket = 500, 514 gdb_sys_connect = 501, 515 gdb_sys_accept = 502, 516 gdb_sys_sendto = 503, 517 gdb_sys_recvfrom = 504, 518 gdb_sys_sendmsg = 505, 519 gdb_sys_recvmsg = 506, 520 gdb_sys_shutdown = 507, 521 gdb_sys_bind = 508, 522 gdb_sys_listen = 509, 523 gdb_sys_getsockname = 510, 524 gdb_sys_getpeername = 511, 525 gdb_sys_socketpair = 512, 526 gdb_sys_setsockopt = 513, 527 gdb_sys_getsockopt = 514, 528 gdb_sys_recv = 515, 529 gdb_sys_shmget = 520, 530 gdb_sys_shmat = 521, 531 gdb_sys_shmctl = 522, 532 gdb_sys_semget = 523, 533 gdb_sys_semop = 524, 534 gdb_sys_semctl = 525, 535 gdb_sys_shmdt = 527, 536 gdb_sys_msgget = 528, 537 gdb_sys_msgsnd = 529, 538 gdb_sys_msgrcv = 530, 539 gdb_sys_msgctl = 531, 540 gdb_sys_semtimedop = 532, 541 gdb_sys_newfstatat = 540, 542 }; 543 544 /* Record a linux syscall. */ 545 546 extern int record_linux_system_call (enum gdb_syscall num, 547 struct regcache *regcache, 548 struct linux_record_tdep *tdep); 549 550 #endif /* LINUX_RECORD_H */ 551