summaryrefslogtreecommitdiff
path: root/gdb/exceptions.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2005-01-14 22:59:36 +0000
committerAndrew Cagney <cagney@redhat.com>2005-01-14 22:59:36 +0000
commit37b92e85ff55f77061c247a7d3b6c60a657ec674 (patch)
tree4eb56b1ceb5326c31c63c4055c825c7f9c48570a /gdb/exceptions.c
parent3e0217fc7bd8de401a2692b7dfa7ff8db0a380f0 (diff)
downloadgdb-37b92e85ff55f77061c247a7d3b6c60a657ec674.tar.gz
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.c64
1 files changed, 43 insertions, 21 deletions
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index aed10a8e5fe..1301623edc4 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");
}
}