]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-6.3-large-core-20051206.patch
- updated (performance fixes).
[packages/gdb.git] / gdb-6.3-large-core-20051206.patch
CommitLineData
3a58abaf
AM
12005-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
242007-10-15 Jan Kratochvil <jan.kratochvil@redhat.com>
25
26 Port to GDB-6.7.
27
51a5ef0f 28Index: gdb-7.1.90.20100711/gdb/symfile-mem.c
3a58abaf 29===================================================================
51a5ef0f
PS
30--- gdb-7.1.90.20100711.orig/gdb/symfile-mem.c 2010-01-01 08:31:42.000000000 +0100
31+++ gdb-7.1.90.20100711/gdb/symfile-mem.c 2010-07-12 10:46:24.000000000 +0200
32@@ -57,6 +57,14 @@
3a58abaf
AM
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
51a5ef0f 47@@ -77,7 +85,7 @@ symbol_file_add_from_memory (struct bfd
3a58abaf
AM
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
51a5ef0f 56Index: gdb-7.1.90.20100711/gdb/target.c
3a58abaf 57===================================================================
51a5ef0f
PS
58--- gdb-7.1.90.20100711.orig/gdb/target.c 2010-07-12 10:00:56.000000000 +0200
59+++ gdb-7.1.90.20100711/gdb/target.c 2010-07-12 10:47:04.000000000 +0200
60@@ -58,7 +58,7 @@ static int nosymbol (char *, CORE_ADDR *
3a58abaf 61
51a5ef0f 62 static void tcomplain (void) ATTRIBUTE_NORETURN;
3a58abaf
AM
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
51a5ef0f 69@@ -513,7 +513,7 @@ target_terminal_inferior (void)
7566401a 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 {
51a5ef0f 78@@ -718,7 +718,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 *))
51a5ef0f 87@@ -1526,7 +1526,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
51a5ef0f 96@@ -1542,7 +1542,7 @@ target_read_memory (CORE_ADDR memaddr, g
7566401a
ER
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
51a5ef0f
PS
105@@ -1561,7 +1561,7 @@ target_read_stack (CORE_ADDR memaddr, gd
106 Callers that can deal with partial writes should call target_write. */
3a58abaf
AM
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
51a5ef0f 114@@ -3218,8 +3218,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 {
51a5ef0f 125@@ -3229,8 +3229,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)
51a5ef0f 136Index: gdb-7.1.90.20100711/gdb/target.h
3a58abaf 137===================================================================
51a5ef0f
PS
138--- gdb-7.1.90.20100711.orig/gdb/target.h 2010-07-12 10:00:56.000000000 +0200
139+++ gdb-7.1.90.20100711/gdb/target.h 2010-07-12 10:46:24.000000000 +0200
140@@ -417,10 +417,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 154 int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *);
51a5ef0f 155@@ -838,12 +838,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
51a5ef0f 171Index: gdb-7.1.90.20100711/gdb/dcache.c
3a58abaf 172===================================================================
51a5ef0f
PS
173--- gdb-7.1.90.20100711.orig/gdb/dcache.c 2010-05-14 19:53:15.000000000 +0200
174+++ gdb-7.1.90.20100711/gdb/dcache.c 2010-07-12 10:46:24.000000000 +0200
175@@ -465,10 +465,10 @@ dcache_free (DCACHE *dcache)
176 NOTE: This is different than the to_xfer_partial interface, in which
177 positive values less than LEN mean further transfers may be possible. */
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 187 int res;
51a5ef0f 188Index: gdb-7.1.90.20100711/gdb/dcache.h
3a58abaf 189===================================================================
51a5ef0f
PS
190--- gdb-7.1.90.20100711.orig/gdb/dcache.h 2010-01-01 08:31:30.000000000 +0100
191+++ gdb-7.1.90.20100711/gdb/dcache.h 2010-07-12 10:46:24.000000000 +0200
7566401a 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);
51a5ef0f 203Index: gdb-7.1.90.20100711/gdb/exec.c
3a58abaf 204===================================================================
51a5ef0f
PS
205--- gdb-7.1.90.20100711.orig/gdb/exec.c 2010-05-14 20:35:11.000000000 +0200
206+++ gdb-7.1.90.20100711/gdb/exec.c 2010-07-12 10:46:24.000000000 +0200
207@@ -571,7 +571,7 @@ map_vmap (bfd *abfd, bfd *arch)
7566401a
ER
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,
51a5ef0f 216Index: gdb-7.1.90.20100711/gdb/linux-nat.c
3a58abaf 217===================================================================
51a5ef0f
PS
218--- gdb-7.1.90.20100711.orig/gdb/linux-nat.c 2010-07-12 10:44:36.000000000 +0200
219+++ gdb-7.1.90.20100711/gdb/linux-nat.c 2010-07-12 10:46:24.000000000 +0200
220@@ -5197,7 +5197,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,
51a5ef0f 229Index: gdb-7.1.90.20100711/gdb/remote.c
3a58abaf 230===================================================================
51a5ef0f
PS
231--- gdb-7.1.90.20100711.orig/gdb/remote.c 2010-07-07 18:15:16.000000000 +0200
232+++ gdb-7.1.90.20100711/gdb/remote.c 2010-07-12 10:46:24.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"
51a5ef0f 241@@ -6515,12 +6516,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
51a5ef0f 263@@ -6529,7 +6537,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
51a5ef0f 272Index: gdb-7.1.90.20100711/gdb/remote-sim.c
3a58abaf 273===================================================================
51a5ef0f
PS
274--- gdb-7.1.90.20100711.orig/gdb/remote-sim.c 2010-05-16 23:11:14.000000000 +0200
275+++ gdb-7.1.90.20100711/gdb/remote-sim.c 2010-07-12 10:46:24.000000000 +0200
276@@ -759,11 +759,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. */
51a5ef0f 293Index: gdb-7.1.90.20100711/gdb/exec.h
7566401a 294===================================================================
51a5ef0f
PS
295--- gdb-7.1.90.20100711.orig/gdb/exec.h 2010-01-01 08:31:31.000000000 +0100
296+++ gdb-7.1.90.20100711/gdb/exec.h 2010-07-12 10:46:24.000000000 +0200
297@@ -60,7 +60,7 @@ extern int resize_section_table (struct
7566401a
ER
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 *,
This page took 3.23875 seconds and 4 git commands to generate.