From f5a96129d27df3f8e5f057b77b2d6f033843966b Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 31 Jan 2002 04:10:51 +0000 Subject: [PATCH] * defs.h (vwarning): Declare. (warning_begin): Delete declaration. * utils.c (vwarning): New function. (warning): Call vwarning. (warning_begin): Delete function. * rs6000-nat.c (vmap_ldinfo): Use the function warning to print the warning message. * d10v-tdep.c (d10v_address_to_pointer) [0]: Delete call to warning_begin. --- gdb/ChangeLog | 13 +++++++++++++ gdb/d10v-tdep.c | 10 ---------- gdb/defs.h | 2 ++ gdb/rs6000-nat.c | 8 +++----- gdb/utils.c | 44 +++++++++++++++++++++----------------------- 5 files changed, 39 insertions(+), 38 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 30e160e..1e481d0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2002-01-30 Andrew Cagney + + * defs.h (vwarning): Declare. + (warning_begin): Delete declaration. + * utils.c (vwarning): New function. + (warning): Call vwarning. + (warning_begin): Delete function. + + * rs6000-nat.c (vmap_ldinfo): Use the function warning to print + the warning message. + * d10v-tdep.c (d10v_address_to_pointer) [0]: Delete call to + warning_begin. + 2002-01-30 Michael Snyder * NEWS: Mention "set trust-readonly-sections" command. diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 0d8934f..d06a0b9 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -402,16 +402,6 @@ d10v_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr) if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD) { -#if 0 - if (! d10v_iaddr_p (addr)) - { - warning_begin (); - fprintf_unfiltered (gdb_stderr, "address `"); - print_address_numeric (addr, 1, gdb_stderr); - fprintf_unfiltered (gdb_stderr, "' is not a code address\n"); - } -#endif - store_unsigned_integer (buf, TYPE_LENGTH (type), d10v_convert_iaddr_to_raw (addr)); } diff --git a/gdb/defs.h b/gdb/defs.h index 56045d6..274cacc 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -1173,6 +1173,8 @@ extern void warning_begin (void); extern void warning (const char *, ...) ATTR_FORMAT (printf, 1, 2); +extern void vwarning (const char *, va_list args); + /* Global functions from other, non-gdb GNU thingies. Libiberty thingies are no longer declared here. We include libiberty.h above, instead. */ diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 94daaff..f79e991 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -851,14 +851,12 @@ vmap_ldinfo (LdInfo *ldi) running a different copy of the same executable. */ if (symfile_objfile != NULL && !got_exec_file) { - warning_begin (); - fputs_unfiltered ("Symbol file ", gdb_stderr); - fputs_unfiltered (symfile_objfile->name, gdb_stderr); - fputs_unfiltered ("\nis not mapped; discarding it.\n\ + warning ("Symbol file %s\nis not mapped; discarding it.\n\ If in fact that file has symbols which the mapped files listed by\n\ \"info files\" lack, you can load symbols with the \"symbol-file\" or\n\ \"add-symbol-file\" commands (note that you must take care of relocating\n\ -symbols to the proper address).\n", gdb_stderr); +symbols to the proper address).", + symfile_objfile->name); free_objfile (symfile_objfile); symfile_objfile = NULL; } diff --git a/gdb/utils.c b/gdb/utils.c index 16c1897..2459dea 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -554,23 +554,28 @@ discard_all_intermediate_continuations (void) -/* Print a warning message. Way to use this is to call warning_begin, - output the warning message (use unfiltered output to gdb_stderr), - ending in a newline. There is not currently a warning_end that you - call afterwards, but such a thing might be added if it is useful - for a GUI to separate warning messages from other output. - - FIXME: Why do warnings use unfiltered output and errors filtered? - Is this anything other than a historical accident? */ +/* Print a warning message. The first argument STRING is the warning + message, used as an fprintf format string, the second is the + va_list of arguments for that string. A warning is unfiltered (not + paginated) so that the user does not need to page through each + screen full of warnings when there are lots of them. */ void -warning_begin (void) +vwarning (const char *string, va_list args) { - target_terminal_ours (); - wrap_here (""); /* Force out any buffered output */ - gdb_flush (gdb_stdout); - if (warning_pre_print) - fprintf_unfiltered (gdb_stderr, warning_pre_print); + if (warning_hook) + (*warning_hook) (string, args); + else + { + target_terminal_ours (); + wrap_here (""); /* Force out any buffered output */ + gdb_flush (gdb_stdout); + if (warning_pre_print) + fprintf_unfiltered (gdb_stderr, warning_pre_print); + vfprintf_unfiltered (gdb_stderr, string, args); + fprintf_unfiltered (gdb_stderr, "\n"); + va_end (args); + } } /* Print a warning message. @@ -584,15 +589,8 @@ warning (const char *string,...) { va_list args; va_start (args, string); - if (warning_hook) - (*warning_hook) (string, args); - else - { - warning_begin (); - vfprintf_unfiltered (gdb_stderr, string, args); - fprintf_unfiltered (gdb_stderr, "\n"); - va_end (args); - } + vwarning (string, args); + va_end (args); } /* Start the printing of an error message. Way to use this is to call -- 2.7.4