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"
32 #include "amd64-linux-tdep.h"
33 #include "i386-linux-tdep.h"
34 #include "linux-tdep.h"
35 #include "i386-xstate.h"
37 #include "gdb_string.h"
39 #include "amd64-tdep.h"
40 #include "solib-svr4.h"
41 #include "xml-syscall.h"
43 #include "features/i386/amd64-linux.c"
44 #include "features/i386/amd64-avx-linux.c"
46 /* The syscall's XML filename for i386. */
47 #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml"
50 #include "linux-record.h"
52 /* Supported register note sections. */
53 static struct core_regset_section amd64_linux_regset_sections
[] =
55 { ".reg", 27 * 8, "general-purpose" },
56 { ".reg2", 512, "floating-point" },
57 { ".reg-xstate", I386_XSTATE_MAX_SIZE
, "XSAVE extended state" },
61 /* Mapping between the general-purpose registers in `struct user'
62 format and GDB's register cache layout. */
64 /* From <sys/reg.h>. */
65 int amd64_linux_gregset_reg_offset
[] =
91 -1, -1, -1, -1, -1, -1, -1, -1,
92 -1, -1, -1, -1, -1, -1, -1, -1,
93 -1, -1, -1, -1, -1, -1, -1, -1,
94 -1, -1, -1, -1, -1, -1, -1, -1, -1,
95 -1, -1, -1, -1, -1, -1, -1, -1,
96 -1, -1, -1, -1, -1, -1, -1, -1,
97 15 * 8 /* "orig_rax" */
101 /* Support for signal handlers. */
103 #define LINUX_SIGTRAMP_INSN0 0x48 /* mov $NNNNNNNN, %rax */
104 #define LINUX_SIGTRAMP_OFFSET0 0
105 #define LINUX_SIGTRAMP_INSN1 0x0f /* syscall */
106 #define LINUX_SIGTRAMP_OFFSET1 7
108 static const gdb_byte linux_sigtramp_code
[] =
110 /* mov $__NR_rt_sigreturn, %rax */
111 LINUX_SIGTRAMP_INSN0
, 0xc7, 0xc0, 0x0f, 0x00, 0x00, 0x00,
113 LINUX_SIGTRAMP_INSN1
, 0x05
116 #define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
118 /* If PC is in a sigtramp routine, return the address of the start of
119 the routine. Otherwise, return 0. */
122 amd64_linux_sigtramp_start (struct frame_info
*this_frame
)
124 CORE_ADDR pc
= get_frame_pc (this_frame
);
125 gdb_byte buf
[LINUX_SIGTRAMP_LEN
];
127 /* We only recognize a signal trampoline if PC is at the start of
128 one of the two instructions. We optimize for finding the PC at
129 the start, as will be the case when the trampoline is not the
130 first frame on the stack. We assume that in the case where the
131 PC is not at the start of the instruction sequence, there will be
132 a few trailing readable bytes on the stack. */
134 if (!safe_frame_unwind_memory (this_frame
, pc
, buf
, sizeof buf
))
137 if (buf
[0] != LINUX_SIGTRAMP_INSN0
)
139 if (buf
[0] != LINUX_SIGTRAMP_INSN1
)
142 pc
-= LINUX_SIGTRAMP_OFFSET1
;
143 if (!safe_frame_unwind_memory (this_frame
, pc
, buf
, sizeof buf
))
147 if (memcmp (buf
, linux_sigtramp_code
, LINUX_SIGTRAMP_LEN
) != 0)
153 /* Return whether THIS_FRAME corresponds to a GNU/Linux sigtramp
157 amd64_linux_sigtramp_p (struct frame_info
*this_frame
)
159 CORE_ADDR pc
= get_frame_pc (this_frame
);
162 find_pc_partial_function (pc
, &name
, NULL
, NULL
);
164 /* If we have NAME, we can optimize the search. The trampoline is
165 named __restore_rt. However, it isn't dynamically exported from
166 the shared C library, so the trampoline may appear to be part of
167 the preceding function. This should always be sigaction,
168 __sigaction, or __libc_sigaction (all aliases to the same
170 if (name
== NULL
|| strstr (name
, "sigaction") != NULL
)
171 return (amd64_linux_sigtramp_start (this_frame
) != 0);
173 return (strcmp ("__restore_rt", name
) == 0);
176 /* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
177 #define AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 40
179 /* Assuming THIS_FRAME is a GNU/Linux sigtramp routine, return the
180 address of the associated sigcontext structure. */
183 amd64_linux_sigcontext_addr (struct frame_info
*this_frame
)
185 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
186 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
190 get_frame_register (this_frame
, AMD64_RSP_REGNUM
, buf
);
191 sp
= extract_unsigned_integer (buf
, 8, byte_order
);
193 /* The sigcontext structure is part of the user context. A pointer
194 to the user context is passed as the third argument to the signal
195 handler, i.e. in %rdx. Unfortunately %rdx isn't preserved across
196 function calls so we can't use it. Fortunately the user context
197 is part of the signal frame and the unwound %rsp directly points
199 return sp
+ AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET
;
204 amd64_linux_get_syscall_number (struct gdbarch
*gdbarch
,
207 struct regcache
*regcache
= get_thread_regcache (ptid
);
208 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
209 /* The content of a register. */
214 /* Getting the system call number from the register.
215 When dealing with x86_64 architecture, this information
216 is stored at %rax register. */
217 regcache_cooked_read (regcache
, AMD64_LINUX_ORIG_RAX_REGNUM
, buf
);
219 ret
= extract_signed_integer (buf
, 8, byte_order
);
225 /* From <asm/sigcontext.h>. */
226 static int amd64_linux_sc_reg_offset
[] =
245 17 * 8, /* %eflags */
247 /* FIXME: kettenis/2002030531: The registers %cs, %fs and %gs are
248 available in `struct sigcontext'. However, they only occupy two
249 bytes instead of four, which makes using them here rather
250 difficult. Leave them out for now. */
260 amd64_linux_register_reggroup_p (struct gdbarch
*gdbarch
, int regnum
,
261 struct reggroup
*group
)
263 if (regnum
== AMD64_LINUX_ORIG_RAX_REGNUM
)
264 return (group
== system_reggroup
265 || group
== save_reggroup
266 || group
== restore_reggroup
);
267 return i386_register_reggroup_p (gdbarch
, regnum
, group
);
270 /* Set the program counter for process PTID to PC. */
273 amd64_linux_write_pc (struct regcache
*regcache
, CORE_ADDR pc
)
275 regcache_cooked_write_unsigned (regcache
, AMD64_RIP_REGNUM
, pc
);
277 /* We must be careful with modifying the program counter. If we
278 just interrupted a system call, the kernel might try to restart
279 it when we resume the inferior. On restarting the system call,
280 the kernel will try backing up the program counter even though it
281 no longer points at the system call. This typically results in a
282 SIGSEGV or SIGILL. We can prevent this by writing `-1' in the
283 "orig_rax" pseudo-register.
285 Note that "orig_rax" is saved when setting up a dummy call frame.
286 This means that it is properly restored when that frame is
287 popped, and that the interrupted system call will be restarted
288 when we resume the inferior on return from a function call from
289 within GDB. In all other cases the system call will not be
291 regcache_cooked_write_unsigned (regcache
, AMD64_LINUX_ORIG_RAX_REGNUM
, -1);
294 /* Record all registers but IP register for process-record. */
297 amd64_all_but_ip_registers_record (struct regcache
*regcache
)
299 if (record_arch_list_add_reg (regcache
, AMD64_RAX_REGNUM
))
301 if (record_arch_list_add_reg (regcache
, AMD64_RCX_REGNUM
))
303 if (record_arch_list_add_reg (regcache
, AMD64_RDX_REGNUM
))
305 if (record_arch_list_add_reg (regcache
, AMD64_RBX_REGNUM
))
307 if (record_arch_list_add_reg (regcache
, AMD64_RSP_REGNUM
))
309 if (record_arch_list_add_reg (regcache
, AMD64_RBP_REGNUM
))
311 if (record_arch_list_add_reg (regcache
, AMD64_RSI_REGNUM
))
313 if (record_arch_list_add_reg (regcache
, AMD64_RDI_REGNUM
))
315 if (record_arch_list_add_reg (regcache
, AMD64_R8_REGNUM
))
317 if (record_arch_list_add_reg (regcache
, AMD64_R9_REGNUM
))
319 if (record_arch_list_add_reg (regcache
, AMD64_R10_REGNUM
))
321 if (record_arch_list_add_reg (regcache
, AMD64_R11_REGNUM
))
323 if (record_arch_list_add_reg (regcache
, AMD64_R12_REGNUM
))
325 if (record_arch_list_add_reg (regcache
, AMD64_R13_REGNUM
))
327 if (record_arch_list_add_reg (regcache
, AMD64_R14_REGNUM
))
329 if (record_arch_list_add_reg (regcache
, AMD64_R15_REGNUM
))
331 if (record_arch_list_add_reg (regcache
, AMD64_EFLAGS_REGNUM
))
337 /* amd64_canonicalize_syscall maps from the native amd64 Linux set
338 of syscall ids into a canonical set of syscall ids used by
341 static enum gdb_syscall
342 amd64_canonicalize_syscall (enum amd64_syscall syscall
)
348 case amd64_sys_write
:
349 return gdb_sys_write
;
354 case amd64_sys_close
:
355 return gdb_sys_close
;
357 case amd64_sys_newstat
:
358 return gdb_sys_newstat
;
360 case amd64_sys_newfstat
:
361 return gdb_sys_newfstat
;
363 case amd64_sys_newlstat
:
364 return gdb_sys_newlstat
;
369 case amd64_sys_lseek
:
370 return gdb_sys_lseek
;
373 return gdb_sys_mmap2
;
375 case amd64_sys_mprotect
:
376 return gdb_sys_mprotect
;
378 case amd64_sys_munmap
:
379 return gdb_sys_munmap
;
384 case amd64_sys_rt_sigaction
:
385 return gdb_sys_rt_sigaction
;
387 case amd64_sys_rt_sigprocmask
:
388 return gdb_sys_rt_sigprocmask
;
390 case amd64_sys_rt_sigreturn
:
391 return gdb_sys_rt_sigreturn
;
393 case amd64_sys_ioctl
:
394 return gdb_sys_ioctl
;
396 case amd64_sys_pread64
:
397 return gdb_sys_pread64
;
399 case amd64_sys_pwrite64
:
400 return gdb_sys_pwrite64
;
402 case amd64_sys_readv
:
403 return gdb_sys_readv
;
405 case amd64_sys_writev
:
406 return gdb_sys_writev
;
408 case amd64_sys_access
:
409 return gdb_sys_access
;
414 case amd64_sys_select
:
415 return gdb_sys_select
;
417 case amd64_sys_sched_yield
:
418 return gdb_sys_sched_yield
;
420 case amd64_sys_mremap
:
421 return gdb_sys_mremap
;
423 case amd64_sys_msync
:
424 return gdb_sys_msync
;
426 case amd64_sys_mincore
:
427 return gdb_sys_mincore
;
429 case amd64_sys_madvise
:
430 return gdb_sys_madvise
;
432 case amd64_sys_shmget
:
433 return gdb_sys_shmget
;
435 case amd64_sys_shmat
:
436 return gdb_sys_shmat
;
438 case amd64_sys_shmctl
:
439 return gdb_sys_shmctl
;
447 case amd64_sys_pause
:
448 return gdb_sys_pause
;
450 case amd64_sys_nanosleep
:
451 return gdb_sys_nanosleep
;
453 case amd64_sys_getitimer
:
454 return gdb_sys_getitimer
;
456 case amd64_sys_alarm
:
457 return gdb_sys_alarm
;
459 case amd64_sys_setitimer
:
460 return gdb_sys_setitimer
;
462 case amd64_sys_getpid
:
463 return gdb_sys_getpid
;
465 case amd64_sys_sendfile64
:
466 return gdb_sys_sendfile64
;
468 case amd64_sys_socket
:
469 return gdb_sys_socket
;
471 case amd64_sys_connect
:
472 return gdb_sys_connect
;
474 case amd64_sys_accept
:
475 return gdb_sys_accept
;
477 case amd64_sys_sendto
:
478 return gdb_sys_sendto
;
480 case amd64_sys_recvfrom
:
481 return gdb_sys_recvfrom
;
483 case amd64_sys_sendmsg
:
484 return gdb_sys_sendmsg
;
486 case amd64_sys_recvmsg
:
487 return gdb_sys_recvmsg
;
489 case amd64_sys_shutdown
:
490 return gdb_sys_shutdown
;
495 case amd64_sys_listen
:
496 return gdb_sys_listen
;
498 case amd64_sys_getsockname
:
499 return gdb_sys_getsockname
;
501 case amd64_sys_getpeername
:
502 return gdb_sys_getpeername
;
504 case amd64_sys_socketpair
:
505 return gdb_sys_socketpair
;
507 case amd64_sys_setsockopt
:
508 return gdb_sys_setsockopt
;
510 case amd64_sys_getsockopt
:
511 return gdb_sys_getsockopt
;
513 case amd64_sys_clone
:
514 return gdb_sys_clone
;
519 case amd64_sys_vfork
:
520 return gdb_sys_vfork
;
522 case amd64_sys_execve
:
523 return gdb_sys_execve
;
528 case amd64_sys_wait4
:
529 return gdb_sys_wait4
;
534 case amd64_sys_uname
:
535 return gdb_sys_uname
;
537 case amd64_sys_semget
:
538 return gdb_sys_semget
;
540 case amd64_sys_semop
:
541 return gdb_sys_semop
;
543 case amd64_sys_semctl
:
544 return gdb_sys_semctl
;
546 case amd64_sys_shmdt
:
547 return gdb_sys_shmdt
;
549 case amd64_sys_msgget
:
550 return gdb_sys_msgget
;
552 case amd64_sys_msgsnd
:
553 return gdb_sys_msgsnd
;
555 case amd64_sys_msgrcv
:
556 return gdb_sys_msgrcv
;
558 case amd64_sys_msgctl
:
559 return gdb_sys_msgctl
;
561 case amd64_sys_fcntl
:
562 return gdb_sys_fcntl
;
564 case amd64_sys_flock
:
565 return gdb_sys_flock
;
567 case amd64_sys_fsync
:
568 return gdb_sys_fsync
;
570 case amd64_sys_fdatasync
:
571 return gdb_sys_fdatasync
;
573 case amd64_sys_truncate
:
574 return gdb_sys_truncate
;
576 case amd64_sys_ftruncate
:
577 return gdb_sys_ftruncate
;
579 case amd64_sys_getdents
:
580 return gdb_sys_getdents
;
582 case amd64_sys_getcwd
:
583 return gdb_sys_getcwd
;
585 case amd64_sys_chdir
:
586 return gdb_sys_chdir
;
588 case amd64_sys_fchdir
:
589 return gdb_sys_fchdir
;
591 case amd64_sys_rename
:
592 return gdb_sys_rename
;
594 case amd64_sys_mkdir
:
595 return gdb_sys_mkdir
;
597 case amd64_sys_rmdir
:
598 return gdb_sys_rmdir
;
600 case amd64_sys_creat
:
601 return gdb_sys_creat
;
606 case amd64_sys_unlink
:
607 return gdb_sys_unlink
;
609 case amd64_sys_symlink
:
610 return gdb_sys_symlink
;
612 case amd64_sys_readlink
:
613 return gdb_sys_readlink
;
615 case amd64_sys_chmod
:
616 return gdb_sys_chmod
;
618 case amd64_sys_fchmod
:
619 return gdb_sys_fchmod
;
621 case amd64_sys_chown
:
622 return gdb_sys_chown
;
624 case amd64_sys_fchown
:
625 return gdb_sys_fchown
;
627 case amd64_sys_lchown
:
628 return gdb_sys_lchown
;
630 case amd64_sys_umask
:
631 return gdb_sys_umask
;
633 case amd64_sys_gettimeofday
:
634 return gdb_sys_gettimeofday
;
636 case amd64_sys_getrlimit
:
637 return gdb_sys_getrlimit
;
639 case amd64_sys_getrusage
:
640 return gdb_sys_getrusage
;
642 case amd64_sys_sysinfo
:
643 return gdb_sys_sysinfo
;
645 case amd64_sys_times
:
646 return gdb_sys_times
;
648 case amd64_sys_ptrace
:
649 return gdb_sys_ptrace
;
651 case amd64_sys_getuid
:
652 return gdb_sys_getuid
;
654 case amd64_sys_syslog
:
655 return gdb_sys_syslog
;
657 case amd64_sys_getgid
:
658 return gdb_sys_getgid
;
660 case amd64_sys_setuid
:
661 return gdb_sys_setuid
;
663 case amd64_sys_setgid
:
664 return gdb_sys_setgid
;
666 case amd64_sys_geteuid
:
667 return gdb_sys_geteuid
;
669 case amd64_sys_getegid
:
670 return gdb_sys_getegid
;
672 case amd64_sys_setpgid
:
673 return gdb_sys_setpgid
;
675 case amd64_sys_getppid
:
676 return gdb_sys_getppid
;
678 case amd64_sys_getpgrp
:
679 return gdb_sys_getpgrp
;
681 case amd64_sys_setsid
:
682 return gdb_sys_setsid
;
684 case amd64_sys_setreuid
:
685 return gdb_sys_setreuid
;
687 case amd64_sys_setregid
:
688 return gdb_sys_setregid
;
690 case amd64_sys_getgroups
:
691 return gdb_sys_getgroups
;
693 case amd64_sys_setgroups
:
694 return gdb_sys_setgroups
;
696 case amd64_sys_setresuid
:
697 return gdb_sys_setresuid
;
699 case amd64_sys_getresuid
:
700 return gdb_sys_getresuid
;
702 case amd64_sys_setresgid
:
703 return gdb_sys_setresgid
;
705 case amd64_sys_getresgid
:
706 return gdb_sys_getresgid
;
708 case amd64_sys_getpgid
:
709 return gdb_sys_getpgid
;
711 case amd64_sys_setfsuid
:
712 return gdb_sys_setfsuid
;
714 case amd64_sys_setfsgid
:
715 return gdb_sys_setfsgid
;
717 case amd64_sys_getsid
:
718 return gdb_sys_getsid
;
720 case amd64_sys_capget
:
721 return gdb_sys_capget
;
723 case amd64_sys_capset
:
724 return gdb_sys_capset
;
726 case amd64_sys_rt_sigpending
:
727 return gdb_sys_rt_sigpending
;
729 case amd64_sys_rt_sigtimedwait
:
730 return gdb_sys_rt_sigtimedwait
;
732 case amd64_sys_rt_sigqueueinfo
:
733 return gdb_sys_rt_sigqueueinfo
;
735 case amd64_sys_rt_sigsuspend
:
736 return gdb_sys_rt_sigsuspend
;
738 case amd64_sys_sigaltstack
:
739 return gdb_sys_sigaltstack
;
741 case amd64_sys_utime
:
742 return gdb_sys_utime
;
744 case amd64_sys_mknod
:
745 return gdb_sys_mknod
;
747 case amd64_sys_personality
:
748 return gdb_sys_personality
;
750 case amd64_sys_ustat
:
751 return gdb_sys_ustat
;
753 case amd64_sys_statfs
:
754 return gdb_sys_statfs
;
756 case amd64_sys_fstatfs
:
757 return gdb_sys_fstatfs
;
759 case amd64_sys_sysfs
:
760 return gdb_sys_sysfs
;
762 case amd64_sys_getpriority
:
763 return gdb_sys_getpriority
;
765 case amd64_sys_setpriority
:
766 return gdb_sys_setpriority
;
768 case amd64_sys_sched_setparam
:
769 return gdb_sys_sched_setparam
;
771 case amd64_sys_sched_getparam
:
772 return gdb_sys_sched_getparam
;
774 case amd64_sys_sched_setscheduler
:
775 return gdb_sys_sched_setscheduler
;
777 case amd64_sys_sched_getscheduler
:
778 return gdb_sys_sched_getscheduler
;
780 case amd64_sys_sched_get_priority_max
:
781 return gdb_sys_sched_get_priority_max
;
783 case amd64_sys_sched_get_priority_min
:
784 return gdb_sys_sched_get_priority_min
;
786 case amd64_sys_sched_rr_get_interval
:
787 return gdb_sys_sched_rr_get_interval
;
789 case amd64_sys_mlock
:
790 return gdb_sys_mlock
;
792 case amd64_sys_munlock
:
793 return gdb_sys_munlock
;
795 case amd64_sys_mlockall
:
796 return gdb_sys_mlockall
;
798 case amd64_sys_munlockall
:
799 return gdb_sys_munlockall
;
801 case amd64_sys_vhangup
:
802 return gdb_sys_vhangup
;
804 case amd64_sys_modify_ldt
:
805 return gdb_sys_modify_ldt
;
807 case amd64_sys_pivot_root
:
808 return gdb_sys_pivot_root
;
810 case amd64_sys_sysctl
:
811 return gdb_sys_sysctl
;
813 case amd64_sys_prctl
:
814 return gdb_sys_prctl
;
816 case amd64_sys_arch_prctl
:
817 return -1; /* Note */
819 case amd64_sys_adjtimex
:
820 return gdb_sys_adjtimex
;
822 case amd64_sys_setrlimit
:
823 return gdb_sys_setrlimit
;
825 case amd64_sys_chroot
:
826 return gdb_sys_chroot
;
834 case amd64_sys_settimeofday
:
835 return gdb_sys_settimeofday
;
837 case amd64_sys_mount
:
838 return gdb_sys_mount
;
840 case amd64_sys_umount
:
841 return gdb_sys_umount
;
843 case amd64_sys_swapon
:
844 return gdb_sys_swapon
;
846 case amd64_sys_swapoff
:
847 return gdb_sys_swapoff
;
849 case amd64_sys_reboot
:
850 return gdb_sys_reboot
;
852 case amd64_sys_sethostname
:
853 return gdb_sys_sethostname
;
855 case amd64_sys_setdomainname
:
856 return gdb_sys_setdomainname
;
861 case amd64_sys_ioperm
:
862 return gdb_sys_ioperm
;
864 case amd64_sys_init_module
:
865 return gdb_sys_init_module
;
867 case amd64_sys_delete_module
:
868 return gdb_sys_delete_module
;
870 case amd64_sys_quotactl
:
871 return gdb_sys_quotactl
;
873 case amd64_sys_nfsservctl
:
874 return gdb_sys_nfsservctl
;
876 case amd64_sys_gettid
:
877 return gdb_sys_gettid
;
879 case amd64_sys_readahead
:
880 return gdb_sys_readahead
;
882 case amd64_sys_setxattr
:
883 return gdb_sys_setxattr
;
885 case amd64_sys_lsetxattr
:
886 return gdb_sys_lsetxattr
;
888 case amd64_sys_fsetxattr
:
889 return gdb_sys_fsetxattr
;
891 case amd64_sys_getxattr
:
892 return gdb_sys_getxattr
;
894 case amd64_sys_lgetxattr
:
895 return gdb_sys_lgetxattr
;
897 case amd64_sys_fgetxattr
:
898 return gdb_sys_fgetxattr
;
900 case amd64_sys_listxattr
:
901 return gdb_sys_listxattr
;
903 case amd64_sys_llistxattr
:
904 return gdb_sys_llistxattr
;
906 case amd64_sys_flistxattr
:
907 return gdb_sys_flistxattr
;
909 case amd64_sys_removexattr
:
910 return gdb_sys_removexattr
;
912 case amd64_sys_lremovexattr
:
913 return gdb_sys_lremovexattr
;
915 case amd64_sys_fremovexattr
:
916 return gdb_sys_fremovexattr
;
918 case amd64_sys_tkill
:
919 return gdb_sys_tkill
;
924 case amd64_sys_futex
:
925 return gdb_sys_futex
;
927 case amd64_sys_sched_setaffinity
:
928 return gdb_sys_sched_setaffinity
;
930 case amd64_sys_sched_getaffinity
:
931 return gdb_sys_sched_getaffinity
;
933 case amd64_sys_io_setup
:
934 return gdb_sys_io_setup
;
936 case amd64_sys_io_destroy
:
937 return gdb_sys_io_destroy
;
939 case amd64_sys_io_getevents
:
940 return gdb_sys_io_getevents
;
942 case amd64_sys_io_submit
:
943 return gdb_sys_io_submit
;
945 case amd64_sys_io_cancel
:
946 return gdb_sys_io_cancel
;
948 case amd64_sys_lookup_dcookie
:
949 return gdb_sys_lookup_dcookie
;
951 case amd64_sys_epoll_create
:
952 return gdb_sys_epoll_create
;
954 case amd64_sys_remap_file_pages
:
955 return gdb_sys_remap_file_pages
;
957 case amd64_sys_getdents64
:
958 return gdb_sys_getdents64
;
960 case amd64_sys_set_tid_address
:
961 return gdb_sys_set_tid_address
;
963 case amd64_sys_restart_syscall
:
964 return gdb_sys_restart_syscall
;
966 case amd64_sys_semtimedop
:
967 return gdb_sys_semtimedop
;
969 case amd64_sys_fadvise64
:
970 return gdb_sys_fadvise64
;
972 case amd64_sys_timer_create
:
973 return gdb_sys_timer_create
;
975 case amd64_sys_timer_settime
:
976 return gdb_sys_timer_settime
;
978 case amd64_sys_timer_gettime
:
979 return gdb_sys_timer_gettime
;
981 case amd64_sys_timer_getoverrun
:
982 return gdb_sys_timer_getoverrun
;
984 case amd64_sys_timer_delete
:
985 return gdb_sys_timer_delete
;
987 case amd64_sys_clock_settime
:
988 return gdb_sys_clock_settime
;
990 case amd64_sys_clock_gettime
:
991 return gdb_sys_clock_gettime
;
993 case amd64_sys_clock_getres
:
994 return gdb_sys_clock_getres
;
996 case amd64_sys_clock_nanosleep
:
997 return gdb_sys_clock_nanosleep
;
999 case amd64_sys_exit_group
:
1000 return gdb_sys_exit_group
;
1002 case amd64_sys_epoll_wait
:
1003 return gdb_sys_epoll_wait
;
1005 case amd64_sys_epoll_ctl
:
1006 return gdb_sys_epoll_ctl
;
1008 case amd64_sys_tgkill
:
1009 return gdb_sys_tgkill
;
1011 case amd64_sys_utimes
:
1012 return gdb_sys_utimes
;
1014 case amd64_sys_mbind
:
1015 return gdb_sys_mbind
;
1017 case amd64_sys_set_mempolicy
:
1018 return gdb_sys_set_mempolicy
;
1020 case amd64_sys_get_mempolicy
:
1021 return gdb_sys_get_mempolicy
;
1023 case amd64_sys_mq_open
:
1024 return gdb_sys_mq_open
;
1026 case amd64_sys_mq_unlink
:
1027 return gdb_sys_mq_unlink
;
1029 case amd64_sys_mq_timedsend
:
1030 return gdb_sys_mq_timedsend
;
1032 case amd64_sys_mq_timedreceive
:
1033 return gdb_sys_mq_timedreceive
;
1035 case amd64_sys_mq_notify
:
1036 return gdb_sys_mq_notify
;
1038 case amd64_sys_mq_getsetattr
:
1039 return gdb_sys_mq_getsetattr
;
1041 case amd64_sys_kexec_load
:
1042 return gdb_sys_kexec_load
;
1044 case amd64_sys_waitid
:
1045 return gdb_sys_waitid
;
1047 case amd64_sys_add_key
:
1048 return gdb_sys_add_key
;
1050 case amd64_sys_request_key
:
1051 return gdb_sys_request_key
;
1053 case amd64_sys_keyctl
:
1054 return gdb_sys_keyctl
;
1056 case amd64_sys_ioprio_set
:
1057 return gdb_sys_ioprio_set
;
1059 case amd64_sys_ioprio_get
:
1060 return gdb_sys_ioprio_get
;
1062 case amd64_sys_inotify_init
:
1063 return gdb_sys_inotify_init
;
1065 case amd64_sys_inotify_add_watch
:
1066 return gdb_sys_inotify_add_watch
;
1068 case amd64_sys_inotify_rm_watch
:
1069 return gdb_sys_inotify_rm_watch
;
1071 case amd64_sys_migrate_pages
:
1072 return gdb_sys_migrate_pages
;
1074 case amd64_sys_openat
:
1075 return gdb_sys_openat
;
1077 case amd64_sys_mkdirat
:
1078 return gdb_sys_mkdirat
;
1080 case amd64_sys_mknodat
:
1081 return gdb_sys_mknodat
;
1083 case amd64_sys_fchownat
:
1084 return gdb_sys_fchownat
;
1086 case amd64_sys_futimesat
:
1087 return gdb_sys_futimesat
;
1089 case amd64_sys_newfstatat
:
1090 return gdb_sys_newfstatat
;
1092 case amd64_sys_unlinkat
:
1093 return gdb_sys_unlinkat
;
1095 case amd64_sys_renameat
:
1096 return gdb_sys_renameat
;
1098 case amd64_sys_linkat
:
1099 return gdb_sys_linkat
;
1101 case amd64_sys_symlinkat
:
1102 return gdb_sys_symlinkat
;
1104 case amd64_sys_readlinkat
:
1105 return gdb_sys_readlinkat
;
1107 case amd64_sys_fchmodat
:
1108 return gdb_sys_fchmodat
;
1110 case amd64_sys_faccessat
:
1111 return gdb_sys_faccessat
;
1113 case amd64_sys_pselect6
:
1114 return gdb_sys_pselect6
;
1116 case amd64_sys_ppoll
:
1117 return gdb_sys_ppoll
;
1119 case amd64_sys_unshare
:
1120 return gdb_sys_unshare
;
1122 case amd64_sys_set_robust_list
:
1123 return gdb_sys_set_robust_list
;
1125 case amd64_sys_get_robust_list
:
1126 return gdb_sys_get_robust_list
;
1128 case amd64_sys_splice
:
1129 return gdb_sys_splice
;
1134 case amd64_sys_sync_file_range
:
1135 return gdb_sys_sync_file_range
;
1137 case amd64_sys_vmsplice
:
1138 return gdb_sys_vmsplice
;
1140 case amd64_sys_move_pages
:
1141 return gdb_sys_move_pages
;
1148 /* Parse the arguments of current system call instruction and record
1149 the values of the registers and memory that will be changed into
1150 "record_arch_list". This instruction is "syscall".
1152 Return -1 if something wrong. */
1154 static struct linux_record_tdep amd64_linux_record_tdep
;
1156 #define RECORD_ARCH_GET_FS 0x1003
1157 #define RECORD_ARCH_GET_GS 0x1004
1160 amd64_linux_syscall_record (struct regcache
*regcache
)
1163 ULONGEST syscall_native
;
1164 enum gdb_syscall syscall_gdb
= -1;
1166 regcache_raw_read_unsigned (regcache
, AMD64_RAX_REGNUM
, &syscall_native
);
1168 switch (syscall_native
)
1170 case amd64_sys_rt_sigreturn
:
1171 if (amd64_all_but_ip_registers_record (regcache
))
1176 case amd64_sys_arch_prctl
:
1177 if (syscall_native
== amd64_sys_arch_prctl
)
1181 regcache_raw_read_unsigned (regcache
, amd64_linux_record_tdep
.arg3
,
1183 if (arg3
== RECORD_ARCH_GET_FS
|| arg3
== RECORD_ARCH_GET_GS
)
1187 regcache_raw_read_unsigned (regcache
,
1188 amd64_linux_record_tdep
.arg2
,
1190 if (record_arch_list_add_mem (addr
,
1191 amd64_linux_record_tdep
.size_ulong
))
1199 syscall_gdb
= amd64_canonicalize_syscall (syscall_native
);
1201 if (syscall_gdb
< 0)
1203 printf_unfiltered (_("Process record and replay target doesn't "
1204 "support syscall number %s\n"),
1205 pulongest (syscall_native
));
1210 ret
= record_linux_system_call (syscall_gdb
, regcache
,
1211 &amd64_linux_record_tdep
);
1217 /* Record the return value of the system call. */
1218 if (record_arch_list_add_reg (regcache
, AMD64_RCX_REGNUM
))
1220 if (record_arch_list_add_reg (regcache
, AMD64_R11_REGNUM
))
1226 #define AMD64_LINUX_redzone 128
1227 #define AMD64_LINUX_xstate 512
1228 #define AMD64_LINUX_frame_size 560
1231 amd64_linux_record_signal (struct gdbarch
*gdbarch
,
1232 struct regcache
*regcache
,
1233 enum target_signal signal
)
1237 if (amd64_all_but_ip_registers_record (regcache
))
1240 if (record_arch_list_add_reg (regcache
, AMD64_RIP_REGNUM
))
1243 /* Record the change in the stack. */
1244 regcache_raw_read_unsigned (regcache
, AMD64_RSP_REGNUM
, &rsp
);
1247 rsp
-= AMD64_LINUX_redzone
;
1248 /* This is for xstate.
1249 sp -= sizeof (struct _fpstate); */
1250 rsp
-= AMD64_LINUX_xstate
;
1251 /* This is for frame_size.
1252 sp -= sizeof (struct rt_sigframe); */
1253 rsp
-= AMD64_LINUX_frame_size
;
1254 if (record_arch_list_add_mem (rsp
, AMD64_LINUX_redzone
1255 + AMD64_LINUX_xstate
1256 + AMD64_LINUX_frame_size
))
1259 if (record_arch_list_add_end ())
1265 /* Get Linux/x86 target description from core dump. */
1267 static const struct target_desc
*
1268 amd64_linux_core_read_description (struct gdbarch
*gdbarch
,
1269 struct target_ops
*target
,
1273 uint64_t xcr0
= i386_linux_core_read_xcr0 (gdbarch
, target
, abfd
);
1274 switch ((xcr0
& I386_XSTATE_AVX_MASK
))
1276 case I386_XSTATE_AVX_MASK
:
1277 return tdesc_amd64_avx_linux
;
1279 return tdesc_amd64_linux
;
1284 amd64_linux_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
1286 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1287 const struct target_desc
*tdesc
= info
.target_desc
;
1288 struct tdesc_arch_data
*tdesc_data
= (void *) info
.tdep_info
;
1289 const struct tdesc_feature
*feature
;
1292 gdb_assert (tdesc_data
);
1294 linux_init_abi (info
, gdbarch
);
1296 tdep
->gregset_reg_offset
= amd64_linux_gregset_reg_offset
;
1297 tdep
->gregset_num_regs
= ARRAY_SIZE (amd64_linux_gregset_reg_offset
);
1298 tdep
->sizeof_gregset
= 27 * 8;
1300 amd64_init_abi (info
, gdbarch
);
1302 /* Reserve a number for orig_rax. */
1303 set_gdbarch_num_regs (gdbarch
, AMD64_LINUX_NUM_REGS
);
1305 if (! tdesc_has_registers (tdesc
))
1306 tdesc
= tdesc_amd64_linux
;
1307 tdep
->tdesc
= tdesc
;
1309 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.i386.linux");
1310 if (feature
== NULL
)
1313 valid_p
= tdesc_numbered_register (feature
, tdesc_data
,
1314 AMD64_LINUX_ORIG_RAX_REGNUM
,
1319 tdep
->sigtramp_p
= amd64_linux_sigtramp_p
;
1320 tdep
->sigcontext_addr
= amd64_linux_sigcontext_addr
;
1321 tdep
->sc_reg_offset
= amd64_linux_sc_reg_offset
;
1322 tdep
->sc_num_regs
= ARRAY_SIZE (amd64_linux_sc_reg_offset
);
1324 tdep
->xsave_xcr0_offset
= I386_LINUX_XSAVE_XCR0_OFFSET
;
1326 /* GNU/Linux uses SVR4-style shared libraries. */
1327 set_solib_svr4_fetch_link_map_offsets
1328 (gdbarch
, svr4_lp64_fetch_link_map_offsets
);
1330 /* Add the %orig_rax register used for syscall restarting. */
1331 set_gdbarch_write_pc (gdbarch
, amd64_linux_write_pc
);
1333 tdep
->register_reggroup_p
= amd64_linux_register_reggroup_p
;
1335 /* Functions for 'catch syscall'. */
1336 set_xml_syscall_file_name (XML_SYSCALL_FILENAME_AMD64
);
1337 set_gdbarch_get_syscall_number (gdbarch
,
1338 amd64_linux_get_syscall_number
);
1340 /* Enable TLS support. */
1341 set_gdbarch_fetch_tls_load_module_address (gdbarch
,
1342 svr4_fetch_objfile_link_map
);
1344 /* GNU/Linux uses SVR4-style shared libraries. */
1345 set_gdbarch_skip_trampoline_code (gdbarch
, find_solib_trampoline_target
);
1347 /* Install supported register note sections. */
1348 set_gdbarch_core_regset_sections (gdbarch
, amd64_linux_regset_sections
);
1350 set_gdbarch_core_read_description (gdbarch
,
1351 amd64_linux_core_read_description
);
1353 /* Displaced stepping. */
1354 set_gdbarch_displaced_step_copy_insn (gdbarch
,
1355 amd64_displaced_step_copy_insn
);
1356 set_gdbarch_displaced_step_fixup (gdbarch
, amd64_displaced_step_fixup
);
1357 set_gdbarch_displaced_step_free_closure (gdbarch
,
1358 simple_displaced_step_free_closure
);
1359 set_gdbarch_displaced_step_location (gdbarch
,
1360 displaced_step_at_entry_point
);
1362 set_gdbarch_get_siginfo_type (gdbarch
, linux_get_siginfo_type
);
1364 set_gdbarch_process_record (gdbarch
, i386_process_record
);
1365 set_gdbarch_process_record_signal (gdbarch
, amd64_linux_record_signal
);
1367 /* Initialize the amd64_linux_record_tdep. */
1368 /* These values are the size of the type that will be used in a system
1369 call. They are obtained from Linux Kernel source. */
1370 amd64_linux_record_tdep
.size_pointer
1371 = gdbarch_ptr_bit (gdbarch
) / TARGET_CHAR_BIT
;
1372 amd64_linux_record_tdep
.size__old_kernel_stat
= 32;
1373 amd64_linux_record_tdep
.size_tms
= 32;
1374 amd64_linux_record_tdep
.size_loff_t
= 8;
1375 amd64_linux_record_tdep
.size_flock
= 32;
1376 amd64_linux_record_tdep
.size_oldold_utsname
= 45;
1377 amd64_linux_record_tdep
.size_ustat
= 32;
1378 /* ADM64 doesn't need this size because it doesn't have sys_sigaction
1379 but sys_rt_sigaction. */
1380 amd64_linux_record_tdep
.size_old_sigaction
= 152;
1381 /* ADM64 doesn't need this size because it doesn't have sys_sigpending
1382 but sys_rt_sigpending. */
1383 amd64_linux_record_tdep
.size_old_sigset_t
= 128;
1384 amd64_linux_record_tdep
.size_rlimit
= 16;
1385 amd64_linux_record_tdep
.size_rusage
= 144;
1386 amd64_linux_record_tdep
.size_timeval
= 16;
1387 amd64_linux_record_tdep
.size_timezone
= 8;
1388 /* ADM64 doesn't need this size because it doesn't have sys_getgroups16
1389 but sys_getgroups. */
1390 amd64_linux_record_tdep
.size_old_gid_t
= 2;
1391 /* ADM64 doesn't need this size because it doesn't have sys_getresuid16
1392 but sys_getresuid. */
1393 amd64_linux_record_tdep
.size_old_uid_t
= 2;
1394 amd64_linux_record_tdep
.size_fd_set
= 128;
1395 amd64_linux_record_tdep
.size_dirent
= 280;
1396 amd64_linux_record_tdep
.size_dirent64
= 280;
1397 amd64_linux_record_tdep
.size_statfs
= 120;
1398 amd64_linux_record_tdep
.size_statfs64
= 120;
1399 amd64_linux_record_tdep
.size_sockaddr
= 16;
1400 amd64_linux_record_tdep
.size_int
1401 = gdbarch_int_bit (gdbarch
) / TARGET_CHAR_BIT
;
1402 amd64_linux_record_tdep
.size_long
1403 = gdbarch_long_bit (gdbarch
) / TARGET_CHAR_BIT
;
1404 amd64_linux_record_tdep
.size_ulong
1405 = gdbarch_long_bit (gdbarch
) / TARGET_CHAR_BIT
;
1406 amd64_linux_record_tdep
.size_msghdr
= 56;
1407 amd64_linux_record_tdep
.size_itimerval
= 32;
1408 amd64_linux_record_tdep
.size_stat
= 144;
1409 amd64_linux_record_tdep
.size_old_utsname
= 325;
1410 amd64_linux_record_tdep
.size_sysinfo
= 112;
1411 amd64_linux_record_tdep
.size_msqid_ds
= 120;
1412 amd64_linux_record_tdep
.size_shmid_ds
= 112;
1413 amd64_linux_record_tdep
.size_new_utsname
= 390;
1414 amd64_linux_record_tdep
.size_timex
= 208;
1415 amd64_linux_record_tdep
.size_mem_dqinfo
= 24;
1416 amd64_linux_record_tdep
.size_if_dqblk
= 72;
1417 amd64_linux_record_tdep
.size_fs_quota_stat
= 80;
1418 amd64_linux_record_tdep
.size_timespec
= 16;
1419 amd64_linux_record_tdep
.size_pollfd
= 8;
1420 amd64_linux_record_tdep
.size_NFS_FHSIZE
= 32;
1421 amd64_linux_record_tdep
.size_knfsd_fh
= 132;
1422 amd64_linux_record_tdep
.size_TASK_COMM_LEN
= 16;
1423 amd64_linux_record_tdep
.size_sigaction
= 152;
1424 amd64_linux_record_tdep
.size_sigset_t
= 128;
1425 amd64_linux_record_tdep
.size_siginfo_t
= 128;
1426 amd64_linux_record_tdep
.size_cap_user_data_t
= 8;
1427 amd64_linux_record_tdep
.size_stack_t
= 24;
1428 amd64_linux_record_tdep
.size_off_t
= 8;
1429 amd64_linux_record_tdep
.size_stat64
= 144;
1430 amd64_linux_record_tdep
.size_gid_t
= 4;
1431 amd64_linux_record_tdep
.size_uid_t
= 4;
1432 amd64_linux_record_tdep
.size_PAGE_SIZE
= 4096;
1433 amd64_linux_record_tdep
.size_flock64
= 32;
1434 amd64_linux_record_tdep
.size_user_desc
= 16;
1435 amd64_linux_record_tdep
.size_io_event
= 32;
1436 amd64_linux_record_tdep
.size_iocb
= 64;
1437 amd64_linux_record_tdep
.size_epoll_event
= 12;
1438 amd64_linux_record_tdep
.size_itimerspec
= 32;
1439 amd64_linux_record_tdep
.size_mq_attr
= 64;
1440 amd64_linux_record_tdep
.size_siginfo
= 128;
1441 amd64_linux_record_tdep
.size_termios
= 60;
1442 amd64_linux_record_tdep
.size_termios2
= 44;
1443 amd64_linux_record_tdep
.size_pid_t
= 4;
1444 amd64_linux_record_tdep
.size_winsize
= 8;
1445 amd64_linux_record_tdep
.size_serial_struct
= 72;
1446 amd64_linux_record_tdep
.size_serial_icounter_struct
= 80;
1447 amd64_linux_record_tdep
.size_hayes_esp_config
= 12;
1448 amd64_linux_record_tdep
.size_size_t
= 8;
1449 amd64_linux_record_tdep
.size_iovec
= 16;
1451 /* These values are the second argument of system call "sys_ioctl".
1452 They are obtained from Linux Kernel source. */
1453 amd64_linux_record_tdep
.ioctl_TCGETS
= 0x5401;
1454 amd64_linux_record_tdep
.ioctl_TCSETS
= 0x5402;
1455 amd64_linux_record_tdep
.ioctl_TCSETSW
= 0x5403;
1456 amd64_linux_record_tdep
.ioctl_TCSETSF
= 0x5404;
1457 amd64_linux_record_tdep
.ioctl_TCGETA
= 0x5405;
1458 amd64_linux_record_tdep
.ioctl_TCSETA
= 0x5406;
1459 amd64_linux_record_tdep
.ioctl_TCSETAW
= 0x5407;
1460 amd64_linux_record_tdep
.ioctl_TCSETAF
= 0x5408;
1461 amd64_linux_record_tdep
.ioctl_TCSBRK
= 0x5409;
1462 amd64_linux_record_tdep
.ioctl_TCXONC
= 0x540A;
1463 amd64_linux_record_tdep
.ioctl_TCFLSH
= 0x540B;
1464 amd64_linux_record_tdep
.ioctl_TIOCEXCL
= 0x540C;
1465 amd64_linux_record_tdep
.ioctl_TIOCNXCL
= 0x540D;
1466 amd64_linux_record_tdep
.ioctl_TIOCSCTTY
= 0x540E;
1467 amd64_linux_record_tdep
.ioctl_TIOCGPGRP
= 0x540F;
1468 amd64_linux_record_tdep
.ioctl_TIOCSPGRP
= 0x5410;
1469 amd64_linux_record_tdep
.ioctl_TIOCOUTQ
= 0x5411;
1470 amd64_linux_record_tdep
.ioctl_TIOCSTI
= 0x5412;
1471 amd64_linux_record_tdep
.ioctl_TIOCGWINSZ
= 0x5413;
1472 amd64_linux_record_tdep
.ioctl_TIOCSWINSZ
= 0x5414;
1473 amd64_linux_record_tdep
.ioctl_TIOCMGET
= 0x5415;
1474 amd64_linux_record_tdep
.ioctl_TIOCMBIS
= 0x5416;
1475 amd64_linux_record_tdep
.ioctl_TIOCMBIC
= 0x5417;
1476 amd64_linux_record_tdep
.ioctl_TIOCMSET
= 0x5418;
1477 amd64_linux_record_tdep
.ioctl_TIOCGSOFTCAR
= 0x5419;
1478 amd64_linux_record_tdep
.ioctl_TIOCSSOFTCAR
= 0x541A;
1479 amd64_linux_record_tdep
.ioctl_FIONREAD
= 0x541B;
1480 amd64_linux_record_tdep
.ioctl_TIOCINQ
1481 = amd64_linux_record_tdep
.ioctl_FIONREAD
;
1482 amd64_linux_record_tdep
.ioctl_TIOCLINUX
= 0x541C;
1483 amd64_linux_record_tdep
.ioctl_TIOCCONS
= 0x541D;
1484 amd64_linux_record_tdep
.ioctl_TIOCGSERIAL
= 0x541E;
1485 amd64_linux_record_tdep
.ioctl_TIOCSSERIAL
= 0x541F;
1486 amd64_linux_record_tdep
.ioctl_TIOCPKT
= 0x5420;
1487 amd64_linux_record_tdep
.ioctl_FIONBIO
= 0x5421;
1488 amd64_linux_record_tdep
.ioctl_TIOCNOTTY
= 0x5422;
1489 amd64_linux_record_tdep
.ioctl_TIOCSETD
= 0x5423;
1490 amd64_linux_record_tdep
.ioctl_TIOCGETD
= 0x5424;
1491 amd64_linux_record_tdep
.ioctl_TCSBRKP
= 0x5425;
1492 amd64_linux_record_tdep
.ioctl_TIOCTTYGSTRUCT
= 0x5426;
1493 amd64_linux_record_tdep
.ioctl_TIOCSBRK
= 0x5427;
1494 amd64_linux_record_tdep
.ioctl_TIOCCBRK
= 0x5428;
1495 amd64_linux_record_tdep
.ioctl_TIOCGSID
= 0x5429;
1496 amd64_linux_record_tdep
.ioctl_TCGETS2
= 0x802c542a;
1497 amd64_linux_record_tdep
.ioctl_TCSETS2
= 0x402c542b;
1498 amd64_linux_record_tdep
.ioctl_TCSETSW2
= 0x402c542c;
1499 amd64_linux_record_tdep
.ioctl_TCSETSF2
= 0x402c542d;
1500 amd64_linux_record_tdep
.ioctl_TIOCGPTN
= 0x80045430;
1501 amd64_linux_record_tdep
.ioctl_TIOCSPTLCK
= 0x40045431;
1502 amd64_linux_record_tdep
.ioctl_FIONCLEX
= 0x5450;
1503 amd64_linux_record_tdep
.ioctl_FIOCLEX
= 0x5451;
1504 amd64_linux_record_tdep
.ioctl_FIOASYNC
= 0x5452;
1505 amd64_linux_record_tdep
.ioctl_TIOCSERCONFIG
= 0x5453;
1506 amd64_linux_record_tdep
.ioctl_TIOCSERGWILD
= 0x5454;
1507 amd64_linux_record_tdep
.ioctl_TIOCSERSWILD
= 0x5455;
1508 amd64_linux_record_tdep
.ioctl_TIOCGLCKTRMIOS
= 0x5456;
1509 amd64_linux_record_tdep
.ioctl_TIOCSLCKTRMIOS
= 0x5457;
1510 amd64_linux_record_tdep
.ioctl_TIOCSERGSTRUCT
= 0x5458;
1511 amd64_linux_record_tdep
.ioctl_TIOCSERGETLSR
= 0x5459;
1512 amd64_linux_record_tdep
.ioctl_TIOCSERGETMULTI
= 0x545A;
1513 amd64_linux_record_tdep
.ioctl_TIOCSERSETMULTI
= 0x545B;
1514 amd64_linux_record_tdep
.ioctl_TIOCMIWAIT
= 0x545C;
1515 amd64_linux_record_tdep
.ioctl_TIOCGICOUNT
= 0x545D;
1516 amd64_linux_record_tdep
.ioctl_TIOCGHAYESESP
= 0x545E;
1517 amd64_linux_record_tdep
.ioctl_TIOCSHAYESESP
= 0x545F;
1518 amd64_linux_record_tdep
.ioctl_FIOQSIZE
= 0x5460;
1520 /* These values are the second argument of system call "sys_fcntl"
1521 and "sys_fcntl64". They are obtained from Linux Kernel source. */
1522 amd64_linux_record_tdep
.fcntl_F_GETLK
= 5;
1523 amd64_linux_record_tdep
.fcntl_F_GETLK64
= 12;
1524 amd64_linux_record_tdep
.fcntl_F_SETLK64
= 13;
1525 amd64_linux_record_tdep
.fcntl_F_SETLKW64
= 14;
1527 amd64_linux_record_tdep
.arg1
= AMD64_RDI_REGNUM
;
1528 amd64_linux_record_tdep
.arg2
= AMD64_RSI_REGNUM
;
1529 amd64_linux_record_tdep
.arg3
= AMD64_RDX_REGNUM
;
1530 amd64_linux_record_tdep
.arg4
= AMD64_R10_REGNUM
;
1531 amd64_linux_record_tdep
.arg5
= AMD64_R8_REGNUM
;
1532 amd64_linux_record_tdep
.arg6
= AMD64_R9_REGNUM
;
1534 tdep
->i386_syscall_record
= amd64_linux_syscall_record
;
1538 /* Provide a prototype to silence -Wmissing-prototypes. */
1539 extern void _initialize_amd64_linux_tdep (void);
1542 _initialize_amd64_linux_tdep (void)
1544 gdbarch_register_osabi (bfd_arch_i386
, bfd_mach_x86_64
,
1545 GDB_OSABI_LINUX
, amd64_linux_init_abi
);
1547 /* Initialize the Linux target description */
1548 initialize_tdesc_amd64_linux ();
1549 initialize_tdesc_amd64_avx_linux ();