Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.135 diff -u -p -r1.135 defs.h --- defs.h 7 Dec 2003 17:22:29 -0000 1.135 +++ defs.h 18 Dec 2003 21:25:08 -0000 @@ -912,6 +912,8 @@ extern NORETURN void verror (const char extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2); +extern NORETURN void error_silent (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2); + extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN; /* Initialize the error buffer. */ @@ -920,6 +922,9 @@ extern void error_init (void); /* Returns a freshly allocate buffer containing the last error message. */ extern char *error_last_message (void); + +/* Output last error message. */ +extern void error_last_output (void); extern NORETURN void internal_verror (const char *file, int line, const char *, va_list ap) ATTR_NORETURN; Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.110 diff -u -p -r1.110 utils.c --- utils.c 21 Sep 2003 01:26:45 -0000 1.110 +++ utils.c 18 Dec 2003 21:25:08 -0000 @@ -626,6 +626,38 @@ do_write (void *data, const char *buffer ui_file_write (data, buffer, length_buffer); } +/* Cause a silent error to occur. Any error message is recorded + though it is not issued. */ +NORETURN void +error_silent (const char *string, ...) +{ + va_list args; + struct ui_file *tmp_stream = mem_fileopen (); + va_start (args, string); + make_cleanup_ui_file_delete (tmp_stream); + vfprintf_unfiltered (tmp_stream, string, args); + /* Copy the stream into the GDB_LASTERR buffer. */ + ui_file_rewind (gdb_lasterr); + ui_file_put (tmp_stream, do_write, gdb_lasterr); + va_end (args); + + throw_exception (RETURN_ERROR); +} + +/* Output the last error message plus any error_pre_print to gdb_stderr. */ +void +error_last_output (void) +{ + target_terminal_ours (); + wrap_here (""); /* Force out any buffered output */ + gdb_flush (gdb_stdout); + annotate_error_begin (); + if (error_pre_print) + fputs_filtered (error_pre_print, gdb_stderr); + ui_file_put (gdb_lasterr, do_write, gdb_stderr); + fprintf_filtered (gdb_stderr, "\n"); +} + NORETURN void error_stream (struct ui_file *stream) { Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.53 diff -u -p -r1.53 linespec.c --- linespec.c 17 Dec 2003 21:47:47 -0000 1.53 +++ linespec.c 18 Dec 2003 21:25:08 -0000 @@ -1469,7 +1469,7 @@ symtab_from_filename (char **argptr, cha if (not_found_ptr) { *not_found_ptr = 1; - throw_exception (RETURN_ERROR); + error_silent ("No source file named %s.", copy); } error ("No source file named %s.", copy); } @@ -1684,7 +1684,7 @@ decode_variable (char *copy, int funfirs if (not_found_ptr) { *not_found_ptr = 1; - throw_exception (RETURN_ERROR); + error_silent ("Function \"%s\" not defined.", copy); } error ("Function \"%s\" not defined.", copy);