Index: gdb/amd64-linux-tdep.c |
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c |
index d9192164ec41ed89a611b6a097b0422eff3e07c9..7fe92d1eea0183f9cd63fc010cce3944c7319ec7 100644 |
--- a/gdb/amd64-linux-tdep.c |
+++ b/gdb/amd64-linux-tdep.c |
@@ -1,6 +1,6 @@ |
/* Target-dependent code for GNU/Linux x86-64. |
- Copyright (C) 2001, 2003-2012 Free Software Foundation, Inc. |
+ Copyright (C) 2001-2013 Free Software Foundation, Inc. |
Contributed by Jiri Smid, SuSE Labs. |
This file is part of GDB. |
@@ -33,7 +33,7 @@ |
#include "linux-tdep.h" |
#include "i386-xstate.h" |
-#include "gdb_string.h" |
+#include <string.h> |
#include "amd64-tdep.h" |
#include "solib-svr4.h" |
@@ -42,13 +42,14 @@ |
#include "features/i386/amd64-linux.c" |
#include "features/i386/amd64-avx-linux.c" |
+#include "features/i386/amd64-mpx-linux.c" |
#include "features/i386/x32-linux.c" |
#include "features/i386/x32-avx-linux.c" |
/* The syscall's XML filename for i386. */ |
#define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" |
-#include "record.h" |
+#include "record-full.h" |
#include "linux-record.h" |
/* Supported register note sections. */ |
@@ -96,6 +97,8 @@ int amd64_linux_gregset_reg_offset[] = |
-1, -1, -1, -1, -1, -1, -1, -1, -1, |
-1, -1, -1, -1, -1, -1, -1, -1, |
-1, -1, -1, -1, -1, -1, -1, -1, |
+ -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */ |
+ -1, -1, /* MPX registers BNDCFGU and BNDSTATUS. */ |
15 * 8 /* "orig_rax" */ |
}; |
@@ -313,39 +316,39 @@ amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc) |
static int |
amd64_all_but_ip_registers_record (struct regcache *regcache) |
{ |
- if (record_arch_list_add_reg (regcache, AMD64_RAX_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RAX_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_RCX_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RCX_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_RDX_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RDX_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_RBX_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RBX_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_RSP_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RSP_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_RBP_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RBP_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_RSI_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RSI_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_RDI_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RDI_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R8_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R8_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R9_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R9_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R10_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R10_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R11_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R11_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R12_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R12_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R13_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R13_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R14_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R14_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R15_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R15_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_EFLAGS_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_EFLAGS_REGNUM)) |
return -1; |
return 0; |
@@ -1164,7 +1167,7 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number) |
/* Parse the arguments of current system call instruction and record |
the values of the registers and memory that will be changed into |
- "record_arch_list". This instruction is "syscall". |
+ "record_full_arch_list". This instruction is "syscall". |
Return -1 if something wrong. */ |
@@ -1203,8 +1206,8 @@ amd64_linux_syscall_record (struct regcache *regcache) |
regcache_raw_read_unsigned (regcache, |
amd64_linux_record_tdep.arg2, |
&addr); |
- if (record_arch_list_add_mem (addr, |
- amd64_linux_record_tdep.size_ulong)) |
+ if (record_full_arch_list_add_mem |
+ (addr, amd64_linux_record_tdep.size_ulong)) |
return -1; |
} |
goto record_regs; |
@@ -1231,9 +1234,9 @@ amd64_linux_syscall_record (struct regcache *regcache) |
record_regs: |
/* Record the return value of the system call. */ |
- if (record_arch_list_add_reg (regcache, AMD64_RCX_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RCX_REGNUM)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_R11_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_R11_REGNUM)) |
return -1; |
return 0; |
@@ -1253,7 +1256,7 @@ amd64_linux_record_signal (struct gdbarch *gdbarch, |
if (amd64_all_but_ip_registers_record (regcache)) |
return -1; |
- if (record_arch_list_add_reg (regcache, AMD64_RIP_REGNUM)) |
+ if (record_full_arch_list_add_reg (regcache, AMD64_RIP_REGNUM)) |
return -1; |
/* Record the change in the stack. */ |
@@ -1267,12 +1270,12 @@ amd64_linux_record_signal (struct gdbarch *gdbarch, |
/* This is for frame_size. |
sp -= sizeof (struct rt_sigframe); */ |
rsp -= AMD64_LINUX_frame_size; |
- if (record_arch_list_add_mem (rsp, AMD64_LINUX_redzone |
+ if (record_full_arch_list_add_mem (rsp, AMD64_LINUX_redzone |
+ AMD64_LINUX_xstate |
+ AMD64_LINUX_frame_size)) |
return -1; |
- if (record_arch_list_add_end ()) |
+ if (record_full_arch_list_add_end ()) |
return -1; |
return 0; |
@@ -1286,9 +1289,15 @@ amd64_linux_core_read_description (struct gdbarch *gdbarch, |
bfd *abfd) |
{ |
/* Linux/x86-64. */ |
- uint64_t xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd); |
- switch ((xcr0 & I386_XSTATE_AVX_MASK)) |
+ uint64_t xcr0 = i386_linux_core_read_xcr0 (abfd); |
+ |
+ switch (xcr0 & I386_XSTATE_ALL_MASK) |
{ |
+ case I386_XSTATE_MPX_MASK: |
+ if (gdbarch_ptr_bit (gdbarch) == 32) |
+ return tdesc_x32_avx_linux; /* No x32 MPX falling back to AVX. */ |
+ else |
+ return tdesc_amd64_mpx_linux; |
case I386_XSTATE_AVX_MASK: |
if (gdbarch_ptr_bit (gdbarch) == 32) |
return tdesc_x32_avx_linux; |
@@ -1623,6 +1632,7 @@ _initialize_amd64_linux_tdep (void) |
/* Initialize the Linux target description. */ |
initialize_tdesc_amd64_linux (); |
initialize_tdesc_amd64_avx_linux (); |
+ initialize_tdesc_amd64_mpx_linux (); |
initialize_tdesc_x32_linux (); |
initialize_tdesc_x32_avx_linux (); |
} |