static int
target_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len,
- int write, asection * bfd_section));
+ int write));
static void init_dummy_target PARAMS ((void));
tlen = MIN (len, 4 - (memaddr & 3));
offset = memaddr & 3;
- errcode = target_xfer_memory (memaddr & ~3, buf, 4, 0, NULL);
+ errcode = target_xfer_memory (memaddr & ~3, buf, 4, 0);
if (errcode != 0)
{
/* The transfer request might have crossed the boundary to an
a single byte. */
tlen = 1;
offset = 0;
- errcode = target_xfer_memory (memaddr, buf, 1, 0, NULL);
+ errcode = target_xfer_memory (memaddr, buf, 1, 0);
if (errcode != 0)
goto done;
}
char *myaddr;
int len;
{
- return target_xfer_memory (memaddr, myaddr, len, 0, NULL);
-}
-
-int
-target_read_memory_section (memaddr, myaddr, len, bfd_section)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- asection *bfd_section;
-{
- return target_xfer_memory (memaddr, myaddr, len, 0, bfd_section);
+ return target_xfer_memory (memaddr, myaddr, len, 0);
}
int
char *myaddr;
int len;
{
- return target_xfer_memory (memaddr, myaddr, len, 1, NULL);
+ return target_xfer_memory (memaddr, myaddr, len, 1);
}
-/* This variable is used to pass section information down to targets. This
- *should* be done by adding an argument to the target_xfer_memory function
- of all the targets, but I didn't feel like changing 50+ files. */
-
-asection *target_memory_bfd_section = NULL;
-
/* Move memory to or from the targets. Iterate until all of it has
been moved, if necessary. The top target gets priority; anything
it doesn't want, is offered to the next one down, etc. Note the
Result is 0 or errno value. */
static int
-target_xfer_memory (memaddr, myaddr, len, write, bfd_section)
+target_xfer_memory (memaddr, myaddr, len, write)
CORE_ADDR memaddr;
char *myaddr;
int len;
int write;
- asection *bfd_section;
{
int curlen;
int res;
if (len == 0)
return 0;
- target_memory_bfd_section = bfd_section;
-
/* to_xfer_memory is not guaranteed to set errno, even when it returns
0. */
errno = 0;
}
+/* Remove all target sections taken from ABFD.
+
+ Scan the current target stack for targets whose section tables
+ refer to sections from BFD, and remove those sections. We use this
+ when we notice that the inferior has unloaded a shared object, for
+ example. */
+void
+remove_target_sections (bfd *abfd)
+{
+ struct target_ops **t;
+
+ for (t = target_structs; t < target_structs + target_struct_size; t++)
+ {
+ struct section_table *src, *dest;
+
+ dest = (*t)->to_sections;
+ for (src = (*t)->to_sections; src < (*t)->to_sections_end; src++)
+ if (src->bfd != abfd)
+ {
+ /* Keep this section. */
+ if (dest < src) *dest = *src;
+ dest++;
+ }
+
+ /* If we've dropped any sections, resize the section table. */
+ if (dest < src)
+ target_resize_to_sections (*t, dest - src);
+ }
+}
+
+
+
+
/* Find a single runnable target in the stack and return it. If for
some reason there is more than one, return NULL. */
do_monitor_command (char *cmd,
int from_tty)
{
- if ((current_target.to_rcmd == (void*) tcomplain)
+ if ((current_target.to_rcmd
+ == (void (*) (char *, struct ui_file *)) tcomplain)
|| (current_target.to_rcmd == debug_to_rcmd
- && (debug_target.to_rcmd == (void*) tcomplain)))
+ && (debug_target.to_rcmd
+ == (void (*) (char *, struct ui_file *)) tcomplain)))
{
error ("\"monitor\" command not supported by this target.\n");
}
add_info ("files", target_info, targ_desc);
add_show_from_set (
- add_set_cmd ("targetdebug", class_maintenance, var_zinteger,
+ add_set_cmd ("target", class_maintenance, var_zinteger,
(char *) &targetdebug,
"Set target debugging.\n\
-When non-zero, target debugging is enabled.", &setlist),
- &showlist);
+When non-zero, target debugging is enabled.", &setdebuglist),
+ &showdebuglist);
add_com ("monitor", class_obscure, do_monitor_command,