From 6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 2 Jan 2022 11:46:15 -0700 Subject: Unify gdb printf functions Now that filtered and unfiltered output can be treated identically, we can unify the printf family of functions. This is done under the name "gdb_printf". Most of this patch was written by script. --- gdb/exec.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index caf790a..0ac4940 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -103,9 +103,9 @@ static void show_exec_file_mismatch_command (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, - _("exec-file-mismatch handling is currently \"%s\".\n"), - exec_file_mismatch_names[exec_file_mismatch_mode]); + gdb_printf (file, + _("exec-file-mismatch handling is currently \"%s\".\n"), + exec_file_mismatch_names[exec_file_mismatch_mode]); } /* Set command. Change the setting for range checking. */ @@ -136,8 +136,8 @@ static void show_write_files (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, _("Writing into executable and core files is %s.\n"), - value); + gdb_printf (file, _("Writing into executable and core files is %s.\n"), + value); } @@ -379,7 +379,7 @@ exec_file_attach (const char *filename, int from_tty) if (!filename) { if (from_tty) - printf_filtered (_("No executable file now.\n")); + gdb_printf (_("No executable file now.\n")); set_gdbarch_from_file (NULL); } @@ -906,11 +906,11 @@ print_section_info (const target_section_table *t, bfd *abfd) /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */ int wid = gdbarch_addr_bit (gdbarch) <= 32 ? 8 : 16; - printf_filtered ("\t`%ps', ", - styled_string (file_name_style.style (), - bfd_get_filename (abfd))); + gdb_printf ("\t`%ps', ", + styled_string (file_name_style.style (), + bfd_get_filename (abfd))); gdb_stdout->wrap_here (8); - printf_filtered (_("file type %s.\n"), bfd_get_target (abfd)); + gdb_printf (_("file type %s.\n"), bfd_get_target (abfd)); if (abfd == current_program_space->exec_bfd ()) { /* gcc-3.4 does not like the initialization in @@ -944,16 +944,16 @@ print_section_info (const target_section_table *t, bfd *abfd) entry_point = gdbarch_addr_bits_remove (gdbarch, bfd_get_start_address (abfd) + displacement); - printf_filtered (_("\tEntry point: %s\n"), - paddress (gdbarch, entry_point)); + gdb_printf (_("\tEntry point: %s\n"), + paddress (gdbarch, entry_point)); } for (const target_section &p : *t) { struct bfd_section *psect = p.the_bfd_section; bfd *pbfd = psect->owner; - printf_filtered ("\t%s", hex_string_custom (p.addr, wid)); - printf_filtered (" - %s", hex_string_custom (p.endaddr, wid)); + gdb_printf ("\t%s", hex_string_custom (p.addr, wid)); + gdb_printf (" - %s", hex_string_custom (p.endaddr, wid)); /* FIXME: A format of "08l" is not wide enough for file offsets larger than 4GB. OTOH, making it "016l" isn't desirable either @@ -962,14 +962,14 @@ print_section_info (const target_section_table *t, bfd *abfd) format string accordingly. */ /* FIXME: i18n: Need to rewrite this sentence. */ if (info_verbose) - printf_filtered (" @ %s", - hex_string_custom (psect->filepos, 8)); - printf_filtered (" is %s", bfd_section_name (psect)); + gdb_printf (" @ %s", + hex_string_custom (psect->filepos, 8)); + gdb_printf (" is %s", bfd_section_name (psect)); if (pbfd != abfd) - printf_filtered (" in %ps", - styled_string (file_name_style.style (), - bfd_get_filename (pbfd))); - printf_filtered ("\n"); + gdb_printf (" in %ps", + styled_string (file_name_style.style (), + bfd_get_filename (pbfd))); + gdb_printf ("\n"); } } -- cgit v1.1