2006-04-14 05:52:53 +00:00
|
|
|
2005-12-14 Jeff Johnston <jjohnstn@redhat.com>
|
|
|
|
|
|
|
|
* symfile-mem.c (read_memory): New static read callback function.
|
|
|
|
(symfile_add_from_memory): Pass read_memory to bfd instead of
|
|
|
|
target_read_memory.
|
|
|
|
* target.c (target_xfer_memory): Add support for LONGEST len and
|
|
|
|
change all callers.
|
|
|
|
(deprecated_debug_xfer_memory, target_read_memory): Ditto.
|
|
|
|
(target_write_memory, do_xfer_memory): Ditto.
|
|
|
|
(target_xfer_memory_partial, target_read_memory_partial): Ditto.
|
|
|
|
(target_write_memory_partial): Ditto.
|
|
|
|
* infptrace.c (child_xfer_memory): Ditto.
|
|
|
|
* linux-nat.c (linux_nat_xfer_memory): Ditto.
|
|
|
|
(linux_nat_proc_xfer_memory): Ditto.
|
|
|
|
* dcache.c (dcache_xfer_memory): Ditto.
|
|
|
|
* exec.c (xfer_memory): Ditto.
|
|
|
|
* remote.c (remote_xfer_memory): Ditto.
|
|
|
|
* remote-sim.c (gdbsim_xfer_interior_memory): Ditto.
|
|
|
|
* target.h: Change prototypes for functions changed above.
|
|
|
|
* linux-nat.h: Ditto.
|
|
|
|
* remote.h: Ditto.
|
|
|
|
* dcache.h: Ditto.
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
Index: gdb-6.5/gdb/symfile-mem.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/symfile-mem.c 2006-07-11 02:35:34.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/symfile-mem.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
@@ -58,6 +58,14 @@
|
2006-04-14 05:52:53 +00:00
|
|
|
#include "elf/common.h"
|
|
|
|
|
|
|
|
|
|
|
|
+/* Local callback routine to pass to bfd to read from target memory,
|
|
|
|
+ using a len constrained to INT_MAX. */
|
|
|
|
+static int
|
2006-07-11 06:33:02 +00:00
|
|
|
+read_target_memory (bfd_vma addr, bfd_byte *buf, int len)
|
2006-04-14 05:52:53 +00:00
|
|
|
+{
|
|
|
|
+ return target_read_memory (addr, buf, (LONGEST)len);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/* Read inferior memory at ADDR to find the header of a loaded object file
|
|
|
|
and read its in-core symbols out of inferior memory. TEMPL is a bfd
|
2006-07-11 06:33:02 +00:00
|
|
|
representing the target's format. NAME is the name to use for this
|
|
|
|
@@ -78,7 +86,7 @@ symbol_file_add_from_memory (struct bfd
|
|
|
|
error (_("add-symbol-file-from-memory not supported for this target"));
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase,
|
|
|
|
- target_read_memory);
|
|
|
|
+ read_target_memory);
|
|
|
|
if (nbfd == NULL)
|
2006-07-11 06:33:02 +00:00
|
|
|
error (_("Failed to read a valid object file image from memory."));
|
2006-04-14 05:52:53 +00:00
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
Index: gdb-6.5/gdb/target.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/target.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/target.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
@@ -83,8 +83,8 @@ static LONGEST default_xfer_partial (str
|
2006-04-14 05:52:53 +00:00
|
|
|
partial transfers, try either target_read_memory_partial or
|
|
|
|
target_write_memory_partial). */
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
-static int target_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
|
|
|
|
- int write);
|
|
|
|
+static int target_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
|
+ LONGEST len, int write);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
static void init_dummy_target (void);
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -511,8 +511,8 @@ update_current_target (void)
|
|
|
|
de_fault (to_prepare_to_store,
|
2006-04-14 05:52:53 +00:00
|
|
|
(void (*) (void))
|
|
|
|
noprocess);
|
2006-07-11 06:33:02 +00:00
|
|
|
- de_fault (deprecated_xfer_memory,
|
|
|
|
- (int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *))
|
|
|
|
+ de_fault (deprecated_xfer_memory,
|
|
|
|
+ (LONGEST (*) (CORE_ADDR, gdb_byte *, LONGEST, int, struct mem_attrib *, struct target_ops *))
|
2006-04-14 05:52:53 +00:00
|
|
|
nomemory);
|
|
|
|
de_fault (to_files_info,
|
|
|
|
(void (*) (struct target_ops *))
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -940,7 +940,7 @@ target_xfer_partial (struct target_ops *
|
2006-04-14 05:52:53 +00:00
|
|
|
implementing another singluar mechanism (for instance, a generic
|
|
|
|
object:annex onto inferior:object:annex say). */
|
|
|
|
|
|
|
|
-static LONGEST
|
|
|
|
+static int
|
|
|
|
xfer_using_stratum (enum target_object object, const char *annex,
|
|
|
|
ULONGEST offset, LONGEST len, void *readbuf,
|
|
|
|
const void *writebuf)
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -1005,7 +1005,7 @@ xfer_using_stratum (enum target_object o
|
2006-04-14 05:52:53 +00:00
|
|
|
deal with partial reads should call target_read_memory_partial. */
|
|
|
|
|
|
|
|
int
|
2006-07-11 06:33:02 +00:00
|
|
|
-target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
|
|
|
|
+target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len)
|
2006-04-14 05:52:53 +00:00
|
|
|
{
|
|
|
|
if (target_xfer_partial_p ())
|
|
|
|
return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -1015,7 +1015,7 @@ target_read_memory (CORE_ADDR memaddr, g
|
2006-04-14 05:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2006-07-11 06:33:02 +00:00
|
|
|
-target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
|
|
|
|
+target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, LONGEST len)
|
2006-04-14 05:52:53 +00:00
|
|
|
{
|
2006-07-11 06:33:02 +00:00
|
|
|
gdb_byte *bytes = alloca (len);
|
|
|
|
memcpy (bytes, myaddr, len);
|
|
|
|
@@ -1056,11 +1056,11 @@ Mode for reading from readonly sections
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
Result is -1 on error, or the number of bytes transfered. */
|
|
|
|
|
|
|
|
-int
|
2006-07-11 06:33:02 +00:00
|
|
|
-do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
|
2006-04-14 05:52:53 +00:00
|
|
|
+LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
+do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len, int write,
|
2006-04-14 05:52:53 +00:00
|
|
|
struct mem_attrib *attrib)
|
|
|
|
{
|
|
|
|
- int res;
|
|
|
|
+ LONGEST res;
|
|
|
|
int done = 0;
|
|
|
|
struct target_ops *t;
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -1118,10 +1118,11 @@ do_xfer_memory (CORE_ADDR memaddr, gdb_b
|
2006-04-14 05:52:53 +00:00
|
|
|
Result is 0 or errno value. */
|
|
|
|
|
|
|
|
static int
|
2006-07-11 06:33:02 +00:00
|
|
|
-target_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write)
|
|
|
|
+target_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
|
+ LONGEST len, int write)
|
2006-04-14 05:52:53 +00:00
|
|
|
{
|
|
|
|
- int res;
|
|
|
|
- int reg_len;
|
|
|
|
+ LONGEST res;
|
|
|
|
+ LONGEST reg_len;
|
|
|
|
struct mem_region *region;
|
|
|
|
|
|
|
|
/* Zero length requests are ok and require no work. */
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -1192,12 +1193,12 @@ target_xfer_memory (CORE_ADDR memaddr, g
|
|
|
|
If we succeed, set *ERR to zero and return the number of bytes transferred.
|
|
|
|
If we fail, set *ERR to a non-zero errno value, and return -1. */
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
-static int
|
2006-07-11 06:33:02 +00:00
|
|
|
-target_xfer_memory_partial (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
|
2006-04-14 05:52:53 +00:00
|
|
|
+static LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
+target_xfer_memory_partial (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len,
|
2006-04-14 05:52:53 +00:00
|
|
|
int write_p, int *err)
|
|
|
|
{
|
|
|
|
- int res;
|
|
|
|
- int reg_len;
|
|
|
|
+ LONGEST res;
|
|
|
|
+ LONGEST reg_len;
|
|
|
|
struct mem_region *region;
|
|
|
|
|
|
|
|
/* Zero length requests are ok and require no work. */
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -1256,9 +1257,9 @@ target_xfer_memory_partial (CORE_ADDR me
|
2006-04-14 05:52:53 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int
|
|
|
|
+LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
target_read_memory_partial (CORE_ADDR memaddr, gdb_byte *buf,
|
|
|
|
- int len, int *err)
|
|
|
|
+ LONGEST len, int *err)
|
2006-04-14 05:52:53 +00:00
|
|
|
{
|
|
|
|
if (target_xfer_partial_p ())
|
2006-07-11 06:33:02 +00:00
|
|
|
{
|
|
|
|
@@ -1285,9 +1286,9 @@ target_read_memory_partial (CORE_ADDR me
|
2006-04-14 05:52:53 +00:00
|
|
|
return target_xfer_memory_partial (memaddr, buf, len, 0, err);
|
|
|
|
}
|
|
|
|
|
|
|
|
-int
|
|
|
|
+LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
target_write_memory_partial (CORE_ADDR memaddr, gdb_byte *buf,
|
|
|
|
- int len, int *err)
|
|
|
|
+ LONGEST len, int *err)
|
2006-04-14 05:52:53 +00:00
|
|
|
{
|
|
|
|
if (target_xfer_partial_p ())
|
2006-07-11 06:33:02 +00:00
|
|
|
{
|
|
|
|
@@ -2044,8 +2045,8 @@ debug_to_prepare_to_store (void)
|
2006-04-14 05:52:53 +00:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
-static int
|
2006-07-11 06:33:02 +00:00
|
|
|
-deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
|
2006-04-14 05:52:53 +00:00
|
|
|
+static LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
+deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, LONGEST len,
|
2006-04-14 05:52:53 +00:00
|
|
|
int write, struct mem_attrib *attrib,
|
|
|
|
struct target_ops *target)
|
|
|
|
{
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -2055,9 +2056,9 @@ deprecated_debug_xfer_memory (CORE_ADDR
|
2006-04-14 05:52:53 +00:00
|
|
|
attrib, target);
|
|
|
|
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
- "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
|
|
|
|
+ "target_xfer_memory (0x%x, xxx, %ld, %s, xxx) = %d",
|
|
|
|
(unsigned int) memaddr, /* possable truncate long long */
|
|
|
|
- len, write ? "write" : "read", retval);
|
|
|
|
+ (long)len, write ? "write" : "read", retval);
|
|
|
|
|
|
|
|
if (retval > 0)
|
|
|
|
{
|
2006-07-11 06:33:02 +00:00
|
|
|
Index: gdb-6.5/gdb/target.h
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/target.h 2006-07-11 02:35:48.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/target.h 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
@@ -332,10 +332,10 @@ struct target_ops
|
2006-04-14 05:52:53 +00:00
|
|
|
NOTE: cagney/2004-10-01: This has been entirely superseeded by
|
|
|
|
to_xfer_partial and inferior inheritance. */
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
- int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
|
2006-04-14 05:52:53 +00:00
|
|
|
- int len, int write,
|
2006-07-11 06:33:02 +00:00
|
|
|
- struct mem_attrib *attrib,
|
|
|
|
- struct target_ops *target);
|
|
|
|
+ LONGEST (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
|
+ LONGEST len, int write,
|
|
|
|
+ struct mem_attrib *attrib,
|
|
|
|
+ struct target_ops *target);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
void (*to_files_info) (struct target_ops *);
|
|
|
|
int (*to_insert_breakpoint) (struct bp_target_info *);
|
|
|
|
@@ -535,21 +535,23 @@ extern void target_disconnect (char *, i
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
extern DCACHE *target_dcache;
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
-extern int do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
|
|
|
|
- int write, struct mem_attrib *attrib);
|
|
|
|
+extern LONGEST do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
|
+ LONGEST len, int write,
|
|
|
|
+ struct mem_attrib *attrib);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
extern int target_read_string (CORE_ADDR, char **, int, int *);
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
-extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
|
|
|
|
+extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
|
+ LONGEST len);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
|
|
|
|
- int len);
|
|
|
|
+ LONGEST len);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
-extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int,
|
2006-04-14 05:52:53 +00:00
|
|
|
- struct mem_attrib *, struct target_ops *);
|
2006-07-11 06:33:02 +00:00
|
|
|
+extern LONGEST xfer_memory (CORE_ADDR, gdb_byte *, LONGEST, int,
|
2006-04-14 05:52:53 +00:00
|
|
|
+ struct mem_attrib *, struct target_ops *);
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
-extern int child_xfer_memory (CORE_ADDR, gdb_byte *, int, int,
|
2006-04-14 05:52:53 +00:00
|
|
|
- struct mem_attrib *, struct target_ops *);
|
2006-07-11 06:33:02 +00:00
|
|
|
+extern LONGEST child_xfer_memory (CORE_ADDR, gdb_byte *, LONGEST, int,
|
|
|
|
+ struct mem_attrib *, struct target_ops *);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
/* Make a single attempt at transfering LEN bytes. On a successful
|
|
|
|
transfer, the number of bytes actually transfered is returned and
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -557,11 +559,11 @@ extern int child_xfer_memory (CORE_ADDR,
|
2006-04-14 05:52:53 +00:00
|
|
|
of bytes actually transfered is not defined) and ERR is set to a
|
|
|
|
non-zero error indication. */
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
-extern int target_read_memory_partial (CORE_ADDR addr, gdb_byte *buf,
|
|
|
|
- int len, int *err);
|
|
|
|
+extern LONGEST target_read_memory_partial (CORE_ADDR addr, gdb_byte *buf,
|
|
|
|
+ LONGEST len, int *err);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
-extern int target_write_memory_partial (CORE_ADDR addr, gdb_byte *buf,
|
|
|
|
- int len, int *err);
|
|
|
|
+extern LONGEST target_write_memory_partial (CORE_ADDR addr, gdb_byte *buf,
|
|
|
|
+ LONGEST len, int *err);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
extern char *child_pid_to_exec_file (int);
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
Index: gdb-6.5/gdb/infptrace.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/infptrace.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/infptrace.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
@@ -368,17 +368,17 @@ store_inferior_registers (int regnum)
|
2006-04-14 05:52:53 +00:00
|
|
|
deprecated_child_ops doesn't allow memory operations to cross below
|
|
|
|
us in the target stack anyway. */
|
|
|
|
|
|
|
|
-int
|
2006-07-11 06:33:02 +00:00
|
|
|
-child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
|
2006-04-14 05:52:53 +00:00
|
|
|
+LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
+child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len, int write,
|
2006-04-14 05:52:53 +00:00
|
|
|
struct mem_attrib *attrib, struct target_ops *target)
|
|
|
|
{
|
|
|
|
- int i;
|
|
|
|
+ LONGEST i;
|
|
|
|
/* Round starting address down to longword boundary. */
|
|
|
|
CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_TYPE_RET);
|
|
|
|
/* Round ending address up; get number of longwords that makes. */
|
|
|
|
- int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1)
|
2006-07-11 06:33:02 +00:00
|
|
|
- / sizeof (PTRACE_TYPE_RET));
|
2006-04-14 05:52:53 +00:00
|
|
|
- int alloc = count * sizeof (PTRACE_TYPE_RET);
|
2006-07-11 06:33:02 +00:00
|
|
|
+ LONGEST count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1)
|
|
|
|
+ / sizeof (PTRACE_TYPE_RET));
|
2006-04-14 05:52:53 +00:00
|
|
|
+ LONGEST alloc = count * sizeof (PTRACE_TYPE_RET);
|
|
|
|
PTRACE_TYPE_RET *buffer;
|
|
|
|
struct cleanup *old_chain = NULL;
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
Index: gdb-6.5/gdb/dcache.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/dcache.c 2006-07-11 02:35:34.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/dcache.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
@@ -527,9 +527,9 @@ dcache_free (DCACHE *dcache)
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
This routine is indended to be called by remote_xfer_ functions. */
|
|
|
|
|
|
|
|
-int
|
|
|
|
+LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
|
- int len, int should_write)
|
2006-04-14 05:52:53 +00:00
|
|
|
+ LONGEST len, int should_write)
|
|
|
|
{
|
|
|
|
int i;
|
2006-07-11 06:33:02 +00:00
|
|
|
int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr);
|
|
|
|
Index: gdb-6.5/gdb/dcache.h
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/dcache.h 2006-07-11 02:35:34.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/dcache.h 2006-07-11 02:35:49.000000000 -0300
|
2006-04-14 05:52:53 +00:00
|
|
|
@@ -37,7 +37,7 @@ void dcache_free (DCACHE *);
|
|
|
|
|
|
|
|
/* Simple to call from <remote>_xfer_memory */
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
-int dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my,
|
|
|
|
- int len, int should_write);
|
|
|
|
+LONGEST dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my,
|
|
|
|
+ LONGEST len, int should_write);
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
#endif /* DCACHE_H */
|
2006-07-11 06:33:02 +00:00
|
|
|
Index: gdb-6.5/gdb/exec.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/exec.c 2006-07-11 02:35:34.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/exec.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
@@ -447,8 +447,8 @@ map_vmap (bfd *abfd, bfd *arch)
|
2006-04-14 05:52:53 +00:00
|
|
|
The same routine is used to handle both core and exec files;
|
|
|
|
we just tail-call it with more arguments to select between them. */
|
|
|
|
|
|
|
|
-int
|
2006-07-11 06:33:02 +00:00
|
|
|
-xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
|
2006-04-14 05:52:53 +00:00
|
|
|
+LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
+xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len, int write,
|
|
|
|
struct mem_attrib *attrib, struct target_ops *target)
|
2006-04-14 05:52:53 +00:00
|
|
|
{
|
2006-07-11 06:33:02 +00:00
|
|
|
int res;
|
|
|
|
Index: gdb-6.5/gdb/linux-nat.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/linux-nat.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/linux-nat.c 2006-07-11 02:36:39.000000000 -0300
|
|
|
|
@@ -3264,7 +3264,7 @@ linux_xfer_partial (struct target_ops *o
|
|
|
|
Revert when Bugzilla 147436 is fixed. */
|
|
|
|
if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
|
|
|
|
{ /* This region contains ia64 rse registers, we have to re-read. */
|
|
|
|
- int xxfer;
|
|
|
|
+ LONGEST xxfer;
|
|
|
|
|
|
|
|
/* Re-read register stack area. */
|
|
|
|
xxfer = super_xfer_partial (ops, object, annex,
|
|
|
|
Index: gdb-6.5/gdb/remote.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/remote.c 2006-07-11 02:35:48.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/remote.c 2006-07-11 02:37:02.000000000 -0300
|
2006-04-14 05:52:53 +00:00
|
|
|
@@ -27,6 +27,7 @@
|
|
|
|
#include "gdb_string.h"
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
+#include <limits.h>
|
|
|
|
#include "inferior.h"
|
|
|
|
#include "bfd.h"
|
|
|
|
#include "symfile.h"
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -3701,19 +3702,27 @@ remote_read_bytes (CORE_ADDR memaddr, gd
|
|
|
|
if SHOULD_WRITE is nonzero. Returns length of data written or
|
|
|
|
read; 0 for error. TARGET is unused. */
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
-static int
|
2006-07-11 06:33:02 +00:00
|
|
|
-remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len,
|
2006-04-14 05:52:53 +00:00
|
|
|
+static LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
+remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, LONGEST mem_len,
|
2006-04-14 05:52:53 +00:00
|
|
|
int should_write, struct mem_attrib *attrib,
|
|
|
|
struct target_ops *target)
|
|
|
|
{
|
|
|
|
CORE_ADDR targ_addr;
|
|
|
|
int targ_len;
|
|
|
|
int res;
|
|
|
|
+ int len;
|
|
|
|
+
|
2006-07-11 06:33:02 +00:00
|
|
|
+
|
2006-04-14 05:52:53 +00:00
|
|
|
+ /* This routine is not set up to handle > INT_MAX bytes. */
|
|
|
|
+ if (mem_len >= (LONGEST)INT_MAX)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ len = (int)mem_len;
|
|
|
|
|
|
|
|
/* Should this be the selected frame? */
|
2006-07-11 06:33:02 +00:00
|
|
|
gdbarch_remote_translate_xfer_address (current_gdbarch,
|
|
|
|
current_regcache,
|
2006-04-14 05:52:53 +00:00
|
|
|
- mem_addr, mem_len,
|
|
|
|
+ mem_addr, len,
|
|
|
|
&targ_addr, &targ_len);
|
|
|
|
if (targ_len <= 0)
|
|
|
|
return 0;
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -3723,7 +3732,7 @@ remote_xfer_memory (CORE_ADDR mem_addr,
|
2006-04-14 05:52:53 +00:00
|
|
|
else
|
|
|
|
res = remote_read_bytes (targ_addr, buffer, targ_len);
|
|
|
|
|
|
|
|
- return res;
|
|
|
|
+ return (LONGEST)res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-07-11 06:33:02 +00:00
|
|
|
Index: gdb-6.5/gdb/remote-sim.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.5.orig/gdb/remote-sim.c 2006-07-11 02:35:34.000000000 -0300
|
|
|
|
+++ gdb-6.5/gdb/remote-sim.c 2006-07-11 02:35:49.000000000 -0300
|
|
|
|
@@ -742,11 +742,14 @@ gdbsim_prepare_to_store (void)
|
2006-04-14 05:52:53 +00:00
|
|
|
|
|
|
|
Returns the number of bytes transferred. */
|
|
|
|
|
|
|
|
-static int
|
2006-07-11 06:33:02 +00:00
|
|
|
-gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
|
2006-04-14 05:52:53 +00:00
|
|
|
+static LONGEST
|
2006-07-11 06:33:02 +00:00
|
|
|
+gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len,
|
2006-04-14 05:52:53 +00:00
|
|
|
int write, struct mem_attrib *attrib,
|
|
|
|
struct target_ops *target)
|
|
|
|
{
|
|
|
|
+ /* Convert to len type that sim_read and sim_write can handle. */
|
|
|
|
+ int xfer_len = (int)len;
|
|
|
|
+
|
|
|
|
if (!program_loaded)
|
2006-07-11 06:33:02 +00:00
|
|
|
error (_("No program loaded."));
|
2006-04-14 05:52:53 +00:00
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
@@ -756,22 +759,22 @@ gdbsim_xfer_inferior_memory (CORE_ADDR m
|
2006-04-14 05:52:53 +00:00
|
|
|
printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
|
|
|
|
gdb_print_host_address (myaddr, gdb_stdout);
|
|
|
|
printf_filtered (", memaddr 0x%s, len %d, write %d\n",
|
|
|
|
- paddr_nz (memaddr), len, write);
|
|
|
|
+ paddr_nz (memaddr), xfer_len, write);
|
|
|
|
if (sr_get_debug () && write)
|
|
|
|
- dump_mem (myaddr, len);
|
|
|
|
+ dump_mem (myaddr, xfer_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (write)
|
|
|
|
{
|
|
|
|
- len = sim_write (gdbsim_desc, memaddr, myaddr, len);
|
|
|
|
+ xfer_len = sim_write (gdbsim_desc, memaddr, myaddr, xfer_len);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
- len = sim_read (gdbsim_desc, memaddr, myaddr, len);
|
|
|
|
- if (sr_get_debug () && len > 0)
|
|
|
|
- dump_mem (myaddr, len);
|
|
|
|
+ xfer_len = sim_read (gdbsim_desc, memaddr, myaddr, xfer_len);
|
|
|
|
+ if (sr_get_debug () && xfer_len > 0)
|
|
|
|
+ dump_mem (myaddr, xfer_len);
|
|
|
|
}
|
|
|
|
- return len;
|
|
|
|
+ return (LONGEST)xfer_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|