* gdb.gdb/selftest.exp (do_steps_and_nexts): Add more matches.
[deliverable/binutils-gdb.git] / gdb / dcache.c
index 72e98660be28bc04ba61f25f260d81bac2faaf08..10f0f95392e2ddb8375c096c50e6272d81ce693d 100644 (file)
@@ -1,7 +1,7 @@
 /* Caching code for GDB, the GNU debugger.
 
-   Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2003 Free
-   Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2007
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,8 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "dcache.h"
@@ -124,7 +124,7 @@ struct dcache_block
   {
     struct dcache_block *p;    /* next in list */
     CORE_ADDR addr;            /* Address for which data is recorded.  */
-    char data[LINE_SIZE];      /* bytes at given address */
+    gdb_byte data[LINE_SIZE];  /* bytes at given address */
     unsigned char state[LINE_SIZE];    /* what state the data is in */
 
     /* whether anything in state is dirty - used to speed up the 
@@ -162,10 +162,6 @@ struct dcache_struct
     struct dcache_block *the_cache;
   };
 
-static int dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr);
-
-static int dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr);
-
 static struct dcache_block *dcache_hit (DCACHE *dcache, CORE_ADDR addr);
 
 static int dcache_write_line (DCACHE *dcache, struct dcache_block *db);
@@ -250,7 +246,7 @@ static int
 dcache_write_line (DCACHE *dcache, struct dcache_block *db)
 {
   CORE_ADDR memaddr;
-  char *myaddr;
+  gdb_byte *myaddr;
   int len;
   int res;
   int reg_len;
@@ -306,19 +302,15 @@ dcache_write_line (DCACHE *dcache, struct dcache_block *db)
          }
 
          dirty_len = e - s;
-         while (dirty_len > 0)
-           {
-             res = do_xfer_memory(memaddr, myaddr, dirty_len, 1,
-                                  &region->attrib);
-             if (res <= 0)
-               return 0;
-
-             memset (&db->state[XFORM(memaddr)], ENTRY_OK, res);
-             memaddr   += res;
-             myaddr    += res;
-             len       -= res;
-             dirty_len -= res;
-           }
+         res = target_write (&current_target, TARGET_OBJECT_RAW_MEMORY,
+                             NULL, myaddr, memaddr, dirty_len);
+         if (res < dirty_len)
+           return 0;
+
+         memset (&db->state[XFORM(memaddr)], ENTRY_OK, res);
+         memaddr += res;
+         myaddr += res;
+         len -= res;
        }
     }
 
@@ -331,7 +323,7 @@ static int
 dcache_read_line (DCACHE *dcache, struct dcache_block *db)
 {
   CORE_ADDR memaddr;
-  char *myaddr;
+  gdb_byte *myaddr;
   int len;
   int res;
   int reg_len;
@@ -365,18 +357,14 @@ dcache_read_line (DCACHE *dcache, struct dcache_block *db)
          continue;
        }
       
-      while (reg_len > 0)
-       {
-         res = do_xfer_memory (memaddr, myaddr, reg_len, 0,
-                               &region->attrib);
-         if (res <= 0)
-           return 0;
+      res = target_read (&current_target, TARGET_OBJECT_RAW_MEMORY,
+                        NULL, myaddr, memaddr, reg_len);
+      if (res < reg_len)
+       return 0;
 
-         memaddr += res;
-         myaddr  += res;
-         len     -= res;
-         reg_len -= res;
-       }
+      memaddr += res;
+      myaddr += res;
+      len -= res;
     }
 
   memset (db->state, ENTRY_OK, sizeof (db->data));
@@ -450,7 +438,7 @@ dcache_writeback (DCACHE *dcache)
    Returns 0 on error. */
 
 static int
-dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
+dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr)
 {
   struct dcache_block *db = dcache_hit (dcache, addr);
 
@@ -477,7 +465,7 @@ dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
  */
 
 static int
-dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
+dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr)
 {
   struct dcache_block *db = dcache_hit (dcache, addr);
 
@@ -536,7 +524,7 @@ dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
                    int len, int should_write)
 {
   int i;
-  int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, char *ptr);
+  int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr);
   xfunc = should_write ? dcache_poke_byte : dcache_peek_byte;
 
   for (i = 0; i < len; i++)
This page took 0.027365 seconds and 4 git commands to generate.