]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | 2005-12-14 Jeff Johnston <jjohnstn@redhat.com> |
2 | ||
3 | * symfile-mem.c (read_memory): New static read callback function. | |
4 | (symfile_add_from_memory): Pass read_memory to bfd instead of | |
5 | target_read_memory. | |
6 | * target.c (target_xfer_memory): Add support for LONGEST len and | |
7 | change all callers. | |
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. | |
20 | * linux-nat.h: Ditto. | |
21 | * remote.h: Ditto. | |
22 | * dcache.h: Ditto. | |
23 | ||
24 | 2007-10-15 Jan Kratochvil <jan.kratochvil@redhat.com> | |
25 | ||
26 | Port to GDB-6.7. | |
27 | ||
28 | Index: gdb-6.8.50.20090226/gdb/symfile-mem.c | |
29 | =================================================================== | |
30 | --- gdb-6.8.50.20090226.orig/gdb/symfile-mem.c 2009-02-21 17:14:49.000000000 +0100 | |
31 | +++ gdb-6.8.50.20090226/gdb/symfile-mem.c 2009-02-28 07:22:09.000000000 +0100 | |
32 | @@ -56,6 +56,14 @@ | |
33 | #include "elf/common.h" | |
34 | ||
35 | ||
36 | +/* Local callback routine to pass to bfd to read from target memory, | |
37 | + using a len constrained to INT_MAX. */ | |
38 | +static int | |
39 | +read_target_memory (bfd_vma addr, bfd_byte *buf, int len) | |
40 | +{ | |
41 | + return target_read_memory (addr, buf, (LONGEST)len); | |
42 | +} | |
43 | + | |
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")); | |
49 | ||
50 | nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase, | |
51 | - target_read_memory); | |
52 | + read_target_memory); | |
53 | if (nbfd == NULL) | |
54 | error (_("Failed to read a valid object file image from memory.")); | |
55 | ||
56 | Index: gdb-6.8.50.20090226/gdb/target.c | |
57 | =================================================================== | |
58 | --- gdb-6.8.50.20090226.orig/gdb/target.c 2009-02-27 00:04:32.000000000 +0100 | |
59 | +++ gdb-6.8.50.20090226/gdb/target.c 2009-02-28 07:22:09.000000000 +0100 | |
60 | @@ -57,7 +57,7 @@ static int nosymbol (char *, CORE_ADDR * | |
61 | ||
62 | static void tcomplain (void) ATTR_NORETURN; | |
63 | ||
64 | -static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *); | |
65 | +static LONGEST nomemory (CORE_ADDR, char *, int, int, struct target_ops *); | |
66 | ||
67 | static int return_zero (void); | |
68 | ||
69 | @@ -286,7 +286,7 @@ target_create_inferior (char *exec_file, | |
70 | } | |
71 | ||
72 | ||
73 | -static int | |
74 | +static LONGEST | |
75 | nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, | |
76 | struct target_ops *t) | |
77 | { | |
78 | @@ -507,7 +507,7 @@ update_current_target (void) | |
79 | (void (*) (struct regcache *)) | |
80 | noprocess); | |
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 *)) | |
84 | nomemory); | |
85 | de_fault (to_files_info, | |
86 | (void (*) (struct target_ops *)) | |
87 | @@ -1237,7 +1237,7 @@ target_xfer_partial (struct target_ops * | |
88 | it makes no progress, and then return how much was transferred). */ | |
89 | ||
90 | int | |
91 | -target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len) | |
92 | +target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len) | |
93 | { | |
94 | if (target_read (¤t_target, TARGET_OBJECT_MEMORY, NULL, | |
95 | myaddr, memaddr, len) == len) | |
96 | @@ -1247,7 +1247,7 @@ target_read_memory (CORE_ADDR memaddr, g | |
97 | } | |
98 | ||
99 | int | |
100 | -target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len) | |
101 | +target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, LONGEST len) | |
102 | { | |
103 | if (target_write (¤t_target, TARGET_OBJECT_MEMORY, NULL, | |
104 | myaddr, memaddr, len) == len) | |
105 | @@ -2777,8 +2777,8 @@ debug_to_prepare_to_store (struct regcac | |
106 | fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n"); | |
107 | } | |
108 | ||
109 | -static int | |
110 | -deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, | |
111 | +static LONGEST | |
112 | +deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, LONGEST len, | |
113 | int write, struct mem_attrib *attrib, | |
114 | struct target_ops *target) | |
115 | { | |
116 | @@ -2788,8 +2788,8 @@ deprecated_debug_xfer_memory (CORE_ADDR | |
117 | attrib, target); | |
118 | ||
119 | fprintf_unfiltered (gdb_stdlog, | |
120 | - "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d", | |
121 | - paddress (memaddr), len, write ? "write" : "read", | |
122 | + "target_xfer_memory (%s, xxx, %ld, %s, xxx) = %d", | |
123 | + paddress (memaddr), (long) len, write ? "write" : "read", | |
124 | retval); | |
125 | ||
126 | if (retval > 0) | |
127 | Index: gdb-6.8.50.20090226/gdb/target.h | |
128 | =================================================================== | |
129 | --- gdb-6.8.50.20090226.orig/gdb/target.h 2009-02-27 00:04:32.000000000 +0100 | |
130 | +++ gdb-6.8.50.20090226/gdb/target.h 2009-02-28 07:22:09.000000000 +0100 | |
131 | @@ -376,10 +376,10 @@ struct target_ops | |
132 | NOTE: cagney/2004-10-01: This has been entirely superseeded by | |
133 | to_xfer_partial and inferior inheritance. */ | |
134 | ||
135 | - int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr, | |
136 | - int len, int write, | |
137 | - struct mem_attrib *attrib, | |
138 | - struct target_ops *target); | |
139 | + LONGEST (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr, | |
140 | + LONGEST len, int write, | |
141 | + struct mem_attrib *attrib, | |
142 | + struct target_ops *target); | |
143 | ||
144 | void (*to_files_info) (struct target_ops *); | |
145 | int (*to_insert_breakpoint) (struct bp_target_info *); | |
146 | @@ -679,13 +679,14 @@ extern DCACHE *target_dcache; | |
147 | ||
148 | extern int target_read_string (CORE_ADDR, char **, int, int *); | |
149 | ||
150 | -extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len); | |
151 | +extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, | |
152 | + LONGEST len); | |
153 | ||
154 | extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, | |
155 | - int len); | |
156 | + LONGEST len); | |
157 | ||
158 | -extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int, | |
159 | - struct mem_attrib *, struct target_ops *); | |
160 | +extern LONGEST xfer_memory (CORE_ADDR, gdb_byte *, LONGEST, int, | |
161 | + struct mem_attrib *, struct target_ops *); | |
162 | ||
163 | /* Fetches the target's memory map. If one is found it is sorted | |
164 | and returned, after some consistency checking. Otherwise, NULL | |
165 | Index: gdb-6.8.50.20090226/gdb/dcache.c | |
166 | =================================================================== | |
167 | --- gdb-6.8.50.20090226.orig/gdb/dcache.c 2009-01-03 06:57:51.000000000 +0100 | |
168 | +++ gdb-6.8.50.20090226/gdb/dcache.c 2009-02-28 07:22:09.000000000 +0100 | |
169 | @@ -524,9 +524,9 @@ dcache_free (DCACHE *dcache) | |
170 | ||
171 | This routine is indended to be called by remote_xfer_ functions. */ | |
172 | ||
173 | -int | |
174 | +LONGEST | |
175 | dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, | |
176 | - int len, int should_write) | |
177 | + LONGEST len, int should_write) | |
178 | { | |
179 | int i; | |
180 | int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr); | |
181 | Index: gdb-6.8.50.20090226/gdb/dcache.h | |
182 | =================================================================== | |
183 | --- gdb-6.8.50.20090226.orig/gdb/dcache.h 2009-01-03 06:57:51.000000000 +0100 | |
184 | +++ gdb-6.8.50.20090226/gdb/dcache.h 2009-02-28 07:22:09.000000000 +0100 | |
185 | @@ -35,7 +35,7 @@ void dcache_free (DCACHE *); | |
186 | ||
187 | /* Simple to call from <remote>_xfer_memory */ | |
188 | ||
189 | -int dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my, | |
190 | - int len, int should_write); | |
191 | +LONGEST dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my, | |
192 | + LONGEST len, int should_write); | |
193 | ||
194 | #endif /* DCACHE_H */ | |
195 | Index: gdb-6.8.50.20090226/gdb/exec.c | |
196 | =================================================================== | |
197 | --- gdb-6.8.50.20090226.orig/gdb/exec.c 2009-02-22 20:35:47.000000000 +0100 | |
198 | +++ gdb-6.8.50.20090226/gdb/exec.c 2009-02-28 07:22:09.000000000 +0100 | |
199 | @@ -464,8 +464,8 @@ map_vmap (bfd *abfd, bfd *arch) | |
200 | The same routine is used to handle both core and exec files; | |
201 | we just tail-call it with more arguments to select between them. */ | |
202 | ||
203 | -int | |
204 | -xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write, | |
205 | +LONGEST | |
206 | +xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len, int write, | |
207 | struct mem_attrib *attrib, struct target_ops *target) | |
208 | { | |
209 | int res; | |
210 | Index: gdb-6.8.50.20090226/gdb/linux-nat.c | |
211 | =================================================================== | |
212 | --- gdb-6.8.50.20090226.orig/gdb/linux-nat.c 2009-02-28 07:22:02.000000000 +0100 | |
213 | +++ gdb-6.8.50.20090226/gdb/linux-nat.c 2009-02-28 07:22:32.000000000 +0100 | |
214 | @@ -4407,7 +4407,7 @@ linux_xfer_partial (struct target_ops *o | |
215 | #endif | |
216 | if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL) | |
217 | { /* This region contains ia64 rse registers, we have to re-read. */ | |
218 | - int xxfer; | |
219 | + LONGEST xxfer; | |
220 | ||
221 | /* Re-read register stack area. */ | |
222 | xxfer = super_xfer_partial (ops, object, annex, | |
223 | Index: gdb-6.8.50.20090226/gdb/remote.c | |
224 | =================================================================== | |
225 | --- gdb-6.8.50.20090226.orig/gdb/remote.c 2009-02-25 03:14:22.000000000 +0100 | |
226 | +++ gdb-6.8.50.20090226/gdb/remote.c 2009-02-28 07:22:09.000000000 +0100 | |
227 | @@ -25,6 +25,7 @@ | |
228 | #include "gdb_string.h" | |
229 | #include <ctype.h> | |
230 | #include <fcntl.h> | |
231 | +#include <limits.h> | |
232 | #include "inferior.h" | |
233 | #include "bfd.h" | |
234 | #include "symfile.h" | |
235 | @@ -5683,12 +5684,19 @@ handle_notification (char *buf, size_t l | |
236 | if SHOULD_WRITE is nonzero. Returns length of data written or | |
237 | read; 0 for error. TARGET is unused. */ | |
238 | ||
239 | -static int | |
240 | -remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len, | |
241 | +static LONGEST | |
242 | +remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, LONGEST mem_len, | |
243 | int should_write, struct mem_attrib *attrib, | |
244 | struct target_ops *target) | |
245 | { | |
246 | int res; | |
247 | + int len; | |
248 | + | |
249 | + /* This routine is not set up to handle > INT_MAX bytes. */ | |
250 | + if (mem_len >= (LONGEST)INT_MAX) | |
251 | + return 0; | |
252 | + | |
253 | + len = (int)mem_len; | |
254 | ||
255 | set_general_thread (inferior_ptid); | |
256 | ||
257 | @@ -5697,7 +5705,7 @@ remote_xfer_memory (CORE_ADDR mem_addr, | |
258 | else | |
259 | res = remote_read_bytes (mem_addr, buffer, mem_len); | |
260 | ||
261 | - return res; | |
262 | + return (LONGEST)res; | |
263 | } | |
264 | ||
265 | /* Sends a packet with content determined by the printf format string | |
266 | Index: gdb-6.8.50.20090226/gdb/remote-sim.c | |
267 | =================================================================== | |
268 | --- gdb-6.8.50.20090226.orig/gdb/remote-sim.c 2009-02-23 19:31:23.000000000 +0100 | |
269 | +++ gdb-6.8.50.20090226/gdb/remote-sim.c 2009-02-28 07:22:09.000000000 +0100 | |
270 | @@ -754,11 +754,14 @@ gdbsim_prepare_to_store (struct regcache | |
271 | ||
272 | Returns the number of bytes transferred. */ | |
273 | ||
274 | -static int | |
275 | -gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, | |
276 | +static LONGEST | |
277 | +gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len, | |
278 | int write, struct mem_attrib *attrib, | |
279 | struct target_ops *target) | |
280 | { | |
281 | + /* Convert to len type that sim_read and sim_write can handle. */ | |
282 | + int xfer_len = (int)len; | |
283 | + | |
284 | /* If no program is running yet, then ignore the simulator for | |
285 | memory. Pass the request down to the next target, hopefully | |
286 | an exec file. */ | |
287 | @@ -774,22 +777,22 @@ gdbsim_xfer_inferior_memory (CORE_ADDR m | |
288 | printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x"); | |
289 | gdb_print_host_address (myaddr, gdb_stdout); | |
290 | printf_filtered (", memaddr 0x%s, len %d, write %d\n", | |
291 | - paddr_nz (memaddr), len, write); | |
292 | + paddr_nz (memaddr), xfer_len, write); | |
293 | if (remote_debug && write) | |
294 | - dump_mem (myaddr, len); | |
295 | + dump_mem (myaddr, xfer_len); | |
296 | } | |
297 | ||
298 | if (write) | |
299 | { | |
300 | - len = sim_write (gdbsim_desc, memaddr, myaddr, len); | |
301 | + xfer_len = sim_write (gdbsim_desc, memaddr, myaddr, xfer_len); | |
302 | } | |
303 | else | |
304 | { | |
305 | - len = sim_read (gdbsim_desc, memaddr, myaddr, len); | |
306 | - if (remote_debug && len > 0) | |
307 | - dump_mem (myaddr, len); | |
308 | + xfer_len = sim_read (gdbsim_desc, memaddr, myaddr, xfer_len); | |
309 | + if (remote_debug && xfer_len > 0) | |
310 | + dump_mem (myaddr, xfer_len); | |
311 | } | |
312 | - return len; | |
313 | + return (LONGEST)xfer_len; | |
314 | } | |
315 | ||
316 | static void |