static void init_dummy_target (void);
+static struct target_ops debug_target;
+
static void debug_to_open (char *, int);
static void debug_to_close (int);
static void debug_to_prepare_to_store (void);
-static int debug_to_xfer_memory (CORE_ADDR, char *, int, int,
- struct mem_attrib *, struct target_ops *);
+static int deprecated_debug_xfer_memory (CORE_ADDR, char *, int, int,
+ struct mem_attrib *,
+ struct target_ops *);
static void debug_to_files_info (struct target_ops *);
static int debug_to_stopped_by_watchpoint (void);
-static CORE_ADDR debug_to_stopped_data_address (void);
+static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
static int debug_to_region_size_ok_for_hw_watchpoint (int);
wierd and mysterious ways. Putting the variable here lets those
wierd and mysterious ways keep building while they are being
converted to the inferior inheritance structure. */
-struct target_ops child_ops;
+struct target_ops deprecated_child_ops;
/* Pointer to array of target architecture structures; the size of the
array; the current index into the array; the allocated size of the
static void
tcomplain (void)
{
- error ("You can't do that when your target is `%s'",
+ error (_("You can't do that when your target is `%s'"),
current_target.to_shortname);
}
void
noprocess (void)
{
- error ("You can't do that without a process to debug.");
+ error (_("You can't do that without a process to debug."));
}
static int
if (ptid_equal (inferior_ptid, null_ptid))
noprocess ();
else
- error ("No run-time support for this");
+ error (_("No run-time support for this"));
}
{
target_kill ();
if (target_has_execution)
- error ("Killing the program did not help.");
+ error (_("Killing the program did not help."));
return;
}
else
{
- error ("Program not killed.");
+ error (_("Program not killed."));
}
}
tcomplain ();
INHERIT (to_fetch_registers, t);
INHERIT (to_store_registers, t);
INHERIT (to_prepare_to_store, t);
- INHERIT (to_xfer_memory, t);
+ INHERIT (deprecated_xfer_memory, t);
INHERIT (to_files_info, t);
INHERIT (to_insert_breakpoint, t);
INHERIT (to_remove_breakpoint, t);
de_fault (to_prepare_to_store,
(void (*) (void))
noprocess);
- de_fault (to_xfer_memory,
+ de_fault (deprecated_xfer_memory,
(int (*) (CORE_ADDR, char *, int, int, struct mem_attrib *, struct target_ops *))
nomemory);
de_fault (to_files_info,
(int (*) (void))
return_zero);
de_fault (to_stopped_data_address,
- (CORE_ADDR (*) (void))
+ (int (*) (struct target_ops *, CORE_ADDR *))
return_zero);
de_fault (to_region_size_ok_for_hw_watchpoint,
default_region_size_ok_for_hw_watchpoint);
(void (*) (int))
target_ignore);
de_fault (to_insert_fork_catchpoint,
- (int (*) (int))
+ (void (*) (int))
tcomplain);
de_fault (to_remove_fork_catchpoint,
(int (*) (int))
tcomplain);
de_fault (to_insert_vfork_catchpoint,
- (int (*) (int))
+ (void (*) (int))
tcomplain);
de_fault (to_remove_vfork_catchpoint,
(int (*) (int))
(int (*) (int))
target_ignore);
de_fault (to_insert_exec_catchpoint,
- (int (*) (int))
+ (void (*) (int))
tcomplain);
de_fault (to_remove_exec_catchpoint,
(int (*) (int))
implementing another singluar mechanism (for instance, a generic
object:annex onto inferior:object:annex say). */
-static int
+static LONGEST
xfer_using_stratum (enum target_object object, const char *annex,
- CORE_ADDR memaddr, int len, void *readbuf,
+ ULONGEST offset, LONGEST len, void *readbuf,
const void *writebuf)
{
LONGEST xfered;
while (1)
{
xfered = target_xfer_partial (target, object, annex,
- readbuf, writebuf, memaddr, len);
+ readbuf, writebuf, offset, len);
if (xfered > 0)
{
/* The partial xfer succeeded, update the counts, check that
len -= xfered;
if (len <= 0)
return 0;
+ offset += xfered;
+ if (readbuf != NULL)
+ readbuf = (bfd_byte *) readbuf + xfered;
+ if (writebuf != NULL)
+ writebuf = (bfd_byte *) writebuf + xfered;
target = target_stack;
}
else if (xfered < 0)
deal with partial reads should call target_read_memory_partial. */
int
-target_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
+target_read_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len)
{
if (target_xfer_partial_p ())
return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
}
int
-target_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
+target_write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
{
+ bfd_byte *bytes = alloca (len);
+ memcpy (bytes, myaddr, len);
if (target_xfer_partial_p ())
return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
- memaddr, len, NULL, myaddr);
+ memaddr, len, NULL, bytes);
else
- return target_xfer_memory (memaddr, myaddr, len, 1);
+ return target_xfer_memory (memaddr, bytes, len, 1);
+}
+
+#ifndef target_stopped_data_address_p
+int
+target_stopped_data_address_p (struct target_ops *target)
+{
+ if (target->to_stopped_data_address
+ == (int (*) (struct target_ops *, CORE_ADDR *)) return_zero)
+ return 0;
+ if (target->to_stopped_data_address == debug_to_stopped_data_address
+ && (debug_target.to_stopped_data_address
+ == (int (*) (struct target_ops *, CORE_ADDR *)) return_zero))
+ return 0;
+ return 1;
}
+#endif
static int trust_readonly = 0;
if (len == 0)
return 0;
- /* to_xfer_memory is not guaranteed to set errno, even when it returns
- 0. */
+ /* deprecated_xfer_memory is not guaranteed to set errno, even when
+ it returns 0. */
errno = 0;
if (!write && trust_readonly)
}
/* The quick case is that the top target can handle the transfer. */
- res = current_target.to_xfer_memory
+ res = current_target.deprecated_xfer_memory
(memaddr, myaddr, len, write, attrib, ¤t_target);
/* If res <= 0 then we call it again in the loop. Ah well. */
if (!t->to_has_memory)
continue;
- res = t->to_xfer_memory (memaddr, myaddr, len, write, attrib, t);
+ res = t->deprecated_xfer_memory (memaddr, myaddr, len, write, attrib, t);
if (res > 0)
break; /* Handled all or part of xfer */
if (t->to_has_all_memory)
const void *writebuf, ULONGEST offset, LONGEST len)
{
if (object == TARGET_OBJECT_MEMORY
- && ops->to_xfer_memory != NULL)
- /* If available, fall back to the target's "to_xfer_memory"
- method. */
+ && ops->deprecated_xfer_memory != NULL)
+ /* If available, fall back to the target's
+ "deprecated_xfer_memory" method. */
{
int xfered = -1;
errno = 0;
void *buffer = xmalloc (len);
struct cleanup *cleanup = make_cleanup (xfree, buffer);
memcpy (buffer, writebuf, len);
- xfered = ops->to_xfer_memory (offset, buffer, len, 1/*write*/, NULL,
- ops);
+ xfered = ops->deprecated_xfer_memory (offset, buffer, len,
+ 1/*write*/, NULL, ops);
do_cleanups (cleanup);
}
if (readbuf != NULL)
- xfered = ops->to_xfer_memory (offset, readbuf, len, 0/*read*/, NULL,
- ops);
+ xfered = ops->deprecated_xfer_memory (offset, readbuf, len, 0/*read*/,
+ NULL, ops);
if (xfered > 0)
return xfered;
else if (xfered == 0 && errno == 0)
- /* "to_xfer_memory" uses 0, cross checked against ERRNO as one
- indication of an error. */
+ /* "deprecated_xfer_memory" uses 0, cross checked against
+ ERRNO as one indication of an error. */
return 0;
else
return -1;
|| query ("A program is being debugged already. Kill it? "))
target_kill ();
else
- error ("Program not killed.");
+ error (_("Program not killed."));
}
/* Calling target_kill may remove the target from the stack. But if
{
(current_target.to_lookup_symbol) (modname, t_reloc);
if (*t_reloc == 0)
- error ("Unable to link to %s and get relocation in rombug", modname);
+ error (_("Unable to link to %s and get relocation in rombug"), modname);
}
else
*t_reloc = (CORE_ADDR) -1;
}
if (count != 1)
- error ("Don't know how to %s. Try \"help target\".", do_mesg);
+ error (_("Don't know how to %s. Try \"help target\"."), do_mesg);
return runable;
}
/* Error-catcher for target_find_memory_regions */
static int dummy_find_memory_regions (int (*ignore1) (), void *ignore2)
{
- error ("No target.");
+ error (_("No target."));
return 0;
}
/* Error-catcher for target_make_corefile_notes */
static char * dummy_make_corefile_notes (bfd *ignore1, int *ignore2)
{
- error ("No target.");
+ error (_("No target."));
return NULL;
}
dummy_target.to_magic = OPS_MAGIC;
}
\f
-
-static struct target_ops debug_target;
-
static void
debug_to_open (char *args, int from_tty)
{
}
static int
-debug_to_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target)
+deprecated_debug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
+ int write, struct mem_attrib *attrib,
+ struct target_ops *target)
{
int retval;
- retval = debug_target.to_xfer_memory (memaddr, myaddr, len, write,
- attrib, target);
+ retval = debug_target.deprecated_xfer_memory (memaddr, myaddr, len, write,
+ attrib, target);
fprintf_unfiltered (gdb_stdlog,
"target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
return retval;
}
-static CORE_ADDR
-debug_to_stopped_data_address (void)
+static int
+debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr)
{
- CORE_ADDR retval;
+ int retval;
- retval = debug_target.to_stopped_data_address ();
+ retval = debug_target.to_stopped_data_address (target, addr);
fprintf_unfiltered (gdb_stdlog,
- "target_stopped_data_address () = 0x%lx\n",
- (unsigned long) retval);
+ "target_stopped_data_address ([0x%lx]) = %ld\n",
+ (unsigned long)*addr,
+ (unsigned long)retval);
return retval;
}
pid);
}
-static int
+static void
debug_to_insert_fork_catchpoint (int pid)
{
- int retval;
+ debug_target.to_insert_fork_catchpoint (pid);
- retval = debug_target.to_insert_fork_catchpoint (pid);
-
- fprintf_unfiltered (gdb_stdlog, "target_insert_fork_catchpoint (%d) = %d\n",
- pid, retval);
-
- return retval;
+ fprintf_unfiltered (gdb_stdlog, "target_insert_fork_catchpoint (%d)\n",
+ pid);
}
static int
return retval;
}
-static int
+static void
debug_to_insert_vfork_catchpoint (int pid)
{
- int retval;
-
- retval = debug_target.to_insert_vfork_catchpoint (pid);
-
- fprintf_unfiltered (gdb_stdlog, "target_insert_vfork_catchpoint (%d)= %d\n",
- pid, retval);
+ debug_target.to_insert_vfork_catchpoint (pid);
- return retval;
+ fprintf_unfiltered (gdb_stdlog, "target_insert_vfork_catchpoint (%d)\n",
+ pid);
}
static int
return retval;
}
-static int
+static void
debug_to_insert_exec_catchpoint (int pid)
{
- int retval;
-
- retval = debug_target.to_insert_exec_catchpoint (pid);
+ debug_target.to_insert_exec_catchpoint (pid);
- fprintf_unfiltered (gdb_stdlog, "target_insert_exec_catchpoint (%d) = %d\n",
- pid, retval);
-
- return retval;
+ fprintf_unfiltered (gdb_stdlog, "target_insert_exec_catchpoint (%d)\n",
+ pid);
}
static int
current_target.to_fetch_registers = debug_to_fetch_registers;
current_target.to_store_registers = debug_to_store_registers;
current_target.to_prepare_to_store = debug_to_prepare_to_store;
- current_target.to_xfer_memory = debug_to_xfer_memory;
+ 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;
|| (current_target.to_rcmd == debug_to_rcmd
&& (debug_target.to_rcmd
== (void (*) (char *, struct ui_file *)) tcomplain)))
- {
- error ("\"monitor\" command not supported by this target.\n");
- }
+ error (_("\"monitor\" command not supported by this target."));
target_rcmd (cmd, gdb_stdtarg);
}
Show mode for reading from readonly sections.", "\
When this mode is on, memory reads from readonly sections (such as .text)\n\
will be read from the object file instead of from the target. This will\n\
-result in significant performance improvement for remote targets.", "\
-Mode for reading from readonly sections is %s.",
+result in significant performance improvement for remote targets.",
+ NULL, /* PRINT: Mode for reading from readonly sections is %s. */
NULL, NULL,
&setlist, &showlist);