aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-12-24 22:31:53 -0700
committerTom Tromey <tom@tromey.com>2022-01-05 11:36:33 -0700
commitb58f47ab4cae11166f210f54bca6e7c58b855a0f (patch)
tree71a3a29e7574066997f1e5c6ef4df785ad928f98
parentb68178b9cbbef2aa4e234db4313ac8ba6d1dc04c (diff)
downloadgdb-b58f47ab4cae11166f210f54bca6e7c58b855a0f.zip
gdb-b58f47ab4cae11166f210f54bca6e7c58b855a0f.tar.gz
gdb-b58f47ab4cae11166f210f54bca6e7c58b855a0f.tar.bz2
Use filtered output in ordinary commands
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. Note that complete_command is not touched due to a comment there explaining why unfiltered output is believed to be used.
-rw-r--r--gdb/breakpoint.c12
-rw-r--r--gdb/cli/cli-cmds.c14
-rw-r--r--gdb/cli/cli-logging.c24
-rw-r--r--gdb/cp-namespace.c2
-rw-r--r--gdb/cp-support.c2
-rw-r--r--gdb/dwarf2/index-cache.c14
-rw-r--r--gdb/exec.c2
-rw-r--r--gdb/maint.c8
-rw-r--r--gdb/memattr.c14
-rw-r--r--gdb/printcmd.c6
-rw-r--r--gdb/record.c10
-rw-r--r--gdb/remote-fileio.c4
-rw-r--r--gdb/symfile.c28
-rw-r--r--gdb/top.c4
-rw-r--r--gdb/tracepoint.c8
-rw-r--r--gdb/tui/tui-regs.c12
-rw-r--r--gdb/user-regs.c4
-rw-r--r--gdb/value.c10
18 files changed, 89 insertions, 89 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index fa99384..c7d7573 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 () == 1)
- printf_unfiltered (_("Deleted breakpoint "));
+ printf_filtered (_("Deleted breakpoint "));
else
- printf_unfiltered (_("Deleted breakpoints "));
+ printf_filtered (_("Deleted breakpoints "));
}
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');
}
/* Delete breakpoint in BS if they are `delete' breakpoints and
@@ -14010,7 +14010,7 @@ map_breakpoint_number_range (std::pair<int, int> 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 == tpnum)
return (struct tracepoint *) t;
- printf_unfiltered ("No tracepoint number %d.\n", tpnum);
+ printf_filtered ("No tracepoint number %d.\n", tpnum);
return NULL;
}
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index ea191cb..e62e7a9 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));
if (strcmp (cwd.get (), current_directory) != 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));
}
void
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index ea486d8..bf12b1a 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;
}
@@ -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 ());
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 ());
}
saved_filename = logging_filename;
@@ -177,8 +177,8 @@ set_logging_off (const char *args, int from_tty)
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 ();
}
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index c5d58d2..e617671 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"));
}
void _initialize_cp_namespace ();
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 66924c5..de83eb5 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -2185,7 +2185,7 @@ first_component_command (const char *arg, int from_tty)
memcpy (prefix, arg, len);
prefix[len] = '\0';
- printf_unfiltered ("%s\n", prefix);
+ printf_filtered ("%s\n", prefix);
}
/* Implement "info vtbl". */
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
index 2191e58..fa6b7ab 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);
- 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 = " ";
- printf_unfiltered ("\n");
+ printf_filtered ("\n");
}
- 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 ());
}
void _initialize_index_cache ();
diff --git a/gdb/exec.c b/gdb/exec.c
index 88e8555..f42862b 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"));
set_gdbarch_from_file (NULL);
}
diff --git a/gdb/maint.c b/gdb/maint.c
index 4f870ef..3584974 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 == NULL || *args == '\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 == NULL || *args == '\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 == NULL || *args == '\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 == NULL || *args == '\0')
{
- printf_unfiltered (_("\"maintenance undeprecate\" takes an argument, \n\
+ printf_filtered (_("\"maintenance undeprecate\" takes an argument, \n\
the command you want to undeprecate.\n"));
}
diff --git a/gdb/memattr.c b/gdb/memattr.c
index 4e8d709..f838884 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -121,7 +121,7 @@ create_user_mem_region (CORE_ADDR lo, CORE_ADDR hi,
/* lo == hi is a useless empty region. */
if (lo >= hi && hi != 0)
{
- printf_unfiltered (_("invalid memory region: low >= high\n"));
+ printf_filtered (_("invalid memory region: low >= high\n"));
return;
}
@@ -148,7 +148,7 @@ create_user_mem_region (CORE_ADDR lo, CORE_ADDR hi,
|| (hi > n.lo && (hi <= n.hi || n.hi == 0))
|| (lo <= n.lo && ((hi >= n.hi && n.hi != 0) || hi == 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)
if (mem_region_list->empty ())
{
- printf_unfiltered (_("There are no memory regions defined.\n"));
+ printf_filtered (_("There are no memory regions defined.\n"));
return;
}
@@ -474,7 +474,7 @@ mem_enable (int num)
m.enabled_p = 1;
return;
}
- printf_unfiltered (_("No memory region number %d.\n"), num);
+ printf_filtered (_("No memory region number %d.\n"), num);
}
static void
@@ -512,7 +512,7 @@ mem_disable (int num)
m.enabled_p = 0;
return;
}
- printf_unfiltered (_("No memory region number %d.\n"), num);
+ printf_filtered (_("No memory region number %d.\n"), num);
}
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;
}
@@ -558,7 +558,7 @@ mem_delete (int num)
if (it != 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);
}
static void
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 4693d58..509f62c 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2058,7 +2058,7 @@ map_display_numbers (const char *args,
return item->number == num;
});
if (iter == 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 = false;
return;
}
- printf_unfiltered (_("No display number %d.\n"), num);
+ printf_filtered (_("No display number %d.\n"), num);
}
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 c08988b..3c93681 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -279,14 +279,14 @@ cmd_record_delete (const char *args, int from_tty)
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;
}
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;
}
@@ -308,8 +308,8 @@ cmd_record_stop (const char *args, int from_tty)
record_stop (t);
record_unpush (t);
- 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"));
gdb::observers::record_changed.notify (current_inferior (), 0, NULL, NULL);
}
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 4b556ba..9963f1e 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 ");
}
void
diff --git a/gdb/symfile.c b/gdb/symfile.c
index e0e408e..0449b91 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2276,8 +2276,8 @@ add_symbol_file_command (const char *args, int from_tty)
statements because hex_string returns a local static
string. */
- 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<sect_opt>::const_iterator it = sect_opts.begin ();
if (!seen_addr)
@@ -2289,7 +2289,7 @@ add_symbol_file_command (const char *args, int from_tty)
const char *sec = it->name;
if (section_addrs.empty ())
- printf_unfiltered (_(" at\n"));
+ printf_filtered (_(" at\n"));
addr = parse_and_eval_address (val);
/* 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");
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 = 0; /* sec2 overlaps sec: unmap sec2. */
}
return;
@@ -3311,7 +3311,7 @@ overlay_auto_command (const char *args, int from_tty)
overlay_debugging = ovly_auto;
enable_overlay_breakpoints ();
if (info_verbose)
- printf_unfiltered (_("Automatic overlay debugging enabled."));
+ printf_filtered (_("Automatic overlay debugging enabled."));
}
/* Function: overlay_manual_command
@@ -3324,7 +3324,7 @@ overlay_manual_command (const char *args, int from_tty)
overlay_debugging = ovly_on;
disable_overlay_breakpoints ();
if (info_verbose)
- printf_unfiltered (_("Overlay debugging enabled."));
+ printf_filtered (_("Overlay debugging enabled."));
}
/* Function: overlay_off_command
@@ -3337,7 +3337,7 @@ overlay_off_command (const char *args, int from_tty)
overlay_debugging = ovly_off;
disable_overlay_breakpoints ();
if (info_verbose)
- printf_unfiltered (_("Overlay debugging disabled."));
+ printf_filtered (_("Overlay debugging disabled."));
}
static void
diff --git a/gdb/top.c b/gdb/top.c
index e225662..07695f8 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -385,7 +385,7 @@ new_ui_command (const char *args, int from_tty)
ui.release ();
}
- printf_unfiltered ("New UI allocated\n");
+ printf_filtered ("New UI allocated\n");
}
/* Handler for SIGHUP. */
@@ -652,7 +652,7 @@ execute_command (const char *p, int from_tty)
std::string prefixname = c->prefixname ();
std::string prefixname_no_space
= 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 abb1064..dc5e7f1 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 == tfind_number && num == -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"));
}
/* 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 a4eda65..16b6c08 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;
- 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"));
for (first = 1, group = reggroup_next (gdbarch, NULL);
group != NULL;
first = 0, group = reggroup_next (gdbarch, group))
{
if (!first)
- printf_unfiltered (", ");
- printf_unfiltered ("%s", reggroup_name (group));
+ printf_filtered (", ");
+ printf_filtered ("%s", reggroup_name (group));
}
- printf_unfiltered ("\n");
+ printf_filtered ("\n");
}
}
diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 06fb968..e9a47be 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 = (struct gdb_user_regs *) gdbarch_data (gdbarch, user_regs_data);
regnum = gdbarch_num_cooked_regs (gdbarch);
- fprintf_unfiltered (gdb_stdout, " %-11s %3s\n", "Name", "Nr");
+ printf_filtered (" %-11s %3s\n", "Name", "Nr");
for (reg = regs->first; reg != NULL; reg = reg->next, ++regnum)
- fprintf_unfiltered (gdb_stdout, " %-11s %3d\n", reg->name, regnum);
+ printf_filtered (" %-11s %3d\n", reg->name, regnum);
}
void _initialize_user_regs ();
diff --git a/gdb/value.c b/gdb/value.c
index 9c396db..37c949f 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 = 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 = 5\" to define them.\n"));
}
}