aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog19
-rw-r--r--gdb/dcache.c33
-rw-r--r--gdb/dcache.h10
-rw-r--r--gdb/remote-bug.c71
-rw-r--r--gdb/remote-nindy.c86
-rw-r--r--gdb/remote-utils.c21
-rw-r--r--gdb/remote-utils.h2
-rw-r--r--gdb/remote.c35
8 files changed, 27 insertions, 250 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f67c9ca..d9df8ad 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+2000-06-19 J.T. Conklin <jtc@redback.com>
+
+ * remote-nindy.c (nindy_fetch_word, nindy_store_word): Removed
+ (nindy_xfer_inferior_memory): Use dcache_xfer_memory() instead of
+ breaking transfer into chunks and using nindy_fetch_word() and
+ nindy_store_word().
+
+ * remote-bug.c (bug_xfer_memory): Use dcache_xfer_memory() instead
+ of breaking transfer into chunks and using gr_fetch_word() and
+ gr_store_word().
+
+ * remote.c (remote_fetch_word, remote_store_word): Removed.
+
+ * remote-utils.h (gr_fetch_word, gr_store_word): Removed.
+ * remote-utils.c (gr_fetch_word, gr_store_word): Removed.
+
+ * dcache.h (dcache_fetch, dcache_poke, dcache_poke_block): Removed.
+ * dcache.c (dcache_fetch, dcache_poke): Removed.
+
2000-06-16 Pierre Muller <muller@ics.u-strasbg.fr>
* defs.h: define language_pascal in language enumeration.
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 538f77e..1c52cc3 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -378,22 +378,6 @@ dcache_writeback (dcache)
}
-/* Using the data cache DCACHE return the contents of the word at
- address ADDR in the remote machine. */
-int
-dcache_fetch (dcache, addr)
- DCACHE *dcache;
- CORE_ADDR addr;
-{
- int res;
-
- if (dcache_xfer_memory (dcache, addr, (char *) &res, sizeof res, 0) != sizeof res)
- memory_error (EIO, addr);
-
- return res;
-}
-
-
/* Write the byte at PTR into ADDR in the data cache.
Return zero on write error.
*/
@@ -419,23 +403,6 @@ dcache_poke_byte (dcache, addr, ptr)
return 1;
}
-/* Write the word at ADDR both in the data cache and in the remote machine.
- Return zero on write error.
- */
-
-int
-dcache_poke (dcache, addr, data)
- DCACHE *dcache;
- CORE_ADDR addr;
- int data;
-{
- if (dcache_xfer_memory (dcache, addr, (char *) &data, sizeof data, 1) != sizeof data)
- return 0;
-
- return dcache_writeback (dcache);
-}
-
-
/* Initialize the data cache. */
DCACHE *
dcache_init (reading, writing)
diff --git a/gdb/dcache.h b/gdb/dcache.h
index d13708f..928173d 100644
--- a/gdb/dcache.h
+++ b/gdb/dcache.h
@@ -27,27 +27,17 @@ typedef int (*memxferfunc) (CORE_ADDR memaddr, char *myaddr, int len);
typedef struct dcache_struct DCACHE;
-/* Using the data cache DCACHE return the contents of the word at
- address ADDR in the remote machine. */
-int dcache_fetch (DCACHE * dcache, CORE_ADDR addr);
-
/* Flush DCACHE. */
void dcache_flush (DCACHE * dcache);
/* Initialize DCACHE. */
DCACHE *dcache_init (memxferfunc reading, memxferfunc writing);
-/* Write the word at ADDR both in the data cache and in the remote machine. */
-int dcache_poke (DCACHE * dcache, CORE_ADDR addr, int data);
-
/* Simple to call from <remote>_xfer_memory */
int dcache_xfer_memory (DCACHE * cache, CORE_ADDR mem, char *my, int len,
int should_write);
-/* Write the bytes at ADDR into the data cache and the remote machine. */
-int dcache_poke_block (DCACHE * cache, CORE_ADDR mem, char *my, int len);
-
/* Turn dcache state on or off */
void set_dcache_state (int);
diff --git a/gdb/remote-bug.c b/gdb/remote-bug.c
index 6c331a1..e3a5a67 100644
--- a/gdb/remote-bug.c
+++ b/gdb/remote-bug.c
@@ -575,75 +575,10 @@ bug_xfer_memory (memaddr, myaddr, len, write, target)
int write;
struct target_ops *target; /* ignored */
{
- register int i;
+ if (len <= 0)
+ return 0;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr;
-
- /* Round ending address up; get number of longwords that makes. */
- register int count;
-
- /* Allocate buffer of that many longwords. */
- register int *buffer;
-
- addr = memaddr & -sizeof (int);
- count = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-
- buffer = (int *) alloca (count * sizeof (int));
-
- if (write)
- {
- /* Fill start and end extra bytes of buffer with existing memory data. */
-
- if (addr != memaddr || len < (int) sizeof (int))
- {
- /* Need part of initial word -- fetch it. */
- buffer[0] = gr_fetch_word (addr);
- }
-
- if (count > 1) /* FIXME, avoid if even boundary */
- {
- buffer[count - 1]
- = gr_fetch_word (addr + (count - 1) * sizeof (int));
- }
-
- /* Copy data to be written over corresponding part of buffer */
-
- memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
- /* Write the entire buffer. */
-
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- gr_store_word (addr, buffer[i]);
- if (errno)
- {
-
- return 0;
- }
-
- }
- }
- else
- {
- /* Read all the longwords */
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- buffer[i] = gr_fetch_word (addr);
- if (errno)
- {
- return 0;
- }
- QUIT;
- }
-
- /* Copy appropriate bytes out of the buffer. */
- memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
- }
-
- return len;
+ return dcache_xfer_memory (gr_get_dcache (), memaddr, myaddr, len, write);
}
static void
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index 8350547..fb8b5e2 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -487,34 +487,9 @@ nindy_store_registers (regno)
immediate_quit--;
}
-/* Read a word from remote address ADDR and return it.
- * This goes through the data cache.
- */
-int
-nindy_fetch_word (addr)
- CORE_ADDR addr;
-{
- return dcache_fetch (nindy_dcache, addr);
-}
-
-/* Write a word WORD into remote address ADDR.
- This goes through the data cache. */
-
-void
-nindy_store_word (addr, word)
- CORE_ADDR addr;
- int word;
-{
- dcache_poke (nindy_dcache, addr, word);
-}
-
/* Copy LEN bytes to or from inferior's memory starting at MEMADDR
to debugger memory starting at MYADDR. Copy to inferior if
- WRITE is nonzero. Returns the length copied.
-
- This is stolen almost directly from infptrace.c's child_xfer_memory,
- which also deals with a word-oriented memory interface. Sometime,
- FIXME, rewrite this to not use the word-oriented routines. */
+ SHOULD_WRITE is nonzero. Returns the length copied. */
int
nindy_xfer_inferior_memory (memaddr, myaddr, len, should_write, target)
@@ -524,61 +499,10 @@ nindy_xfer_inferior_memory (memaddr, myaddr, len, should_write, target)
int should_write;
struct target_ops *target; /* ignored */
{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & -sizeof (int);
- /* Round ending address up; get number of longwords that makes. */
- register int count
- = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca (count * sizeof (int));
-
- if (should_write)
- {
- /* Fill start and end extra bytes of buffer with existing memory data. */
-
- if (addr != memaddr || len < (int) sizeof (int))
- {
- /* Need part of initial word -- fetch it. */
- buffer[0] = nindy_fetch_word (addr);
- }
-
- if (count > 1) /* FIXME, avoid if even boundary */
- {
- buffer[count - 1]
- = nindy_fetch_word (addr + (count - 1) * sizeof (int));
- }
-
- /* Copy data to be written over corresponding part of buffer */
-
- memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
- /* Write the entire buffer. */
-
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- nindy_store_word (addr, buffer[i]);
- if (errno)
- return 0;
- }
- }
- else
- {
- /* Read all the longwords */
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- buffer[i] = nindy_fetch_word (addr);
- if (errno)
- return 0;
- QUIT;
- }
-
- /* Copy appropriate bytes out of the buffer. */
- memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
- }
- return len;
+ if (len <= 0)
+ return 0;
+ return dcache_xfer_memory (nindy_dcache, memaddr, myaddr,
+ len, should_write);
}
static void
diff --git a/gdb/remote-utils.c b/gdb/remote-utils.c
index 457d7b1..de0cbeb 100644
--- a/gdb/remote-utils.c
+++ b/gdb/remote-utils.c
@@ -618,27 +618,6 @@ gr_prepare_to_store ()
/* Do nothing, since we assume we can store individual regs */
}
-/* Read a word from remote address ADDR and return it.
- * This goes through the data cache.
- */
-int
-gr_fetch_word (addr)
- CORE_ADDR addr;
-{
- return dcache_fetch (gr_get_dcache (), addr);
-}
-
-/* Write a word WORD into remote address ADDR.
- This goes through the data cache. */
-
-void
-gr_store_word (addr, word)
- CORE_ADDR addr;
- int word;
-{
- dcache_poke (gr_get_dcache (), addr, word);
-}
-
void
_initialize_sr_support ()
{
diff --git a/gdb/remote-utils.h b/gdb/remote-utils.h
index d82ea8d..75e852a 100644
--- a/gdb/remote-utils.h
+++ b/gdb/remote-utils.h
@@ -117,7 +117,6 @@ extern struct gr_settings *gr_settings;
#define gr_expect_prompt() sr_expect(gr_get_prompt())
-int gr_fetch_word (CORE_ADDR addr);
int gr_multi_scan (char *list[], int passthrough);
int sr_get_hex_digit (int ignore_space);
int sr_pollchar (void);
@@ -132,7 +131,6 @@ void gr_generic_checkin (void);
void gr_kill (void);
void gr_mourn (void);
void gr_prepare_to_store (void);
-void gr_store_word (CORE_ADDR addr, int word);
void sr_expect (char *string);
void sr_get_hex_byte (char *byt);
void sr_scan_args (char *proto, char *args);
diff --git a/gdb/remote.c b/gdb/remote.c
index 0e54af7..d43b81d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3209,43 +3209,8 @@ remote_store_registers (regno)
remote_send (buf, PBUFSIZ);
}
-
-/* Use of the data cache *used* to be disabled because it loses for looking
- at and changing hardware I/O ports and the like. Accepting `volatile'
- would perhaps be one way to fix it. Another idea would be to use the
- executable file for the text segment (for all SEC_CODE sections?
- For all SEC_READONLY sections?). This has problems if you want to
- actually see what the memory contains (e.g. self-modifying code,
- clobbered memory, user downloaded the wrong thing).
-
- Because it speeds so much up, it's now enabled, if you're playing
- with registers you turn it of (set remotecache 0). */
-
-/* Read a word from remote address ADDR and return it.
- This goes through the data cache. */
-
-#if 0 /* unused? */
-static int
-remote_fetch_word (addr)
- CORE_ADDR addr;
-{
- return dcache_fetch (remote_dcache, addr);
-}
-
-/* Write a word WORD into remote address ADDR.
- This goes through the data cache. */
-
-static void
-remote_store_word (addr, word)
- CORE_ADDR addr;
- int word;
-{
- dcache_poke (remote_dcache, addr, word);
-}
-#endif /* 0 (unused?) */
-
/* Return the number of hex digits in num. */
static int