static void kill_command (char *arg, int from_tty) { /* FIXME: This should not really be inferior_ptid (or target_has_execution). It should be a distinct flag that indicates that a target is active, cuz some targets don't have processes! */ if (ptid_equal (inferior_ptid, null_ptid)) error ("The program is not being run."); if (!query ("Kill the program being debugged? ")) error ("Not confirmed."); target_kill (); init_thread_list (); /* Destroy thread info */ /* Killing off the inferior can leave us with a core file. If so, print the state we are left in. */ if (target_has_stack) { printf_filtered ("In %s,\n", target_longname); if (deprecated_selected_frame == NULL) fputs_filtered ("No selected stack frame.\n", gdb_stdout); else print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC); } bfd_cache_close_all (); }
void exec_file_attach (char *filename, int from_tty) { /* Remove any previous exec file. */ exec_close (); if (!ptid_equal (inferior_ptid, null_ptid)) { target_kill (); init_thread_list (); struct program_space *ss; ALL_PSPACES (ss) { set_current_program_space (ss); breakpoint_program_space_exit (ss); } symbol_file_clear (0); }