/* Target-dependent code for GNU/Linux i386.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
+ 2011 Free Software Foundation, Inc.
This file is part of GDB.
format and GDB's register cache layout. */
/* From <sys/reg.h>. */
-static int i386_linux_gregset_reg_offset[] =
+int i386_linux_gregset_reg_offset[] =
{
6 * 4, /* %eax */
1 * 4, /* %ecx */
I386_LINUX_XSAVE_XCR0_OFFSET,
8))
{
- warning (_("Couldn't read `xcr0' bytes from `.reg-xstate' section in core file."));
+ warning (_("Couldn't read `xcr0' bytes from "
+ "`.reg-xstate' section in core file."));
return 0;
}
}
}
else
- xcr0 = I386_XSTATE_SSE_MASK;
+ xcr0 = 0;
return xcr0;
}
struct target_ops *target,
bfd *abfd)
{
- asection *section = bfd_get_section_by_name (abfd, ".reg2");
- uint64_t xcr0;
-
- if (section == NULL)
- return NULL;
-
- section = bfd_get_section_by_name (abfd, ".reg-xfp");
- if (section == NULL)
- return tdesc_i386_mmx_linux;
-
/* Linux/i386. */
- xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
- if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
- return tdesc_i386_avx_linux;
- else
+ uint64_t xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
+ switch ((xcr0 & I386_XSTATE_AVX_MASK))
+ {
+ case I386_XSTATE_AVX_MASK:
+ return tdesc_i386_avx_linux;
+ case I386_XSTATE_SSE_MASK:
+ return tdesc_i386_linux;
+ case I386_XSTATE_X87_MASK:
+ return tdesc_i386_mmx_linux;
+ default:
+ break;
+ }
+
+ if (bfd_get_section_by_name (abfd, ".reg-xfp") != NULL)
return tdesc_i386_linux;
+ else
+ return tdesc_i386_mmx_linux;
}
static void
gdb_assert (tdesc_data);
+ linux_init_abi (info, gdbarch);
+
/* GNU/Linux uses ELF. */
i386_elf_init_abi (info, gdbarch);
tdep->i386_sysenter_record = i386_linux_intx80_sysenter_record;
/* N_FUN symbols in shared libaries have 0 for their values and need
- to be relocated. */
+ to be relocated. */
set_gdbarch_sofun_address_maybe_missing (gdbarch, 1);
/* GNU/Linux uses SVR4-style shared libraries. */
/* Displaced stepping. */
set_gdbarch_displaced_step_copy_insn (gdbarch,
- simple_displaced_step_copy_insn);
+ i386_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, i386_displaced_step_fixup);
set_gdbarch_displaced_step_free_closure (gdbarch,
simple_displaced_step_free_closure);
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
i386_linux_init_abi);
- /* Initialize the Linux target description */
+ /* Initialize the Linux target description. */
initialize_tdesc_i386_linux ();
initialize_tdesc_i386_mmx_linux ();
initialize_tdesc_i386_avx_linux ();