aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>2000-09-22 17:45:47 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>2000-09-22 17:45:47 +0000
commitd5d653533c52e5f5f417afedf6ff3c6e6311e5ac (patch)
treed0c7459f1a757906fb5810a8400b11ab629b24f9
parent151337e87933dfb13a87703c0c9c2cf2f1f6084e (diff)
downloadgdb-d5d653533c52e5f5f417afedf6ff3c6e6311e5ac.zip
gdb-d5d653533c52e5f5f417afedf6ff3c6e6311e5ac.tar.gz
gdb-d5d653533c52e5f5f417afedf6ff3c6e6311e5ac.tar.bz2
* i386-linux-nat.c (OLD_CANNOT_FETCH_REGISTER,
OLD_CANNOT_FETCH_REGISTER): New definitions for accessible registers when accessing the registers via the U area. (fetch_register, store_register): Use them. (cannot_fetch_register, cannot_store_register): New functions, all registers should be accessible if we have GETREGS support. * config/i386/nm-linux.h: Use cannot_fetch/store_register for CANNOT_FETCH/STORE_REGISTER definitions.
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/config/i386/nm-linux.h8
-rw-r--r--gdb/i386-linux-nat.c32
3 files changed, 40 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c8dacff..5ca71fe 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2000-09-22 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
+
+ * i386-linux-nat.c (OLD_CANNOT_FETCH_REGISTER,
+ OLD_CANNOT_FETCH_REGISTER): New definitions for accessible registers
+ when accessing the registers via the U area.
+ (fetch_register, store_register): Use them.
+ (cannot_fetch_register, cannot_store_register): New functions,
+ all registers should be accessible if we have GETREGS support.
+ * config/i386/nm-linux.h: Use cannot_fetch/store_register for
+ CANNOT_FETCH/STORE_REGISTER definitions.
+
2000-09-06 Fred Fish <fnf@cygnus.com>
* infttrace.c (update_thread_state_after_attach): Pass address
diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h
index 6f83d38..c6bd54d 100644
--- a/gdb/config/i386/nm-linux.h
+++ b/gdb/config/i386/nm-linux.h
@@ -65,12 +65,14 @@ extern int kernel_u_size (void);
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
-/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we fall
+/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we might fall
back on the code `infptrace.c' (well a copy of that code in
`i386-linux-nat.c' for now) and we can access only the
general-purpose registers in that way. */
-#define CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS)
-#define CANNOT_STORE_REGISTER(regno) CANNOT_FETCH_REGISTER (regno)
+extern int cannot_fetch_register (int regno);
+extern int cannot_store_register (int regno);
+#define CANNOT_FETCH_REGISTER(regno) cannot_store_register (regno)
+#define CANNOT_STORE_REGISTER(regno) cannot_fetch_register (regno)
/* Override child_resume in `infptrace.c'. */
#define CHILD_RESUME
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 15e6a18..a1bc3d7 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -133,9 +133,7 @@ int have_ptrace_getfpxregs =
#endif
/* Registers we shouldn't try to fetch. */
-#if !defined (CANNOT_FETCH_REGISTER)
-#define CANNOT_FETCH_REGISTER(regno) 0
-#endif
+#define OLD_CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS)
/* Fetch one register. */
@@ -150,7 +148,7 @@ fetch_register (int regno)
char buf[MAX_REGISTER_RAW_SIZE];
int tid;
- if (CANNOT_FETCH_REGISTER (regno))
+ if (OLD_CANNOT_FETCH_REGISTER (regno))
{
memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */
supply_register (regno, buf);
@@ -201,9 +199,7 @@ old_fetch_inferior_registers (int regno)
}
/* Registers we shouldn't try to store. */
-#if !defined (CANNOT_STORE_REGISTER)
-#define CANNOT_STORE_REGISTER(regno) 0
-#endif
+#define OLD_CANNOT_STORE_REGISTER(regno) ((regno) >= NUM_GREGS)
/* Store one register. */
@@ -217,7 +213,7 @@ store_register (int regno)
unsigned int offset; /* Offset of registers within the u area. */
int tid;
- if (CANNOT_STORE_REGISTER (regno))
+ if (OLD_CANNOT_STORE_REGISTER (regno))
{
return;
}
@@ -513,6 +509,26 @@ static void dummy_sse_values (void) {}
/* Transferring arbitrary registers between GDB and inferior. */
+/* Check if register REGNO in the child process is accessible.
+ If we are accessing registers directly via the U area, only the
+ general-purpose registers are available.
+ All registers should be accessible if we have GETREGS support. */
+
+int
+cannot_fetch_register (int regno)
+{
+ if (! have_ptrace_getregs)
+ return OLD_CANNOT_FETCH_REGISTER (regno);
+ return 0;
+}
+int
+cannot_store_register (int regno)
+{
+ if (! have_ptrace_getregs)
+ return OLD_CANNOT_STORE_REGISTER (regno);
+ return 0;
+}
+
/* Fetch register REGNO from the child process. If REGNO is -1, do
this for all registers (including the floating point and SSE
registers). */