/* Target-dependent code for GNU/Linux i386.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "record-full.h"
#include "linux-record.h"
-#include <stdint.h>
-
#include "features/i386/i386-linux.c"
#include "features/i386/i386-mmx-linux.c"
#include "features/i386/i386-mpx-linux.c"
#include "features/i386/i386-avx-linux.c"
#include "features/i386/i386-avx512-linux.c"
-/* Supported register note sections. */
-static struct core_regset_section i386_linux_regset_sections[] =
-{
- { ".reg", 68, "general-purpose" },
- { ".reg2", 108, "floating-point" },
- { NULL, 0 }
-};
-
-static struct core_regset_section i386_linux_sse_regset_sections[] =
-{
- { ".reg", 68, "general-purpose" },
- { ".reg-xfp", 512, "extended floating-point" },
- { NULL, 0 }
-};
-
-static struct core_regset_section i386_linux_avx_regset_sections[] =
-{
- { ".reg", 68, "general-purpose" },
- { ".reg-xstate", X86_XSTATE_MAX_SIZE, "XSAVE extended state" },
- { NULL, 0 }
-};
-
/* Return non-zero, when the register is in the corresponding register
group. Put the LINUX_ORIG_EAX register in the system group. */
static int
enum { i386_syscall_max = 499 };
if (syscall <= i386_syscall_max)
- return syscall;
+ return (enum gdb_syscall) syscall;
else
- return -1;
+ return gdb_sys_no_syscall;
}
/* Parse the arguments of current system call instruction and record
return tdesc_i386_mmx_linux;
}
+/* Similar to i386_supply_fpregset, but use XSAVE extended state. */
+
+static void
+i386_linux_supply_xstateregset (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *xstateregs, size_t len)
+{
+ i387_supply_xsave (regcache, regnum, xstateregs);
+}
+
+/* Similar to i386_collect_fpregset, but use XSAVE extended state. */
+
+static void
+i386_linux_collect_xstateregset (const struct regset *regset,
+ const struct regcache *regcache,
+ int regnum, void *xstateregs, size_t len)
+{
+ i387_collect_xsave (regcache, regnum, xstateregs, 1);
+}
+
+/* Register set definitions. */
+
+static const struct regset i386_linux_xstateregset =
+ {
+ NULL,
+ i386_linux_supply_xstateregset,
+ i386_linux_collect_xstateregset
+ };
+
+/* Iterate over core file register note sections. */
+
+static void
+i386_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ cb (".reg", 68, &i386_gregset, NULL, cb_data);
+
+ if (tdep->xcr0 & X86_XSTATE_AVX)
+ cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0),
+ &i386_linux_xstateregset, "XSAVE extended state", cb_data);
+ else if (tdep->xcr0 & X86_XSTATE_SSE)
+ cb (".reg-xfp", 512, &i386_fpregset, "extended floating-point",
+ cb_data);
+ else
+ cb (".reg2", 108, &i386_fpregset, NULL, cb_data);
+}
+
/* Linux kernel shows PC value after the 'int $0x80' instruction even if
inferior is still inside the syscall. On next PTRACE_SINGLESTEP it will
finish the syscall but PC will not change.
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- /* Install supported register note sections. */
- if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx512")
- || tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx"))
- set_gdbarch_core_regset_sections (gdbarch, i386_linux_avx_regset_sections);
- else if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"))
- set_gdbarch_core_regset_sections (gdbarch, i386_linux_sse_regset_sections);
- else
- set_gdbarch_core_regset_sections (gdbarch, i386_linux_regset_sections);
-
+ /* Core file support. */
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, i386_linux_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch,
i386_linux_core_read_description);
set_gdbarch_displaced_step_free_closure (gdbarch,
simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch,
- displaced_step_at_entry_point);
+ linux_displaced_step_location);
/* Functions for 'catch syscall'. */
- set_xml_syscall_file_name (XML_SYSCALL_FILENAME_I386);
+ set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_I386);
set_gdbarch_get_syscall_number (gdbarch,
i386_linux_get_syscall_number);
-
- set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
}
/* Provide a prototype to silence -Wmissing-prototypes. */