1 2005-12-14 Jeff Johnston <jjohnstn@redhat.com>
3 * symfile-mem.c (read_memory): New static read callback function.
4 (symfile_add_from_memory): Pass read_memory to bfd instead of
6 * target.c (target_xfer_memory): Add support for LONGEST len and
8 (deprecated_debug_xfer_memory, target_read_memory): Ditto.
9 (target_write_memory, do_xfer_memory): Ditto.
10 (target_xfer_memory_partial, target_read_memory_partial): Ditto.
11 (target_write_memory_partial): Ditto.
12 * infptrace.c (child_xfer_memory): Ditto.
13 * linux-nat.c (linux_nat_xfer_memory): Ditto.
14 (linux_nat_proc_xfer_memory): Ditto.
15 * dcache.c (dcache_xfer_memory): Ditto.
16 * exec.c (xfer_memory): Ditto.
17 * remote.c (remote_xfer_memory): Ditto.
18 * remote-sim.c (gdbsim_xfer_interior_memory): Ditto.
19 * target.h: Change prototypes for functions changed above.
24 2007-10-15 Jan Kratochvil <jan.kratochvil@redhat.com>
28 Index: gdb-6.8.50.20090909/gdb/symfile-mem.c
29 ===================================================================
30 --- gdb-6.8.50.20090909.orig/gdb/symfile-mem.c 2009-07-02 19:21:06.000000000 +0200
31 +++ gdb-6.8.50.20090909/gdb/symfile-mem.c 2009-09-09 19:06:57.000000000 +0200
33 #include "elf/common.h"
36 +/* Local callback routine to pass to bfd to read from target memory,
37 + using a len constrained to INT_MAX. */
39 +read_target_memory (bfd_vma addr, bfd_byte *buf, int len)
41 + return target_read_memory (addr, buf, (LONGEST)len);
44 /* Read inferior memory at ADDR to find the header of a loaded object file
45 and read its in-core symbols out of inferior memory. TEMPL is a bfd
46 representing the target's format. NAME is the name to use for this
47 @@ -76,7 +84,7 @@ symbol_file_add_from_memory (struct bfd
48 error (_("add-symbol-file-from-memory not supported for this target"));
50 nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase,
51 - target_read_memory);
52 + read_target_memory);
54 error (_("Failed to read a valid object file image from memory."));
56 Index: gdb-6.8.50.20090909/gdb/target.c
57 ===================================================================
58 --- gdb-6.8.50.20090909.orig/gdb/target.c 2009-09-09 19:05:56.000000000 +0200
59 +++ gdb-6.8.50.20090909/gdb/target.c 2009-09-09 19:08:11.000000000 +0200
60 @@ -59,7 +59,7 @@ static int nosymbol (char *, CORE_ADDR *
62 static void tcomplain (void) ATTR_NORETURN;
64 -static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
65 +static LONGEST nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
67 static int return_zero (void);
69 @@ -492,7 +492,7 @@ target_terminal_inferior (void)
70 (*current_target.to_terminal_inferior) ();
75 nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
78 @@ -711,7 +711,7 @@ update_current_target (void)
79 (void (*) (struct regcache *))
81 de_fault (deprecated_xfer_memory,
82 - (int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *))
83 + (LONGEST (*) (CORE_ADDR, gdb_byte *, LONGEST, int, struct mem_attrib *, struct target_ops *))
85 de_fault (to_files_info,
86 (void (*) (struct target_ops *))
87 @@ -1443,7 +1443,7 @@ target_xfer_partial (struct target_ops *
88 it makes no progress, and then return how much was transferred). */
91 -target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
92 +target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len)
94 /* Dispatch to the topmost target, not the flattened current_target.
95 Memory accesses check target->to_has_(all_)memory, and the
96 @@ -1459,7 +1459,7 @@ target_read_memory (CORE_ADDR memaddr, g
97 the target's stack. This may trigger different cache behavior. */
100 -target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
101 +target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len)
103 /* Dispatch to the topmost target, not the flattened current_target.
104 Memory accesses check target->to_has_(all_)memory, and the
105 @@ -1473,7 +1473,7 @@ target_read_stack (CORE_ADDR memaddr, gd
109 -target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
110 +target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, LONGEST len)
112 /* Dispatch to the topmost target, not the flattened current_target.
113 Memory accesses check target->to_has_(all_)memory, and the
114 @@ -2964,8 +2964,8 @@ debug_to_prepare_to_store (struct regcac
115 fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
119 -deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
121 +deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, LONGEST len,
122 int write, struct mem_attrib *attrib,
123 struct target_ops *target)
125 @@ -2975,8 +2975,8 @@ deprecated_debug_xfer_memory (CORE_ADDR
128 fprintf_unfiltered (gdb_stdlog,
129 - "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d",
130 - paddress (target_gdbarch, memaddr), len,
131 + "target_xfer_memory (%s, xxx, %ld, %s, xxx) = %d",
132 + paddress (target_gdbarch, memaddr), (long) len,
133 write ? "write" : "read", retval);
136 Index: gdb-6.8.50.20090909/gdb/target.h
137 ===================================================================
138 --- gdb-6.8.50.20090909.orig/gdb/target.h 2009-09-09 19:05:56.000000000 +0200
139 +++ gdb-6.8.50.20090909/gdb/target.h 2009-09-09 19:07:36.000000000 +0200
140 @@ -366,10 +366,10 @@ struct target_ops
141 NOTE: cagney/2004-10-01: This has been entirely superseeded by
142 to_xfer_partial and inferior inheritance. */
144 - int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
145 - int len, int write,
146 - struct mem_attrib *attrib,
147 - struct target_ops *target);
148 + LONGEST (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
149 + LONGEST len, int write,
150 + struct mem_attrib *attrib,
151 + struct target_ops *target);
153 void (*to_files_info) (struct target_ops *);
154 int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *);
155 @@ -680,12 +680,12 @@ extern void target_dcache_invalidate (vo
157 extern int target_read_string (CORE_ADDR, char **, int, int *);
159 -extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
160 +extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len);
162 -extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
163 +extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len);
165 extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
169 /* Fetches the target's memory map. If one is found it is sorted
170 and returned, after some consistency checking. Otherwise, NULL
171 Index: gdb-6.8.50.20090909/gdb/dcache.c
172 ===================================================================
173 --- gdb-6.8.50.20090909.orig/gdb/dcache.c 2009-08-31 22:18:45.000000000 +0200
174 +++ gdb-6.8.50.20090909/gdb/dcache.c 2009-09-09 19:09:21.000000000 +0200
175 @@ -390,10 +390,10 @@ dcache_free (DCACHE *dcache)
177 The meaning of the result is the same as for target_write. */
181 dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache,
182 CORE_ADDR memaddr, gdb_byte *myaddr,
183 - int len, int should_write)
184 + LONGEST len, int should_write)
188 Index: gdb-6.8.50.20090909/gdb/dcache.h
189 ===================================================================
190 --- gdb-6.8.50.20090909.orig/gdb/dcache.h 2009-08-31 22:18:45.000000000 +0200
191 +++ gdb-6.8.50.20090909/gdb/dcache.h 2009-09-09 19:08:54.000000000 +0200
192 @@ -35,8 +35,8 @@ void dcache_free (DCACHE *);
194 /* Simple to call from <remote>_xfer_memory */
196 -int dcache_xfer_memory (struct target_ops *ops, DCACHE *cache, CORE_ADDR mem,
197 - gdb_byte *my, int len, int should_write);
198 +LONGEST dcache_xfer_memory (struct target_ops *ops, DCACHE *cache, CORE_ADDR mem,
199 + gdb_byte *my, LONGEST len, int should_write);
201 void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
203 Index: gdb-6.8.50.20090909/gdb/exec.c
204 ===================================================================
205 --- gdb-6.8.50.20090909.orig/gdb/exec.c 2009-07-02 19:21:06.000000000 +0200
206 +++ gdb-6.8.50.20090909/gdb/exec.c 2009-09-09 19:06:57.000000000 +0200
207 @@ -560,7 +560,7 @@ map_vmap (bfd *abfd, bfd *arch)
213 section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
214 ULONGEST offset, LONGEST len,
215 struct target_section *sections,
216 Index: gdb-6.8.50.20090909/gdb/linux-nat.c
217 ===================================================================
218 --- gdb-6.8.50.20090909.orig/gdb/linux-nat.c 2009-09-09 19:06:46.000000000 +0200
219 +++ gdb-6.8.50.20090909/gdb/linux-nat.c 2009-09-09 19:06:57.000000000 +0200
220 @@ -4622,7 +4622,7 @@ linux_xfer_partial (struct target_ops *o
222 if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
223 { /* This region contains ia64 rse registers, we have to re-read. */
227 /* Re-read register stack area. */
228 xxfer = super_xfer_partial (ops, object, annex,
229 Index: gdb-6.8.50.20090909/gdb/remote.c
230 ===================================================================
231 --- gdb-6.8.50.20090909.orig/gdb/remote.c 2009-08-18 18:17:16.000000000 +0200
232 +++ gdb-6.8.50.20090909/gdb/remote.c 2009-09-09 19:06:57.000000000 +0200
234 #include "gdb_string.h"
238 #include "inferior.h"
241 @@ -5764,12 +5765,19 @@ handle_notification (char *buf, size_t l
242 if SHOULD_WRITE is nonzero. Returns length of data written or
243 read; 0 for error. TARGET is unused. */
246 -remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len,
248 +remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, LONGEST mem_len,
249 int should_write, struct mem_attrib *attrib,
250 struct target_ops *target)
255 + /* This routine is not set up to handle > INT_MAX bytes. */
256 + if (mem_len >= (LONGEST)INT_MAX)
259 + len = (int)mem_len;
261 set_general_thread (inferior_ptid);
263 @@ -5778,7 +5786,7 @@ remote_xfer_memory (CORE_ADDR mem_addr,
265 res = remote_read_bytes (mem_addr, buffer, mem_len);
268 + return (LONGEST)res;
271 /* Sends a packet with content determined by the printf format string
272 Index: gdb-6.8.50.20090909/gdb/remote-sim.c
273 ===================================================================
274 --- gdb-6.8.50.20090909.orig/gdb/remote-sim.c 2009-07-02 19:21:06.000000000 +0200
275 +++ gdb-6.8.50.20090909/gdb/remote-sim.c 2009-09-09 19:06:57.000000000 +0200
276 @@ -752,11 +752,14 @@ gdbsim_prepare_to_store (struct regcache
278 Returns the number of bytes transferred. */
281 -gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
283 +gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len,
284 int write, struct mem_attrib *attrib,
285 struct target_ops *target)
287 + /* Convert to len type that sim_read and sim_write can handle. */
288 + int xfer_len = (int)len;
290 /* If no program is running yet, then ignore the simulator for
291 memory. Pass the request down to the next target, hopefully
293 Index: gdb-6.8.50.20090909/gdb/exec.h
294 ===================================================================
295 --- gdb-6.8.50.20090909.orig/gdb/exec.h 2009-06-12 20:38:36.000000000 +0200
296 +++ gdb-6.8.50.20090909/gdb/exec.h 2009-09-09 19:06:57.000000000 +0200
297 @@ -56,7 +56,7 @@ extern int resize_section_table (struct
299 One, and only one, of readbuf or writebuf must be non-NULL. */
301 -extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
302 +extern LONGEST section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
304 struct target_section *,
305 struct target_section *,