diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2003-09-12 15:24:24 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2003-09-12 15:24:24 +0000 |
commit | b0abbc58f0daefaf286d6a008820fef5f69e5353 (patch) | |
tree | 4ea9f0be5a7fb68c6995722b191270368af237ad | |
parent | 1f5280e04a8b778c6ec12bd9fb4bfbdcb81e1d44 (diff) | |
download | gdb-b0abbc58f0daefaf286d6a008820fef5f69e5353.zip gdb-b0abbc58f0daefaf286d6a008820fef5f69e5353.tar.gz gdb-b0abbc58f0daefaf286d6a008820fef5f69e5353.tar.bz2 |
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.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/top.c | 48 |
2 files changed, 40 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ae994ca..c999b83 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 @@ -1439,28 +1439,25 @@ quit_confirm (void) return 1; } -/* Quit without asking for confirmation. */ +/* Helper routine for quit_force that requires error handling. */ -void -quit_force (char *args, int from_tty) +struct qt_args { - int exit_code = 0; - - /* An optional expression may be used to cause gdb to terminate with the - value of that expression. */ - if (args) - { - struct value *val = parse_and_eval (args); + char *args; + int from_tty; +}; - exit_code = (int) value_as_long (val); - } +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 (args, from_tty); + target_detach (qt->args, qt->from_tty); else - target_kill (); + target_kill (); } /* UDI wants this, to kill the TIP. */ @@ -1472,6 +1469,29 @@ quit_force (char *args, int from_tty) do_final_cleanups (ALL_CLEANUPS); /* Do any final cleanups before exiting */ + return 0; +} + +/* Quit without asking for confirmation. */ + +void +quit_force (char *args, int from_tty) +{ + int exit_code = 0; + + /* An optional expression may be used to cause gdb to terminate with the + value of that expression. */ + if (args) + { + struct value *val = parse_and_eval (args); + + exit_code = (int) value_as_long (val); + } + + /* We want to handle any quit errors and exit regardless. */ + catch_errors (quit_target, args, + "Quitting: ", RETURN_MASK_ALL); + exit (exit_code); } |