* 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.
This commit is contained in:
Peter Schauer 2000-09-22 17:45:47 +00:00
parent 151337e879
commit d5d653533c
3 changed files with 40 additions and 11 deletions

View file

@ -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> 2000-09-06 Fred Fish <fnf@cygnus.com>
* infttrace.c (update_thread_state_after_attach): Pass address * infttrace.c (update_thread_state_after_attach): Pass address

View file

@ -65,12 +65,14 @@ extern int kernel_u_size (void);
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS #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 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 `i386-linux-nat.c' for now) and we can access only the
general-purpose registers in that way. */ general-purpose registers in that way. */
#define CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS) extern int cannot_fetch_register (int regno);
#define CANNOT_STORE_REGISTER(regno) CANNOT_FETCH_REGISTER (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'. */ /* Override child_resume in `infptrace.c'. */
#define CHILD_RESUME #define CHILD_RESUME

View file

@ -133,9 +133,7 @@ int have_ptrace_getfpxregs =
#endif #endif
/* Registers we shouldn't try to fetch. */ /* Registers we shouldn't try to fetch. */
#if !defined (CANNOT_FETCH_REGISTER) #define OLD_CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS)
#define CANNOT_FETCH_REGISTER(regno) 0
#endif
/* Fetch one register. */ /* Fetch one register. */
@ -150,7 +148,7 @@ fetch_register (int regno)
char buf[MAX_REGISTER_RAW_SIZE]; char buf[MAX_REGISTER_RAW_SIZE];
int tid; int tid;
if (CANNOT_FETCH_REGISTER (regno)) if (OLD_CANNOT_FETCH_REGISTER (regno))
{ {
memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */
supply_register (regno, buf); supply_register (regno, buf);
@ -201,9 +199,7 @@ old_fetch_inferior_registers (int regno)
} }
/* Registers we shouldn't try to store. */ /* Registers we shouldn't try to store. */
#if !defined (CANNOT_STORE_REGISTER) #define OLD_CANNOT_STORE_REGISTER(regno) ((regno) >= NUM_GREGS)
#define CANNOT_STORE_REGISTER(regno) 0
#endif
/* Store one register. */ /* Store one register. */
@ -217,7 +213,7 @@ store_register (int regno)
unsigned int offset; /* Offset of registers within the u area. */ unsigned int offset; /* Offset of registers within the u area. */
int tid; int tid;
if (CANNOT_STORE_REGISTER (regno)) if (OLD_CANNOT_STORE_REGISTER (regno))
{ {
return; return;
} }
@ -513,6 +509,26 @@ static void dummy_sse_values (void) {}
/* Transferring arbitrary registers between GDB and inferior. */ /* 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 /* Fetch register REGNO from the child process. If REGNO is -1, do
this for all registers (including the floating point and SSE this for all registers (including the floating point and SSE
registers). */ registers). */