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);
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);
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;
(*current_target.to_terminal_inferior) (¤t_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)
{
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. */
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
return current_target.to_decr_pc_after_break (¤t_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)
{
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;
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 *,