]>
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 | ||
7566401a | 28 | Index: gdb-6.8.50.20090909/gdb/symfile-mem.c |
3a58abaf | 29 | =================================================================== |
7566401a ER |
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 | |
3a58abaf AM |
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 | ||
7566401a | 56 | Index: gdb-6.8.50.20090909/gdb/target.c |
3a58abaf | 57 | =================================================================== |
7566401a ER |
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 * | |
3a58abaf AM |
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 | ||
7566401a ER |
69 | @@ -492,7 +492,7 @@ target_terminal_inferior (void) |
70 | (*current_target.to_terminal_inferior) (); | |
3a58abaf AM |
71 | } |
72 | ||
3a58abaf AM |
73 | -static int |
74 | +static LONGEST | |
75 | nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, | |
76 | struct target_ops *t) | |
77 | { | |
7566401a | 78 | @@ -711,7 +711,7 @@ update_current_target (void) |
3a58abaf AM |
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 *)) | |
7566401a | 87 | @@ -1443,7 +1443,7 @@ target_xfer_partial (struct target_ops * |
3a58abaf AM |
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 | { | |
7566401a ER |
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. */ | |
98 | ||
99 | int | |
100 | -target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len) | |
101 | +target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len) | |
102 | { | |
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 | |
3a58abaf AM |
106 | } |
107 | ||
108 | int | |
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) | |
111 | { | |
7566401a ER |
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 | |
3a58abaf AM |
115 | fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n"); |
116 | } | |
117 | ||
118 | -static int | |
119 | -deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, | |
120 | +static LONGEST | |
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) | |
124 | { | |
7566401a | 125 | @@ -2975,8 +2975,8 @@ deprecated_debug_xfer_memory (CORE_ADDR |
3a58abaf AM |
126 | attrib, target); |
127 | ||
128 | fprintf_unfiltered (gdb_stdlog, | |
129 | - "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d", | |
7566401a | 130 | - paddress (target_gdbarch, memaddr), len, |
3a58abaf | 131 | + "target_xfer_memory (%s, xxx, %ld, %s, xxx) = %d", |
7566401a ER |
132 | + paddress (target_gdbarch, memaddr), (long) len, |
133 | write ? "write" : "read", retval); | |
3a58abaf AM |
134 | |
135 | if (retval > 0) | |
7566401a | 136 | Index: gdb-6.8.50.20090909/gdb/target.h |
3a58abaf | 137 | =================================================================== |
7566401a ER |
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 | |
3a58abaf AM |
141 | NOTE: cagney/2004-10-01: This has been entirely superseeded by |
142 | to_xfer_partial and inferior inheritance. */ | |
143 | ||
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); | |
152 | ||
153 | void (*to_files_info) (struct target_ops *); | |
7566401a ER |
154 | int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *); |
155 | @@ -680,12 +680,12 @@ extern void target_dcache_invalidate (vo | |
3a58abaf AM |
156 | |
157 | extern int target_read_string (CORE_ADDR, char **, int, int *); | |
158 | ||
159 | -extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len); | |
7566401a ER |
160 | +extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len); |
161 | ||
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); | |
3a58abaf AM |
164 | |
165 | extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, | |
166 | - int len); | |
167 | + LONGEST len); | |
168 | ||
3a58abaf AM |
169 | /* Fetches the target's memory map. If one is found it is sorted |
170 | and returned, after some consistency checking. Otherwise, NULL | |
7566401a | 171 | Index: gdb-6.8.50.20090909/gdb/dcache.c |
3a58abaf | 172 | =================================================================== |
7566401a ER |
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) | |
3a58abaf | 176 | |
7566401a | 177 | The meaning of the result is the same as for target_write. */ |
3a58abaf AM |
178 | |
179 | -int | |
180 | +LONGEST | |
7566401a ER |
181 | dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache, |
182 | CORE_ADDR memaddr, gdb_byte *myaddr, | |
3a58abaf AM |
183 | - int len, int should_write) |
184 | + LONGEST len, int should_write) | |
185 | { | |
186 | int i; | |
7566401a ER |
187 | int res; |
188 | Index: gdb-6.8.50.20090909/gdb/dcache.h | |
3a58abaf | 189 | =================================================================== |
7566401a ER |
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 *); | |
3a58abaf AM |
193 | |
194 | /* Simple to call from <remote>_xfer_memory */ | |
195 | ||
7566401a ER |
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); | |
3a58abaf | 200 | |
7566401a ER |
201 | void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, |
202 | int len); | |
203 | Index: gdb-6.8.50.20090909/gdb/exec.c | |
3a58abaf | 204 | =================================================================== |
7566401a ER |
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) | |
208 | } | |
209 | \f | |
3a58abaf AM |
210 | |
211 | -int | |
3a58abaf | 212 | +LONGEST |
7566401a ER |
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 | |
3a58abaf | 217 | =================================================================== |
7566401a ER |
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 | |
3a58abaf AM |
221 | #endif |
222 | if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL) | |
223 | { /* This region contains ia64 rse registers, we have to re-read. */ | |
224 | - int xxfer; | |
225 | + LONGEST xxfer; | |
226 | ||
227 | /* Re-read register stack area. */ | |
228 | xxfer = super_xfer_partial (ops, object, annex, | |
7566401a | 229 | Index: gdb-6.8.50.20090909/gdb/remote.c |
3a58abaf | 230 | =================================================================== |
7566401a ER |
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 | |
3a58abaf AM |
233 | @@ -25,6 +25,7 @@ |
234 | #include "gdb_string.h" | |
235 | #include <ctype.h> | |
236 | #include <fcntl.h> | |
237 | +#include <limits.h> | |
238 | #include "inferior.h" | |
239 | #include "bfd.h" | |
240 | #include "symfile.h" | |
7566401a | 241 | @@ -5764,12 +5765,19 @@ handle_notification (char *buf, size_t l |
3a58abaf AM |
242 | if SHOULD_WRITE is nonzero. Returns length of data written or |
243 | read; 0 for error. TARGET is unused. */ | |
244 | ||
245 | -static int | |
246 | -remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len, | |
247 | +static LONGEST | |
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) | |
251 | { | |
252 | int res; | |
253 | + int len; | |
254 | + | |
255 | + /* This routine is not set up to handle > INT_MAX bytes. */ | |
256 | + if (mem_len >= (LONGEST)INT_MAX) | |
257 | + return 0; | |
258 | + | |
259 | + len = (int)mem_len; | |
260 | ||
261 | set_general_thread (inferior_ptid); | |
262 | ||
7566401a | 263 | @@ -5778,7 +5786,7 @@ remote_xfer_memory (CORE_ADDR mem_addr, |
3a58abaf AM |
264 | else |
265 | res = remote_read_bytes (mem_addr, buffer, mem_len); | |
266 | ||
267 | - return res; | |
268 | + return (LONGEST)res; | |
269 | } | |
270 | ||
271 | /* Sends a packet with content determined by the printf format string | |
7566401a | 272 | Index: gdb-6.8.50.20090909/gdb/remote-sim.c |
3a58abaf | 273 | =================================================================== |
7566401a ER |
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 | |
3a58abaf AM |
277 | |
278 | Returns the number of bytes transferred. */ | |
279 | ||
280 | -static int | |
281 | -gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, | |
282 | +static LONGEST | |
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) | |
286 | { | |
287 | + /* Convert to len type that sim_read and sim_write can handle. */ | |
288 | + int xfer_len = (int)len; | |
289 | + | |
290 | /* If no program is running yet, then ignore the simulator for | |
291 | memory. Pass the request down to the next target, hopefully | |
292 | an exec file. */ | |
7566401a ER |
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 | |
298 | ||
299 | One, and only one, of readbuf or writebuf must be non-NULL. */ | |
3a58abaf | 300 | |
7566401a ER |
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 *, | |
303 | ULONGEST, LONGEST, | |
304 | struct target_section *, | |
305 | struct target_section *, |