static void debug_to_terminal_info (char *, int);
-static void debug_to_kill (void);
-
static void debug_to_load (char *, int);
static int debug_to_lookup_symbol (char *, CORE_ADDR *);
{
}
+void
+target_kill (void)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_kill != NULL)
+ {
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog, "target_kill ()\n");
+
+ t->to_kill (t);
+ return;
+ }
+
+ noprocess ();
+}
+
void
target_load (char *arg, int from_tty)
{
{
printf_unfiltered (_("You are already running a program:\n"));
target_files_info ();
- if (query ("Kill it? "))
+ if (query (_("Kill it? ")))
{
target_kill ();
if (target_has_execution)
INHERIT (to_terminal_ours, t);
INHERIT (to_terminal_save_ours, t);
INHERIT (to_terminal_info, t);
- INHERIT (to_kill, t);
+ /* Do not inherit to_kill. */
INHERIT (to_load, t);
INHERIT (to_lookup_symbol, t);
/* Do no inherit to_create_inferior. */
target_ignore);
de_fault (to_terminal_info,
default_terminal_info);
- de_fault (to_kill,
- (void (*) (void))
- noprocess);
de_fault (to_load,
(void (*) (char *, int))
tcomplain);
t->to_mourn_inferior (t);
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n");
+
+ /* We no longer need to keep handles on any of the object files.
+ Make sure to release them to avoid unnecessarily locking any
+ of them while we're not actually debugging. */
+ bfd_cache_close_all ();
+
return;
}
}
from_tty);
}
-static void
-debug_to_kill (void)
-{
- debug_target.to_kill ();
-
- fprintf_unfiltered (gdb_stdlog, "target_kill ()\n");
-}
-
static void
debug_to_load (char *args, int from_tty)
{
current_target.to_terminal_ours = debug_to_terminal_ours;
current_target.to_terminal_save_ours = debug_to_terminal_save_ours;
current_target.to_terminal_info = debug_to_terminal_info;
- current_target.to_kill = debug_to_kill;
current_target.to_load = debug_to_load;
current_target.to_lookup_symbol = debug_to_lookup_symbol;
current_target.to_post_startup_inferior = debug_to_post_startup_inferior;