[RFA] Save SSE registers to generated core files, without breaking other architectures

Daniel Jacobowitz drow@mvista.com
Tue Apr 2 11:55:00 GMT 2002


How does this patch look?  The original problem was that we can not rely on
HAVE_PTRACE_FPXREGSET, because the presence of PTRACE_FPXREGSET doesn't
imply that GDB has a fill_fpxregset function available.  I updated it to
check for a separate flag.  It's not ideal, but until we separate regset
handling into an appropriate vector, it's the best we can do (I think).

OK?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-04-02  Daniel Jacobowitz  <drow@mvista.com>

	* config/i386/tm-linux.h: Define FILL_FPXREGSET.
	* gregset.h: If FILL_FPXREGSET is defined, provide
	gdb_fpxregset_t, supply_fpxregset, and fill_fpxregset.
	* linux-proc.c (linux_do_thread_registers): If FILL_FPXREGSET
	is defined, call fill_fpxregset.

Index: gregset.h
===================================================================
RCS file: /cvs/src/src/gdb/gregset.h,v
retrieving revision 1.5
diff -u -p -r1.5 gregset.h
--- gregset.h	2002/02/24 22:14:33	1.5
+++ gregset.h	2002/04/02 19:51:15
@@ -52,5 +52,18 @@ extern void supply_fpregset (gdb_fpregse
 extern void fill_gregset (gdb_gregset_t *gregs, int regno);
 extern void fill_fpregset (gdb_fpregset_t *fpregs, int regno);
 
+#ifdef FILL_FPXREGSET
+/* Linux/i386: Copy register values between GDB's internal register cache
+   and the i386 extended floating point registers.  */
+
+#ifndef GDB_FPXREGSET_T
+#define GDB_FPXREGSET_T elf_fpxregset_t
+#endif
+
+typedef GDB_FPXREGSET_T gdb_fpxregset_t;
+
+extern void supply_fpxregset (gdb_fpxregset_t *fpxregs);
+extern void fill_fpxregset (gdb_fpxregset_t *fpxregs, int regno);
+#endif
 
 #endif
Index: linux-proc.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-proc.c,v
retrieving revision 1.8
diff -u -p -r1.8 linux-proc.c
--- linux-proc.c	2002/03/25 19:47:41	1.8
+++ linux-proc.c	2002/04/02 19:51:15
@@ -167,6 +167,9 @@ linux_do_thread_registers (bfd *obfd, pt
 {
   gdb_gregset_t gregs;
   gdb_fpregset_t fpregs;
+#ifdef FILL_FPXREGSET
+  gdb_fpxregset_t fpxregs;
+#endif
   unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid);
 
   fill_gregset (&gregs, -1);
@@ -183,6 +186,14 @@ linux_do_thread_registers (bfd *obfd, pt
 					      note_size, 
 					      &fpregs, 
 					      sizeof (fpregs));
+#ifdef FILL_FPXREGSET
+  fill_fpxregset (&fpxregs, -1);
+  note_data = (char *) elfcore_write_prxfpreg (obfd, 
+					       note_data, 
+					       note_size, 
+					       &fpxregs, 
+					       sizeof (fpxregs));
+#endif
   return note_data;
 }
 
Index: config/i386/tm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-linux.h,v
retrieving revision 1.17
diff -u -p -r1.17 tm-linux.h
--- tm-linux.h	2002/02/24 22:56:05	1.17
+++ tm-linux.h	2002/04/02 19:51:46
@@ -26,6 +26,7 @@
 #define I386_GNULINUX_TARGET
 #define HAVE_I387_REGS
 #ifdef HAVE_PTRACE_GETFPXREGS
+#define FILL_FPXREGSET
 #define HAVE_SSE_REGS
 #endif
 



More information about the Gdb-patches mailing list