2005-05-16 Andrew Cagney <cagney@gnu.org>

* target.h (target_read_partial, target_write_partial)
	(do_xfer_memory, xfer_memory, target_read, target_write)
	(get_target_memory): For buffers, change "void*" to gdb_byte.
	(struct target_ops): Ditto for to_xfer_partial and
	deprecated_xfer_memory.
	* dcache.h (dcache_xfer_memory): Ditto.
	* target.c (default_xfer_partial, target_read_partial)
	(target_write_partial, target_read, target_write)
	(do_xfer_memory, update_current_target, get_target_memory): Update.
	(target_read_string): Change buf to a gdb_byte.
	* dcache.c (dcache_xfer_memory): Update.
	* exec.c (xfer_memory): Make buffer type to gdb_byte.
	* mem-break.c (default_memory_insert_breakpoint): Remove cast.
	* disasm.c (dis_asm_read_memory): Remove cast, use gdb_byte.
This commit is contained in:
Andrew Cagney
2005-05-16 04:45:43 +00:00
parent 44cd25cf2d
commit 1b0ba10226
8 changed files with 52 additions and 36 deletions

View File

@@ -1,3 +1,20 @@
2005-05-16 Andrew Cagney <cagney@gnu.org>
* target.h (target_read_partial, target_write_partial)
(do_xfer_memory, xfer_memory, target_read, target_write)
(get_target_memory): For buffers, change "void*" to gdb_byte.
(struct target_ops): Ditto for to_xfer_partial and
deprecated_xfer_memory.
* dcache.h (dcache_xfer_memory): Ditto.
* target.c (default_xfer_partial, target_read_partial)
(target_write_partial, target_read, target_write)
(do_xfer_memory, update_current_target, get_target_memory): Update.
(target_read_string): Change buf to a gdb_byte.
* dcache.c (dcache_xfer_memory): Update.
* exec.c (xfer_memory): Make buffer type to gdb_byte.
* mem-break.c (default_memory_insert_breakpoint): Remove cast.
* disasm.c (dis_asm_read_memory): Remove cast, use gdb_byte.
2005-05-16 Mark Kettenis <kettenis@gnu.org> 2005-05-16 Mark Kettenis <kettenis@gnu.org>
* sol-thread.c (ignore): Change last argument to `gdb_byte.' * sol-thread.c (ignore): Change last argument to `gdb_byte.'

View File

@@ -532,8 +532,8 @@ dcache_free (DCACHE *dcache)
This routine is indended to be called by remote_xfer_ functions. */ This routine is indended to be called by remote_xfer_ functions. */
int int
dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, char *myaddr, int len, dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
int should_write) int len, int should_write)
{ {
int i; int i;
int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, char *ptr); int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, char *ptr);

View File

@@ -37,7 +37,7 @@ void dcache_free (DCACHE *);
/* Simple to call from <remote>_xfer_memory */ /* Simple to call from <remote>_xfer_memory */
int dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, char *my, int len, int dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my,
int should_write); int len, int should_write);
#endif /* DCACHE_H */ #endif /* DCACHE_H */

View File

@@ -46,10 +46,10 @@ struct dis_line_entry
/* Like target_read_memory, but slightly different parameters. */ /* Like target_read_memory, but slightly different parameters. */
static int static int
dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int len, dis_asm_read_memory (bfd_vma memaddr, gdb_byte *myaddr, unsigned int len,
struct disassemble_info *info) struct disassemble_info *info)
{ {
return target_read_memory (memaddr, (char *) myaddr, len); return target_read_memory (memaddr, myaddr, len);
} }
/* Like memory_error with slightly different parameters. */ /* Like memory_error with slightly different parameters. */

View File

@@ -455,9 +455,8 @@ map_vmap (bfd *abfd, bfd *arch)
we just tail-call it with more arguments to select between them. */ we just tail-call it with more arguments to select between them. */
int int
xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
struct mem_attrib *attrib, struct mem_attrib *attrib, struct target_ops *target)
struct target_ops *target)
{ {
int res; int res;
struct section_table *p; struct section_table *p;

View File

@@ -58,7 +58,7 @@ default_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
/* Write the breakpoint. */ /* Write the breakpoint. */
if (val == 0) if (val == 0)
val = target_write_memory (addr, (char *) bp, bplen); val = target_write_memory (addr, bp, bplen);
return val; return val;
} }

View File

@@ -71,8 +71,8 @@ static void nosupport_runtime (void);
static LONGEST default_xfer_partial (struct target_ops *ops, static LONGEST default_xfer_partial (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, void *readbuf, const char *annex, gdb_byte *readbuf,
const void *writebuf, const gdb_byte *writebuf,
ULONGEST offset, LONGEST len); ULONGEST offset, LONGEST len);
/* Transfer LEN bytes between target address MEMADDR and GDB address /* Transfer LEN bytes between target address MEMADDR and GDB address
@@ -81,7 +81,7 @@ static LONGEST default_xfer_partial (struct target_ops *ops,
partial transfers, try either target_read_memory_partial or partial transfers, try either target_read_memory_partial or
target_write_memory_partial). */ target_write_memory_partial). */
static int target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, static int target_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
int write); int write);
static void init_dummy_target (void); static void init_dummy_target (void);
@@ -505,7 +505,7 @@ update_current_target (void)
(void (*) (void)) (void (*) (void))
noprocess); noprocess);
de_fault (deprecated_xfer_memory, de_fault (deprecated_xfer_memory,
(int (*) (CORE_ADDR, char *, int, int, struct mem_attrib *, struct target_ops *)) (int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *))
nomemory); nomemory);
de_fault (to_files_info, de_fault (to_files_info,
(void (*) (struct target_ops *)) (void (*) (struct target_ops *))
@@ -771,7 +771,7 @@ int
target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop) target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
{ {
int tlen, origlen, offset, i; int tlen, origlen, offset, i;
char buf[4]; gdb_byte buf[4];
int errcode = 0; int errcode = 0;
char *buffer; char *buffer;
int buffer_allocated; int buffer_allocated;
@@ -790,7 +790,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
tlen = MIN (len, 4 - (memaddr & 3)); tlen = MIN (len, 4 - (memaddr & 3));
offset = memaddr & 3; offset = memaddr & 3;
errcode = target_read_memory (memaddr & ~3, buf, 4); errcode = target_read_memory (memaddr & ~3, buf, sizeof buf);
if (errcode != 0) if (errcode != 0)
{ {
/* The transfer request might have crossed the boundary to an /* The transfer request might have crossed the boundary to an
@@ -1053,7 +1053,7 @@ Mode for reading from readonly sections is %s.\n"),
Result is -1 on error, or the number of bytes transfered. */ Result is -1 on error, or the number of bytes transfered. */
int int
do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
struct mem_attrib *attrib) struct mem_attrib *attrib)
{ {
int res; int res;
@@ -1114,7 +1114,7 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
Result is 0 or errno value. */ Result is 0 or errno value. */
static int static int
target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write) target_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write)
{ {
int res; int res;
int reg_len; int reg_len;
@@ -1151,7 +1151,7 @@ target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
{ {
if (region->attrib.cache) if (region->attrib.cache)
res = dcache_xfer_memory (target_dcache, memaddr, myaddr, res = dcache_xfer_memory (target_dcache, memaddr, myaddr,
reg_len, write); reg_len, write);
else else
res = do_xfer_memory (memaddr, myaddr, reg_len, write, res = do_xfer_memory (memaddr, myaddr, reg_len, write,
&region->attrib); &region->attrib);
@@ -1305,8 +1305,8 @@ target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
static LONGEST static LONGEST
default_xfer_partial (struct target_ops *ops, enum target_object object, default_xfer_partial (struct target_ops *ops, enum target_object object,
const char *annex, void *readbuf, const char *annex, gdb_byte *readbuf,
const void *writebuf, ULONGEST offset, LONGEST len) const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{ {
if (object == TARGET_OBJECT_MEMORY if (object == TARGET_OBJECT_MEMORY
&& ops->deprecated_xfer_memory != NULL) && ops->deprecated_xfer_memory != NULL)
@@ -1352,7 +1352,7 @@ default_xfer_partial (struct target_ops *ops, enum target_object object,
LONGEST LONGEST
target_read_partial (struct target_ops *ops, target_read_partial (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, void *buf, const char *annex, gdb_byte *buf,
ULONGEST offset, LONGEST len) ULONGEST offset, LONGEST len)
{ {
return target_xfer_partial (ops, object, annex, buf, NULL, offset, len); return target_xfer_partial (ops, object, annex, buf, NULL, offset, len);
@@ -1361,7 +1361,7 @@ target_read_partial (struct target_ops *ops,
LONGEST LONGEST
target_write_partial (struct target_ops *ops, target_write_partial (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, const void *buf, const char *annex, const gdb_byte *buf,
ULONGEST offset, LONGEST len) ULONGEST offset, LONGEST len)
{ {
return target_xfer_partial (ops, object, annex, NULL, buf, offset, len); return target_xfer_partial (ops, object, annex, NULL, buf, offset, len);
@@ -1371,7 +1371,7 @@ target_write_partial (struct target_ops *ops,
LONGEST LONGEST
target_read (struct target_ops *ops, target_read (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, void *buf, const char *annex, gdb_byte *buf,
ULONGEST offset, LONGEST len) ULONGEST offset, LONGEST len)
{ {
LONGEST xfered = 0; LONGEST xfered = 0;
@@ -1393,7 +1393,7 @@ target_read (struct target_ops *ops,
LONGEST LONGEST
target_write (struct target_ops *ops, target_write (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, const void *buf, const char *annex, const gdb_byte *buf,
ULONGEST offset, LONGEST len) ULONGEST offset, LONGEST len)
{ {
LONGEST xfered = 0; LONGEST xfered = 0;
@@ -1415,7 +1415,7 @@ target_write (struct target_ops *ops,
/* Memory transfer methods. */ /* Memory transfer methods. */
void void
get_target_memory (struct target_ops *ops, CORE_ADDR addr, void *buf, get_target_memory (struct target_ops *ops, CORE_ADDR addr, gdb_byte *buf,
LONGEST len) LONGEST len)
{ {
if (target_read (ops, TARGET_OBJECT_MEMORY, NULL, buf, addr, len) if (target_read (ops, TARGET_OBJECT_MEMORY, NULL, buf, addr, len)

View File

@@ -236,23 +236,23 @@ enum target_object
extern LONGEST target_read_partial (struct target_ops *ops, extern LONGEST target_read_partial (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, void *buf, const char *annex, gdb_byte *buf,
ULONGEST offset, LONGEST len); ULONGEST offset, LONGEST len);
extern LONGEST target_write_partial (struct target_ops *ops, extern LONGEST target_write_partial (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, const void *buf, const char *annex, const gdb_byte *buf,
ULONGEST offset, LONGEST len); ULONGEST offset, LONGEST len);
/* Wrappers to perform the full transfer. */ /* Wrappers to perform the full transfer. */
extern LONGEST target_read (struct target_ops *ops, extern LONGEST target_read (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, void *buf, const char *annex, gdb_byte *buf,
ULONGEST offset, LONGEST len); ULONGEST offset, LONGEST len);
extern LONGEST target_write (struct target_ops *ops, extern LONGEST target_write (struct target_ops *ops,
enum target_object object, enum target_object object,
const char *annex, const void *buf, const char *annex, const gdb_byte *buf,
ULONGEST offset, LONGEST len); ULONGEST offset, LONGEST len);
/* Wrappers to target read/write that perform memory transfers. They /* Wrappers to target read/write that perform memory transfers. They
@@ -263,7 +263,7 @@ extern LONGEST target_write (struct target_ops *ops,
which in turn lifted it from read_memory. */ which in turn lifted it from read_memory. */
extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr, extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr,
void *buf, LONGEST len); gdb_byte *buf, LONGEST len);
extern ULONGEST get_target_memory_unsigned (struct target_ops *ops, extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
CORE_ADDR addr, int len); CORE_ADDR addr, int len);
@@ -329,7 +329,7 @@ struct target_ops
NOTE: cagney/2004-10-01: This has been entirely superseeded by NOTE: cagney/2004-10-01: This has been entirely superseeded by
to_xfer_partial and inferior inheritance. */ to_xfer_partial and inferior inheritance. */
int (*deprecated_xfer_memory) (CORE_ADDR memaddr, char *myaddr, int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
int len, int write, int len, int write,
struct mem_attrib *attrib, struct mem_attrib *attrib,
struct target_ops *target); struct target_ops *target);
@@ -419,7 +419,7 @@ struct target_ops
only one, of readbuf or writebuf must be non-NULL. */ only one, of readbuf or writebuf must be non-NULL. */
LONGEST (*to_xfer_partial) (struct target_ops *ops, LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex, enum target_object object, const char *annex,
void *readbuf, const void *writebuf, gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, LONGEST len); ULONGEST offset, LONGEST len);
int to_magic; int to_magic;
@@ -532,8 +532,8 @@ extern void target_disconnect (char *, int);
extern DCACHE *target_dcache; extern DCACHE *target_dcache;
extern int do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, extern int do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
struct mem_attrib *attrib); int write, struct mem_attrib *attrib);
extern int target_read_string (CORE_ADDR, char **, int, int *); extern int target_read_string (CORE_ADDR, char **, int, int *);
@@ -542,7 +542,7 @@ extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
int len); int len);
extern int xfer_memory (CORE_ADDR, char *, int, int, extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int,
struct mem_attrib *, struct target_ops *); struct mem_attrib *, struct target_ops *);
extern int child_xfer_memory (CORE_ADDR, char *, int, int, extern int child_xfer_memory (CORE_ADDR, char *, int, int,