aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog47
-rw-r--r--gdb/common/i386-xstate.h1
-rw-r--r--gdb/config/djgpp/fnchange.lst4
-rw-r--r--gdb/doc/ChangeLog6
-rw-r--r--gdb/doc/gdb.texinfo5
-rw-r--r--gdb/features/Makefile5
-rw-r--r--gdb/features/i386/i386-mmx-linux.c76
-rw-r--r--gdb/features/i386/i386-mmx-linux.xml16
-rw-r--r--gdb/features/i386/i386-mmx.c71
-rw-r--r--gdb/features/i386/i386-mmx.xml14
-rw-r--r--gdb/gdbserver/ChangeLog17
-rw-r--r--gdb/gdbserver/Makefile.in7
-rw-r--r--gdb/gdbserver/configure.srv8
-rw-r--r--gdb/gdbserver/linux-x86-low.c43
-rw-r--r--gdb/i386-linux-nat.c28
-rw-r--r--gdb/i386-linux-tdep.c6
-rw-r--r--gdb/i386-linux-tdep.h1
-rw-r--r--gdb/i386-tdep.c45
-rw-r--r--gdb/regformats/i386/i386-mmx-linux.dat46
-rw-r--r--gdb/regformats/i386/i386-mmx.dat36
20 files changed, 442 insertions, 40 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0bed4e4..a4bd29e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,43 @@
+2010-04-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-linux-nat.c (have_ptrace_getfpxregs): Initialize to -1
+ if HAVE_PTRACE_GETFPXREGS is defined.
+ (i386_linux_read_description): Set have_ptrace_getfpxregs and
+ have_ptrace_getregset to 0 if ptrace PTRACE_GETFPXREGS failed.
+
+ * i386-linux-tdep.c: Include "features/i386/i386-mmx-linux.c"
+ (i386_linux_core_read_description): Return tdesc_i386_mmx_linux
+ if .reg-xfp section doesn't exist.
+ (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_mmx_linux.
+
+ * i386-linux-tdep.h (tdesc_i386_mmx_linux): New.
+
+ * i386-tdep.c: Include "features/i386/i386-mmx.c".
+ (i386_go32_init_abi): Set tdesc to tdesc_i386_mmx.
+ (i386_validate_tdesc_p): Make org.gnu.gdb.i386.sse optional. Set
+ xcr0 to I386_XSTATE_X87_MASK if SSE isn't available.
+ (i386_gdbarch_init): Update comments.
+ (_initialize_i386_tdep): Call initialize_tdesc_i386_mmx.
+
+ * common/i386-xstate.h (I386_XSTATE_X87_MASK): New.
+
+ * config/djgpp/fnchange.lst: Add i386 MMX XML files.
+
+ * features/Makefile (i386/i386-mmx-expedite): New.
+ (i386/i386-mmx-linux-expedite): Likewise.
+ ($(outdir)/i386/i386-mmx.dat): Likewise.
+ ($(outdir)/i386/i386-mmx-linux.dat): Likewise.
+
+ * features/i386/i386-mmx-linux.c: New.
+ * features/i386/i386-mmx-linux.xml: Likewise.
+ * features/i386/i386-mmx.c: Likewise.
+ * features/i386/i386-mmx.xml: Likewise.
+ * regformats/i386/i386-mmx-linux.dat: Likewise.
+ * regformats/i386/i386-mmx.dat: Likewise.
+
+ * features/Makefile (WHICH): Add i386/i386-mmx and
+ i386/i386-mmx-linux.
+
2010-04-08 Doug Evans <dje@google.com>
* source.c (openp): Skip $cdir in PATH.
@@ -5,11 +45,10 @@
2010-04-08 Phil Muldoon <pmuldoon@redhat.com>
PR python/11417
-
* python/py-lazy-string.c (stpy_convert_to_value): Check for
- a NULL address.
- (gdbpy_create_lazy_string_object): Allow strings with a NULL
- address and a zero length.
+ a NULL address.
+ (gdbpy_create_lazy_string_object): Allow strings with a NULL
+ address and a zero length.
2010-04-08 Hui Zhu <teawater@gmail.com>
diff --git a/gdb/common/i386-xstate.h b/gdb/common/i386-xstate.h
index 5e16015..ec40a0d 100644
--- a/gdb/common/i386-xstate.h
+++ b/gdb/common/i386-xstate.h
@@ -26,6 +26,7 @@
#define I386_XSTATE_AVX (1ULL << 2)
/* Supported mask and size of the extended state. */
+#define I386_XSTATE_X87_MASK I386_XSTATE_X87
#define I386_XSTATE_SSE_MASK (I386_XSTATE_X87 | I386_XSTATE_SSE)
#define I386_XSTATE_AVX_MASK (I386_XSTATE_SSE_MASK | I386_XSTATE_AVX)
diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst
index 251ae2f..5e34bae 100644
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -236,6 +236,10 @@
@V@/gdb/features/i386/i386-avx.c @V@/gdb/features/i386/i32-a.c
@V@/gdb/features/i386/i386-avx-linux.xml @V@/gdb/features/i386/i32-al.xml
@V@/gdb/features/i386/i386-avx.xml @V@/gdb/features/i386/i32-a.xml
+@V@/gdb/features/i386/i386-mmx-linux.c @V@/features/i386/i32-ml.c
+@V@/gdb/features/i386/i386-mmx.c @V@/gdb/features/i386/i32-m.c
+@V@/gdb/features/i386/i386-mmx-linux.xml @V@/gdb/features/i386/i32-ml.xml
+@V@/gdb/features/i386/i386-mmx.xml @V@/gdb/features/i386/i32-m.xml
@V@/gdb/f-exp.tab.c @V@/gdb/f-exp_tab.c
@V@/gdb/gdbserver/linux-cris-low.c @V@/gdb/gdbserver/lx-cris.c
@V@/gdb/gdbserver/linux-crisv32-low.c @V@/gdb/gdbserver/lx-cris32.c
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 16264af..e3ca994 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gdb.texinfo (i386 Features): Make org.gnu.gdb.i386.avx
+ optional. Make org.gnu.gdb.i386.avx requires
+ org.gnu.gdb.i386.avx.
+
2010-04-08 Doug Evans <dje@google.com>
* gdb.texinfo (Command Files): Document that gdb skips $cdir in
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 039287d..01ede98 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -33850,7 +33850,7 @@ targets. It should describe the following registers:
The register sets may be different, depending on the target.
-The @samp{org.gnu.gdb.i386.sse} feature is required. It should
+The @samp{org.gnu.gdb.i386.sse} feature is optional. It should
describe registers:
@itemize @minus
@@ -33862,7 +33862,8 @@ describe registers:
@samp{mxcsr}
@end itemize
-The @samp{org.gnu.gdb.i386.avx} feature is optional. It should
+The @samp{org.gnu.gdb.i386.avx} feature is optional and requires the
+@samp{org.gnu.gdb.i386.sse} feature. It should
describe the upper 128 bits of @sc{ymm} registers:
@itemize @minus
diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index 1166582..987854b 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -32,6 +32,7 @@
WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 arm-with-neon \
i386/i386 i386/i386-linux \
+ i386/i386-mmx i386/i386-mmx-linux \
i386/amd64 i386/amd64-linux \
i386/i386-avx i386/i386-avx-linux \
i386/amd64-avx i386/amd64-avx-linux \
@@ -49,6 +50,8 @@ i386/amd64-expedite = rbp,rsp,rip
i386/amd64-linux-expedite = rbp,rsp,rip
i386/i386-avx-expedite = ebp,esp,eip
i386/i386-avx-linux-expedite = ebp,esp,eip
+i386/i386-mmx-expedite = ebp,esp,eip
+i386/i386-mmx-linux-expedite = ebp,esp,eip
i386/amd64-avx-expedite = rbp,rsp,rip
i386/amd64-avx-linux-expedite = rbp,rsp,rip
mips-expedite = r29,pc
@@ -99,6 +102,8 @@ $(outdir)/i386/amd64-linux.dat: i386/64bit-core.xml i386/64bit-sse.xml \
$(outdir)/i386/i386-avx.dat: i386/32bit-core.xml i386/32bit-avx.xml
$(outdir)/i386/i386-avx-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \
i386/32bit-linux.xml
+$(outdir)/i386/i386-mmx.dat: i386/32bit-core.xml
+$(outdir)/i386/i386-mmx-linux.dat: i386/32bit-core.xml i386/32bit-linux.xml
$(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml
$(outdir)/i386/amd64-avx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \
i386/64bit-linux.xml
diff --git a/gdb/features/i386/i386-mmx-linux.c b/gdb/features/i386/i386-mmx-linux.c
new file mode 100644
index 0000000..364ade4
--- /dev/null
+++ b/gdb/features/i386/i386-mmx-linux.c
@@ -0,0 +1,76 @@
+/* THIS FILE IS GENERATED. Original: i386-mmx-linux.xml */
+
+#include "defs.h"
+#include "osabi.h"
+#include "target-descriptions.h"
+
+struct target_desc *tdesc_i386_mmx_linux;
+static void
+initialize_tdesc_i386_mmx_linux (void)
+{
+ struct target_desc *result = allocate_target_description ();
+ struct tdesc_feature *feature;
+ struct tdesc_type *field_type, *type;
+
+ set_tdesc_architecture (result, bfd_scan_arch ("i386"));
+
+ set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux"));
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+ tdesc_add_flag (field_type, 0, "CF");
+ tdesc_add_flag (field_type, 1, "");
+ tdesc_add_flag (field_type, 2, "PF");
+ tdesc_add_flag (field_type, 4, "AF");
+ tdesc_add_flag (field_type, 6, "ZF");
+ tdesc_add_flag (field_type, 7, "SF");
+ tdesc_add_flag (field_type, 8, "TF");
+ tdesc_add_flag (field_type, 9, "IF");
+ tdesc_add_flag (field_type, 10, "DF");
+ tdesc_add_flag (field_type, 11, "OF");
+ tdesc_add_flag (field_type, 14, "NT");
+ tdesc_add_flag (field_type, 16, "RF");
+ tdesc_add_flag (field_type, 17, "VM");
+ tdesc_add_flag (field_type, 18, "AC");
+ tdesc_add_flag (field_type, 19, "VIF");
+ tdesc_add_flag (field_type, 20, "VIP");
+ tdesc_add_flag (field_type, 21, "ID");
+
+ tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr");
+ tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr");
+ tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr");
+ tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags");
+ tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux");
+ tdesc_create_reg (feature, "orig_eax", 41, 1, NULL, 32, "int");
+
+ tdesc_i386_mmx_linux = result;
+}
diff --git a/gdb/features/i386/i386-mmx-linux.xml b/gdb/features/i386/i386-mmx-linux.xml
new file mode 100644
index 0000000..19d4f3f
--- /dev/null
+++ b/gdb/features/i386/i386-mmx-linux.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!-- I386 with MMX - Includes Linux-only special "register". -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+ <architecture>i386</architecture>
+ <osabi>GNU/Linux</osabi>
+ <xi:include href="32bit-core.xml"/>
+ <xi:include href="32bit-linux.xml"/>
+</target>
diff --git a/gdb/features/i386/i386-mmx.c b/gdb/features/i386/i386-mmx.c
new file mode 100644
index 0000000..f43df65
--- /dev/null
+++ b/gdb/features/i386/i386-mmx.c
@@ -0,0 +1,71 @@
+/* THIS FILE IS GENERATED. Original: i386-mmx.xml */
+
+#include "defs.h"
+#include "osabi.h"
+#include "target-descriptions.h"
+
+struct target_desc *tdesc_i386_mmx;
+static void
+initialize_tdesc_i386_mmx (void)
+{
+ struct target_desc *result = allocate_target_description ();
+ struct tdesc_feature *feature;
+ struct tdesc_type *field_type, *type;
+
+ set_tdesc_architecture (result, bfd_scan_arch ("i386"));
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+ tdesc_add_flag (field_type, 0, "CF");
+ tdesc_add_flag (field_type, 1, "");
+ tdesc_add_flag (field_type, 2, "PF");
+ tdesc_add_flag (field_type, 4, "AF");
+ tdesc_add_flag (field_type, 6, "ZF");
+ tdesc_add_flag (field_type, 7, "SF");
+ tdesc_add_flag (field_type, 8, "TF");
+ tdesc_add_flag (field_type, 9, "IF");
+ tdesc_add_flag (field_type, 10, "DF");
+ tdesc_add_flag (field_type, 11, "OF");
+ tdesc_add_flag (field_type, 14, "NT");
+ tdesc_add_flag (field_type, 16, "RF");
+ tdesc_add_flag (field_type, 17, "VM");
+ tdesc_add_flag (field_type, 18, "AC");
+ tdesc_add_flag (field_type, 19, "VIF");
+ tdesc_add_flag (field_type, 20, "VIP");
+ tdesc_add_flag (field_type, 21, "ID");
+
+ tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr");
+ tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr");
+ tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr");
+ tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags");
+ tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32");
+ tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext");
+ tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int");
+ tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int");
+
+ tdesc_i386_mmx = result;
+}
diff --git a/gdb/features/i386/i386-mmx.xml b/gdb/features/i386/i386-mmx.xml
new file mode 100644
index 0000000..7bb9e7a
--- /dev/null
+++ b/gdb/features/i386/i386-mmx.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!-- I386 with MMX -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+ <architecture>i386</architecture>
+ <xi:include href="32bit-core.xml"/>
+</target>
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 8a26b27..e9324d1 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,20 @@
+2010-04-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.in (clean): Also remove i386-mmx.c i386-mmx-linux.c.
+ (i386-mmx.o): New.
+ (i386-mmx.c): Likewise.
+ (i386-mmx-linux.o): Likewise.
+ (i386-mmx-linux.c): Likewise.
+
+ * configure.srv (srv_i386_regobj): Add i386-mmx.o.
+ (srv_i386_linux_regobj): Add i386-mmx-linux.o.
+ (srv_i386_xmlfiles): Add i386/i386-mmx.xml.
+ (srv_i386_linux_xmlfiles): Add i386/i386-mmx-linux.xml.
+
+ * linux-x86-low.c (init_registers_i386_mmx_linux): New.
+ (x86_linux_update_xmltarget): Call init_registers_i386_mmx_linux
+ and return if ptrace PTRACE_GETFPXREGS failed in 32bit.
+
2010-04-07 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.in (clean): Updated.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 2ec9784..a95837a 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -219,6 +219,7 @@ clean:
rm -f xml-builtin.c stamp-xml
rm -f i386-avx.c i386-avx-linux.c
rm -f amd64-avx.c amd64-avx-linux.c
+ rm -f i386-mmx.c i386-mmx-linux.c
maintainer-clean realclean distclean: clean
rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log
@@ -359,6 +360,12 @@ i386-avx.c : $(srcdir)/../regformats/i386/i386-avx.dat $(regdat_sh)
i386-avx-linux.o : i386-avx-linux.c $(regdef_h)
i386-avx-linux.c : $(srcdir)/../regformats/i386/i386-avx-linux.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx-linux.dat i386-avx-linux.c
+i386-mmx.o : i386-mmx.c $(regdef_h)
+i386-mmx.c : $(srcdir)/../regformats/i386/i386-mmx.dat $(regdat_sh)
+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-mmx.dat i386-mmx.c
+i386-mmx-linux.o : i386-mmx-linux.c $(regdef_h)
+i386-mmx-linux.c : $(srcdir)/../regformats/i386/i386-mmx-linux.dat $(regdat_sh)
+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-mmx-linux.dat i386-mmx-linux.c
reg-ia64.o : reg-ia64.c $(regdef_h)
reg-ia64.c : $(srcdir)/../regformats/reg-ia64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-ia64.dat reg-ia64.c
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 8bc9aeb..803d3f4 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -22,16 +22,16 @@
# Default hostio_last_error implementation
srv_hostio_err_objs="hostio-errno.o"
-srv_i386_regobj="i386.o i386-avx.o"
-srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o"
+srv_i386_regobj="i386.o i386-avx.o i386-mmx.o"
+srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-mmx-linux.o"
srv_amd64_regobj="amd64.o x86-64-avx.o"
srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o"
srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml"
srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml"
-srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml $srv_i386_32bit_xmlfiles"
+srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml i386/i386-mmx.xml $srv_i386_32bit_xmlfiles"
srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml $srv_i386_64bit_xmlfiles"
-srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles"
+srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/i386-mmx-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles"
srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/64bit-linux.xml $srv_i386_64bit_xmlfiles"
# Input is taken from the "${target}" variable.
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 3853b25..9754c1e 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -37,6 +37,8 @@ void init_registers_amd64_linux (void);
void init_registers_i386_avx_linux (void);
/* Defined in auto-generated file amd64-avx-linux.c. */
void init_registers_amd64_avx_linux (void);
+/* Defined in auto-generated file i386-mmx-linux.c. */
+void init_registers_i386_mmx_linux (void);
/* Backward compatibility for gdb without XML support. */
@@ -828,19 +830,56 @@ static int use_xml;
static void
x86_linux_update_xmltarget (void)
{
+ int pid;
+ struct regset_info *regset;
static unsigned long long xcr0;
static int have_ptrace_getregset = -1;
+#ifdef HAVE_PTRACE_GETFPXREGS
+ static int have_ptrace_getfpxregs = -1;
+#endif
if (!current_inferior)
return;
+ pid = pid_of (get_thread_lwp (current_inferior));
#ifdef __x86_64__
if (num_xmm_registers == 8)
init_registers_i386_linux ();
else
init_registers_amd64_linux ();
#else
- init_registers_i386_linux ();
+ {
+# ifdef HAVE_PTRACE_GETFPXREGS
+ if (have_ptrace_getfpxregs == -1)
+ {
+ elf_fpxregset_t fpxregs;
+
+ if (ptrace (PTRACE_GETFPXREGS, pid, 0, (int) &fpxregs) < 0)
+ {
+ have_ptrace_getfpxregs = 0;
+ x86_xcr0 = I386_XSTATE_X87_MASK;
+
+ /* Disable PTRACE_GETFPXREGS. */
+ for (regset = target_regsets;
+ regset->fill_function != NULL; regset++)
+ if (regset->get_request == PTRACE_GETFPXREGS)
+ {
+ regset->size = 0;
+ break;
+ }
+ }
+ else
+ have_ptrace_getfpxregs = 1;
+ }
+
+ if (!have_ptrace_getfpxregs)
+ {
+ init_registers_i386_mmx_linux ();
+ return;
+ }
+# endif
+ init_registers_i386_linux ();
+ }
#endif
if (!use_xml)
@@ -863,10 +902,8 @@ x86_linux_update_xmltarget (void)
/* Check if XSAVE extended state is supported. */
if (have_ptrace_getregset == -1)
{
- int pid = pid_of (get_thread_lwp (current_inferior));
unsigned long long xstateregs[I386_XSTATE_SSE_SIZE / sizeof (long long)];
struct iovec iov;
- struct regset_info *regset;
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index a251907..d559811 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -150,7 +150,7 @@ int have_ptrace_getregs =
for this to be a simple variable. */
int have_ptrace_getfpxregs =
#ifdef HAVE_PTRACE_GETFPXREGS
- 1
+ -1
#else
0
#endif
@@ -946,19 +946,33 @@ i386_linux_child_post_startup_inferior (ptid_t ptid)
static const struct target_desc *
i386_linux_read_description (struct target_ops *ops)
{
+ int tid;
static uint64_t xcr0;
+ /* GNU/Linux LWP ID's are process ID's. */
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+
+#ifdef HAVE_PTRACE_GETFPXREGS
+ if (have_ptrace_getfpxregs == -1)
+ {
+ elf_fpxregset_t fpxregs;
+
+ if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
+ {
+ have_ptrace_getfpxregs = 0;
+ have_ptrace_getregset = 0;
+ return tdesc_i386_mmx_linux;
+ }
+ }
+#endif
+
if (have_ptrace_getregset == -1)
{
- int tid;
uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))];
struct iovec iov;
- /* GNU/Linux LWP ID's are process ID's. */
- tid = TIDGET (inferior_ptid);
- if (tid == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
-
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 34a1924..72aced5 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -50,6 +50,7 @@
#include <stdint.h>
#include "features/i386/i386-linux.c"
+#include "features/i386/i386-mmx-linux.c"
#include "features/i386/i386-avx-linux.c"
/* Supported register note sections. */
@@ -616,6 +617,10 @@ i386_linux_core_read_description (struct gdbarch *gdbarch,
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)
@@ -890,5 +895,6 @@ _initialize_i386_linux_tdep (void)
/* Initialize the Linux target description */
initialize_tdesc_i386_linux ();
+ initialize_tdesc_i386_mmx_linux ();
initialize_tdesc_i386_avx_linux ();
}
diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h
index eaeb63c..1228681 100644
--- a/gdb/i386-linux-tdep.h
+++ b/gdb/i386-linux-tdep.h
@@ -41,6 +41,7 @@ extern uint64_t i386_linux_core_read_xcr0
/* Linux target description. */
extern struct target_desc *tdesc_i386_linux;
+extern struct target_desc *tdesc_i386_mmx_linux;
extern struct target_desc *tdesc_i386_avx_linux;
/* Format of XSAVE extended state is:
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 9e0f61f..22854bd 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -58,6 +58,7 @@
#include "features/i386/i386.c"
#include "features/i386/i386-avx.c"
+#include "features/i386/i386-mmx.c"
/* Register names. */
@@ -2937,8 +2938,8 @@ i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->jb_pc_offset = 36;
/* DJGPP does not support the SSE registers. */
- tdep->num_xmm_regs = 0;
- set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I387_NUM_REGS);
+ if (! tdesc_has_registers (info.target_desc))
+ tdep->tdesc = tdesc_i386_mmx;
/* Native compiler is GCC, which uses the SVR4 register numbering
even in COFF and STABS. See the comment in i386_gdbarch_init,
@@ -6649,13 +6650,12 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
/* Get core registers. */
feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.core");
+ if (feature_core == NULL)
+ return 0;
/* Get SSE registers. */
feature_sse = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse");
- if (feature_core == NULL || feature_sse == NULL)
- return 0;
-
/* Try AVX registers. */
feature_avx = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx");
@@ -6664,6 +6664,10 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
/* The XCR0 bits. */
if (feature_avx)
{
+ /* AVX register description requires SSE register description. */
+ if (!feature_sse)
+ return 0;
+
tdep->xcr0 = I386_XSTATE_AVX_MASK;
/* It may have been set by OSABI initialization function. */
@@ -6679,19 +6683,27 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
tdep->ymm0h_regnum + i,
tdep->ymmh_register_names[i]);
}
- else
+ else if (feature_sse)
tdep->xcr0 = I386_XSTATE_SSE_MASK;
+ else
+ {
+ tdep->xcr0 = I386_XSTATE_X87_MASK;
+ tdep->num_xmm_regs = 0;
+ }
num_regs = tdep->num_core_regs;
for (i = 0; i < num_regs; i++)
valid_p &= tdesc_numbered_register (feature_core, tdesc_data, i,
tdep->register_names[i]);
- /* Need to include %mxcsr, so add one. */
- num_regs += tdep->num_xmm_regs + 1;
- for (; i < num_regs; i++)
- valid_p &= tdesc_numbered_register (feature_sse, tdesc_data, i,
- tdep->register_names[i]);
+ if (feature_sse)
+ {
+ /* Need to include %mxcsr, so add one. */
+ num_regs += tdep->num_xmm_regs + 1;
+ for (; i < num_regs; i++)
+ valid_p &= tdesc_numbered_register (feature_sse, tdesc_data, i,
+ tdep->register_names[i]);
+ }
return valid_p;
}
@@ -6732,15 +6744,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
and the SSE registers. This can be overridden for a specific ABI
by adjusting the members `st0_regnum', `mm0_regnum' and
`num_xmm_regs' of `struct gdbarch_tdep', otherwise the registers
- will show up in the output of "info all-registers". Ideally we
- should try to autodetect whether they are available, such that we
- can prevent "info all-registers" from displaying registers that
- aren't available.
-
- NOTE: kevinb/2003-07-13: ... if it's a choice between printing
- [the SSE registers] always (even when they don't exist) or never
- showing them to the user (even when they do exist), I prefer the
- former over the latter. */
+ will show up in the output of "info all-registers". */
tdep->st0_regnum = I386_ST0_REGNUM;
@@ -7039,6 +7043,7 @@ is \"default\"."),
/* Initialize the standard target descriptions. */
initialize_tdesc_i386 ();
+ initialize_tdesc_i386_mmx ();
initialize_tdesc_i386_avx ();
/* Tell remote stub that we support XML target description. */
diff --git a/gdb/regformats/i386/i386-mmx-linux.dat b/gdb/regformats/i386/i386-mmx-linux.dat
new file mode 100644
index 0000000..9dcf223
--- /dev/null
+++ b/gdb/regformats/i386/i386-mmx-linux.dat
@@ -0,0 +1,46 @@
+# DO NOT EDIT: generated from i386/i386-mmx-linux.xml
+name:i386_mmx_linux
+xmltarget:i386-mmx-linux.xml
+expedite:ebp,esp,eip
+32:eax
+32:ecx
+32:edx
+32:ebx
+32:esp
+32:ebp
+32:esi
+32:edi
+32:eip
+32:eflags
+32:cs
+32:ss
+32:ds
+32:es
+32:fs
+32:gs
+80:st0
+80:st1
+80:st2
+80:st3
+80:st4
+80:st5
+80:st6
+80:st7
+32:fctrl
+32:fstat
+32:ftag
+32:fiseg
+32:fioff
+32:foseg
+32:fooff
+32:fop
+0:
+0:
+0:
+0:
+0:
+0:
+0:
+0:
+0:
+32:orig_eax
diff --git a/gdb/regformats/i386/i386-mmx.dat b/gdb/regformats/i386/i386-mmx.dat
new file mode 100644
index 0000000..38a95d4
--- /dev/null
+++ b/gdb/regformats/i386/i386-mmx.dat
@@ -0,0 +1,36 @@
+# DO NOT EDIT: generated from i386/i386-mmx.xml
+name:i386_mmx
+xmltarget:i386-mmx.xml
+expedite:ebp,esp,eip
+32:eax
+32:ecx
+32:edx
+32:ebx
+32:esp
+32:ebp
+32:esi
+32:edi
+32:eip
+32:eflags
+32:cs
+32:ss
+32:ds
+32:es
+32:fs
+32:gs
+80:st0
+80:st1
+80:st2
+80:st3
+80:st4
+80:st5
+80:st6
+80:st7
+32:fctrl
+32:fstat
+32:ftag
+32:fiseg
+32:fioff
+32:foseg
+32:fooff
+32:fop