2003-09-12 Jeff Johnston <jjohnstn@redhat.com>
* top.c (quit_target): New static helper function. (quit_force): Moved code to quit_target(). Call quit_target() via catch_errors() to catch errors during quit.
This commit is contained in:
parent
1f5280e04a
commit
b0abbc58f0
|
@ -1,3 +1,9 @@
|
|||
2003-09-12 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* top.c (quit_target): New static helper function.
|
||||
(quit_force): Moved code to quit_target(). Call quit_target()
|
||||
via catch_errors() to catch errors during quit.
|
||||
|
||||
2003-09-11 David Carlton <carlton@kealia.com>
|
||||
|
||||
* buildsym.c (finish_block): Use allocate_block to allocate the
|
||||
|
|
52
gdb/top.c
52
gdb/top.c
|
@ -1439,6 +1439,39 @@ quit_confirm (void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Helper routine for quit_force that requires error handling. */
|
||||
|
||||
struct qt_args
|
||||
{
|
||||
char *args;
|
||||
int from_tty;
|
||||
};
|
||||
|
||||
static int
|
||||
quit_target (void *arg)
|
||||
{
|
||||
struct qt_args *qt = (struct qt_args *)arg;
|
||||
|
||||
if (! ptid_equal (inferior_ptid, null_ptid) && target_has_execution)
|
||||
{
|
||||
if (attach_flag)
|
||||
target_detach (qt->args, qt->from_tty);
|
||||
else
|
||||
target_kill ();
|
||||
}
|
||||
|
||||
/* UDI wants this, to kill the TIP. */
|
||||
target_close (1);
|
||||
|
||||
/* Save the history information if it is appropriate to do so. */
|
||||
if (write_history_p && history_filename)
|
||||
write_history (history_filename);
|
||||
|
||||
do_final_cleanups (ALL_CLEANUPS); /* Do any final cleanups before exiting */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Quit without asking for confirmation. */
|
||||
|
||||
void
|
||||
|
@ -1455,22 +1488,9 @@ quit_force (char *args, int from_tty)
|
|||
exit_code = (int) value_as_long (val);
|
||||
}
|
||||
|
||||
if (! ptid_equal (inferior_ptid, null_ptid) && target_has_execution)
|
||||
{
|
||||
if (attach_flag)
|
||||
target_detach (args, from_tty);
|
||||
else
|
||||
target_kill ();
|
||||
}
|
||||
|
||||
/* UDI wants this, to kill the TIP. */
|
||||
target_close (1);
|
||||
|
||||
/* Save the history information if it is appropriate to do so. */
|
||||
if (write_history_p && history_filename)
|
||||
write_history (history_filename);
|
||||
|
||||
do_final_cleanups (ALL_CLEANUPS); /* Do any final cleanups before exiting */
|
||||
/* We want to handle any quit errors and exit regardless. */
|
||||
catch_errors (quit_target, args,
|
||||
"Quitting: ", RETURN_MASK_ALL);
|
||||
|
||||
exit (exit_code);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue