(quit): Print annotation before printing the error message.
* main.c (return_to_top_level): Print annotation before doing the
longjmp.
* symtab.c (decode_line_1): Call error not warning and then
return_to_top_level. Call error_begin and printf_unfiltered
rather calling warning (before calls to return_to_top_level).
* core.c (memory_error): Use error_begin, printf_unfiltered,
print_address_numeric and return_to_top_level instead of error.
Cleans up a FIXME-32x64.
* language.c (type_error, range_error): Call error_begin
not just target_terminal_ours.
Thu Apr 28 08:40:56 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * utils.c, defs.h (error_begin): New function.
+ (quit): Print annotation before printing the error message.
+ * main.c (return_to_top_level): Print annotation before doing the
+ longjmp.
+ * symtab.c (decode_line_1): Call error not warning and then
+ return_to_top_level. Call error_begin and printf_unfiltered
+ rather calling warning (before calls to return_to_top_level).
+ * core.c (memory_error): Use error_begin, printf_unfiltered,
+ print_address_numeric and return_to_top_level instead of error.
+ Cleans up a FIXME-32x64.
+ * language.c (type_error, range_error): Call error_begin
+ not just target_terminal_ours.
+
* dbxread.c (stabsect_build_psymtabs): Assign to sym_stab_info
directly, rather than via DBX_SYMFILE_INFO. A cast on the left
side of an assignment is non-portable.
- * symtab.c (decode_line_1): Call error not warning and then
- return_to_top_level.
-
* utils.c (query): Change syntax of query annotations to be
consistent with other input annotations.
(prompt_for_continue): Likewise for prompt-for-continue annotation.
int status;
CORE_ADDR memaddr;
{
- /* FIXME-32x64--casting CORE_ADDR to unsigned long */
if (status == EIO)
{
/* Actually, address between memaddr and memaddr + len
was out of bounds. */
- error ("Cannot access memory at address %s.",
- local_hex_string((unsigned long) memaddr));
+ error_begin ();
+ printf_unfiltered ("Cannot access memory at address ");
+ print_address_numeric (memaddr, gdb_stdout);
+ printf_unfiltered (".\n");
+ return_to_top_level (RETURN_ERROR);
}
else
{
- error ("Error accessing memory address %s: %s.",
- local_hex_string ((unsigned long) memaddr),
- safe_strerror (status));
+ error_begin ();
+ printf_unfiltered ("Error accessing memory address ");
+ print_address_numeric (memaddr, gdb_stdout);
+ printf_unfiltered (": %s.\n",
+ safe_strerror (status));
+ return_to_top_level (RETURN_ERROR);
}
}
gdb_readline PARAMS ((char *));
extern char *
-command_line_input PARAMS ((char *, int));
+command_line_input PARAMS ((char *, int, char *));
extern void
print_prompt PARAMS ((void));
extern NORETURN void /* Does not return to the caller. */
error ();
+extern void error_begin PARAMS ((void));
+
extern NORETURN void /* Does not return to the caller. */
fatal ();
va_list args;
char *string;
- if (type_check==type_check_warn)
- fprintf_unfiltered(gdb_stderr,warning_pre_print);
+ if (type_check == type_check_warn)
+ fprintf_unfiltered (gdb_stderr, warning_pre_print);
else
- target_terminal_ours();
+ error_begin ();
va_start (args);
string = va_arg (args, char *);
vfprintf_unfiltered (gdb_stderr, string, args);
fprintf_unfiltered (gdb_stderr, "\n");
va_end (args);
- if (type_check==type_check_on)
- return_to_top_level (RETURN_ERROR);
+ if (type_check == type_check_on)
+ return_to_top_level (RETURN_ERROR);
}
void
va_list args;
char *string;
- if (range_check==range_check_warn)
- fprintf_unfiltered(gdb_stderr,warning_pre_print);
+ if (range_check == range_check_warn)
+ fprintf_unfiltered (gdb_stderr, warning_pre_print);
else
- target_terminal_ours();
+ error_begin ();
va_start (args);
string = va_arg (args, char *);
vfprintf_unfiltered (gdb_stderr, string, args);
fprintf_unfiltered (gdb_stderr, "\n");
va_end (args);
- if (range_check==range_check_on)
- return_to_top_level (RETURN_ERROR);
+ if (range_check == range_check_on)
+ return_to_top_level (RETURN_ERROR);
}
\f
return (s);
}
\f
+#if 0
+
/* Find the closest symbol value (of any sort -- function or variable)
- for a given address value. Slow but complete. */
+ for a given address value. Slow but complete. (currently unused,
+ mainly because it is too slow. We could fix it if each symtab and
+ psymtab had contained in it the addresses ranges of each of its
+ sections, which also would be required to make things like "info
+ line *0x2345" cause psymtabs to be converted to symtabs). */
struct symbol *
find_addr_symbol (addr, symtabp, symaddrp)
*symaddrp = best_sym_addr;
return best_sym;
}
-
+#endif /* 0 */
/* Find the source file and line number for a given PC value.
Return a structure containing a symtab pointer, a line number,
while(!++p && *p != '>');
if (!p)
{
- /* FIXME: Why warning() and then return_to_top_level?
- What's wrong with error()? */
- warning("non-matching '<' and '>' in command");
- return_to_top_level (RETURN_ERROR);
+ error ("non-matching '<' and '>' in command");
}
}
if (p[0] == ':' || p[0] == ' ' || p[0] == '\t')
opname = cplus_mangle_opname (tmp, DMGL_ANSI);
if (opname == NULL)
{
- warning ("no mangling for \"%s\"", tmp);
+ error_begin ();
+ printf_unfiltered ("no mangling for \"%s\"\n", tmp);
cplusplus_hint (saved_arg);
return_to_top_level (RETURN_ERROR);
}
}
else
tmp = copy;
+ error_begin ();
if (tmp[0] == '~')
- warning ("the class `%s' does not have destructor defined",
- SYMBOL_SOURCE_NAME(sym_class));
+ printf_unfiltered
+ ("the class `%s' does not have destructor defined\n",
+ SYMBOL_SOURCE_NAME(sym_class));
else
- warning ("the class %s does not have any method named %s",
- SYMBOL_SOURCE_NAME(sym_class), tmp);
+ printf_unfiltered
+ ("the class %s does not have any method named %s\n",
+ SYMBOL_SOURCE_NAME(sym_class), tmp);
cplusplus_hint (saved_arg);
return_to_top_level (RETURN_ERROR);
}
}
else
{
+ error_begin ();
/* The quotes are important if copy is empty. */
- warning ("can't find class, struct, or union named \"%s\"",
- copy);
+ printf_unfiltered
+ ("can't find class, struct, or union named \"%s\"\n", copy);
cplusplus_hint (saved_arg);
return_to_top_level (RETURN_ERROR);
}
printf_unfiltered("%s ",prompt);
gdb_flush(gdb_stdout);
- args = command_line_input ((char *) NULL, 0);
+ args = command_line_input ((char *) NULL, 0, "overload-choice");
if (args == 0 || *args == 0)
error_no_arg ("one or more choice numbers");
va_end (args);
}
+/* Start the printing of an error message. Way to use this is to call
+ this, output the error message, and then call
+ return_to_top_level (RETURN_ERROR). error() provides a convenient way to
+ do this for the special case that the error message can be formatted with
+ a single printf call, but this is more general. */
+void
+error_begin ()
+{
+ target_terminal_ours ();
+ wrap_here (""); /* Force out any buffered output */
+ gdb_flush (gdb_stdout);
+
+ if (annotation_level > 1)
+ fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
+
+ if (error_pre_print)
+ fprintf_filtered (gdb_stderr, error_pre_print);
+}
+
/* Print an error message and return to command level.
The first argument STRING is the error message, used as a fprintf string,
and the remaining args are passed as arguments to it. */
va_list args;
char *string;
+ error_begin ();
va_start (args);
- target_terminal_ours ();
- wrap_here(""); /* Force out any buffered output */
- gdb_flush (gdb_stdout);
- if (error_pre_print)
- fprintf_filtered (gdb_stderr, error_pre_print);
string = va_arg (args, char *);
vfprintf_filtered (gdb_stderr, string, args);
fprintf_filtered (gdb_stderr, "\n");
SERIAL_FLUSH_OUTPUT (gdb_stdout_serial);
SERIAL_UN_FDOPEN (gdb_stdout_serial);
+ if (annotation_level > 1)
+ fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
+
/* Don't use *_filtered; we don't want to prompt the user to continue. */
if (error_pre_print)
fprintf_unfiltered (gdb_stderr, error_pre_print);