diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2004-11-05 20:32:04 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2004-11-05 20:32:04 +0000 |
commit | d75e3c94b3e236ab6aadcad497264f32b48c921e (patch) | |
tree | ae41749e48fd6dd60a8caa409f089fc44caafc96 /gdb/utils.c | |
parent | 98f276a08832a7fb1ee2707a6e4a3e44d1d4b349 (diff) | |
download | gdb-d75e3c94b3e236ab6aadcad497264f32b48c921e.zip gdb-d75e3c94b3e236ab6aadcad497264f32b48c921e.tar.gz gdb-d75e3c94b3e236ab6aadcad497264f32b48c921e.tar.bz2 |
2004-11-05 Jeff Johnston <jjohnstn@redhat.com>
* defs.h (fatal, vfatal): New function prototypes.
* stack.c (backtrace_command_stub): Stub to call backtrace_command_1
via catch_errors.
(backtrace_command): Change to call backtrace_command_stub via
catch_errors instead of calling backtrace_command_1 directly.
(backtrace_full_command): Ditto.
* utils.c (error_stream_1): New static function.
(verror): Change to call error_stream_1 instead of error_stream.
(error_stream): Call error_stream_1 with RETURN_ERROR argument.
(vfatal, fatal): New functions.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index e30808c..0f4ea5a 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -104,6 +104,9 @@ static void prompt_for_continue (void); static void set_screen_size (void); static void set_width (void); +static NORETURN void error_stream_1 (struct ui_file *stream, + enum return_reason reason) ATTR_NORETURN; + /* Chain of cleanup actions established with make_cleanup, to be executed if an error happens. */ @@ -620,7 +623,7 @@ verror (const char *string, va_list args) struct ui_file *tmp_stream = mem_fileopen (); make_cleanup_ui_file_delete (tmp_stream); vfprintf_unfiltered (tmp_stream, string, args); - error_stream (tmp_stream); + error_stream_1 (tmp_stream, RETURN_ERROR); } NORETURN void @@ -632,6 +635,28 @@ 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. */ + +NORETURN void +vfatal (const char *string, va_list args) +{ + struct ui_file *tmp_stream = mem_fileopen (); + make_cleanup_ui_file_delete (tmp_stream); + vfprintf_unfiltered (tmp_stream, string, args); + error_stream_1 (tmp_stream, RETURN_QUIT); +} + +NORETURN void +fatal (const char *string, ...) +{ + va_list args; + va_start (args, string); + vfatal (string, args); + va_end (args); +} + static void do_write (void *data, const char *buffer, long length_buffer) { @@ -670,8 +695,8 @@ error_output_message (char *pre_print, char *msg) fprintf_filtered (gdb_stderr, "\n"); } -NORETURN void -error_stream (struct ui_file *stream) +static NORETURN void +error_stream_1 (struct ui_file *stream, enum return_reason reason) { if (deprecated_error_begin_hook) deprecated_error_begin_hook (); @@ -690,7 +715,13 @@ error_stream (struct ui_file *stream) ui_file_put (stream, do_write, gdb_stderr); fprintf_filtered (gdb_stderr, "\n"); - throw_exception (RETURN_ERROR); + throw_exception (reason); +} + +NORETURN void +error_stream (struct ui_file *stream) +{ + error_stream_1 (stream, RETURN_ERROR); } /* Get the last error message issued by gdb */ |