+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
/* 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
#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. */
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);
}
/* 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. */
unsigned int offset; /* Offset of registers within the u area. */
int tid;
- if (CANNOT_STORE_REGISTER (regno))
+ if (OLD_CANNOT_STORE_REGISTER (regno))
{
return;
}
/* 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). */