From 306d9ac5139c6d8b59e30e1e9ee60776b7425838 Mon Sep 17 00:00:00 2001 From: David Carlton Date: Mon, 4 Aug 2003 17:08:24 +0000 Subject: [PATCH] 2003-08-04 David Carlton * charset.c (cached_iconv_convert): Add __FILE__ and __LINE__ args to internal_error call. * source.c (forward_search_command): Add "%s" format argument. (reverse_search_command): Ditto. * top.c (quit_confirm): Ditto. * cli/cli-setshow.c (do_setshow_command): Ditto. * cp-valprint.c (cp_print_class_method): Replace {f,}printf_{un,}filtered by {f,}puts_{un,}filtered. (cp_print_class_member): Ditto. * event-top.c (command_line_handler): Ditto. * linux-proc.c (linux_info_proc_cmd): Ditto. * p-typeprint.c (pascal_type_print_base): Ditto. * p-valprint.c (pascal_object_print_class_method): Ditto. (pascal_object_print_class_member): Ditto. * printcmd.c (print_scalar_formatted,printf_command): Ditto. * remote.c (remote_cisco_section_offsets): Ditto. * top.c (command_line_input): Ditto. * utils.c (vwarning,error_stream,quit): Ditto. * valprint.c (print_floating,print_binary_chars) (print_octal_chars,print_decimal_chars,print_hex_chars): Ditto. 2003-08-04 David Carlton * mi-main.c (mi_error_last_message): Add "%s" second argument to xasprintf call. 2003-08-04 David Carlton * generic/gdbtk.c (gdbtk_source_start_file): Add "%s" first argument to error call. (tk_command): Ditto. (view_command): Ditto. --- gdb/ChangeLog | 23 +++++++++++++++++++++++ gdb/charset.c | 3 ++- gdb/cli/cli-setshow.c | 2 +- gdb/cp-valprint.c | 4 ++-- gdb/event-top.c | 2 +- gdb/linux-proc.c | 2 +- gdb/mi/ChangeLog | 5 +++++ gdb/mi/mi-main.c | 2 +- gdb/p-typeprint.c | 4 ++-- gdb/p-valprint.c | 4 ++-- gdb/printcmd.c | 4 ++-- gdb/remote.c | 2 +- gdb/source.c | 4 ++-- gdb/top.c | 14 +++++++------- gdb/utils.c | 6 +++--- gdb/valprint.c | 22 +++++++++++----------- 16 files changed, 66 insertions(+), 37 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de60e7d..8b7f2ea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +2003-08-04 David Carlton + + * charset.c (cached_iconv_convert): Add __FILE__ and __LINE__ args + to internal_error call. + * source.c (forward_search_command): Add "%s" format argument. + (reverse_search_command): Ditto. + * top.c (quit_confirm): Ditto. + * cli/cli-setshow.c (do_setshow_command): Ditto. + * cp-valprint.c (cp_print_class_method): Replace + {f,}printf_{un,}filtered by {f,}puts_{un,}filtered. + (cp_print_class_member): Ditto. + * event-top.c (command_line_handler): Ditto. + * linux-proc.c (linux_info_proc_cmd): Ditto. + * p-typeprint.c (pascal_type_print_base): Ditto. + * p-valprint.c (pascal_object_print_class_method): Ditto. + (pascal_object_print_class_member): Ditto. + * printcmd.c (print_scalar_formatted,printf_command): Ditto. + * remote.c (remote_cisco_section_offsets): Ditto. + * top.c (command_line_input): Ditto. + * utils.c (vwarning,error_stream,quit): Ditto. + * valprint.c (print_floating,print_binary_chars) + (print_octal_chars,print_decimal_chars,print_hex_chars): Ditto. + 2003-08-04 Andrew Cagney * frame.c (frame_func_unwind): Use frame_unwind_address_in_block. diff --git a/gdb/charset.c b/gdb/charset.c index c311447..fa68374 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -443,7 +443,8 @@ cached_iconv_convert (struct cached_iconv *ci, int from_char, int *to_char) return 0; /* Anything else is mysterious. */ - internal_error ("Error converting character `%d' from `%s' to `%s' " + internal_error (__FILE__, __LINE__, + "Error converting character `%d' from `%s' to `%s' " "character set: %s", from_char, ci->from->name, ci->to->name, safe_strerror (errno)); diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 1d68ae4..64a0d73 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -213,7 +213,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) strcat (msg, c->enums[i]); } strcat (msg, "."); - error (msg); + error ("%s", msg); } p = strchr (arg, ' '); diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index a591d18..27d8ec3 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -143,7 +143,7 @@ cp_print_class_method (char *valaddr, char *demangled_name; fprintf_filtered (stream, "&"); - fprintf_filtered (stream, kind); + fputs_filtered (kind, stream); demangled_name = cplus_demangle (TYPE_FN_FIELD_PHYSNAME (f, j), DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) @@ -720,7 +720,7 @@ cp_print_class_member (char *valaddr, struct type *domain, if (i < len) { char *name; - fprintf_filtered (stream, prefix); + fputs_filtered (prefix, stream); name = type_name_no_tag (domain); if (name) fputs_filtered (name, stream); diff --git a/gdb/event-top.c b/gdb/event-top.c index 5ab324d..9db28fb 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -612,7 +612,7 @@ command_line_handler (char *rl) if (annotation_level > 1 && instream == stdin) { printf_unfiltered ("\n\032\032post-"); - printf_unfiltered (async_annotation_suffix); + puts_unfiltered (async_annotation_suffix); printf_unfiltered ("\n"); } diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c index e4ea747..282a3ec 100644 --- a/gdb/linux-proc.c +++ b/gdb/linux-proc.c @@ -446,7 +446,7 @@ linux_info_proc_cmd (char *args, int from_tty) if ((procfile = fopen (fname1, "r")) > 0) { while (fgets (buffer, sizeof (buffer), procfile) != NULL) - printf_filtered (buffer); + puts_filtered (buffer); fclose (procfile); } else diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index f4a4ad8..5af17c3 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,8 @@ +2003-08-04 David Carlton + + * mi-main.c (mi_error_last_message): Add "%s" second argument to + xasprintf call. + 2003-06-28 Daniel Jacobowitz * mi-out.c (mi_ui_out_impl): Add NULL for redirect member. diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 5e55913..64a28fd 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -101,7 +101,7 @@ void mi_error_last_message (void) { char *s = error_last_message (); - xasprintf (&mi_error_message, s); + xasprintf (&mi_error_message, "%s", s); xfree (s); } diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 293de70..286f22d 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -460,8 +460,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, /* void pointer */ if ((TYPE_CODE (type) == TYPE_CODE_PTR) && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)) { - fprintf_filtered (stream, - TYPE_NAME (type) ? TYPE_NAME (type) : "pointer"); + fputs_filtered (TYPE_NAME (type) ? TYPE_NAME (type) : "pointer", + stream); return; } /* When SHOW is zero or less, and there is a valid type name, then always diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 4867dcb..718d287 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -661,7 +661,7 @@ common: char *demangled_name; fprintf_filtered (stream, "&"); - fprintf_filtered (stream, kind); + fputs_filtered (kind, stream); demangled_name = cplus_demangle (TYPE_FN_FIELD_PHYSNAME (f, j), DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) @@ -1080,7 +1080,7 @@ pascal_object_print_class_member (char *valaddr, struct type *domain, if (i < len) { char *name; - fprintf_filtered (stream, prefix); + fputs_filtered (prefix, stream); name = type_name_no_tag (domain); if (name) fputs_filtered (name, stream); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 3f0bc3c..dd7f636 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -507,7 +507,7 @@ print_scalar_formatted (void *valaddr, struct type *type, int format, int size, strcpy (buf, local_binary_format_prefix ()); strcat (buf, cp); strcat (buf, local_binary_format_suffix ()); - fprintf_filtered (stream, buf); + fputs_filtered (buf, stream); } break; @@ -2003,7 +2003,7 @@ printf_command (char *arg, int from_tty) current_substring += strlen (current_substring) + 1; } /* Print the portion of the format string after the last argument. */ - printf_filtered (last_arg); + puts_filtered (last_arg); } do_cleanups (old_cleanups); } diff --git a/gdb/remote.c b/gdb/remote.c index 75e1e08..e6c4fbc 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2071,7 +2071,7 @@ remote_cisco_section_offsets (bfd_vma text_addr, sprintf_vma (tmp + strlen (tmp), data_addr); sprintf (tmp + strlen (tmp), " bss = 0x"); sprintf_vma (tmp + strlen (tmp), bss_addr); - fprintf_filtered (gdb_stdlog, tmp); + fputs_filtered (tmp, gdb_stdlog); fprintf_filtered (gdb_stdlog, "Reloc offset: text = 0x%s data = 0x%s bss = 0x%s\n", paddr_nz (*text_offs), diff --git a/gdb/source.c b/gdb/source.c index ae94add..749617b 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1361,7 +1361,7 @@ forward_search_command (char *regex, int from_tty) msg = (char *) re_comp (regex); if (msg) - error (msg); + error ("%s", msg); if (current_source_symtab == 0) select_source_symtab (0); @@ -1457,7 +1457,7 @@ reverse_search_command (char *regex, int from_tty) msg = (char *) re_comp (regex); if (msg) - error (msg); + error ("%s", msg); if (current_source_symtab == 0) select_source_symtab (0); diff --git a/gdb/top.c b/gdb/top.c index 3efebec..e4f9642 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1201,9 +1201,9 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix) if (annotation_level > 1 && instream == stdin) { - printf_unfiltered ("\n\032\032pre-"); - printf_unfiltered (annotation_suffix); - printf_unfiltered ("\n"); + puts_unfiltered ("\n\032\032pre-"); + puts_unfiltered (annotation_suffix); + puts_unfiltered ("\n"); } /* Don't use fancy stuff if not talking to stdin. */ @@ -1222,9 +1222,9 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix) if (annotation_level > 1 && instream == stdin) { - printf_unfiltered ("\n\032\032post-"); - printf_unfiltered (annotation_suffix); - printf_unfiltered ("\n"); + puts_unfiltered ("\n\032\032post-"); + puts_unfiltered (annotation_suffix); + puts_unfiltered ("\n"); } if (!rl || rl == (char *) EOF) @@ -1686,7 +1686,7 @@ quit_confirm (void) else s = "The program is running. Exit anyway? "; - if (!query (s)) + if (!query ("%s", s)) return 0; } diff --git a/gdb/utils.c b/gdb/utils.c index 4dfe89b..a7c22ee 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -578,7 +578,7 @@ vwarning (const char *string, va_list args) wrap_here (""); /* Force out any buffered output */ gdb_flush (gdb_stdout); if (warning_pre_print) - fprintf_unfiltered (gdb_stderr, warning_pre_print); + fputs_unfiltered (warning_pre_print, gdb_stderr); vfprintf_unfiltered (gdb_stderr, string, args); fprintf_unfiltered (gdb_stderr, "\n"); va_end (args); @@ -644,7 +644,7 @@ error_stream (struct ui_file *stream) gdb_flush (gdb_stdout); annotate_error_begin (); if (error_pre_print) - fprintf_filtered (gdb_stderr, error_pre_print); + fputs_filtered (error_pre_print, gdb_stderr); ui_file_put (stream, do_write, gdb_stderr); fprintf_filtered (gdb_stderr, "\n"); @@ -922,7 +922,7 @@ quit (void) /* Don't use *_filtered; we don't want to prompt the user to continue. */ if (quit_pre_print) - fprintf_unfiltered (gdb_stderr, quit_pre_print); + fputs_unfiltered (quit_pre_print, gdb_stderr); #ifdef __MSDOS__ /* No steenking SIGINT will ever be coming our way when the diff --git a/gdb/valprint.c b/gdb/valprint.c index d4b8bf5..71e391a 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -452,9 +452,9 @@ print_floating (char *valaddr, struct type *type, struct ui_file *stream) if (floatformat_is_negative (fmt, valaddr)) fprintf_filtered (stream, "-"); fprintf_filtered (stream, "nan("); - fprintf_filtered (stream, local_hex_format_prefix ()); - fprintf_filtered (stream, floatformat_mantissa (fmt, valaddr)); - fprintf_filtered (stream, local_hex_format_suffix ()); + fputs_filtered (local_hex_format_prefix (), stream); + fputs_filtered (floatformat_mantissa (fmt, valaddr), stream); + fputs_filtered (local_hex_format_suffix (), stream); fprintf_filtered (stream, ")"); return; } @@ -515,7 +515,7 @@ print_binary_chars (struct ui_file *stream, unsigned char *valaddr, /* FIXME: We should be not printing leading zeroes in most cases. */ - fprintf_filtered (stream, local_binary_format_prefix ()); + fputs_filtered (local_binary_format_prefix (), stream); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) { for (p = valaddr; @@ -553,7 +553,7 @@ print_binary_chars (struct ui_file *stream, unsigned char *valaddr, } } } - fprintf_filtered (stream, local_binary_format_suffix ()); + fputs_filtered (local_binary_format_suffix (), stream); } /* VALADDR points to an integer of LEN bytes. @@ -602,7 +602,7 @@ print_octal_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len) cycle = (len * BITS_IN_BYTES) % BITS_IN_OCTAL; carry = 0; - fprintf_filtered (stream, local_octal_format_prefix ()); + fputs_filtered (local_octal_format_prefix (), stream); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) { for (p = valaddr; @@ -701,7 +701,7 @@ print_octal_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len) } } - fprintf_filtered (stream, local_octal_format_suffix ()); + fputs_filtered (local_octal_format_suffix (), stream); } /* VALADDR points to an integer of LEN bytes. @@ -744,7 +744,7 @@ print_decimal_chars (struct ui_file *stream, unsigned char *valaddr, digits[i] = 0; } - fprintf_filtered (stream, local_decimal_format_prefix ()); + fputs_filtered (local_decimal_format_prefix (), stream); /* Ok, we have an unknown number of bytes of data to be printed in * decimal. @@ -841,7 +841,7 @@ print_decimal_chars (struct ui_file *stream, unsigned char *valaddr, } xfree (digits); - fprintf_filtered (stream, local_decimal_format_suffix ()); + fputs_filtered (local_decimal_format_suffix (), stream); } /* VALADDR points to an integer of LEN bytes. Print it in hex on stream. */ @@ -853,7 +853,7 @@ print_hex_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len) /* FIXME: We should be not printing leading zeroes in most cases. */ - fprintf_filtered (stream, local_hex_format_prefix ()); + fputs_filtered (local_hex_format_prefix (), stream); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) { for (p = valaddr; @@ -872,7 +872,7 @@ print_hex_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len) fprintf_filtered (stream, "%02x", *p); } } - fprintf_filtered (stream, local_hex_format_suffix ()); + fputs_filtered (local_hex_format_suffix (), stream); } /* Called by various _val_print routines to print elements of an -- 2.7.4