1 /* Target-dependent code for GNU/Linux x86-64.
3 Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
5 Contributed by Jiri Smid, SuSE Labs.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "arch-utils.h"
30 #include "reggroups.h"
31 #include "amd64-linux-tdep.h"
32 #include "linux-tdep.h"
34 #include "gdb_string.h"
36 #include "amd64-tdep.h"
37 #include "solib-svr4.h"
38 #include "xml-syscall.h"
40 #include "features/i386/amd64-linux.c"
42 /* The syscall's XML filename for i386. */
43 #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml"
46 #include "linux-record.h"
48 /* Mapping between the general-purpose registers in `struct user'
49 format and GDB's register cache layout. */
51 /* From <sys/reg.h>. */
52 static int amd64_linux_gregset_reg_offset
[] =
81 /* Support for signal handlers. */
83 #define LINUX_SIGTRAMP_INSN0 0x48 /* mov $NNNNNNNN, %rax */
84 #define LINUX_SIGTRAMP_OFFSET0 0
85 #define LINUX_SIGTRAMP_INSN1 0x0f /* syscall */
86 #define LINUX_SIGTRAMP_OFFSET1 7
88 static const gdb_byte linux_sigtramp_code
[] =
90 /* mov $__NR_rt_sigreturn, %rax */
91 LINUX_SIGTRAMP_INSN0
, 0xc7, 0xc0, 0x0f, 0x00, 0x00, 0x00,
93 LINUX_SIGTRAMP_INSN1
, 0x05
96 #define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
98 /* If PC is in a sigtramp routine, return the address of the start of
99 the routine. Otherwise, return 0. */
102 amd64_linux_sigtramp_start (struct frame_info
*this_frame
)
104 CORE_ADDR pc
= get_frame_pc (this_frame
);
105 gdb_byte buf
[LINUX_SIGTRAMP_LEN
];
107 /* We only recognize a signal trampoline if PC is at the start of
108 one of the two instructions. We optimize for finding the PC at
109 the start, as will be the case when the trampoline is not the
110 first frame on the stack. We assume that in the case where the
111 PC is not at the start of the instruction sequence, there will be
112 a few trailing readable bytes on the stack. */
114 if (!safe_frame_unwind_memory (this_frame
, pc
, buf
, sizeof buf
))
117 if (buf
[0] != LINUX_SIGTRAMP_INSN0
)
119 if (buf
[0] != LINUX_SIGTRAMP_INSN1
)
122 pc
-= LINUX_SIGTRAMP_OFFSET1
;
123 if (!safe_frame_unwind_memory (this_frame
, pc
, buf
, sizeof buf
))
127 if (memcmp (buf
, linux_sigtramp_code
, LINUX_SIGTRAMP_LEN
) != 0)
133 /* Return whether THIS_FRAME corresponds to a GNU/Linux sigtramp
137 amd64_linux_sigtramp_p (struct frame_info
*this_frame
)
139 CORE_ADDR pc
= get_frame_pc (this_frame
);
142 find_pc_partial_function (pc
, &name
, NULL
, NULL
);
144 /* If we have NAME, we can optimize the search. The trampoline is
145 named __restore_rt. However, it isn't dynamically exported from
146 the shared C library, so the trampoline may appear to be part of
147 the preceding function. This should always be sigaction,
148 __sigaction, or __libc_sigaction (all aliases to the same
150 if (name
== NULL
|| strstr (name
, "sigaction") != NULL
)
151 return (amd64_linux_sigtramp_start (this_frame
) != 0);
153 return (strcmp ("__restore_rt", name
) == 0);
156 /* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
157 #define AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 40
159 /* Assuming THIS_FRAME is a GNU/Linux sigtramp routine, return the
160 address of the associated sigcontext structure. */
163 amd64_linux_sigcontext_addr (struct frame_info
*this_frame
)
165 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
166 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
170 get_frame_register (this_frame
, AMD64_RSP_REGNUM
, buf
);
171 sp
= extract_unsigned_integer (buf
, 8, byte_order
);
173 /* The sigcontext structure is part of the user context. A pointer
174 to the user context is passed as the third argument to the signal
175 handler, i.e. in %rdx. Unfortunately %rdx isn't preserved across
176 function calls so we can't use it. Fortunately the user context
177 is part of the signal frame and the unwound %rsp directly points
179 return sp
+ AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET
;
184 amd64_linux_get_syscall_number (struct gdbarch
*gdbarch
,
187 struct regcache
*regcache
= get_thread_regcache (ptid
);
188 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
189 /* The content of a register. */
194 /* Getting the system call number from the register.
195 When dealing with x86_64 architecture, this information
196 is stored at %rax register. */
197 regcache_cooked_read (regcache
, AMD64_LINUX_ORIG_RAX_REGNUM
, buf
);
199 ret
= extract_signed_integer (buf
, 8, byte_order
);
205 /* From <asm/sigcontext.h>. */
206 static int amd64_linux_sc_reg_offset
[] =
225 17 * 8, /* %eflags */
227 /* FIXME: kettenis/2002030531: The registers %cs, %fs and %gs are
228 available in `struct sigcontext'. However, they only occupy two
229 bytes instead of four, which makes using them here rather
230 difficult. Leave them out for now. */
240 amd64_linux_register_reggroup_p (struct gdbarch
*gdbarch
, int regnum
,
241 struct reggroup
*group
)
243 if (regnum
== AMD64_LINUX_ORIG_RAX_REGNUM
)
244 return (group
== system_reggroup
245 || group
== save_reggroup
246 || group
== restore_reggroup
);
247 return i386_register_reggroup_p (gdbarch
, regnum
, group
);
250 /* Set the program counter for process PTID to PC. */
253 amd64_linux_write_pc (struct regcache
*regcache
, CORE_ADDR pc
)
255 regcache_cooked_write_unsigned (regcache
, AMD64_RIP_REGNUM
, pc
);
257 /* We must be careful with modifying the program counter. If we
258 just interrupted a system call, the kernel might try to restart
259 it when we resume the inferior. On restarting the system call,
260 the kernel will try backing up the program counter even though it
261 no longer points at the system call. This typically results in a
262 SIGSEGV or SIGILL. We can prevent this by writing `-1' in the
263 "orig_rax" pseudo-register.
265 Note that "orig_rax" is saved when setting up a dummy call frame.
266 This means that it is properly restored when that frame is
267 popped, and that the interrupted system call will be restarted
268 when we resume the inferior on return from a function call from
269 within GDB. In all other cases the system call will not be
271 regcache_cooked_write_unsigned (regcache
, AMD64_LINUX_ORIG_RAX_REGNUM
, -1);
274 /* Record all registers but IP register for process-record. */
277 amd64_all_but_ip_registers_record (struct regcache
*regcache
)
279 if (record_arch_list_add_reg (regcache
, AMD64_RAX_REGNUM
))
281 if (record_arch_list_add_reg (regcache
, AMD64_RCX_REGNUM
))
283 if (record_arch_list_add_reg (regcache
, AMD64_RDX_REGNUM
))
285 if (record_arch_list_add_reg (regcache
, AMD64_RBX_REGNUM
))
287 if (record_arch_list_add_reg (regcache
, AMD64_RSP_REGNUM
))
289 if (record_arch_list_add_reg (regcache
, AMD64_RBP_REGNUM
))
291 if (record_arch_list_add_reg (regcache
, AMD64_RSI_REGNUM
))
293 if (record_arch_list_add_reg (regcache
, AMD64_RDI_REGNUM
))
295 if (record_arch_list_add_reg (regcache
, AMD64_R8_REGNUM
))
297 if (record_arch_list_add_reg (regcache
, AMD64_R9_REGNUM
))
299 if (record_arch_list_add_reg (regcache
, AMD64_R10_REGNUM
))
301 if (record_arch_list_add_reg (regcache
, AMD64_R11_REGNUM
))
303 if (record_arch_list_add_reg (regcache
, AMD64_R12_REGNUM
))
305 if (record_arch_list_add_reg (regcache
, AMD64_R13_REGNUM
))
307 if (record_arch_list_add_reg (regcache
, AMD64_R14_REGNUM
))
309 if (record_arch_list_add_reg (regcache
, AMD64_R15_REGNUM
))
311 if (record_arch_list_add_reg (regcache
, AMD64_EFLAGS_REGNUM
))
317 /* amd64_canonicalize_syscall maps from the native amd64 Linux set
318 of syscall ids into a canonical set of syscall ids used by
321 static enum gdb_syscall
322 amd64_canonicalize_syscall (enum amd64_syscall syscall
)
328 case amd64_sys_write
:
329 return gdb_sys_write
;
334 case amd64_sys_close
:
335 return gdb_sys_close
;
337 case amd64_sys_newstat
:
338 return gdb_sys_newstat
;
340 case amd64_sys_newfstat
:
341 return gdb_sys_newfstat
;
343 case amd64_sys_newlstat
:
344 return gdb_sys_newlstat
;
349 case amd64_sys_lseek
:
350 return gdb_sys_lseek
;
353 return gdb_sys_mmap2
;
355 case amd64_sys_mprotect
:
356 return gdb_sys_mprotect
;
358 case amd64_sys_munmap
:
359 return gdb_sys_munmap
;
364 case amd64_sys_rt_sigaction
:
365 return gdb_sys_rt_sigaction
;
367 case amd64_sys_rt_sigprocmask
:
368 return gdb_sys_rt_sigprocmask
;
370 case amd64_sys_rt_sigreturn
:
371 return gdb_sys_rt_sigreturn
;
373 case amd64_sys_ioctl
:
374 return gdb_sys_ioctl
;
376 case amd64_sys_pread64
:
377 return gdb_sys_pread64
;
379 case amd64_sys_pwrite64
:
380 return gdb_sys_pwrite64
;
382 case amd64_sys_readv
:
383 return gdb_sys_readv
;
385 case amd64_sys_writev
:
386 return gdb_sys_writev
;
388 case amd64_sys_access
:
389 return gdb_sys_access
;
394 case amd64_sys_select
:
395 return gdb_sys_select
;
397 case amd64_sys_sched_yield
:
398 return gdb_sys_sched_yield
;
400 case amd64_sys_mremap
:
401 return gdb_sys_mremap
;
403 case amd64_sys_msync
:
404 return gdb_sys_msync
;
406 case amd64_sys_mincore
:
407 return gdb_sys_mincore
;
409 case amd64_sys_madvise
:
410 return gdb_sys_madvise
;
412 case amd64_sys_shmget
:
413 return gdb_sys_shmget
;
415 case amd64_sys_shmat
:
416 return gdb_sys_shmat
;
418 case amd64_sys_shmctl
:
419 return gdb_sys_shmctl
;
427 case amd64_sys_pause
:
428 return gdb_sys_pause
;
430 case amd64_sys_nanosleep
:
431 return gdb_sys_nanosleep
;
433 case amd64_sys_getitimer
:
434 return gdb_sys_getitimer
;
436 case amd64_sys_alarm
:
437 return gdb_sys_alarm
;
439 case amd64_sys_setitimer
:
440 return gdb_sys_setitimer
;
442 case amd64_sys_getpid
:
443 return gdb_sys_getpid
;
445 case amd64_sys_sendfile64
:
446 return gdb_sys_sendfile64
;
448 case amd64_sys_socket
:
449 return gdb_sys_socket
;
451 case amd64_sys_connect
:
452 return gdb_sys_connect
;
454 case amd64_sys_accept
:
455 return gdb_sys_accept
;
457 case amd64_sys_sendto
:
458 return gdb_sys_sendto
;
460 case amd64_sys_recvfrom
:
461 return gdb_sys_recvfrom
;
463 case amd64_sys_sendmsg
:
464 return gdb_sys_sendmsg
;
466 case amd64_sys_recvmsg
:
467 return gdb_sys_recvmsg
;
469 case amd64_sys_shutdown
:
470 return gdb_sys_shutdown
;
475 case amd64_sys_listen
:
476 return gdb_sys_listen
;
478 case amd64_sys_getsockname
:
479 return gdb_sys_getsockname
;
481 case amd64_sys_getpeername
:
482 return gdb_sys_getpeername
;
484 case amd64_sys_socketpair
:
485 return gdb_sys_socketpair
;
487 case amd64_sys_setsockopt
:
488 return gdb_sys_setsockopt
;
490 case amd64_sys_getsockopt
:
491 return gdb_sys_getsockopt
;
493 case amd64_sys_clone
:
494 return gdb_sys_clone
;
499 case amd64_sys_vfork
:
500 return gdb_sys_vfork
;
502 case amd64_sys_execve
:
503 return gdb_sys_execve
;
508 case amd64_sys_wait4
:
509 return gdb_sys_wait4
;
514 case amd64_sys_uname
:
515 return gdb_sys_uname
;
517 case amd64_sys_semget
:
518 return gdb_sys_semget
;
520 case amd64_sys_semop
:
521 return gdb_sys_semop
;
523 case amd64_sys_semctl
:
524 return gdb_sys_semctl
;
526 case amd64_sys_shmdt
:
527 return gdb_sys_shmdt
;
529 case amd64_sys_msgget
:
530 return gdb_sys_msgget
;
532 case amd64_sys_msgsnd
:
533 return gdb_sys_msgsnd
;
535 case amd64_sys_msgrcv
:
536 return gdb_sys_msgrcv
;
538 case amd64_sys_msgctl
:
539 return gdb_sys_msgctl
;
541 case amd64_sys_fcntl
:
542 return gdb_sys_fcntl
;
544 case amd64_sys_flock
:
545 return gdb_sys_flock
;
547 case amd64_sys_fsync
:
548 return gdb_sys_fsync
;
550 case amd64_sys_fdatasync
:
551 return gdb_sys_fdatasync
;
553 case amd64_sys_truncate
:
554 return gdb_sys_truncate
;
556 case amd64_sys_ftruncate
:
557 return gdb_sys_ftruncate
;
559 case amd64_sys_getdents
:
560 return gdb_sys_getdents
;
562 case amd64_sys_getcwd
:
563 return gdb_sys_getcwd
;
565 case amd64_sys_chdir
:
566 return gdb_sys_chdir
;
568 case amd64_sys_fchdir
:
569 return gdb_sys_fchdir
;
571 case amd64_sys_rename
:
572 return gdb_sys_rename
;
574 case amd64_sys_mkdir
:
575 return gdb_sys_mkdir
;
577 case amd64_sys_rmdir
:
578 return gdb_sys_rmdir
;
580 case amd64_sys_creat
:
581 return gdb_sys_creat
;
586 case amd64_sys_unlink
:
587 return gdb_sys_unlink
;
589 case amd64_sys_symlink
:
590 return gdb_sys_symlink
;
592 case amd64_sys_readlink
:
593 return gdb_sys_readlink
;
595 case amd64_sys_chmod
:
596 return gdb_sys_chmod
;
598 case amd64_sys_fchmod
:
599 return gdb_sys_fchmod
;
601 case amd64_sys_chown
:
602 return gdb_sys_chown
;
604 case amd64_sys_fchown
:
605 return gdb_sys_fchown
;
607 case amd64_sys_lchown
:
608 return gdb_sys_lchown
;
610 case amd64_sys_umask
:
611 return gdb_sys_umask
;
613 case amd64_sys_gettimeofday
:
614 return gdb_sys_gettimeofday
;
616 case amd64_sys_getrlimit
:
617 return gdb_sys_getrlimit
;
619 case amd64_sys_getrusage
:
620 return gdb_sys_getrusage
;
622 case amd64_sys_sysinfo
:
623 return gdb_sys_sysinfo
;
625 case amd64_sys_times
:
626 return gdb_sys_times
;
628 case amd64_sys_ptrace
:
629 return gdb_sys_ptrace
;
631 case amd64_sys_getuid
:
632 return gdb_sys_getuid
;
634 case amd64_sys_syslog
:
635 return gdb_sys_syslog
;
637 case amd64_sys_getgid
:
638 return gdb_sys_getgid
;
640 case amd64_sys_setuid
:
641 return gdb_sys_setuid
;
643 case amd64_sys_setgid
:
644 return gdb_sys_setgid
;
646 case amd64_sys_geteuid
:
647 return gdb_sys_geteuid
;
649 case amd64_sys_getegid
:
650 return gdb_sys_getegid
;
652 case amd64_sys_setpgid
:
653 return gdb_sys_setpgid
;
655 case amd64_sys_getppid
:
656 return gdb_sys_getppid
;
658 case amd64_sys_getpgrp
:
659 return gdb_sys_getpgrp
;
661 case amd64_sys_setsid
:
662 return gdb_sys_setsid
;
664 case amd64_sys_setreuid
:
665 return gdb_sys_setreuid
;
667 case amd64_sys_setregid
:
668 return gdb_sys_setregid
;
670 case amd64_sys_getgroups
:
671 return gdb_sys_getgroups
;
673 case amd64_sys_setgroups
:
674 return gdb_sys_setgroups
;
676 case amd64_sys_setresuid
:
677 return gdb_sys_setresuid
;
679 case amd64_sys_getresuid
:
680 return gdb_sys_getresuid
;
682 case amd64_sys_setresgid
:
683 return gdb_sys_setresgid
;
685 case amd64_sys_getresgid
:
686 return gdb_sys_getresgid
;
688 case amd64_sys_getpgid
:
689 return gdb_sys_getpgid
;
691 case amd64_sys_setfsuid
:
692 return gdb_sys_setfsuid
;
694 case amd64_sys_setfsgid
:
695 return gdb_sys_setfsgid
;
697 case amd64_sys_getsid
:
698 return gdb_sys_getsid
;
700 case amd64_sys_capget
:
701 return gdb_sys_capget
;
703 case amd64_sys_capset
:
704 return gdb_sys_capset
;
706 case amd64_sys_rt_sigpending
:
707 return gdb_sys_rt_sigpending
;
709 case amd64_sys_rt_sigtimedwait
:
710 return gdb_sys_rt_sigtimedwait
;
712 case amd64_sys_rt_sigqueueinfo
:
713 return gdb_sys_rt_sigqueueinfo
;
715 case amd64_sys_rt_sigsuspend
:
716 return gdb_sys_rt_sigsuspend
;
718 case amd64_sys_sigaltstack
:
719 return gdb_sys_sigaltstack
;
721 case amd64_sys_utime
:
722 return gdb_sys_utime
;
724 case amd64_sys_mknod
:
725 return gdb_sys_mknod
;
727 case amd64_sys_personality
:
728 return gdb_sys_personality
;
730 case amd64_sys_ustat
:
731 return gdb_sys_ustat
;
733 case amd64_sys_statfs
:
734 return gdb_sys_statfs
;
736 case amd64_sys_fstatfs
:
737 return gdb_sys_fstatfs
;
739 case amd64_sys_sysfs
:
740 return gdb_sys_sysfs
;
742 case amd64_sys_getpriority
:
743 return gdb_sys_getpriority
;
745 case amd64_sys_setpriority
:
746 return gdb_sys_setpriority
;
748 case amd64_sys_sched_setparam
:
749 return gdb_sys_sched_setparam
;
751 case amd64_sys_sched_getparam
:
752 return gdb_sys_sched_getparam
;
754 case amd64_sys_sched_setscheduler
:
755 return gdb_sys_sched_setscheduler
;
757 case amd64_sys_sched_getscheduler
:
758 return gdb_sys_sched_getscheduler
;
760 case amd64_sys_sched_get_priority_max
:
761 return gdb_sys_sched_get_priority_max
;
763 case amd64_sys_sched_get_priority_min
:
764 return gdb_sys_sched_get_priority_min
;
766 case amd64_sys_sched_rr_get_interval
:
767 return gdb_sys_sched_rr_get_interval
;
769 case amd64_sys_mlock
:
770 return gdb_sys_mlock
;
772 case amd64_sys_munlock
:
773 return gdb_sys_munlock
;
775 case amd64_sys_mlockall
:
776 return gdb_sys_mlockall
;
778 case amd64_sys_munlockall
:
779 return gdb_sys_munlockall
;
781 case amd64_sys_vhangup
:
782 return gdb_sys_vhangup
;
784 case amd64_sys_modify_ldt
:
785 return gdb_sys_modify_ldt
;
787 case amd64_sys_pivot_root
:
788 return gdb_sys_pivot_root
;
790 case amd64_sys_sysctl
:
791 return gdb_sys_sysctl
;
793 case amd64_sys_prctl
:
794 return gdb_sys_prctl
;
796 case amd64_sys_arch_prctl
:
797 return -1; /* Note */
799 case amd64_sys_adjtimex
:
800 return gdb_sys_adjtimex
;
802 case amd64_sys_setrlimit
:
803 return gdb_sys_setrlimit
;
805 case amd64_sys_chroot
:
806 return gdb_sys_chroot
;
814 case amd64_sys_settimeofday
:
815 return gdb_sys_settimeofday
;
817 case amd64_sys_mount
:
818 return gdb_sys_mount
;
820 case amd64_sys_umount
:
821 return gdb_sys_umount
;
823 case amd64_sys_swapon
:
824 return gdb_sys_swapon
;
826 case amd64_sys_swapoff
:
827 return gdb_sys_swapoff
;
829 case amd64_sys_reboot
:
830 return gdb_sys_reboot
;
832 case amd64_sys_sethostname
:
833 return gdb_sys_sethostname
;
835 case amd64_sys_setdomainname
:
836 return gdb_sys_setdomainname
;
841 case amd64_sys_ioperm
:
842 return gdb_sys_ioperm
;
844 case amd64_sys_init_module
:
845 return gdb_sys_init_module
;
847 case amd64_sys_delete_module
:
848 return gdb_sys_delete_module
;
850 case amd64_sys_quotactl
:
851 return gdb_sys_quotactl
;
853 case amd64_sys_nfsservctl
:
854 return gdb_sys_nfsservctl
;
856 case amd64_sys_gettid
:
857 return gdb_sys_gettid
;
859 case amd64_sys_readahead
:
860 return gdb_sys_readahead
;
862 case amd64_sys_setxattr
:
863 return gdb_sys_setxattr
;
865 case amd64_sys_lsetxattr
:
866 return gdb_sys_lsetxattr
;
868 case amd64_sys_fsetxattr
:
869 return gdb_sys_fsetxattr
;
871 case amd64_sys_getxattr
:
872 return gdb_sys_getxattr
;
874 case amd64_sys_lgetxattr
:
875 return gdb_sys_lgetxattr
;
877 case amd64_sys_fgetxattr
:
878 return gdb_sys_fgetxattr
;
880 case amd64_sys_listxattr
:
881 return gdb_sys_listxattr
;
883 case amd64_sys_llistxattr
:
884 return gdb_sys_llistxattr
;
886 case amd64_sys_flistxattr
:
887 return gdb_sys_flistxattr
;
889 case amd64_sys_removexattr
:
890 return gdb_sys_removexattr
;
892 case amd64_sys_lremovexattr
:
893 return gdb_sys_lremovexattr
;
895 case amd64_sys_fremovexattr
:
896 return gdb_sys_fremovexattr
;
898 case amd64_sys_tkill
:
899 return gdb_sys_tkill
;
904 case amd64_sys_futex
:
905 return gdb_sys_futex
;
907 case amd64_sys_sched_setaffinity
:
908 return gdb_sys_sched_setaffinity
;
910 case amd64_sys_sched_getaffinity
:
911 return gdb_sys_sched_getaffinity
;
913 case amd64_sys_io_setup
:
914 return gdb_sys_io_setup
;
916 case amd64_sys_io_destroy
:
917 return gdb_sys_io_destroy
;
919 case amd64_sys_io_getevents
:
920 return gdb_sys_io_getevents
;
922 case amd64_sys_io_submit
:
923 return gdb_sys_io_submit
;
925 case amd64_sys_io_cancel
:
926 return gdb_sys_io_cancel
;
928 case amd64_sys_lookup_dcookie
:
929 return gdb_sys_lookup_dcookie
;
931 case amd64_sys_epoll_create
:
932 return gdb_sys_epoll_create
;
934 case amd64_sys_remap_file_pages
:
935 return gdb_sys_remap_file_pages
;
937 case amd64_sys_getdents64
:
938 return gdb_sys_getdents64
;
940 case amd64_sys_set_tid_address
:
941 return gdb_sys_set_tid_address
;
943 case amd64_sys_restart_syscall
:
944 return gdb_sys_restart_syscall
;
946 case amd64_sys_semtimedop
:
947 return gdb_sys_semtimedop
;
949 case amd64_sys_fadvise64
:
950 return gdb_sys_fadvise64
;
952 case amd64_sys_timer_create
:
953 return gdb_sys_timer_create
;
955 case amd64_sys_timer_settime
:
956 return gdb_sys_timer_settime
;
958 case amd64_sys_timer_gettime
:
959 return gdb_sys_timer_gettime
;
961 case amd64_sys_timer_getoverrun
:
962 return gdb_sys_timer_getoverrun
;
964 case amd64_sys_timer_delete
:
965 return gdb_sys_timer_delete
;
967 case amd64_sys_clock_settime
:
968 return gdb_sys_clock_settime
;
970 case amd64_sys_clock_gettime
:
971 return gdb_sys_clock_gettime
;
973 case amd64_sys_clock_getres
:
974 return gdb_sys_clock_getres
;
976 case amd64_sys_clock_nanosleep
:
977 return gdb_sys_clock_nanosleep
;
979 case amd64_sys_exit_group
:
980 return gdb_sys_exit_group
;
982 case amd64_sys_epoll_wait
:
983 return gdb_sys_epoll_wait
;
985 case amd64_sys_epoll_ctl
:
986 return gdb_sys_epoll_ctl
;
988 case amd64_sys_tgkill
:
989 return gdb_sys_tgkill
;
991 case amd64_sys_utimes
:
992 return gdb_sys_utimes
;
994 case amd64_sys_mbind
:
995 return gdb_sys_mbind
;
997 case amd64_sys_set_mempolicy
:
998 return gdb_sys_set_mempolicy
;
1000 case amd64_sys_get_mempolicy
:
1001 return gdb_sys_get_mempolicy
;
1003 case amd64_sys_mq_open
:
1004 return gdb_sys_mq_open
;
1006 case amd64_sys_mq_unlink
:
1007 return gdb_sys_mq_unlink
;
1009 case amd64_sys_mq_timedsend
:
1010 return gdb_sys_mq_timedsend
;
1012 case amd64_sys_mq_timedreceive
:
1013 return gdb_sys_mq_timedreceive
;
1015 case amd64_sys_mq_notify
:
1016 return gdb_sys_mq_notify
;
1018 case amd64_sys_mq_getsetattr
:
1019 return gdb_sys_mq_getsetattr
;
1021 case amd64_sys_kexec_load
:
1022 return gdb_sys_kexec_load
;
1024 case amd64_sys_waitid
:
1025 return gdb_sys_waitid
;
1027 case amd64_sys_add_key
:
1028 return gdb_sys_add_key
;
1030 case amd64_sys_request_key
:
1031 return gdb_sys_request_key
;
1033 case amd64_sys_keyctl
:
1034 return gdb_sys_keyctl
;
1036 case amd64_sys_ioprio_set
:
1037 return gdb_sys_ioprio_set
;
1039 case amd64_sys_ioprio_get
:
1040 return gdb_sys_ioprio_get
;
1042 case amd64_sys_inotify_init
:
1043 return gdb_sys_inotify_init
;
1045 case amd64_sys_inotify_add_watch
:
1046 return gdb_sys_inotify_add_watch
;
1048 case amd64_sys_inotify_rm_watch
:
1049 return gdb_sys_inotify_rm_watch
;
1051 case amd64_sys_migrate_pages
:
1052 return gdb_sys_migrate_pages
;
1054 case amd64_sys_openat
:
1055 return gdb_sys_openat
;
1057 case amd64_sys_mkdirat
:
1058 return gdb_sys_mkdirat
;
1060 case amd64_sys_mknodat
:
1061 return gdb_sys_mknodat
;
1063 case amd64_sys_fchownat
:
1064 return gdb_sys_fchownat
;
1066 case amd64_sys_futimesat
:
1067 return gdb_sys_futimesat
;
1069 case amd64_sys_newfstatat
:
1070 return gdb_sys_newfstatat
;
1072 case amd64_sys_unlinkat
:
1073 return gdb_sys_unlinkat
;
1075 case amd64_sys_renameat
:
1076 return gdb_sys_renameat
;
1078 case amd64_sys_linkat
:
1079 return gdb_sys_linkat
;
1081 case amd64_sys_symlinkat
:
1082 return gdb_sys_symlinkat
;
1084 case amd64_sys_readlinkat
:
1085 return gdb_sys_readlinkat
;
1087 case amd64_sys_fchmodat
:
1088 return gdb_sys_fchmodat
;
1090 case amd64_sys_faccessat
:
1091 return gdb_sys_faccessat
;
1093 case amd64_sys_pselect6
:
1094 return gdb_sys_pselect6
;
1096 case amd64_sys_ppoll
:
1097 return gdb_sys_ppoll
;
1099 case amd64_sys_unshare
:
1100 return gdb_sys_unshare
;
1102 case amd64_sys_set_robust_list
:
1103 return gdb_sys_set_robust_list
;
1105 case amd64_sys_get_robust_list
:
1106 return gdb_sys_get_robust_list
;
1108 case amd64_sys_splice
:
1109 return gdb_sys_splice
;
1114 case amd64_sys_sync_file_range
:
1115 return gdb_sys_sync_file_range
;
1117 case amd64_sys_vmsplice
:
1118 return gdb_sys_vmsplice
;
1120 case amd64_sys_move_pages
:
1121 return gdb_sys_move_pages
;
1128 /* Parse the arguments of current system call instruction and record
1129 the values of the registers and memory that will be changed into
1130 "record_arch_list". This instruction is "syscall".
1132 Return -1 if something wrong. */
1134 static struct linux_record_tdep amd64_linux_record_tdep
;
1136 #define RECORD_ARCH_GET_FS 0x1003
1137 #define RECORD_ARCH_GET_GS 0x1004
1140 amd64_linux_syscall_record (struct regcache
*regcache
)
1143 ULONGEST syscall_native
;
1144 enum gdb_syscall syscall_gdb
= -1;
1146 regcache_raw_read_unsigned (regcache
, AMD64_RAX_REGNUM
, &syscall_native
);
1148 switch (syscall_native
)
1150 case amd64_sys_rt_sigreturn
:
1151 if (amd64_all_but_ip_registers_record (regcache
))
1156 case amd64_sys_arch_prctl
:
1157 if (syscall_native
== amd64_sys_arch_prctl
)
1161 regcache_raw_read_unsigned (regcache
, amd64_linux_record_tdep
.arg3
,
1163 if (arg3
== RECORD_ARCH_GET_FS
|| arg3
== RECORD_ARCH_GET_GS
)
1167 regcache_raw_read_unsigned (regcache
,
1168 amd64_linux_record_tdep
.arg2
,
1170 if (record_arch_list_add_mem (addr
,
1171 amd64_linux_record_tdep
.size_ulong
))
1179 syscall_gdb
= amd64_canonicalize_syscall (syscall_native
);
1181 if (syscall_gdb
< 0)
1183 printf_unfiltered (_("Process record and replay target doesn't "
1184 "support syscall number %s\n"),
1185 pulongest (syscall_native
));
1190 ret
= record_linux_system_call (syscall_gdb
, regcache
,
1191 &amd64_linux_record_tdep
);
1197 /* Record the return value of the system call. */
1198 if (record_arch_list_add_reg (regcache
, AMD64_RCX_REGNUM
))
1200 if (record_arch_list_add_reg (regcache
, AMD64_R11_REGNUM
))
1206 #define AMD64_LINUX_redzone 128
1207 #define AMD64_LINUX_xstate 512
1208 #define AMD64_LINUX_frame_size 560
1211 amd64_linux_record_signal (struct gdbarch
*gdbarch
,
1212 struct regcache
*regcache
,
1213 enum target_signal signal
)
1217 if (amd64_all_but_ip_registers_record (regcache
))
1220 if (record_arch_list_add_reg (regcache
, AMD64_RIP_REGNUM
))
1223 /* Record the change in the stack. */
1224 regcache_raw_read_unsigned (regcache
, AMD64_RSP_REGNUM
, &rsp
);
1227 rsp
-= AMD64_LINUX_redzone
;
1228 /* This is for xstate.
1229 sp -= sizeof (struct _fpstate); */
1230 rsp
-= AMD64_LINUX_xstate
;
1231 /* This is for frame_size.
1232 sp -= sizeof (struct rt_sigframe); */
1233 rsp
-= AMD64_LINUX_frame_size
;
1234 if (record_arch_list_add_mem (rsp
, AMD64_LINUX_redzone
1235 + AMD64_LINUX_xstate
1236 + AMD64_LINUX_frame_size
))
1239 if (record_arch_list_add_end ())
1245 /* Get Linux/x86 target description from core dump. */
1247 static const struct target_desc
*
1248 amd64_linux_core_read_description (struct gdbarch
*gdbarch
,
1249 struct target_ops
*target
,
1252 asection
*section
= bfd_get_section_by_name (abfd
, ".reg2");
1254 if (section
== NULL
)
1258 return tdesc_amd64_linux
;
1262 amd64_linux_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
1264 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1265 const struct target_desc
*tdesc
= info
.target_desc
;
1266 struct tdesc_arch_data
*tdesc_data
= (void *) info
.tdep_info
;
1267 const struct tdesc_feature
*feature
;
1270 gdb_assert (tdesc_data
);
1272 tdep
->gregset_reg_offset
= amd64_linux_gregset_reg_offset
;
1273 tdep
->gregset_num_regs
= ARRAY_SIZE (amd64_linux_gregset_reg_offset
);
1274 tdep
->sizeof_gregset
= 27 * 8;
1276 amd64_init_abi (info
, gdbarch
);
1278 /* Reserve a number for orig_rax. */
1279 set_gdbarch_num_regs (gdbarch
, AMD64_LINUX_NUM_REGS
);
1281 if (! tdesc_has_registers (tdesc
))
1282 tdesc
= tdesc_amd64_linux
;
1283 tdep
->tdesc
= tdesc
;
1285 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.i386.linux");
1286 if (feature
== NULL
)
1289 valid_p
= tdesc_numbered_register (feature
, tdesc_data
,
1290 AMD64_LINUX_ORIG_RAX_REGNUM
,
1295 tdep
->sigtramp_p
= amd64_linux_sigtramp_p
;
1296 tdep
->sigcontext_addr
= amd64_linux_sigcontext_addr
;
1297 tdep
->sc_reg_offset
= amd64_linux_sc_reg_offset
;
1298 tdep
->sc_num_regs
= ARRAY_SIZE (amd64_linux_sc_reg_offset
);
1300 /* GNU/Linux uses SVR4-style shared libraries. */
1301 set_solib_svr4_fetch_link_map_offsets
1302 (gdbarch
, svr4_lp64_fetch_link_map_offsets
);
1304 /* Add the %orig_rax register used for syscall restarting. */
1305 set_gdbarch_write_pc (gdbarch
, amd64_linux_write_pc
);
1307 tdep
->register_reggroup_p
= amd64_linux_register_reggroup_p
;
1309 /* Functions for 'catch syscall'. */
1310 set_xml_syscall_file_name (XML_SYSCALL_FILENAME_AMD64
);
1311 set_gdbarch_get_syscall_number (gdbarch
,
1312 amd64_linux_get_syscall_number
);
1314 /* Enable TLS support. */
1315 set_gdbarch_fetch_tls_load_module_address (gdbarch
,
1316 svr4_fetch_objfile_link_map
);
1318 /* GNU/Linux uses SVR4-style shared libraries. */
1319 set_gdbarch_skip_trampoline_code (gdbarch
, find_solib_trampoline_target
);
1321 set_gdbarch_core_read_description (gdbarch
,
1322 amd64_linux_core_read_description
);
1324 /* Displaced stepping. */
1325 set_gdbarch_displaced_step_copy_insn (gdbarch
,
1326 amd64_displaced_step_copy_insn
);
1327 set_gdbarch_displaced_step_fixup (gdbarch
, amd64_displaced_step_fixup
);
1328 set_gdbarch_displaced_step_free_closure (gdbarch
,
1329 simple_displaced_step_free_closure
);
1330 set_gdbarch_displaced_step_location (gdbarch
,
1331 displaced_step_at_entry_point
);
1333 set_gdbarch_get_siginfo_type (gdbarch
, linux_get_siginfo_type
);
1335 set_gdbarch_process_record (gdbarch
, i386_process_record
);
1336 set_gdbarch_process_record_signal (gdbarch
, amd64_linux_record_signal
);
1338 /* Initialize the amd64_linux_record_tdep. */
1339 /* These values are the size of the type that will be used in a system
1340 call. They are obtained from Linux Kernel source. */
1341 amd64_linux_record_tdep
.size_pointer
1342 = gdbarch_ptr_bit (gdbarch
) / TARGET_CHAR_BIT
;
1343 amd64_linux_record_tdep
.size__old_kernel_stat
= 32;
1344 amd64_linux_record_tdep
.size_tms
= 32;
1345 amd64_linux_record_tdep
.size_loff_t
= 8;
1346 amd64_linux_record_tdep
.size_flock
= 32;
1347 amd64_linux_record_tdep
.size_oldold_utsname
= 45;
1348 amd64_linux_record_tdep
.size_ustat
= 32;
1349 /* ADM64 doesn't need this size because it doesn't have sys_sigaction
1350 but sys_rt_sigaction. */
1351 amd64_linux_record_tdep
.size_old_sigaction
= 152;
1352 /* ADM64 doesn't need this size because it doesn't have sys_sigpending
1353 but sys_rt_sigpending. */
1354 amd64_linux_record_tdep
.size_old_sigset_t
= 128;
1355 amd64_linux_record_tdep
.size_rlimit
= 16;
1356 amd64_linux_record_tdep
.size_rusage
= 144;
1357 amd64_linux_record_tdep
.size_timeval
= 16;
1358 amd64_linux_record_tdep
.size_timezone
= 8;
1359 /* ADM64 doesn't need this size because it doesn't have sys_getgroups16
1360 but sys_getgroups. */
1361 amd64_linux_record_tdep
.size_old_gid_t
= 2;
1362 /* ADM64 doesn't need this size because it doesn't have sys_getresuid16
1363 but sys_getresuid. */
1364 amd64_linux_record_tdep
.size_old_uid_t
= 2;
1365 amd64_linux_record_tdep
.size_fd_set
= 128;
1366 amd64_linux_record_tdep
.size_dirent
= 280;
1367 amd64_linux_record_tdep
.size_dirent64
= 280;
1368 amd64_linux_record_tdep
.size_statfs
= 120;
1369 amd64_linux_record_tdep
.size_statfs64
= 120;
1370 amd64_linux_record_tdep
.size_sockaddr
= 16;
1371 amd64_linux_record_tdep
.size_int
1372 = gdbarch_int_bit (gdbarch
) / TARGET_CHAR_BIT
;
1373 amd64_linux_record_tdep
.size_long
1374 = gdbarch_long_bit (gdbarch
) / TARGET_CHAR_BIT
;
1375 amd64_linux_record_tdep
.size_ulong
1376 = gdbarch_long_bit (gdbarch
) / TARGET_CHAR_BIT
;
1377 amd64_linux_record_tdep
.size_msghdr
= 56;
1378 amd64_linux_record_tdep
.size_itimerval
= 32;
1379 amd64_linux_record_tdep
.size_stat
= 144;
1380 amd64_linux_record_tdep
.size_old_utsname
= 325;
1381 amd64_linux_record_tdep
.size_sysinfo
= 112;
1382 amd64_linux_record_tdep
.size_msqid_ds
= 120;
1383 amd64_linux_record_tdep
.size_shmid_ds
= 112;
1384 amd64_linux_record_tdep
.size_new_utsname
= 390;
1385 amd64_linux_record_tdep
.size_timex
= 208;
1386 amd64_linux_record_tdep
.size_mem_dqinfo
= 24;
1387 amd64_linux_record_tdep
.size_if_dqblk
= 72;
1388 amd64_linux_record_tdep
.size_fs_quota_stat
= 80;
1389 amd64_linux_record_tdep
.size_timespec
= 16;
1390 amd64_linux_record_tdep
.size_pollfd
= 8;
1391 amd64_linux_record_tdep
.size_NFS_FHSIZE
= 32;
1392 amd64_linux_record_tdep
.size_knfsd_fh
= 132;
1393 amd64_linux_record_tdep
.size_TASK_COMM_LEN
= 16;
1394 amd64_linux_record_tdep
.size_sigaction
= 152;
1395 amd64_linux_record_tdep
.size_sigset_t
= 128;
1396 amd64_linux_record_tdep
.size_siginfo_t
= 128;
1397 amd64_linux_record_tdep
.size_cap_user_data_t
= 8;
1398 amd64_linux_record_tdep
.size_stack_t
= 24;
1399 amd64_linux_record_tdep
.size_off_t
= 8;
1400 amd64_linux_record_tdep
.size_stat64
= 144;
1401 amd64_linux_record_tdep
.size_gid_t
= 4;
1402 amd64_linux_record_tdep
.size_uid_t
= 4;
1403 amd64_linux_record_tdep
.size_PAGE_SIZE
= 4096;
1404 amd64_linux_record_tdep
.size_flock64
= 32;
1405 amd64_linux_record_tdep
.size_user_desc
= 16;
1406 amd64_linux_record_tdep
.size_io_event
= 32;
1407 amd64_linux_record_tdep
.size_iocb
= 64;
1408 amd64_linux_record_tdep
.size_epoll_event
= 12;
1409 amd64_linux_record_tdep
.size_itimerspec
= 32;
1410 amd64_linux_record_tdep
.size_mq_attr
= 64;
1411 amd64_linux_record_tdep
.size_siginfo
= 128;
1412 amd64_linux_record_tdep
.size_termios
= 60;
1413 amd64_linux_record_tdep
.size_termios2
= 44;
1414 amd64_linux_record_tdep
.size_pid_t
= 4;
1415 amd64_linux_record_tdep
.size_winsize
= 8;
1416 amd64_linux_record_tdep
.size_serial_struct
= 72;
1417 amd64_linux_record_tdep
.size_serial_icounter_struct
= 80;
1418 amd64_linux_record_tdep
.size_hayes_esp_config
= 12;
1419 amd64_linux_record_tdep
.size_size_t
= 8;
1420 amd64_linux_record_tdep
.size_iovec
= 16;
1422 /* These values are the second argument of system call "sys_ioctl".
1423 They are obtained from Linux Kernel source. */
1424 amd64_linux_record_tdep
.ioctl_TCGETS
= 0x5401;
1425 amd64_linux_record_tdep
.ioctl_TCSETS
= 0x5402;
1426 amd64_linux_record_tdep
.ioctl_TCSETSW
= 0x5403;
1427 amd64_linux_record_tdep
.ioctl_TCSETSF
= 0x5404;
1428 amd64_linux_record_tdep
.ioctl_TCGETA
= 0x5405;
1429 amd64_linux_record_tdep
.ioctl_TCSETA
= 0x5406;
1430 amd64_linux_record_tdep
.ioctl_TCSETAW
= 0x5407;
1431 amd64_linux_record_tdep
.ioctl_TCSETAF
= 0x5408;
1432 amd64_linux_record_tdep
.ioctl_TCSBRK
= 0x5409;
1433 amd64_linux_record_tdep
.ioctl_TCXONC
= 0x540A;
1434 amd64_linux_record_tdep
.ioctl_TCFLSH
= 0x540B;
1435 amd64_linux_record_tdep
.ioctl_TIOCEXCL
= 0x540C;
1436 amd64_linux_record_tdep
.ioctl_TIOCNXCL
= 0x540D;
1437 amd64_linux_record_tdep
.ioctl_TIOCSCTTY
= 0x540E;
1438 amd64_linux_record_tdep
.ioctl_TIOCGPGRP
= 0x540F;
1439 amd64_linux_record_tdep
.ioctl_TIOCSPGRP
= 0x5410;
1440 amd64_linux_record_tdep
.ioctl_TIOCOUTQ
= 0x5411;
1441 amd64_linux_record_tdep
.ioctl_TIOCSTI
= 0x5412;
1442 amd64_linux_record_tdep
.ioctl_TIOCGWINSZ
= 0x5413;
1443 amd64_linux_record_tdep
.ioctl_TIOCSWINSZ
= 0x5414;
1444 amd64_linux_record_tdep
.ioctl_TIOCMGET
= 0x5415;
1445 amd64_linux_record_tdep
.ioctl_TIOCMBIS
= 0x5416;
1446 amd64_linux_record_tdep
.ioctl_TIOCMBIC
= 0x5417;
1447 amd64_linux_record_tdep
.ioctl_TIOCMSET
= 0x5418;
1448 amd64_linux_record_tdep
.ioctl_TIOCGSOFTCAR
= 0x5419;
1449 amd64_linux_record_tdep
.ioctl_TIOCSSOFTCAR
= 0x541A;
1450 amd64_linux_record_tdep
.ioctl_FIONREAD
= 0x541B;
1451 amd64_linux_record_tdep
.ioctl_TIOCINQ
1452 = amd64_linux_record_tdep
.ioctl_FIONREAD
;
1453 amd64_linux_record_tdep
.ioctl_TIOCLINUX
= 0x541C;
1454 amd64_linux_record_tdep
.ioctl_TIOCCONS
= 0x541D;
1455 amd64_linux_record_tdep
.ioctl_TIOCGSERIAL
= 0x541E;
1456 amd64_linux_record_tdep
.ioctl_TIOCSSERIAL
= 0x541F;
1457 amd64_linux_record_tdep
.ioctl_TIOCPKT
= 0x5420;
1458 amd64_linux_record_tdep
.ioctl_FIONBIO
= 0x5421;
1459 amd64_linux_record_tdep
.ioctl_TIOCNOTTY
= 0x5422;
1460 amd64_linux_record_tdep
.ioctl_TIOCSETD
= 0x5423;
1461 amd64_linux_record_tdep
.ioctl_TIOCGETD
= 0x5424;
1462 amd64_linux_record_tdep
.ioctl_TCSBRKP
= 0x5425;
1463 amd64_linux_record_tdep
.ioctl_TIOCTTYGSTRUCT
= 0x5426;
1464 amd64_linux_record_tdep
.ioctl_TIOCSBRK
= 0x5427;
1465 amd64_linux_record_tdep
.ioctl_TIOCCBRK
= 0x5428;
1466 amd64_linux_record_tdep
.ioctl_TIOCGSID
= 0x5429;
1467 amd64_linux_record_tdep
.ioctl_TCGETS2
= 0x802c542a;
1468 amd64_linux_record_tdep
.ioctl_TCSETS2
= 0x402c542b;
1469 amd64_linux_record_tdep
.ioctl_TCSETSW2
= 0x402c542c;
1470 amd64_linux_record_tdep
.ioctl_TCSETSF2
= 0x402c542d;
1471 amd64_linux_record_tdep
.ioctl_TIOCGPTN
= 0x80045430;
1472 amd64_linux_record_tdep
.ioctl_TIOCSPTLCK
= 0x40045431;
1473 amd64_linux_record_tdep
.ioctl_FIONCLEX
= 0x5450;
1474 amd64_linux_record_tdep
.ioctl_FIOCLEX
= 0x5451;
1475 amd64_linux_record_tdep
.ioctl_FIOASYNC
= 0x5452;
1476 amd64_linux_record_tdep
.ioctl_TIOCSERCONFIG
= 0x5453;
1477 amd64_linux_record_tdep
.ioctl_TIOCSERGWILD
= 0x5454;
1478 amd64_linux_record_tdep
.ioctl_TIOCSERSWILD
= 0x5455;
1479 amd64_linux_record_tdep
.ioctl_TIOCGLCKTRMIOS
= 0x5456;
1480 amd64_linux_record_tdep
.ioctl_TIOCSLCKTRMIOS
= 0x5457;
1481 amd64_linux_record_tdep
.ioctl_TIOCSERGSTRUCT
= 0x5458;
1482 amd64_linux_record_tdep
.ioctl_TIOCSERGETLSR
= 0x5459;
1483 amd64_linux_record_tdep
.ioctl_TIOCSERGETMULTI
= 0x545A;
1484 amd64_linux_record_tdep
.ioctl_TIOCSERSETMULTI
= 0x545B;
1485 amd64_linux_record_tdep
.ioctl_TIOCMIWAIT
= 0x545C;
1486 amd64_linux_record_tdep
.ioctl_TIOCGICOUNT
= 0x545D;
1487 amd64_linux_record_tdep
.ioctl_TIOCGHAYESESP
= 0x545E;
1488 amd64_linux_record_tdep
.ioctl_TIOCSHAYESESP
= 0x545F;
1489 amd64_linux_record_tdep
.ioctl_FIOQSIZE
= 0x5460;
1491 /* These values are the second argument of system call "sys_fcntl"
1492 and "sys_fcntl64". They are obtained from Linux Kernel source. */
1493 amd64_linux_record_tdep
.fcntl_F_GETLK
= 5;
1494 amd64_linux_record_tdep
.fcntl_F_GETLK64
= 12;
1495 amd64_linux_record_tdep
.fcntl_F_SETLK64
= 13;
1496 amd64_linux_record_tdep
.fcntl_F_SETLKW64
= 14;
1498 amd64_linux_record_tdep
.arg1
= AMD64_RDI_REGNUM
;
1499 amd64_linux_record_tdep
.arg2
= AMD64_RSI_REGNUM
;
1500 amd64_linux_record_tdep
.arg3
= AMD64_RDX_REGNUM
;
1501 amd64_linux_record_tdep
.arg4
= AMD64_R10_REGNUM
;
1502 amd64_linux_record_tdep
.arg5
= AMD64_R8_REGNUM
;
1503 amd64_linux_record_tdep
.arg6
= AMD64_R9_REGNUM
;
1505 tdep
->i386_syscall_record
= amd64_linux_syscall_record
;
1509 /* Provide a prototype to silence -Wmissing-prototypes. */
1510 extern void _initialize_amd64_linux_tdep (void);
1513 _initialize_amd64_linux_tdep (void)
1515 gdbarch_register_osabi (bfd_arch_i386
, bfd_mach_x86_64
,
1516 GDB_OSABI_LINUX
, amd64_linux_init_abi
);
1518 /* Initialize the Linux target description */
1519 initialize_tdesc_amd64_linux ();