diff options
author | Gary Benson <gbenson@redhat.com> | 2014-07-23 14:51:26 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2014-07-24 09:55:50 +0100 |
commit | 2c51604d3adbcc77a25d78ce900f5be4597c2504 (patch) | |
tree | 9040f7940bb0e9a8451115c45bb7e185a4a85b5a /gdb/utils.c | |
parent | 342119630e4612856017d03f2892f5a693d85d8e (diff) | |
download | gdb-2c51604d3adbcc77a25d78ce900f5be4597c2504.zip gdb-2c51604d3adbcc77a25d78ce900f5be4597c2504.tar.gz gdb-2c51604d3adbcc77a25d78ce900f5be4597c2504.tar.bz2 |
Rationalize "fatal" error handling outside of gdbserver
GDB and gdbserver have functions named "fatal" that are used in
completely different ways. In gdbserver "fatal" is used to handle
critical errors: it differs from "error" in that "fatal" causes
gdbserver to exit whereas "error" does not. In GDB "fatal" is used
to abort the current operation and return to the command level.
This is implemented by throwing a non-error "RETURN_QUIT" exception.
This commit removes GDB's "fatal" and "vfatal" functions entirely.
The exception-throwing function "throw_vfatal" is renamed as
"throw_vquit", and a new convenience function "throw_quit" is added.
The small number of calls to "fatal" are replaced with calls to
"throw_quit", making what is happening more obvious.
This commit also modifies GDB's "throw_error" to call "throw_verror"
rather than calling "throw_it" directly. This change means the
assignment of RETURN_ERROR as the exception type now happens in
precisely one place in GDB rather than two.
gdb/
2014-07-24 Gary Benson <gbenson@redhat.com>
* exceptions.h (throw_vfatal): Renamed to...
(throw_vquit): New declaration.
(throw_quit): Likewise.
* exceptions.c (throw_vfatal): Renamed to...
(throw_vquit): New function.
(throw_quit): Likewise.
(throw_error): Call throw_verror rather than throw_it.
* utils.h (vfatal): Removed.
(fatal): Likewise.
* utils.c (vfatal): Removed.
(fatal): Likewise.
(internal_verror): Replaced call to fatal with call to throw_quit.
(quit): Replaced calls to fatal with calls to throw_quit.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index a9e8196..8af8827 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -569,26 +569,6 @@ error (const char *string, ...) va_end (args); } -/* Print an error message and quit. - The first argument STRING is the error message, used as a fprintf string, - and the remaining args are passed as arguments to it. */ - -void -vfatal (const char *string, va_list args) -{ - throw_vfatal (string, args); -} - -void -fatal (const char *string, ...) -{ - va_list args; - - va_start (args, string); - throw_vfatal (string, args); - va_end (args); -} - void error_stream (struct ui_file *stream) { @@ -833,7 +813,7 @@ void internal_verror (const char *file, int line, const char *fmt, va_list ap) { internal_vproblem (&internal_error_problem, file, line, fmt, ap); - fatal (_("Command aborted.")); + throw_quit (_("Command aborted.")); } void @@ -1090,15 +1070,15 @@ quit (void) #ifdef __MSDOS__ /* No steenking SIGINT will ever be coming our way when the program is resumed. Don't lie. */ - fatal ("Quit"); + throw_quit ("Quit"); #else if (job_control /* If there is no terminal switching for this target, then we can't possibly get screwed by the lack of job control. */ || !target_supports_terminal_ours ()) - fatal ("Quit"); + throw_quit ("Quit"); else - fatal ("Quit (expect signal SIGINT when the program is resumed)"); + throw_quit ("Quit (expect signal SIGINT when the program is resumed)"); #endif } |