This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFA] Workaround for glibc 2.1.3 prfpregset_t bug


Here is a patch to work around the prfpregset_t bug in glibc 2.1.3.
This should make libthread_db assisted debugging work on Linux/i386.

I also noticed that I accidentally added some defines to config.in
instead of acconfig.h.

OK, to check this in (on both branches)?

Mark


2000-04-11  Mark Kettenis  <kettenis@gnu.org>

	* acconfig.h (HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T,
	HAVE_PSADDR_T): Add them here instead of in config.in.

	* acconfig.h (PRFPREGSET_T_BROKEN): New define.
	* configure.in: Add check for broken prfpregset_t type.
	* lin-thread.c (gdb_prfpregset): New typedef, depends on
	definition of PRFPREGSET_T_BROKEN.
	(ps_lgetfpregs, ps_lsetfpregs, p_td_thr_getfpregs,
	p_td_thr_setfpregs, thread_db_fetch_registers,
	thread_db_store_registers): Use gdb_prfpregset_t instead of
	prfpregset_t.
	* config.in: Regenerated.
	* configure: Regenerated.


Index: acconfig.h
===================================================================
RCS file: /cvs/src/src/gdb/acconfig.h,v
retrieving revision 1.4
diff -u -p -r1.4 acconfig.h
--- acconfig.h	2000/04/07 01:16:17	1.4
+++ acconfig.h	2000/04/10 23:44:42
@@ -13,6 +13,21 @@
 /* Define if gregset_t type is available. */
 #undef HAVE_GREGSET_T
 
+/* Define if <sys/procfs.h> has prgregset_t. */
+#undef HAVE_PRGREGSET_T
+
+/* Define if <sys/procfs.h> has prfpregset_t. */
+#undef HAVE_PRFPREGSET_T
+
+/* Define if <sys/procfs.h> has lwpid_t. */
+#undef HAVE_LWPID_T
+
+/* Define if <sys/procfs.h> has psaddr_t. */
+#undef HAVE_PSADDR_T
+
+/* Define if the prfpregset_t type is broken. */
+#undef PRFPREGSET_T_BROKEN
+
 /* Define if you want to use new multi-fd /proc interface
    (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros). */
 #undef NEW_PROC_API
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.18
diff -u -p -r1.18 configure.in
--- configure.in	2000/04/08 11:13:17	1.18
+++ configure.in	2000/04/10 23:44:43
@@ -200,6 +200,27 @@ if test "$ac_cv_header_sys_procfs_h" = y
   BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
   BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
 
+  dnl Check for broken prfpregset_t type
+
+  if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
+    AC_MSG_CHECKING(whether prfpregset_t type is broken)
+    AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
+      [AC_TRY_RUN([#include <sys/procfs.h>
+       int main ()
+       {
+         if (sizeof (prfpregset_t) == sizeof (void *))
+           return 1;
+         return 0;
+       }],
+       gdb_cv_prfpregset_t_broken=no,
+       gdb_cv_prfpregset_t_broken=yes,
+       gdb_cv_prfpregset_t_broken=yes)])
+    AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
+    if test $gdb_cv_prfpregset_t_broken = yes; then
+      AC_DEFINE(PRFPREGSET_T_BROKEN)
+    fi
+  fi
+
   dnl Check for PIOCSET ioctl entry 
 
   AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
Index: lin-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-thread.c,v
retrieving revision 1.3
diff -u -p -r1.3 lin-thread.c
--- lin-thread.c	2000/03/24 21:07:17	1.3
+++ lin-thread.c	2000/04/10 23:44:45
@@ -170,6 +170,16 @@ typedef const void *gdb_ps_write_buf_t;
 typedef size_t gdb_ps_size_t;
 #endif
 
+/* Unfortunately glibc 2.1.3 was released with a broken prfpregset_t
+   type.  We let configure check for this lossage, and make
+   appropriate typedefs here.  */
+
+#ifdef PRFPREGSET_T_BROKEN
+typedef elf_fpregset_t gdb_prfpregset_t;
+#else
+typedef prfpregset_t gdb_prfpregset_t;
+#endif
+
 /* 
  * proc_service callback functions, called by thread_db.
  */
@@ -392,7 +402,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph,		/*
 ps_err_e
 ps_lgetfpregs (gdb_ps_prochandle_t ph,		/* Get LWP float regs */
 	       lwpid_t       lwpid,
-	       prfpregset_t *fpregset)
+	       gdb_prfpregset_t *fpregset)
 {
   struct cleanup *old_chain = save_inferior_pid ();
 
@@ -406,7 +416,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph,		
 ps_err_e
 ps_lsetfpregs (gdb_ps_prochandle_t ph,		/* Set LWP float regs */
 	       lwpid_t             lwpid,
-	       const prfpregset_t *fpregset)
+	       const gdb_prfpregset_t *fpregset)
 {
   struct cleanup *old_chain = save_inferior_pid ();
 
@@ -508,10 +518,10 @@ static td_err_e (*p_td_thr_setgregs)    
 					   const prgregset_t regset);
 
 static td_err_e (*p_td_thr_getfpregs)     (const td_thrhandle_t *th_p,
-					   prfpregset_t *fpregset);
+					   gdb_prfpregset_t *fpregset);
 
 static td_err_e (*p_td_thr_setfpregs)     (const td_thrhandle_t *th_p,
-					   const prfpregset_t *fpregset);
+					   const gdb_prfpregset_t *fpregset);
 
 static td_err_e (*p_td_ta_map_id2thr)     (const td_thragent_t *ta_p,
 					   thread_t tid,
@@ -1270,7 +1280,7 @@ thread_db_fetch_registers (regno)
      int regno;
 {
   td_thrhandle_t thandle;
-  prfpregset_t fpregset;
+  gdb_prfpregset_t fpregset;
   prgregset_t gregset;
   thread_t thread;
   td_err_e ret;
@@ -1321,7 +1331,7 @@ thread_db_store_registers (regno)
      int regno;
 {
   td_thrhandle_t thandle;
-  prfpregset_t fpregset;
+  gdb_prfpregset_t fpregset;
   prgregset_t  gregset;
   thread_t thread;
   td_err_e ret;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]