aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/core.c17
-rw-r--r--gdb/defs.h4
-rw-r--r--gdb/language.c20
-rw-r--r--gdb/symtab.c36
-rw-r--r--gdb/utils.c28
6 files changed, 82 insertions, 39 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 400b40a..05bb47b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,12 +1,22 @@
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.
diff --git a/gdb/core.c b/gdb/core.c
index f16efe8..fe44651 100644
--- a/gdb/core.c
+++ b/gdb/core.c
@@ -138,19 +138,24 @@ memory_error (status, memaddr)
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);
}
}
diff --git a/gdb/defs.h b/gdb/defs.h
index f86b46d..4b7b0c3 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -337,7 +337,7 @@ extern char *
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));
@@ -623,6 +623,8 @@ extern char *warning_pre_print;
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 ();
diff --git a/gdb/language.c b/gdb/language.c
index 9dcdbba..af0243b 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -983,18 +983,18 @@ type_error (va_alist)
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
@@ -1004,18 +1004,18 @@ range_error (va_alist)
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);
}
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f9eaf86..dfe5ac8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1038,8 +1038,14 @@ find_pc_symtab (pc)
return (s);
}
+#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)
@@ -1110,7 +1116,7 @@ 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,
@@ -1863,10 +1869,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
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')
@@ -1923,7 +1926,8 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
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);
}
@@ -2015,21 +2019,25 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
}
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);
}
@@ -2338,7 +2346,7 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
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");
diff --git a/gdb/utils.c b/gdb/utils.c
index d1a5e70..33501ba 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -250,6 +250,25 @@ warning (va_alist)
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. */
@@ -262,12 +281,8 @@ error (va_alist)
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");
@@ -438,6 +453,9 @@ quit ()
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);