This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
glibc 2.1.3: elf_gregset_t
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: glibc 2.1.3: elf_gregset_t
- From: Jim Kingdon <kingdon at redhat dot com>
- Date: Mon, 14 Feb 2000 12:33:03 -0500
Here is another fix to the elf_gregset_t problem, from Jakub Jelenc.
I think I like this fix better than
http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00047.html
There are basically two differences:
(1) the msg00047 patch contains many other cleanups to the
i386-linux-nat.c file. I briefly read/skimmed them and didn't see
any surprises but I didn't look that closely.
(2) the enclosed patch tries to keep working with glibc2.0 (if I am
correctly reading the ifdefs). This strikes me as important.
For a list of other glibc 2.1.3 issues see
http://sourceware.cygnus.com/gdb/issues50.html
--- gdb-19991004/gdb/config/i386/xm-linux.h.jj Fri Sep 3 04:19:16 1999
+++ gdb-19991004/gdb/config/i386/xm-linux.h Tue Feb 8 11:54:43 2000
@@ -36,4 +36,11 @@
/* Need R_OK etc, but USG isn't defined. */
#include <unistd.h>
+#include <features.h>
+
+#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 0
+#define GDB_GREGSET_TYPE elf_gregset_t
+#define GDB_FPREGSET_TYPE elf_fpregset_t
+#endif
+
#endif /* #ifndef XM_LINUX_H */
--- gdb-19991004/gdb/i386-linux-nat.c.jj Fri Sep 3 04:16:57 1999
+++ gdb-19991004/gdb/i386-linux-nat.c Tue Feb 8 11:46:27 2000
@@ -44,20 +44,31 @@ static int regmap[] =
DS, ES, FS, GS,
};
+#ifdef GDB_GREGSET_TYPE
+typedef GDB_GREGSET_TYPE gdb_gregset_t;
+#else
+typedef gregset_t gdb_gregset_t;
+#endif
+
+#ifdef GDB_FPREGSET_TYPE
+typedef GDB_FPREGSET_TYPE gdb_fpregset_t;
+#else
+typedef fpregset_t gdb_fpregset_t;
+#endif
/* FIXME: These routine absolutely depends upon (NUM_REGS - NUM_FREGS)
being less than or equal to the number of registers that can be stored
- in a gregset_t. Note that with the current scheme there will typically
- be more registers actually stored in a gregset_t that what we know
+ in a gdb_gregset_t. Note that with the current scheme there will typically
+ be more registers actually stored in a gdb_gregset_t that what we know
about. This is bogus and should be fixed. */
-/* Given a pointer to a general register set in /proc format (gregset_t *),
+/* Given a pointer to a general register set in /proc format (gdb_gregset_t *),
unpack the register contents and supply them as gdb's idea of the current
register values. */
void
supply_gregset (gregsetp)
- gregset_t *gregsetp;
+ gdb_gregset_t *gregsetp;
{
register int regi;
register greg_t *regp = (greg_t *) gregsetp;
@@ -70,7 +81,7 @@ supply_gregset (gregsetp)
void
fill_gregset (gregsetp, regno)
- gregset_t *gregsetp;
+ gdb_gregset_t *gregsetp;
int regno;
{
int regi;
@@ -86,13 +97,13 @@ fill_gregset (gregsetp, regno)
}
-/* Given a pointer to a floating point register set in (fpregset_t *)
+/* Given a pointer to a floating point register set in (gdb_fpregset_t *)
format, unpack the register contents and supply them as gdb's
idea of the current floating point register values. */
void
supply_fpregset (fpregsetp)
- fpregset_t *fpregsetp;
+ gdb_fpregset_t *fpregsetp;
{
register int regi;
char *from;
@@ -104,13 +115,13 @@ supply_fpregset (fpregsetp)
}
}
-/* Given a pointer to a floating point register set in (fpregset_t *)
+/* Given a pointer to a floating point register set in (gdb_fpregset_t *)
format, update all of the registers from gdb's idea
of the current floating point register set. */
void
fill_fpregset (fpregsetp, regno)
- fpregset_t *fpregsetp;
+ gdb_fpregset_t *fpregsetp;
int regno;
{
int regi;
--- gdb-19991004/gdb/core-regset.c.jj Wed Sep 29 16:14:50 1999
+++ gdb-19991004/gdb/core-regset.c Tue Feb 8 11:44:59 2000
@@ -52,6 +52,18 @@ static void fetch_core_registers PARAMS
void _initialize_core_regset PARAMS ((void));
+#ifdef GDB_GREGSET_TYPE
+typedef GDB_GREGSET_TYPE gdb_gregset_t;
+#else
+typedef gregset_t gdb_gregset_t;
+#endif
+
+#ifdef GDB_FPREGSET_TYPE
+typedef GDB_FPREGSET_TYPE gdb_fpregset_t;
+#else
+typedef fpregset_t gdb_fpregset_t;
+#endif
+
/*
GLOBAL FUNCTION
@@ -85,8 +97,8 @@ fetch_core_registers (core_reg_sect, cor
CORE_ADDR reg_addr; /* Unused in this version */
{
#if defined (HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T)
- gregset_t gregset;
- fpregset_t fpregset;
+ gdb_gregset_t gregset;
+ gdb_fpregset_t fpregset;
if (which == 0)
{