From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 3F1B53858438; Wed, 5 Jan 2022 18:53:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F1B53858438 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Use filtered output in ordinary commands X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: b68178b9cbbef2aa4e234db4313ac8ba6d1dc04c X-Git-Newrev: b58f47ab4cae11166f210f54bca6e7c58b855a0f Message-Id: <20220105185351.3F1B53858438@sourceware.org> Date: Wed, 5 Jan 2022 18:53:51 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2022 18:53:51 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db58f47ab4cae= 11166f210f54bca6e7c58b855a0f commit b58f47ab4cae11166f210f54bca6e7c58b855a0f Author: Tom Tromey Date: Fri Dec 24 22:31:53 2021 -0700 Use filtered output in ordinary commands =20 Many otherwise ordinary commands choose to use unfiltered output rather than filtered. I don't think there's any reason for this, so this changes many such commands to use filtered output instead. =20 Note that complete_command is not touched due to a comment there explaining why unfiltered output is believed to be used. Diff: --- gdb/breakpoint.c | 12 ++++++------ gdb/cli/cli-cmds.c | 14 +++++++------- gdb/cli/cli-logging.c | 24 ++++++++++++------------ gdb/cp-namespace.c | 2 +- gdb/cp-support.c | 2 +- gdb/dwarf2/index-cache.c | 14 +++++++------- gdb/exec.c | 2 +- gdb/maint.c | 8 ++++---- gdb/memattr.c | 14 +++++++------- gdb/printcmd.c | 6 +++--- gdb/record.c | 10 +++++----- gdb/remote-fileio.c | 4 ++-- gdb/symfile.c | 28 ++++++++++++++-------------- gdb/top.c | 4 ++-- gdb/tracepoint.c | 8 ++++---- gdb/tui/tui-regs.c | 12 ++++++------ gdb/user-regs.c | 4 ++-- gdb/value.c | 10 +++++----- 18 files changed, 89 insertions(+), 89 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index fa99384a496..c7d75731621 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -11535,19 +11535,19 @@ clear_command (const char *arg, int from_tty) if (from_tty) { if (found.size () =3D=3D 1) - printf_unfiltered (_("Deleted breakpoint ")); + printf_filtered (_("Deleted breakpoint ")); else - printf_unfiltered (_("Deleted breakpoints ")); + printf_filtered (_("Deleted breakpoints ")); } =20 for (breakpoint *iter : found) { if (from_tty) - printf_unfiltered ("%d ", iter->number); + printf_filtered ("%d ", iter->number); delete_breakpoint (iter); } if (from_tty) - putchar_unfiltered ('\n'); + putchar_filtered ('\n'); } =0C /* Delete breakpoint in BS if they are `delete' breakpoints and @@ -14010,7 +14010,7 @@ map_breakpoint_number_range (std::pair bp= _num_range, break; } if (!match) - printf_unfiltered (_("No breakpoint number %d.\n"), i); + printf_filtered (_("No breakpoint number %d.\n"), i); } } } @@ -14948,7 +14948,7 @@ get_tracepoint_by_number (const char **arg, if (t->number =3D=3D tpnum) return (struct tracepoint *) t; =20 - printf_unfiltered ("No tracepoint number %d.\n", tpnum); + printf_filtered ("No tracepoint number %d.\n", tpnum); return NULL; } =20 diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index ea191cb4adb..e62e7a9331f 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -501,14 +501,14 @@ pwd_command (const char *args, int from_tty) safe_strerror (errno)); =20 if (strcmp (cwd.get (), current_directory) !=3D 0) - printf_unfiltered (_("Working directory %ps\n (canonically %ps).\n"), - styled_string (file_name_style.style (), - current_directory), - styled_string (file_name_style.style (), cwd.get ())); + printf_filtered (_("Working directory %ps\n (canonically %ps).\n"), + styled_string (file_name_style.style (), + current_directory), + styled_string (file_name_style.style (), cwd.get ())); else - printf_unfiltered (_("Working directory %ps.\n"), - styled_string (file_name_style.style (), - current_directory)); + printf_filtered (_("Working directory %ps.\n"), + styled_string (file_name_style.style (), + current_directory)); } =20 void diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c index ea486d89dfa..bf12b1aa1f2 100644 --- a/gdb/cli/cli-logging.c +++ b/gdb/cli/cli-logging.c @@ -115,8 +115,8 @@ handle_redirections (int from_tty) { if (!saved_filename.empty ()) { - fprintf_unfiltered (gdb_stdout, "Already logging to %s.\n", - saved_filename.c_str ()); + printf_filtered ("Already logging to %s.\n", + saved_filename.c_str ()); return; } =20 @@ -128,18 +128,18 @@ handle_redirections (int from_tty) if (from_tty) { if (!logging_redirect) - fprintf_unfiltered (gdb_stdout, "Copying output to %s.\n", - logging_filename.c_str ()); + printf_filtered ("Copying output to %s.\n", + logging_filename.c_str ()); else - fprintf_unfiltered (gdb_stdout, "Redirecting output to %s.\n", - logging_filename.c_str ()); + printf_filtered ("Redirecting output to %s.\n", + logging_filename.c_str ()); =20 if (!debug_redirect) - fprintf_unfiltered (gdb_stdout, "Copying debug output to %s.\n", - logging_filename.c_str ()); + printf_filtered ("Copying debug output to %s.\n", + logging_filename.c_str ()); else - fprintf_unfiltered (gdb_stdout, "Redirecting debug output to %s.\n", - logging_filename.c_str ()); + printf_filtered ("Redirecting debug output to %s.\n", + logging_filename.c_str ()); } =20 saved_filename =3D logging_filename; @@ -177,8 +177,8 @@ set_logging_off (const char *args, int from_tty) =20 pop_output_files (); if (from_tty) - fprintf_unfiltered (gdb_stdout, "Done logging to %s.\n", - saved_filename.c_str ()); + printf_filtered ("Done logging to %s.\n", + saved_filename.c_str ()); saved_filename.clear (); } =20 diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index c5d58d20757..e6176719677 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -1058,7 +1058,7 @@ cp_lookup_transparent_type_loop (const char *name, static void maintenance_cplus_namespace (const char *args, int from_tty) { - printf_unfiltered (_("The `maint namespace' command was removed.\n")); + printf_filtered (_("The `maint namespace' command was removed.\n")); } =20 void _initialize_cp_namespace (); diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 66924c5437e..de83eb5d957 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -2185,7 +2185,7 @@ first_component_command (const char *arg, int from_tt= y) memcpy (prefix, arg, len); prefix[len] =3D '\0'; =20 - printf_unfiltered ("%s\n", prefix); + printf_filtered ("%s\n", prefix); } =20 /* Implement "info vtbl". */ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c index 2191e58f0bb..fa6b7abccd5 100644 --- a/gdb/dwarf2/index-cache.c +++ b/gdb/dwarf2/index-cache.c @@ -257,8 +257,8 @@ show_index_cache_command (const char *arg, int from_tty) /* Call all "show index-cache" subcommands. */ cmd_show_list (show_index_cache_prefix_list, from_tty); =20 - printf_unfiltered ("\n"); - printf_unfiltered + printf_filtered ("\n"); + printf_filtered (_("The index cache is currently %s.\n"), global_index_cache.enabled () ? _("enabled") : _("disabled")); } @@ -316,13 +316,13 @@ show_index_cache_stats_command (const char *arg, int = from_tty) if (in_show_index_cache_command) { indent =3D " "; - printf_unfiltered ("\n"); + printf_filtered ("\n"); } =20 - printf_unfiltered (_("%s Cache hits (this session): %u\n"), - indent, global_index_cache.n_hits ()); - printf_unfiltered (_("%sCache misses (this session): %u\n"), - indent, global_index_cache.n_misses ()); + printf_filtered (_("%s Cache hits (this session): %u\n"), + indent, global_index_cache.n_hits ()); + printf_filtered (_("%sCache misses (this session): %u\n"), + indent, global_index_cache.n_misses ()); } =20 void _initialize_index_cache (); diff --git a/gdb/exec.c b/gdb/exec.c index 88e8555ccf3..f42862b2159 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -378,7 +378,7 @@ exec_file_attach (const char *filename, int from_tty) if (!filename) { if (from_tty) - printf_unfiltered (_("No executable file now.\n")); + printf_filtered (_("No executable file now.\n")); =20 set_gdbarch_from_file (NULL); } diff --git a/gdb/maint.c b/gdb/maint.c index 4f870ef7fd8..3584974c9e1 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -116,7 +116,7 @@ static void maintenance_time_display (const char *args, int from_tty) { if (args =3D=3D NULL || *args =3D=3D '\0') - printf_unfiltered (_("\"maintenance time\" takes a numeric argument.\n= ")); + printf_filtered (_("\"maintenance time\" takes a numeric argument.\n")= ); else set_per_command_time (strtol (args, NULL, 10)); } @@ -125,7 +125,7 @@ static void maintenance_space_display (const char *args, int from_tty) { if (args =3D=3D NULL || *args =3D=3D '\0') - printf_unfiltered ("\"maintenance space\" takes a numeric argument.\n"= ); + printf_filtered ("\"maintenance space\" takes a numeric argument.\n"); else set_per_command_space (strtol (args, NULL, 10)); } @@ -632,7 +632,7 @@ maintenance_deprecate (const char *args, int from_tty) { if (args =3D=3D NULL || *args =3D=3D '\0') { - printf_unfiltered (_("\"maintenance deprecate\" takes an argument,\n\ + printf_filtered (_("\"maintenance deprecate\" takes an argument,\n\ the command you want to deprecate, and optionally the replacement command\= n\ enclosed in quotes.\n")); } @@ -646,7 +646,7 @@ maintenance_undeprecate (const char *args, int from_tty) { if (args =3D=3D NULL || *args =3D=3D '\0') { - printf_unfiltered (_("\"maintenance undeprecate\" takes an argument,= \n\ + printf_filtered (_("\"maintenance undeprecate\" takes an argument, \= n\ the command you want to undeprecate.\n")); } =20 diff --git a/gdb/memattr.c b/gdb/memattr.c index 4e8d709841a..f83888449a1 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -121,7 +121,7 @@ create_user_mem_region (CORE_ADDR lo, CORE_ADDR hi, /* lo =3D=3D hi is a useless empty region. */ if (lo >=3D hi && hi !=3D 0) { - printf_unfiltered (_("invalid memory region: low >=3D high\n")); + printf_filtered (_("invalid memory region: low >=3D high\n")); return; } =20 @@ -148,7 +148,7 @@ create_user_mem_region (CORE_ADDR lo, CORE_ADDR hi, || (hi > n.lo && (hi <=3D n.hi || n.hi =3D=3D 0)) || (lo <=3D n.lo && ((hi >=3D n.hi && n.hi !=3D 0) || hi =3D=3D 0))) { - printf_unfiltered (_("overlapping memory region\n")); + printf_filtered (_("overlapping memory region\n")); return; } } @@ -347,7 +347,7 @@ info_mem_command (const char *args, int from_tty) =20 if (mem_region_list->empty ()) { - printf_unfiltered (_("There are no memory regions defined.\n")); + printf_filtered (_("There are no memory regions defined.\n")); return; } =20 @@ -474,7 +474,7 @@ mem_enable (int num) m.enabled_p =3D 1; return; } - printf_unfiltered (_("No memory region number %d.\n"), num); + printf_filtered (_("No memory region number %d.\n"), num); } =20 static void @@ -512,7 +512,7 @@ mem_disable (int num) m.enabled_p =3D 0; return; } - printf_unfiltered (_("No memory region number %d.\n"), num); + printf_filtered (_("No memory region number %d.\n"), num); } =20 static void @@ -545,7 +545,7 @@ mem_delete (int num) { if (!mem_region_list) { - printf_unfiltered (_("No memory region number %d.\n"), num); + printf_filtered (_("No memory region number %d.\n"), num); return; } =20 @@ -558,7 +558,7 @@ mem_delete (int num) if (it !=3D mem_region_list->end ()) mem_region_list->erase (it); else - printf_unfiltered (_("No memory region number %d.\n"), num); + printf_filtered (_("No memory region number %d.\n"), num); } =20 static void diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 4693d582904..509f62c21c7 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2058,7 +2058,7 @@ map_display_numbers (const char *args, return item->number =3D=3D num; }); if (iter =3D=3D all_displays.end ()) - printf_unfiltered (_("No display number %d.\n"), num); + printf_filtered (_("No display number %d.\n"), num); else function (iter->get ()); } @@ -2253,7 +2253,7 @@ disable_display (int num) d->enabled_p =3D false; return; } - printf_unfiltered (_("No display number %d.\n"), num); + printf_filtered (_("No display number %d.\n"), num); } =20 void @@ -2274,7 +2274,7 @@ static void info_display_command (const char *ignore, int from_tty) { if (all_displays.empty ()) - printf_unfiltered (_("There are no auto-display expressions now.\n")); + printf_filtered (_("There are no auto-display expressions now.\n")); else printf_filtered (_("Auto-display expressions now in effect:\n\ Num Enb Expression\n")); diff --git a/gdb/record.c b/gdb/record.c index c08988b5426..3c936811fe4 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -279,14 +279,14 @@ cmd_record_delete (const char *args, int from_tty) =20 if (!target_record_is_replaying (inferior_ptid)) { - printf_unfiltered (_("Already at end of record list.\n")); + printf_filtered (_("Already at end of record list.\n")); return; } =20 if (!target_supports_delete_record ()) { - printf_unfiltered (_("The current record target does not support " - "this operation.\n")); + printf_filtered (_("The current record target does not support " + "this operation.\n")); return; } =20 @@ -308,8 +308,8 @@ cmd_record_stop (const char *args, int from_tty) record_stop (t); record_unpush (t); =20 - printf_unfiltered (_("Process record is stopped and all execution " - "logs are deleted.\n")); + printf_filtered (_("Process record is stopped and all execution " + "logs are deleted.\n")); =20 gdb::observers::record_changed.notify (current_inferior (), 0, NULL, NUL= L); } diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index 4b556ba0c13..9963f1ebc01 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -1290,8 +1290,8 @@ show_system_call_allowed (const char *args, int from_= tty) if (args) error (_("Garbage after \"show remote " "system-call-allowed\" command: `%s'"), args); - printf_unfiltered ("Calling host system(3) call from target is %sallowed= \n", - remote_fio_system_call_allowed ? "" : "not "); + printf_filtered ("Calling host system(3) call from target is %sallowed\n= ", + remote_fio_system_call_allowed ? "" : "not "); } =20 void diff --git a/gdb/symfile.c b/gdb/symfile.c index e0e408e844f..0449b919974 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2276,8 +2276,8 @@ add_symbol_file_command (const char *args, int from_t= ty) statements because hex_string returns a local static string. */ =20 - printf_unfiltered (_("add symbol table from file \"%s\""), - filename.get ()); + printf_filtered (_("add symbol table from file \"%s\""), + filename.get ()); section_addr_info section_addrs; std::vector::const_iterator it =3D sect_opts.begin (); if (!seen_addr) @@ -2289,7 +2289,7 @@ add_symbol_file_command (const char *args, int from_t= ty) const char *sec =3D it->name; =20 if (section_addrs.empty ()) - printf_unfiltered (_(" at\n")); + printf_filtered (_(" at\n")); addr =3D parse_and_eval_address (val); =20 /* Here we store the section offsets in the order they were @@ -2309,13 +2309,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_unfiltered (_("%s offset by %s\n"), - (section_addrs.empty () - ? _(" with all sections") - : _("with other sections")), - paddress (gdbarch, offset)); + printf_filtered (_("%s offset by %s\n"), + (section_addrs.empty () + ? _(" with all sections") + : _("with other sections")), + paddress (gdbarch, offset)); else if (section_addrs.empty ()) - printf_unfiltered ("\n"); + printf_filtered ("\n"); =20 if (from_tty && (!query ("%s", ""))) error (_("Not confirmed.")); @@ -3262,8 +3262,8 @@ map_overlay_command (const char *args, int from_tty) sec2)) { if (info_verbose) - printf_unfiltered (_("Note: section %s unmapped by overlap\n"), - bfd_section_name (sec2->the_bfd_section)); + printf_filtered (_("Note: section %s unmapped by overlap\n"), + bfd_section_name (sec2->the_bfd_section)); sec2->ovly_mapped =3D 0; /* sec2 overlaps sec: unmap sec2. */ } return; @@ -3311,7 +3311,7 @@ overlay_auto_command (const char *args, int from_tty) overlay_debugging =3D ovly_auto; enable_overlay_breakpoints (); if (info_verbose) - printf_unfiltered (_("Automatic overlay debugging enabled.")); + printf_filtered (_("Automatic overlay debugging enabled.")); } =20 /* Function: overlay_manual_command @@ -3324,7 +3324,7 @@ overlay_manual_command (const char *args, int from_tt= y) overlay_debugging =3D ovly_on; disable_overlay_breakpoints (); if (info_verbose) - printf_unfiltered (_("Overlay debugging enabled.")); + printf_filtered (_("Overlay debugging enabled.")); } =20 /* Function: overlay_off_command @@ -3337,7 +3337,7 @@ overlay_off_command (const char *args, int from_tty) overlay_debugging =3D ovly_off; disable_overlay_breakpoints (); if (info_verbose) - printf_unfiltered (_("Overlay debugging disabled.")); + printf_filtered (_("Overlay debugging disabled.")); } =20 static void diff --git a/gdb/top.c b/gdb/top.c index e225662950b..07695f88fd4 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -385,7 +385,7 @@ new_ui_command (const char *args, int from_tty) ui.release (); } =20 - printf_unfiltered ("New UI allocated\n"); + printf_filtered ("New UI allocated\n"); } =20 /* Handler for SIGHUP. */ @@ -652,7 +652,7 @@ execute_command (const char *p, int from_tty) std::string prefixname =3D c->prefixname (); std::string prefixname_no_space =3D prefixname.substr (0, prefixname.length () - 1); - printf_unfiltered + printf_filtered ("\"%s\" must be followed by the name of a subcommand.\n", prefixname_no_space.c_str ()); help_list (*c->subcommands, prefixname.c_str (), all_commands, diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index abb10644453..dc5e7f141cf 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2195,8 +2195,8 @@ tfind_1 (enum trace_find_type type, int num, } else { - printf_unfiltered (_("Found trace frame %d, tracepoint %d\n"), - traceframe_number, tracepoint_number); + printf_filtered (_("Found trace frame %d, tracepoint %d\n"), + traceframe_number, tracepoint_number); } } else @@ -2204,9 +2204,9 @@ tfind_1 (enum trace_find_type type, int num, if (uiout->is_mi_like_p ()) uiout->field_string ("found", "0"); else if (type =3D=3D tfind_number && num =3D=3D -1) - printf_unfiltered (_("No longer looking at any trace frame\n")); + printf_filtered (_("No longer looking at any trace frame\n")); else /* This case may never occur, check. */ - printf_unfiltered (_("No trace frame found\n")); + printf_filtered (_("No trace frame found\n")); } =20 /* If we're in nonstop mode and getting out of looking at trace diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index a4eda65e700..16b6c081253 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -606,20 +606,20 @@ tui_reg_command (const char *args, int from_tty) struct reggroup *group; int first; =20 - printf_unfiltered (_("\"tui reg\" must be followed by the name of " - "either a register group,\nor one of 'next' " - "or 'prev'. Known register groups are:\n")); + printf_filtered (_("\"tui reg\" must be followed by the name of " + "either a register group,\nor one of 'next' " + "or 'prev'. Known register groups are:\n")); =20 for (first =3D 1, group =3D reggroup_next (gdbarch, NULL); group !=3D NULL; first =3D 0, group =3D reggroup_next (gdbarch, group)) { if (!first) - printf_unfiltered (", "); - printf_unfiltered ("%s", reggroup_name (group)); + printf_filtered (", "); + printf_filtered ("%s", reggroup_name (group)); } =20 - printf_unfiltered ("\n"); + printf_filtered ("\n"); } } =20 diff --git a/gdb/user-regs.c b/gdb/user-regs.c index 06fb96888de..e9a47be767d 100644 --- a/gdb/user-regs.c +++ b/gdb/user-regs.c @@ -223,9 +223,9 @@ maintenance_print_user_registers (const char *args, int= from_tty) regs =3D (struct gdb_user_regs *) gdbarch_data (gdbarch, user_regs_data); regnum =3D gdbarch_num_cooked_regs (gdbarch); =20 - fprintf_unfiltered (gdb_stdout, " %-11s %3s\n", "Name", "Nr"); + printf_filtered (" %-11s %3s\n", "Name", "Nr"); for (reg =3D regs->first; reg !=3D NULL; reg =3D reg->next, ++regnum) - fprintf_unfiltered (gdb_stdout, " %-11s %3d\n", reg->name, regnum); + printf_filtered (" %-11s %3d\n", reg->name, regnum); } =20 void _initialize_user_regs (); diff --git a/gdb/value.c b/gdb/value.c index 9c396dbfe34..37c949f0853 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2649,11 +2649,11 @@ show_convenience (const char *ignore, int from_tty) The user can't create them except via Python, and if Python support is installed this message will never be printed ($_streq will exist). */ - printf_unfiltered (_("No debugger convenience variables now defined.= \n" - "Convenience variables have " - "names starting with \"$\";\n" - "use \"set\" as in \"set " - "$foo =3D 5\" to define them.\n")); + printf_filtered (_("No debugger convenience variables now defined.\n" + "Convenience variables have " + "names starting with \"$\";\n" + "use \"set\" as in \"set " + "$foo =3D 5\" to define them.\n")); } }