diff options
author | Tom Tromey <tom@tromey.com> | 2022-01-02 11:46:15 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-03-29 12:46:24 -0600 |
commit | 6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a (patch) | |
tree | 641a6a86240919fe4ba9219fbbbe15bc6331c22d /gdb/symfile.c | |
parent | a11ac3b3e8ff6769badcf0041894f6c5acc1b94f (diff) | |
download | binutils-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.zip binutils-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.gz binutils-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.bz2 |
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.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index 790ceec..dcd217c 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1082,8 +1082,8 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, if (deprecated_pre_add_symbol_hook) deprecated_pre_add_symbol_hook (name); else - printf_filtered (_("Reading symbols from %ps...\n"), - styled_string (file_name_style.style (), name)); + gdb_printf (_("Reading symbols from %ps...\n"), + styled_string (file_name_style.style (), name)); } syms_from_objfile (objfile, addrs, add_flags); @@ -1095,8 +1095,8 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, if ((flags & OBJF_READNOW)) { if (should_print) - printf_filtered (_("Expanding full symbols from %ps...\n"), - styled_string (file_name_style.style (), name)); + gdb_printf (_("Expanding full symbols from %ps...\n"), + styled_string (file_name_style.style (), name)); objfile->expand_all_symtabs (); } @@ -1107,8 +1107,8 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, file, and so printing it twice is just redundant. */ if (should_print && !objfile_has_symbols (objfile) && objfile->separate_debug_objfile == nullptr) - printf_filtered (_("(No debugging symbols found in %ps)\n"), - styled_string (file_name_style.style (), name)); + gdb_printf (_("(No debugging symbols found in %ps)\n"), + styled_string (file_name_style.style (), name)); if (should_print) { @@ -1235,7 +1235,7 @@ symbol_file_clear (int from_tty) gdb_assert (current_program_space->symfile_object_file == NULL); if (from_tty) - printf_filtered (_("No symbol file now.\n")); + gdb_printf (_("No symbol file now.\n")); } /* See symfile.h. */ @@ -1262,7 +1262,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc, if (separate_debug_file_debug) { - fprintf_filtered (gdb_stdlog, _(" Trying %s..."), name.c_str ()); + gdb_printf (gdb_stdlog, _(" Trying %s..."), name.c_str ()); gdb_flush (gdb_stdlog); } @@ -1271,7 +1271,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc, if (abfd == NULL) { if (separate_debug_file_debug) - fprintf_filtered (gdb_stdlog, _(" no, unable to open.\n")); + gdb_printf (gdb_stdlog, _(" no, unable to open.\n")); return 0; } @@ -1295,8 +1295,8 @@ separate_debug_file_exists (const std::string &name, unsigned long crc, && abfd_stat.st_ino == parent_stat.st_ino) { if (separate_debug_file_debug) - fprintf_filtered (gdb_stdlog, - _(" no, same file as the objfile.\n")); + gdb_printf (gdb_stdlog, + _(" no, same file as the objfile.\n")); return 0; } @@ -1310,7 +1310,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc, if (!file_crc_p) { if (separate_debug_file_debug) - fprintf_filtered (gdb_stdlog, _(" no, error computing CRC.\n")); + gdb_printf (gdb_stdlog, _(" no, error computing CRC.\n")); return 0; } @@ -1328,8 +1328,8 @@ separate_debug_file_exists (const std::string &name, unsigned long crc, if (!gdb_bfd_crc (parent_objfile->obfd, &parent_crc)) { if (separate_debug_file_debug) - fprintf_filtered (gdb_stdlog, - _(" no, error computing CRC.\n")); + gdb_printf (gdb_stdlog, + _(" no, error computing CRC.\n")); return 0; } @@ -1341,13 +1341,13 @@ separate_debug_file_exists (const std::string &name, unsigned long crc, name.c_str (), objfile_name (parent_objfile)); if (separate_debug_file_debug) - fprintf_filtered (gdb_stdlog, _(" no, CRC doesn't match.\n")); + gdb_printf (gdb_stdlog, _(" no, CRC doesn't match.\n")); return 0; } if (separate_debug_file_debug) - fprintf_filtered (gdb_stdlog, _(" yes!\n")); + gdb_printf (gdb_stdlog, _(" yes!\n")); return 1; } @@ -1357,10 +1357,10 @@ static void show_debug_file_directory (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, - _("The directory where separate debug " - "symbols are searched for is \"%s\".\n"), - value); + gdb_printf (file, + _("The directory where separate debug " + "symbols are searched for is \"%s\".\n"), + value); } #if ! defined (DEBUG_SUBDIRECTORY) @@ -1382,9 +1382,9 @@ find_separate_debug_file (const char *dir, unsigned long crc32, struct objfile *objfile) { if (separate_debug_file_debug) - fprintf_filtered (gdb_stdlog, - _("\nLooking for separate debug info (debug link) for " - "%s\n"), objfile_name (objfile)); + gdb_printf (gdb_stdlog, + _("\nLooking for separate debug info (debug link) for " + "%s\n"), objfile_name (objfile)); /* First try in the same directory as the original file. */ std::string debugfile = dir; @@ -2277,8 +2277,8 @@ add_symbol_file_command (const char *args, int from_tty) statements because hex_string returns a local static string. */ - printf_filtered (_("add symbol table from file \"%s\""), - filename.get ()); + gdb_printf (_("add symbol table from file \"%s\""), + filename.get ()); section_addr_info section_addrs; std::vector<sect_opt>::const_iterator it = sect_opts.begin (); if (!seen_addr) @@ -2290,7 +2290,7 @@ add_symbol_file_command (const char *args, int from_tty) const char *sec = it->name; if (section_addrs.empty ()) - printf_filtered (_(" at\n")); + gdb_printf (_(" at\n")); addr = parse_and_eval_address (val); /* Here we store the section offsets in the order they were @@ -2300,8 +2300,8 @@ add_symbol_file_command (const char *args, int from_tty) index is not used for any other purpose. */ section_addrs.emplace_back (addr, sec, section_addrs.size ()); - printf_filtered ("\t%s_addr = %s\n", sec, - paddress (gdbarch, addr)); + gdb_printf ("\t%s_addr = %s\n", sec, + paddress (gdbarch, addr)); /* The object's sections are initialized when a call is made to build_objfile_section_table (objfile). @@ -2310,13 +2310,13 @@ add_symbol_file_command (const char *args, int from_tty) so we can't determine what section names are valid. */ } if (seen_offset) - printf_filtered (_("%s offset by %s\n"), - (section_addrs.empty () - ? _(" with all sections") - : _("with other sections")), - paddress (gdbarch, offset)); + gdb_printf (_("%s offset by %s\n"), + (section_addrs.empty () + ? _(" with all sections") + : _("with other sections")), + paddress (gdbarch, offset)); else if (section_addrs.empty ()) - printf_filtered ("\n"); + gdb_printf ("\n"); if (from_tty && (!query ("%s", ""))) error (_("Not confirmed.")); @@ -2442,15 +2442,15 @@ reread_symbols (int from_tty) if (res != 0) { /* FIXME, should use print_sys_errmsg but it's not filtered. */ - printf_filtered (_("`%s' has disappeared; keeping its symbols.\n"), - objfile_name (objfile)); + gdb_printf (_("`%s' has disappeared; keeping its symbols.\n"), + objfile_name (objfile)); continue; } new_modtime = new_statbuf.st_mtime; if (new_modtime != objfile->mtime) { - printf_filtered (_("`%s' has changed; re-reading symbols.\n"), - objfile_name (objfile)); + gdb_printf (_("`%s' has changed; re-reading symbols.\n"), + objfile_name (objfile)); /* There are various functions like symbol_file_add, symfile_bfd_open, syms_from_objfile, etc., which might @@ -2598,9 +2598,9 @@ reread_symbols (int from_tty) const int should_print = (print_symbol_loading_p (from_tty, mainline, 1) && readnow_symbol_files); if (should_print) - printf_filtered (_("Expanding full symbols from %ps...\n"), - styled_string (file_name_style.style (), - objfile_name (objfile))); + gdb_printf (_("Expanding full symbols from %ps...\n"), + styled_string (file_name_style.style (), + objfile_name (objfile))); objfile->expand_all_symtabs (); } @@ -2608,7 +2608,7 @@ reread_symbols (int from_tty) if (!objfile_has_symbols (objfile)) { gdb_stdout->wrap_here (0); - printf_filtered (_("(no debugging symbols found)\n")); + gdb_printf (_("(no debugging symbols found)\n")); gdb_stdout->wrap_here (0); } @@ -2677,10 +2677,10 @@ static void show_ext_args (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, - _("Mapping between filename extension " - "and source language is \"%s\".\n"), - value); + gdb_printf (file, + _("Mapping between filename extension " + "and source language is \"%s\".\n"), + value); } static void @@ -2745,11 +2745,11 @@ set_ext_lang_command (const char *args, static void info_ext_lang_command (const char *args, int from_tty) { - printf_filtered (_("Filename extensions and the languages they represent:")); - printf_filtered ("\n\n"); + gdb_printf (_("Filename extensions and the languages they represent:")); + gdb_printf ("\n\n"); for (const filename_language &entry : filename_language_table) - printf_filtered ("\t%s\t- %s\n", entry.ext.c_str (), - language_str (entry.lang)); + gdb_printf ("\t%s\t- %s\n", entry.ext.c_str (), + language_str (entry.lang)); } enum language @@ -2794,13 +2794,13 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename) if (last_objfile_name.empty () || last_objfile_name != this_objfile_name) { last_objfile_name = this_objfile_name; - fprintf_filtered (gdb_stdlog, - "Creating one or more symtabs for objfile %s ...\n", - this_objfile_name); + gdb_printf (gdb_stdlog, + "Creating one or more symtabs for objfile %s ...\n", + this_objfile_name); } - fprintf_filtered (gdb_stdlog, - "Created symtab %s for module %s.\n", - host_address_to_string (symtab), filename); + gdb_printf (gdb_stdlog, + "Created symtab %s for module %s.\n", + host_address_to_string (symtab), filename); } /* Add it to CUST's list of symtabs. */ @@ -2835,10 +2835,10 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name) if (symtab_create_debug) { - fprintf_filtered (gdb_stdlog, - "Created compunit symtab %s for %s.\n", - host_address_to_string (cu), - cu->name); + gdb_printf (gdb_stdlog, + "Created compunit symtab %s for %s.\n", + host_address_to_string (cu), + cu->name); } return cu; @@ -3201,11 +3201,11 @@ list_overlays_command (const char *args, int from_tty) size = bfd_section_size (osect->the_bfd_section); name = bfd_section_name (osect->the_bfd_section); - printf_filtered ("Section %s, loaded at ", name); + gdb_printf ("Section %s, loaded at ", name); gdb_puts (paddress (gdbarch, lma)); gdb_puts (" - "); gdb_puts (paddress (gdbarch, lma + size)); - printf_filtered (", mapped at "); + gdb_printf (", mapped at "); gdb_puts (paddress (gdbarch, vma)); gdb_puts (" - "); gdb_puts (paddress (gdbarch, vma + size)); @@ -3215,7 +3215,7 @@ list_overlays_command (const char *args, int from_tty) } } if (nmapped == 0) - printf_filtered (_("No sections are mapped.\n")); + gdb_printf (_("No sections are mapped.\n")); } /* Function: map_overlay_command @@ -3254,8 +3254,8 @@ map_overlay_command (const char *args, int from_tty) sec2)) { if (info_verbose) - printf_filtered (_("Note: section %s unmapped by overlap\n"), - bfd_section_name (sec2->the_bfd_section)); + gdb_printf (_("Note: section %s unmapped by overlap\n"), + bfd_section_name (sec2->the_bfd_section)); sec2->ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2. */ } return; @@ -3303,7 +3303,7 @@ overlay_auto_command (const char *args, int from_tty) overlay_debugging = ovly_auto; enable_overlay_breakpoints (); if (info_verbose) - printf_filtered (_("Automatic overlay debugging enabled.")); + gdb_printf (_("Automatic overlay debugging enabled.")); } /* Function: overlay_manual_command @@ -3316,7 +3316,7 @@ overlay_manual_command (const char *args, int from_tty) overlay_debugging = ovly_on; disable_overlay_breakpoints (); if (info_verbose) - printf_filtered (_("Overlay debugging enabled.")); + gdb_printf (_("Overlay debugging enabled.")); } /* Function: overlay_off_command @@ -3329,7 +3329,7 @@ overlay_off_command (const char *args, int from_tty) overlay_debugging = ovly_off; disable_overlay_breakpoints (); if (info_verbose) - printf_filtered (_("Overlay debugging disabled.")); + gdb_printf (_("Overlay debugging disabled.")); } static void |