diff options
author | Andrew Cagney <cagney@redhat.com> | 2005-01-14 22:59:36 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2005-01-14 22:59:36 +0000 |
commit | 9cbc821d4e761ccb7164c704f4299160e72b4d08 (patch) | |
tree | 0e5fafb2b596bfb20c0adf31b69f68af17cc9185 /gdb/exceptions.c | |
parent | df227444e2db8b4acfe7cd64263580798bd9f4cc (diff) | |
download | gdb-9cbc821d4e761ccb7164c704f4299160e72b4d08.zip gdb-9cbc821d4e761ccb7164c704f4299160e72b4d08.tar.gz gdb-9cbc821d4e761ccb7164c704f4299160e72b4d08.tar.bz2 |
2005-01-14 Andrew Cagney <cagney@gnu.org>
* exceptions.h (exception_fprintf): Declare.
(exception_print): Drop pre_print parameter.
* mi/mi-main.c (mi_execute_command): Update exception_print call.
* cli/cli-interp.c (safe_execute_command): Update exception_print
call.
* remote.c (remote_open_1): Instead of passing an error prefix to
catch_exceptions, use catch_exceptions and exception_fprintf.
(remote_start_remote): Change return type to void.
* breakpoint.c (insert_bp_location): Instead of passing an error
prefix to catch_exceptions, use catch_exceptions and
exception_fprintf.
(insert_catchpoint): Change return type to void.
(break_command_1): Update exception_print call.
* exceptions.c (exception_fprintf): New function.
(print_exception): New function.
(exception_print): Use print_exception.
Diffstat (limited to 'gdb/exceptions.c')
-rw-r--r-- | gdb/exceptions.c | 64 |
1 files changed, 43 insertions, 21 deletions
diff --git a/gdb/exceptions.c b/gdb/exceptions.c index aed10a8..1301623 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -302,9 +302,28 @@ do_write (void *data, const char *buffer, long length_buffer) } +static void +print_exception (struct ui_file *file, struct exception e) +{ + /* KLUGE: cagney/2005-01-13: Write the string out one line at a time + as that way the MI's behavior is preserved. */ + const char *start; + const char *end; + for (start = e.message; start != NULL; start = end) + { + end = strchr (start, '\n'); + if (end == NULL) + fputs_filtered (start, file); + else + { + end++; + ui_file_write (file, start, end - start); + } + } +} + void -exception_print (struct ui_file *file, const char *pre_print, - struct exception e) +exception_print (struct ui_file *file, struct exception e) { if (e.reason < 0 && e.message != NULL) { @@ -312,26 +331,29 @@ exception_print (struct ui_file *file, const char *pre_print, wrap_here (""); /* Force out any buffered output */ gdb_flush (file); annotate_error_begin (); - if (pre_print) - fputs_filtered (pre_print, file); + print_exception (file, e); + fprintf_filtered (file, "\n"); + } +} - /* KLUGE: cagney/2005-01-13: Write the string out one line at a - time as that way the MI's behavior is preserved. */ - { - const char *start; - const char *end; - for (start = e.message; start != NULL; start = end) - { - end = strchr (start, '\n'); - if (end == NULL) - fputs_filtered (start, file); - else - { - end++; - ui_file_write (file, start, end - start); - } - } - } +void +exception_fprintf (struct ui_file *file, struct exception e, + const char *prefix, ...) +{ + if (e.reason < 0 && e.message != NULL) + { + va_list args; + target_terminal_ours (); + wrap_here (""); /* Force out any buffered output */ + gdb_flush (file); + annotate_error_begin (); + + /* Print the prefix. */ + va_start (args, prefix); + vfprintf_filtered (file, prefix, args); + va_end (args); + + print_exception (file, e); fprintf_filtered (file, "\n"); } } |