summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-02-26 14:36:04 +0000
committerPedro Alves <palves@redhat.com>2014-02-26 14:39:23 +0000
commit7a44e40e8b7e2f91d66930cdf1fe5fed0ba9c584 (patch)
tree2886f5b5bf6d9dee2c51f887df6ab645de7e6fb4 /gdb
parentbd265cd0bde9e045ab5946532449430b66fe91ad (diff)
downloadbinutils-gdb-7a44e40e8b7e2f91d66930cdf1fe5fed0ba9c584.tar.gz
eliminate target_ops->deprecated_xfer_memory
As no target uses it anymore, it can finally go away. After removing the deprecated_xfer_memory handling from default_xfer_partial, we can delete the latter, because the only thing it does is delegate to the target beneath unconditionally, which is what the delegator installed by target-delegates.c will do for us if no to_xfer_partial method is installed. This was the last user of de_fault, so that goes away too. Tested on x86_64 Fedora 17. gdb/ 2014-02-26 Pedro Alves <palves@redhat.com> * target.c (complete_target_initialization): Don't install default_xfer_partial as to_xfer_partial hook. (nomemory): Delete. (update_current_target): Don't INHERIT nor de_fault deprecated_xfer_memory. Delete de_fault macro. (default_xfer_partial, deprecated_debug_xfer_memory): Delete. (setup_target_debug): Don't install a deprecated_xfer_memory hook. * target.h (struct target_ops) <deprecated_xfer_memory>: Delete field.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/target.c122
-rw-r--r--gdb/target.h26
3 files changed, 12 insertions, 148 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 28f3e227097..05d3e487e8d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,17 @@
2014-02-26 Pedro Alves <palves@redhat.com>
+ * target.c (complete_target_initialization): Don't install
+ default_xfer_partial as to_xfer_partial hook.
+ (nomemory): Delete.
+ (update_current_target): Don't INHERIT nor de_fault
+ deprecated_xfer_memory. Delete de_fault macro.
+ (default_xfer_partial, deprecated_debug_xfer_memory): Delete.
+ (setup_target_debug): Don't install a deprecated_xfer_memory hook.
+ * target.h (struct target_ops) <deprecated_xfer_memory>: Delete
+ field.
+
+2014-02-26 Pedro Alves <palves@redhat.com>
+
* go32-nat.c (my_write_child): New function.
(go32_xfer_memory): Rewrite as to_xfer_partial helper.
(go32_xfer_partial): New function.
diff --git a/gdb/target.c b/gdb/target.c
index 3e54d85b486..6cd97417e8c 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -75,8 +75,6 @@ static int default_search_memory (struct target_ops *ops,
static void tcomplain (void) ATTRIBUTE_NORETURN;
-static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
-
static int return_zero (struct target_ops *);
static int return_zero_has_execution (struct target_ops *, ptid_t);
@@ -85,8 +83,6 @@ static void target_command (char *, int);
static struct target_ops *find_default_run_target (char *);
-static target_xfer_partial_ftype default_xfer_partial;
-
static struct gdbarch *default_thread_architecture (struct target_ops *ops,
ptid_t ptid);
@@ -375,8 +371,6 @@ void
complete_target_initialization (struct target_ops *t)
{
/* Provide default values for all "must have" methods. */
- if (t->to_xfer_partial == NULL)
- t->to_xfer_partial = default_xfer_partial;
if (t->to_has_all_memory == NULL)
t->to_has_all_memory = return_zero;
@@ -516,14 +510,6 @@ target_terminal_inferior (void)
(*current_target.to_terminal_inferior) (&current_target);
}
-static int
-nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
- struct target_ops *t)
-{
- errno = EIO; /* Can't read/write this location. */
- return 0; /* No bytes handled. */
-}
-
static void
tcomplain (void)
{
@@ -603,28 +589,12 @@ update_current_target (void)
INHERIT (to_shortname, t);
INHERIT (to_longname, t);
INHERIT (to_attach_no_wait, t);
- INHERIT (deprecated_xfer_memory, t);
INHERIT (to_have_steppable_watchpoint, t);
INHERIT (to_have_continuable_watchpoint, t);
INHERIT (to_has_thread_control, t);
}
#undef INHERIT
- /* Clean up a target struct so it no longer has any zero pointers in
- it. Do not add any new de_faults here. Instead, use the
- delegation mechanism provided by make-target-delegates. */
-
-#define de_fault(field, value) \
- if (!current_target.field) \
- current_target.field = value
-
- de_fault (deprecated_xfer_memory,
- (int (*) (CORE_ADDR, gdb_byte *, int, int,
- struct mem_attrib *, struct target_ops *))
- nomemory);
-
-#undef de_fault
-
/* Finally, position the target-stack beneath the squashed
"current_target". That way code looking for a non-inherited
target method can quickly and simply find it. */
@@ -1651,56 +1621,6 @@ show_trust_readonly (struct ui_file *file, int from_tty,
value);
}
-/* More generic transfers. */
-
-static enum target_xfer_status
-default_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
-{
- if (object == TARGET_OBJECT_MEMORY
- && ops->deprecated_xfer_memory != NULL)
- /* If available, fall back to the target's
- "deprecated_xfer_memory" method. */
- {
- int xfered = -1;
-
- errno = 0;
- if (writebuf != NULL)
- {
- void *buffer = xmalloc (len);
- struct cleanup *cleanup = make_cleanup (xfree, buffer);
-
- memcpy (buffer, writebuf, len);
- xfered = ops->deprecated_xfer_memory (offset, buffer, len,
- 1/*write*/, NULL, ops);
- do_cleanups (cleanup);
- }
- if (readbuf != NULL)
- xfered = ops->deprecated_xfer_memory (offset, readbuf, len,
- 0/*read*/, NULL, ops);
- if (xfered > 0)
- {
- *xfered_len = (ULONGEST) xfered;
- return TARGET_XFER_E_IO;
- }
- else if (xfered == 0 && errno == 0)
- /* "deprecated_xfer_memory" uses 0, cross checked against
- ERRNO as one indication of an error. */
- return TARGET_XFER_EOF;
- else
- return TARGET_XFER_E_IO;
- }
- else
- {
- gdb_assert (ops->beneath != NULL);
- return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
- }
-}
-
/* Target vector read/write partial wrapper functions. */
static enum target_xfer_status
@@ -3840,47 +3760,6 @@ target_decr_pc_after_break (struct gdbarch *gdbarch)
return current_target.to_decr_pc_after_break (&current_target, gdbarch);
}
-static int
-deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target)
-{
- int retval;
-
- retval = debug_target.deprecated_xfer_memory (memaddr, myaddr, len, write,
- attrib, target);
-
- fprintf_unfiltered (gdb_stdlog,
- "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d",
- paddress (target_gdbarch (), memaddr), len,
- write ? "write" : "read", retval);
-
- if (retval > 0)
- {
- int i;
-
- fputs_unfiltered (", bytes =", gdb_stdlog);
- for (i = 0; i < retval; i++)
- {
- if ((((intptr_t) &(myaddr[i])) & 0xf) == 0)
- {
- if (targetdebug < 2 && i > 0)
- {
- fprintf_unfiltered (gdb_stdlog, " ...");
- break;
- }
- fprintf_unfiltered (gdb_stdlog, "\n");
- }
-
- fprintf_unfiltered (gdb_stdlog, " %02x", myaddr[i] & 0xff);
- }
- }
-
- fputc_unfiltered ('\n', gdb_stdlog);
-
- return retval;
-}
-
static void
debug_to_files_info (struct target_ops *target)
{
@@ -4309,7 +4188,6 @@ setup_target_debug (void)
current_target.to_open = debug_to_open;
current_target.to_post_attach = debug_to_post_attach;
current_target.to_prepare_to_store = debug_to_prepare_to_store;
- current_target.deprecated_xfer_memory = deprecated_debug_xfer_memory;
current_target.to_files_info = debug_to_files_info;
current_target.to_insert_breakpoint = debug_to_insert_breakpoint;
current_target.to_remove_breakpoint = debug_to_remove_breakpoint;
diff --git a/gdb/target.h b/gdb/target.h
index 4b735ddd2e2..ab797b2ffa6 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -421,32 +421,6 @@ struct target_ops
void (*to_prepare_to_store) (struct target_ops *, struct regcache *)
TARGET_DEFAULT_NORETURN (noprocess ());
- /* Transfer LEN bytes of memory between GDB address MYADDR and
- target address MEMADDR. If WRITE, transfer them to the target, else
- transfer them from the target. TARGET is the target from which we
- get this function.
-
- Return value, N, is one of the following:
-
- 0 means that we can't handle this. If errno has been set, it is the
- error which prevented us from doing it (FIXME: What about bfd_error?).
-
- positive (call it N) means that we have transferred N bytes
- starting at MEMADDR. We might be able to handle more bytes
- beyond this length, but no promises.
-
- negative (call its absolute value N) means that we cannot
- transfer right at MEMADDR, but we could transfer at least
- something at MEMADDR + N.
-
- NOTE: cagney/2004-10-01: This has been entirely superseeded by
- to_xfer_partial and inferior inheritance. */
-
- int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
- int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target);
-
void (*to_files_info) (struct target_ops *)
TARGET_DEFAULT_IGNORE ();
int (*to_insert_breakpoint) (struct target_ops *, struct gdbarch *,