From: Peter Schauer Date: Fri, 22 Sep 2000 17:45:47 +0000 (+0000) Subject: * i386-linux-nat.c (OLD_CANNOT_FETCH_REGISTER, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5d653533c52e5f5f417afedf6ff3c6e6311e5ac;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c8dacffbdaa..5ca71fe54c0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2000-09-22 Peter Schauer + + * 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 * 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 6f83d38f0e5..c6bd54df2a6 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 15e6a189bf7..a1bc3d77ae7 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). */