/* Caching code for GDB, the GNU debugger.
- Copyright (C) 1992-2014 Free Software Foundation, Inc.
+ Copyright (C) 1992-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "dcache.h"
#include "gdbcmd.h"
-#include <string.h>
#include "gdbcore.h"
#include "target-dcache.h"
#include "inferior.h"
if (db)
remove_block (&dcache->freelist, db);
else
- db = xmalloc (offsetof (struct dcache_block, data) +
- dcache->line_size);
+ db = ((struct dcache_block *)
+ xmalloc (offsetof (struct dcache_block, data)
+ + dcache->line_size));
dcache->size++;
}
DCACHE *
dcache_init (void)
{
- DCACHE *dcache;
-
- dcache = (DCACHE *) xmalloc (sizeof (*dcache));
+ DCACHE *dcache = XNEW (DCACHE);
dcache->tree = splay_tree_new (dcache_splay_tree_compare,
NULL,
if (i == 0)
{
- /* FIXME: We lose the real error status. */
- return TARGET_XFER_E_IO;
+ /* Even though reading the whole line failed, we may be able to
+ read a piece starting where the caller wanted. */
+ return raw_memory_xfer_partial (ops, myaddr, NULL, memaddr, len,
+ xfered_len);
}
else
{
{
printf_unfiltered (
"\"set dcache\" must be followed by the name of a subcommand.\n");
- help_list (dcache_set_list, "set dcache ", -1, gdb_stdout);
+ help_list (dcache_set_list, "set dcache ", all_commands, gdb_stdout);
}
static void