/* Caching code for GDB, the GNU debugger.
Copyright (C) 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2007,
- 2008, 2009 Free Software Foundation, Inc.
+ 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GDB.
static struct dcache_block *dcache_hit (DCACHE *dcache, CORE_ADDR addr);
-static int dcache_write_line (DCACHE *dcache, struct dcache_block *db);
-
static int dcache_read_line (DCACHE *dcache, struct dcache_block *db);
static struct dcache_block *dcache_alloc (DCACHE *dcache, CORE_ADDR addr);
}
/* If addr is present in the dcache, return the address of the block
- containing it. */
+ containing it. Otherwise return NULL. */
static struct dcache_block *
dcache_hit (DCACHE *dcache, CORE_ADDR addr)
return db;
}
-/* Fill a cache line from target memory. */
+/* Fill a cache line from target memory.
+ The result is 1 for success, 0 if the (entire) cache line
+ wasn't readable. */
static int
dcache_read_line (DCACHE *dcache, struct dcache_block *db)
return db;
}
-/* Using the data cache DCACHE return the contents of the byte at
+/* Using the data cache DCACHE, store in *PTR the contents of the byte at
address ADDR in the remote machine.
Returns 1 for success, 0 for error. */
return -1;
}
-/* Initialize the data cache. */
+/* Allocate and initialize a data cache. */
DCACHE *
dcache_init (void)
{
DCACHE *dcache;
- int i;
dcache = (DCACHE *) xmalloc (sizeof (*dcache));
to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is
nonzero.
- The meaning of the result is the same as for target_write. */
+ Return the number of bytes actually transfered, or -1 if the
+ transfer is not supported or otherwise fails. Return of a non-negative
+ value less than LEN indicates that no further transfer is possible.
+ NOTE: This is different than the to_xfer_partial interface, in which
+ positive values less than LEN mean further transfers may be possible. */
int
dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache,
int i;
int res;
int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr);
+
xfunc = should_write ? dcache_poke_byte : dcache_peek_byte;
/* If this is a different inferior from what we've recorded,
dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
int i;
+
for (i = 0; i < len; i++)
dcache_poke_byte (dcache, memaddr + i, myaddr + i);
}
dcache_info (char *exp, int tty)
{
splay_tree_node n;
- int i, refcount, lineno;
+ int i, refcount;
if (exp)
{
char *linestart;
+
i = strtol (exp, &linestart, 10);
if (linestart == exp || i < 0)
{