This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH RFC] Convert CANNOT_STORE_REGISTER, CANNOT_FETCH_REGISTER into multi-arch


Getting ready to commit the CRIS port of gdb as a pure multi-arch
target, I found that CANNOT_STORE_REGISTER and CANNOT_FETCH_REGISTER
needed to be converted to the multi-arch framework.  I added predicates
for both macros and changed the #ifdefs in infptrace.c, regcache.c and
lynx-nat.c to use the predicates instead.

Ok to commit?

(The CONTRIBUTE file said I shouldn't submit patches for gdbarch.h and
gdbarch.c, so if/when this patch is accepted I assume I will just commit
the regenerated versions of those.)


2001-05-18  Orjan Friberg  <orjanf@axis.com>

        * gdbarch.sh (CANNOT_STORE_REGISTER, CANNOT_FETCH_REGISTER): 
        Multi-arch.
        * gdbarch.h, gdbarch.c: Regenerate.
        * infptrace.c (fetch_register): Replace #ifdef
CANNOT_FETCH_REGISTER
        with CANNOT_FETCH_REGISTER_P ().
        (store_register): Replace #ifdef CANNOT_STORE_REGISTER with 
        CANNOT_STORE_REGISTER_P ().
        * regcache.c (legacy_write_register_gen): Ditto.
        * lynx-nat.c (store_inferior_registers): Ditto.


Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.62
diff -c -3 -p -r1.62 gdbarch.sh
*** gdbarch.sh  2001/05/14 16:43:35     1.62
--- gdbarch.sh  2001/05/18 15:31:35
*************** f:2:DO_REGISTERS_INFO:void:do_registers_
*** 423,428 ****
--- 423,430 ----
  # also include/...-sim.h.
  f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int
reg_nr:reg_nr:::default_regi
ster_sim_regno::0
  F:2:REGISTER_BYTES_OK:int:register_bytes_ok:long
nr_bytes:nr_bytes::0:0
+ F:2:CANNOT_STORE_REGISTER:int:cannot_store_register:int
reg_nr:reg_nr::0:0
+ F:2:CANNOT_FETCH_REGISTER:int:cannot_fetch_register:int
reg_nr:reg_nr::0:0
  #
  v:1:USE_GENERIC_DUMMY_FRAMES:int:use_generic_dummy_frames::::0:-1
  v:2:CALL_DUMMY_LOCATION:int:call_dummy_location::::0:0
Index: infptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/infptrace.c,v
retrieving revision 1.15
diff -c -3 -p -r1.15 infptrace.c
*** infptrace.c 2001/05/15 00:03:36     1.15
--- infptrace.c 2001/05/18 15:31:35
*************** _initialize_kernel_u_addr (void)
*** 349,359 ****
      - KERNEL_U_ADDR
  #endif
  
- /* Registers we shouldn't try to fetch.  */
- #if !defined (CANNOT_FETCH_REGISTER)
- #define CANNOT_FETCH_REGISTER(regno) 0
- #endif
- 
  /* Fetch one register.  */
  
  static void
--- 349,354 ----
*************** fetch_register (int regno)
*** 367,373 ****
    char buf[MAX_REGISTER_RAW_SIZE];
    int tid;
  
!   if (CANNOT_FETCH_REGISTER (regno))
      {
        memset (buf, '\0', REGISTER_RAW_SIZE (regno));  /* Supply zeroes
*/
        supply_register (regno, buf);
--- 362,368 ----
    char buf[MAX_REGISTER_RAW_SIZE];
    int tid;
  
!   if (CANNOT_FETCH_REGISTER_P () && CANNOT_FETCH_REGISTER (regno))
      {
        memset (buf, '\0', REGISTER_RAW_SIZE (regno));  /* Supply zeroes
*/
        supply_register (regno, buf);
*************** fetch_inferior_registers (int regno)
*** 418,428 ****
      }
  }
  
- /* Registers we shouldn't try to store.  */
- #if !defined (CANNOT_STORE_REGISTER)
- #define CANNOT_STORE_REGISTER(regno) 0
- #endif
- 
  /* Store one register. */
  
  static void
--- 413,418 ----
*************** store_register (int regno)
*** 435,441 ****
    unsigned int offset;                /* Offset of registers within
the u area
.  */
    int tid;
  
!   if (CANNOT_STORE_REGISTER (regno))
      {
        return;
      }
--- 425,431 ----
    unsigned int offset;                /* Offset of registers within
the u area
.  */
    int tid;
  
!   if (CANNOT_STORE_REGISTER_P () && CANNOT_STORE_REGISTER (regno))
      {
        return;
      }
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.23
diff -c -3 -p -r1.23 regcache.c
*** regcache.c  2001/05/04 04:15:26     1.23
--- regcache.c  2001/05/18 15:31:36
*************** read_register_gen (int regnum, char *buf
*** 315,325 ****
  /* Write register REGNUM at MYADDR to the target.  MYADDR points at
     REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order.  */
  
- /* Registers we shouldn't try to store.  */
- #if !defined (CANNOT_STORE_REGISTER)
- #define CANNOT_STORE_REGISTER(regnum) 0
- #endif
- 
  static void
  legacy_write_register_gen (int regnum, char *myaddr)
  {
--- 315,320 ----
*************** legacy_write_register_gen (int regnum, c
*** 328,334 ****
  
    /* On the sparc, writing %g0 is a no-op, so we don't even want to
       change the registers array if something writes to this register. 
*/
!   if (CANNOT_STORE_REGISTER (regnum))
      return;
  
    if (! ptid_equal (registers_ptid, inferior_ptid))
--- 323,329 ----
  
    /* On the sparc, writing %g0 is a no-op, so we don't even want to
       change the registers array if something writes to this register. 
*/
!   if (CANNOT_STORE_REGISTER_P () && CANNOT_STORE_REGISTER (regnum))
      return;
  
    if (! ptid_equal (registers_ptid, inferior_ptid))
Index: lynx-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/lynx-nat.c,v
retrieving revision 1.8
diff -c -3 -p -r1.8 lynx-nat.c
*** lynx-nat.c  2001/05/04 04:15:25     1.8
--- lynx-nat.c  2001/05/18 15:31:36
*************** fetch_inferior_registers (int regno)
*** 539,549 ****
     If REGNO is -1, do this for all registers.
     Otherwise, REGNO specifies which register (so we can save time). 
*/
  
- /* Registers we shouldn't try to store.  */
- #if !defined (CANNOT_STORE_REGISTER)
- #define CANNOT_STORE_REGISTER(regno) 0
- #endif
- 
  void
  store_inferior_registers (int regno)
  {
--- 539,544 ----
*************** store_inferior_registers (int regno)
*** 565,571 ****
      {
        int ptrace_fun = PTRACE_POKEUSER;
  
!       if (CANNOT_STORE_REGISTER (regno))
        continue;
  
  #ifdef M68K
--- 560,566 ----
      {
        int ptrace_fun = PTRACE_POKEUSER;
  
!       if (CANNOT_STORE_REGISTER_P () && CANNOT_STORE_REGISTER (regno))
        continue;
  
  #ifdef M68K


-- 
Orjan Friberg              E-mail: orjan.friberg@axis.com
Axis Communications AB     Phone:  +46 46 272 17 68


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]