|
|
16b31aa |
2005-12-14 Jeff Johnston <jjohnstn@redhat.com>
|
|
|
16b31aa |
|
|
|
16b31aa |
* symfile-mem.c (read_memory): New static read callback function.
|
|
|
16b31aa |
(symfile_add_from_memory): Pass read_memory to bfd instead of
|
|
|
16b31aa |
target_read_memory.
|
|
|
16b31aa |
* target.c (target_xfer_memory): Add support for LONGEST len and
|
|
|
16b31aa |
change all callers.
|
|
|
16b31aa |
(deprecated_debug_xfer_memory, target_read_memory): Ditto.
|
|
|
16b31aa |
(target_write_memory, do_xfer_memory): Ditto.
|
|
|
16b31aa |
(target_xfer_memory_partial, target_read_memory_partial): Ditto.
|
|
|
16b31aa |
(target_write_memory_partial): Ditto.
|
|
|
16b31aa |
* infptrace.c (child_xfer_memory): Ditto.
|
|
|
16b31aa |
* linux-nat.c (linux_nat_xfer_memory): Ditto.
|
|
|
16b31aa |
(linux_nat_proc_xfer_memory): Ditto.
|
|
|
16b31aa |
* dcache.c (dcache_xfer_memory): Ditto.
|
|
|
16b31aa |
* exec.c (xfer_memory): Ditto.
|
|
|
16b31aa |
* remote.c (remote_xfer_memory): Ditto.
|
|
|
16b31aa |
* remote-sim.c (gdbsim_xfer_interior_memory): Ditto.
|
|
|
16b31aa |
* target.h: Change prototypes for functions changed above.
|
|
|
16b31aa |
* linux-nat.h: Ditto.
|
|
|
16b31aa |
* remote.h: Ditto.
|
|
|
16b31aa |
* dcache.h: Ditto.
|
|
|
16b31aa |
|
|
|
eb9d945 |
2007-10-15 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
eb9d945 |
|
|
|
eb9d945 |
Port to GDB-6.7.
|
|
|
eb9d945 |
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/symfile-mem.c
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/symfile-mem.c 2009-02-21 17:14:49.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/symfile-mem.c 2009-02-28 07:22:09.000000000 +0100
|
|
|
eb9d945 |
@@ -56,6 +56,14 @@
|
|
|
16b31aa |
#include "elf/common.h"
|
|
|
16b31aa |
|
|
|
16b31aa |
|
|
|
16b31aa |
+/* Local callback routine to pass to bfd to read from target memory,
|
|
|
16b31aa |
+ using a len constrained to INT_MAX. */
|
|
|
16b31aa |
+static int
|
|
|
9231e41 |
+read_target_memory (bfd_vma addr, bfd_byte *buf, int len)
|
|
|
16b31aa |
+{
|
|
|
16b31aa |
+ return target_read_memory (addr, buf, (LONGEST)len);
|
|
|
16b31aa |
+}
|
|
|
16b31aa |
+
|
|
|
16b31aa |
/* Read inferior memory at ADDR to find the header of a loaded object file
|
|
|
16b31aa |
and read its in-core symbols out of inferior memory. TEMPL is a bfd
|
|
|
9231e41 |
representing the target's format. NAME is the name to use for this
|
|
|
eb9d945 |
@@ -76,7 +84,7 @@ symbol_file_add_from_memory (struct bfd
|
|
|
9231e41 |
error (_("add-symbol-file-from-memory not supported for this target"));
|
|
|
16b31aa |
|
|
|
16b31aa |
nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase,
|
|
|
16b31aa |
- target_read_memory);
|
|
|
16b31aa |
+ read_target_memory);
|
|
|
16b31aa |
if (nbfd == NULL)
|
|
|
9231e41 |
error (_("Failed to read a valid object file image from memory."));
|
|
|
16b31aa |
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/target.c
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/target.c 2009-02-27 00:04:32.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/target.c 2009-02-28 07:22:09.000000000 +0100
|
|
|
407ebe9 |
@@ -57,7 +57,7 @@ static int nosymbol (char *, CORE_ADDR *
|
|
|
aefb0e1 |
|
|
|
aefb0e1 |
static void tcomplain (void) ATTR_NORETURN;
|
|
|
aefb0e1 |
|
|
|
aefb0e1 |
-static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
|
|
|
aefb0e1 |
+static LONGEST nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
|
|
|
aefb0e1 |
|
|
|
aefb0e1 |
static int return_zero (void);
|
|
|
aefb0e1 |
|
|
|
1592379 |
@@ -286,7 +286,7 @@ target_create_inferior (char *exec_file,
|
|
|
aefb0e1 |
}
|
|
|
aefb0e1 |
|
|
|
407ebe9 |
|
|
|
aefb0e1 |
-static int
|
|
|
aefb0e1 |
+static LONGEST
|
|
|
aefb0e1 |
nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
|
|
|
aefb0e1 |
struct target_ops *t)
|
|
|
aefb0e1 |
{
|
|
|
1592379 |
@@ -507,7 +507,7 @@ update_current_target (void)
|
|
|
eb9d945 |
(void (*) (struct regcache *))
|
|
|
16b31aa |
noprocess);
|
|
|
aefb0e1 |
de_fault (deprecated_xfer_memory,
|
|
|
aefb0e1 |
- (int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *))
|
|
|
9231e41 |
+ (LONGEST (*) (CORE_ADDR, gdb_byte *, LONGEST, int, struct mem_attrib *, struct target_ops *))
|
|
|
16b31aa |
nomemory);
|
|
|
aefb0e1 |
de_fault (to_files_info,
|
|
|
aefb0e1 |
(void (*) (struct target_ops *))
|
|
|
1592379 |
@@ -1237,7 +1237,7 @@ target_xfer_partial (struct target_ops *
|
|
|
aefb0e1 |
it makes no progress, and then return how much was transferred). */
|
|
|
16b31aa |
|
|
|
16b31aa |
int
|
|
|
9231e41 |
-target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
|
|
|
9231e41 |
+target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len)
|
|
|
16b31aa |
{
|
|
|
aefb0e1 |
if (target_read (¤t_target, TARGET_OBJECT_MEMORY, NULL,
|
|
|
aefb0e1 |
myaddr, memaddr, len) == len)
|
|
|
1592379 |
@@ -1247,7 +1247,7 @@ target_read_memory (CORE_ADDR memaddr, g
|
|
|
16b31aa |
}
|
|
|
16b31aa |
|
|
|
16b31aa |
int
|
|
|
9231e41 |
-target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
|
|
|
9231e41 |
+target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, LONGEST len)
|
|
|
16b31aa |
{
|
|
|
aefb0e1 |
if (target_write (¤t_target, TARGET_OBJECT_MEMORY, NULL,
|
|
|
aefb0e1 |
myaddr, memaddr, len) == len)
|
|
|
1592379 |
@@ -2777,8 +2777,8 @@ debug_to_prepare_to_store (struct regcac
|
|
|
16b31aa |
fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
|
|
|
16b31aa |
}
|
|
|
16b31aa |
|
|
|
16b31aa |
-static int
|
|
|
9231e41 |
-deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
|
|
|
16b31aa |
+static LONGEST
|
|
|
9231e41 |
+deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, LONGEST len,
|
|
|
16b31aa |
int write, struct mem_attrib *attrib,
|
|
|
16b31aa |
struct target_ops *target)
|
|
|
16b31aa |
{
|
|
|
1592379 |
@@ -2788,8 +2788,8 @@ deprecated_debug_xfer_memory (CORE_ADDR
|
|
|
16b31aa |
attrib, target);
|
|
|
16b31aa |
|
|
|
16b31aa |
fprintf_unfiltered (gdb_stdlog,
|
|
|
81783d0 |
- "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d",
|
|
|
81783d0 |
- paddress (memaddr), len, write ? "write" : "read",
|
|
|
81783d0 |
+ "target_xfer_memory (%s, xxx, %ld, %s, xxx) = %d",
|
|
|
81783d0 |
+ paddress (memaddr), (long) len, write ? "write" : "read",
|
|
|
81783d0 |
retval);
|
|
|
16b31aa |
|
|
|
16b31aa |
if (retval > 0)
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/target.h
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/target.h 2009-02-27 00:04:32.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/target.h 2009-02-28 07:22:09.000000000 +0100
|
|
|
1592379 |
@@ -376,10 +376,10 @@ struct target_ops
|
|
|
16b31aa |
NOTE: cagney/2004-10-01: This has been entirely superseeded by
|
|
|
16b31aa |
to_xfer_partial and inferior inheritance. */
|
|
|
16b31aa |
|
|
|
9231e41 |
- int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
16b31aa |
- int len, int write,
|
|
|
9231e41 |
- struct mem_attrib *attrib,
|
|
|
9231e41 |
- struct target_ops *target);
|
|
|
9231e41 |
+ LONGEST (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
9231e41 |
+ LONGEST len, int write,
|
|
|
9231e41 |
+ struct mem_attrib *attrib,
|
|
|
9231e41 |
+ struct target_ops *target);
|
|
|
16b31aa |
|
|
|
9231e41 |
void (*to_files_info) (struct target_ops *);
|
|
|
9231e41 |
int (*to_insert_breakpoint) (struct bp_target_info *);
|
|
|
1592379 |
@@ -679,13 +679,14 @@ extern DCACHE *target_dcache;
|
|
|
16b31aa |
|
|
|
16b31aa |
extern int target_read_string (CORE_ADDR, char **, int, int *);
|
|
|
16b31aa |
|
|
|
9231e41 |
-extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
|
|
|
9231e41 |
+extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
9231e41 |
+ LONGEST len);
|
|
|
16b31aa |
|
|
|
9231e41 |
extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
|
|
|
9231e41 |
- int len);
|
|
|
9231e41 |
+ LONGEST len);
|
|
|
16b31aa |
|
|
|
9231e41 |
-extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int,
|
|
|
16b31aa |
- struct mem_attrib *, struct target_ops *);
|
|
|
9231e41 |
+extern LONGEST xfer_memory (CORE_ADDR, gdb_byte *, LONGEST, int,
|
|
|
16b31aa |
+ struct mem_attrib *, struct target_ops *);
|
|
|
16b31aa |
|
|
|
aefb0e1 |
/* Fetches the target's memory map. If one is found it is sorted
|
|
|
aefb0e1 |
and returned, after some consistency checking. Otherwise, NULL
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/dcache.c
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/dcache.c 2009-01-03 06:57:51.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/dcache.c 2009-02-28 07:22:09.000000000 +0100
|
|
|
407ebe9 |
@@ -524,9 +524,9 @@ dcache_free (DCACHE *dcache)
|
|
|
16b31aa |
|
|
|
16b31aa |
This routine is indended to be called by remote_xfer_ functions. */
|
|
|
16b31aa |
|
|
|
16b31aa |
-int
|
|
|
16b31aa |
+LONGEST
|
|
|
9231e41 |
dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
|
|
|
9231e41 |
- int len, int should_write)
|
|
|
16b31aa |
+ LONGEST len, int should_write)
|
|
|
16b31aa |
{
|
|
|
16b31aa |
int i;
|
|
|
9231e41 |
int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr);
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/dcache.h
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/dcache.h 2009-01-03 06:57:51.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/dcache.h 2009-02-28 07:22:09.000000000 +0100
|
|
|
eb9d945 |
@@ -35,7 +35,7 @@ void dcache_free (DCACHE *);
|
|
|
16b31aa |
|
|
|
16b31aa |
/* Simple to call from <remote>_xfer_memory */
|
|
|
16b31aa |
|
|
|
9231e41 |
-int dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my,
|
|
|
9231e41 |
- int len, int should_write);
|
|
|
9231e41 |
+LONGEST dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my,
|
|
|
9231e41 |
+ LONGEST len, int should_write);
|
|
|
16b31aa |
|
|
|
16b31aa |
#endif /* DCACHE_H */
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/exec.c
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/exec.c 2009-02-22 20:35:47.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/exec.c 2009-02-28 07:22:09.000000000 +0100
|
|
|
1592379 |
@@ -464,8 +464,8 @@ map_vmap (bfd *abfd, bfd *arch)
|
|
|
16b31aa |
The same routine is used to handle both core and exec files;
|
|
|
16b31aa |
we just tail-call it with more arguments to select between them. */
|
|
|
16b31aa |
|
|
|
16b31aa |
-int
|
|
|
9231e41 |
-xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
|
|
|
16b31aa |
+LONGEST
|
|
|
9231e41 |
+xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len, int write,
|
|
|
9231e41 |
struct mem_attrib *attrib, struct target_ops *target)
|
|
|
16b31aa |
{
|
|
|
9231e41 |
int res;
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/linux-nat.c
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/linux-nat.c 2009-02-28 07:22:02.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/linux-nat.c 2009-02-28 07:22:32.000000000 +0100
|
|
|
1592379 |
@@ -4407,7 +4407,7 @@ linux_xfer_partial (struct target_ops *o
|
|
|
1592379 |
#endif
|
|
|
9231e41 |
if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
|
|
|
9231e41 |
{ /* This region contains ia64 rse registers, we have to re-read. */
|
|
|
9231e41 |
- int xxfer;
|
|
|
9231e41 |
+ LONGEST xxfer;
|
|
|
9231e41 |
|
|
|
9231e41 |
/* Re-read register stack area. */
|
|
|
9231e41 |
xxfer = super_xfer_partial (ops, object, annex,
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/remote.c
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/remote.c 2009-02-25 03:14:22.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/remote.c 2009-02-28 07:22:09.000000000 +0100
|
|
|
eb9d945 |
@@ -25,6 +25,7 @@
|
|
|
16b31aa |
#include "gdb_string.h"
|
|
|
16b31aa |
#include <ctype.h>
|
|
|
16b31aa |
#include <fcntl.h>
|
|
|
16b31aa |
+#include <limits.h>
|
|
|
16b31aa |
#include "inferior.h"
|
|
|
16b31aa |
#include "bfd.h"
|
|
|
16b31aa |
#include "symfile.h"
|
|
|
1592379 |
@@ -5683,12 +5684,19 @@ handle_notification (char *buf, size_t l
|
|
|
9231e41 |
if SHOULD_WRITE is nonzero. Returns length of data written or
|
|
|
9231e41 |
read; 0 for error. TARGET is unused. */
|
|
|
16b31aa |
|
|
|
16b31aa |
-static int
|
|
|
9231e41 |
-remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len,
|
|
|
16b31aa |
+static LONGEST
|
|
|
9231e41 |
+remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, LONGEST mem_len,
|
|
|
16b31aa |
int should_write, struct mem_attrib *attrib,
|
|
|
16b31aa |
struct target_ops *target)
|
|
|
16b31aa |
{
|
|
|
16b31aa |
int res;
|
|
|
16b31aa |
+ int len;
|
|
|
16b31aa |
+
|
|
|
16b31aa |
+ /* This routine is not set up to handle > INT_MAX bytes. */
|
|
|
16b31aa |
+ if (mem_len >= (LONGEST)INT_MAX)
|
|
|
16b31aa |
+ return 0;
|
|
|
16b31aa |
+
|
|
|
16b31aa |
+ len = (int)mem_len;
|
|
|
16b31aa |
|
|
|
407ebe9 |
set_general_thread (inferior_ptid);
|
|
|
407ebe9 |
|
|
|
1592379 |
@@ -5697,7 +5705,7 @@ remote_xfer_memory (CORE_ADDR mem_addr,
|
|
|
16b31aa |
else
|
|
|
aefb0e1 |
res = remote_read_bytes (mem_addr, buffer, mem_len);
|
|
|
16b31aa |
|
|
|
16b31aa |
- return res;
|
|
|
16b31aa |
+ return (LONGEST)res;
|
|
|
16b31aa |
}
|
|
|
16b31aa |
|
|
|
aefb0e1 |
/* Sends a packet with content determined by the printf format string
|
|
|
1592379 |
Index: gdb-6.8.50.20090226/gdb/remote-sim.c
|
|
|
9231e41 |
===================================================================
|
|
|
1592379 |
--- gdb-6.8.50.20090226.orig/gdb/remote-sim.c 2009-02-23 19:31:23.000000000 +0100
|
|
|
1592379 |
+++ gdb-6.8.50.20090226/gdb/remote-sim.c 2009-02-28 07:22:09.000000000 +0100
|
|
|
1592379 |
@@ -754,11 +754,14 @@ gdbsim_prepare_to_store (struct regcache
|
|
|
16b31aa |
|
|
|
16b31aa |
Returns the number of bytes transferred. */
|
|
|
16b31aa |
|
|
|
16b31aa |
-static int
|
|
|
9231e41 |
-gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
|
|
|
16b31aa |
+static LONGEST
|
|
|
9231e41 |
+gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len,
|
|
|
16b31aa |
int write, struct mem_attrib *attrib,
|
|
|
16b31aa |
struct target_ops *target)
|
|
|
16b31aa |
{
|
|
|
16b31aa |
+ /* Convert to len type that sim_read and sim_write can handle. */
|
|
|
16b31aa |
+ int xfer_len = (int)len;
|
|
|
16b31aa |
+
|
|
|
aefb0e1 |
/* If no program is running yet, then ignore the simulator for
|
|
|
aefb0e1 |
memory. Pass the request down to the next target, hopefully
|
|
|
aefb0e1 |
an exec file. */
|
|
|
1592379 |
@@ -774,22 +777,22 @@ gdbsim_xfer_inferior_memory (CORE_ADDR m
|
|
|
16b31aa |
printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
|
|
|
16b31aa |
gdb_print_host_address (myaddr, gdb_stdout);
|
|
|
16b31aa |
printf_filtered (", memaddr 0x%s, len %d, write %d\n",
|
|
|
16b31aa |
- paddr_nz (memaddr), len, write);
|
|
|
16b31aa |
+ paddr_nz (memaddr), xfer_len, write);
|
|
|
eb9d945 |
if (remote_debug && write)
|
|
|
16b31aa |
- dump_mem (myaddr, len);
|
|
|
16b31aa |
+ dump_mem (myaddr, xfer_len);
|
|
|
16b31aa |
}
|
|
|
16b31aa |
|
|
|
16b31aa |
if (write)
|
|
|
16b31aa |
{
|
|
|
16b31aa |
- len = sim_write (gdbsim_desc, memaddr, myaddr, len);
|
|
|
16b31aa |
+ xfer_len = sim_write (gdbsim_desc, memaddr, myaddr, xfer_len);
|
|
|
16b31aa |
}
|
|
|
16b31aa |
else
|
|
|
16b31aa |
{
|
|
|
16b31aa |
- len = sim_read (gdbsim_desc, memaddr, myaddr, len);
|
|
|
eb9d945 |
- if (remote_debug && len > 0)
|
|
|
16b31aa |
- dump_mem (myaddr, len);
|
|
|
16b31aa |
+ xfer_len = sim_read (gdbsim_desc, memaddr, myaddr, xfer_len);
|
|
|
eb9d945 |
+ if (remote_debug && xfer_len > 0)
|
|
|
16b31aa |
+ dump_mem (myaddr, xfer_len);
|
|
|
16b31aa |
}
|
|
|
16b31aa |
- return len;
|
|
|
16b31aa |
+ return (LONGEST)xfer_len;
|
|
|
16b31aa |
}
|
|
|
16b31aa |
|
|
|
16b31aa |
static void
|