public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 00/12] More filtered output cleanups
@ 2022-01-01 17:55 Tom Tromey
  2022-01-01 17:55 ` [PATCH 01/12] Use filtered output for gdbarch dump Tom Tromey
                   ` (12 more replies)
  0 siblings, 13 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches

I found a number of places that use unfiltered output, but that
probably ought to use filtered output.  This patch fixes nearly all of
them (I'll send the remaining patches separately).

The default for user commands should always be to use filtered output.
This way, users will get the correct paging behavior.  And, because
the filter only applies to gdb_stdout anyway, it's safest to use the
_filtered forms in most places.

In the longer run, I think it would be best to reimplement the pager
directly in the gdb_stdout ui_file.  That way, almost no code will
need to make the filtered/unfiltered distinction -- it will be done by
choice of stream.  I'm working on some patches toward this goal.  This
series is a useful step toward that, and IMO desirable on its own as
well.

Regression tested on x86-64 Fedora 34.

Tom



^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 01/12] Use filtered output for gdbarch dump
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-01 17:55 ` [PATCH 02/12] Use filtered output in target-descriptions.c Tom Tromey
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes gdbarch dumping to use filtered output.  This seems a bit
better to me, both on the principle that this is an ordinary command,
and because the output can be voluminous, so it may be nice to stop in
the middle.
---
 gdb/aarch64-tdep.c |   4 +-
 gdb/arc-tdep.c     |  20 +-
 gdb/arm-tdep.c     |  64 +++---
 gdb/cris-tdep.c    |  12 +-
 gdb/gdbarch.c      | 534 ++++++++++++++++++++++-----------------------
 gdb/gdbarch.py     |   8 +-
 gdb/hppa-tdep.c    |   6 +-
 gdb/mips-tdep.c    |  54 ++---
 gdb/mn10300-tdep.c |   4 +-
 gdb/or1k-tdep.c    |   8 +-
 10 files changed, 357 insertions(+), 357 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 70fb66954a4..63d626f90ac 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -3652,8 +3652,8 @@ aarch64_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
   if (tdep == NULL)
     return;
 
-  fprintf_unfiltered (file, _("aarch64_dump_tdep: Lowest pc = 0x%s"),
-		      paddress (gdbarch, tdep->lowest_pc));
+  fprintf_filtered (file, _("aarch64_dump_tdep: Lowest pc = 0x%s"),
+		    paddress (gdbarch, tdep->lowest_pc));
 }
 
 #if GDB_SELF_TEST
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index f5308822f88..90ec323d05e 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -2456,16 +2456,16 @@ arc_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
 {
   arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
-  fprintf_unfiltered (file, "arc_dump_tdep: jb_pc = %i\n", tdep->jb_pc);
-
-  fprintf_unfiltered (file, "arc_dump_tdep: is_sigtramp = <%s>\n",
-		      host_address_to_string (tdep->is_sigtramp));
-  fprintf_unfiltered (file, "arc_dump_tdep: sigcontext_addr = <%s>\n",
-		      host_address_to_string (tdep->sigcontext_addr));
-  fprintf_unfiltered (file, "arc_dump_tdep: sc_reg_offset = <%s>\n",
-		      host_address_to_string (tdep->sc_reg_offset));
-  fprintf_unfiltered (file, "arc_dump_tdep: sc_num_regs = %d\n",
-		      tdep->sc_num_regs);
+  fprintf_filtered (file, "arc_dump_tdep: jb_pc = %i\n", tdep->jb_pc);
+
+  fprintf_filtered (file, "arc_dump_tdep: is_sigtramp = <%s>\n",
+		    host_address_to_string (tdep->is_sigtramp));
+  fprintf_filtered (file, "arc_dump_tdep: sigcontext_addr = <%s>\n",
+		    host_address_to_string (tdep->sigcontext_addr));
+  fprintf_filtered (file, "arc_dump_tdep: sc_reg_offset = <%s>\n",
+		    host_address_to_string (tdep->sc_reg_offset));
+  fprintf_filtered (file, "arc_dump_tdep: sc_num_regs = %d\n",
+		    tdep->sc_num_regs);
 }
 
 /* This command accepts single argument - address of instruction to
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index d631f53f703..f6bd76a354d 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9717,38 +9717,38 @@ arm_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
   if (tdep == NULL)
     return;
 
-  fprintf_unfiltered (file, _("arm_dump_tdep: fp_model = %i\n"),
-		      (int) tdep->fp_model);
-  fprintf_unfiltered (file, _("arm_dump_tdep: have_fpa_registers = %i\n"),
-		      (int) tdep->have_fpa_registers);
-  fprintf_unfiltered (file, _("arm_dump_tdep: have_wmmx_registers = %i\n"),
-		      (int) tdep->have_wmmx_registers);
-  fprintf_unfiltered (file, _("arm_dump_tdep: vfp_register_count = %i\n"),
-		      (int) tdep->vfp_register_count);
-  fprintf_unfiltered (file, _("arm_dump_tdep: have_s_pseudos = %s\n"),
-		      tdep->have_s_pseudos? "true" : "false");
-  fprintf_unfiltered (file, _("arm_dump_tdep: s_pseudo_base = %i\n"),
-		      (int) tdep->s_pseudo_base);
-  fprintf_unfiltered (file, _("arm_dump_tdep: s_pseudo_count = %i\n"),
-		      (int) tdep->s_pseudo_count);
-  fprintf_unfiltered (file, _("arm_dump_tdep: have_q_pseudos = %s\n"),
-		      tdep->have_q_pseudos? "true" : "false");
-  fprintf_unfiltered (file, _("arm_dump_tdep: q_pseudo_base = %i\n"),
-		      (int) tdep->q_pseudo_base);
-  fprintf_unfiltered (file, _("arm_dump_tdep: q_pseudo_count = %i\n"),
-		      (int) tdep->q_pseudo_count);
-  fprintf_unfiltered (file, _("arm_dump_tdep: have_neon = %i\n"),
-		      (int) tdep->have_neon);
-  fprintf_unfiltered (file, _("arm_dump_tdep: have_mve = %s\n"),
-		      tdep->have_mve? "yes" : "no");
-  fprintf_unfiltered (file, _("arm_dump_tdep: mve_vpr_regnum = %i\n"),
-		      tdep->mve_vpr_regnum);
-  fprintf_unfiltered (file, _("arm_dump_tdep: mve_pseudo_base = %i\n"),
-		      tdep->mve_pseudo_base);
-  fprintf_unfiltered (file, _("arm_dump_tdep: mve_pseudo_count = %i\n"),
-		      tdep->mve_pseudo_count);
-  fprintf_unfiltered (file, _("arm_dump_tdep: Lowest pc = 0x%lx\n"),
-		      (unsigned long) tdep->lowest_pc);
+  fprintf_filtered (file, _("arm_dump_tdep: fp_model = %i\n"),
+		    (int) tdep->fp_model);
+  fprintf_filtered (file, _("arm_dump_tdep: have_fpa_registers = %i\n"),
+		    (int) tdep->have_fpa_registers);
+  fprintf_filtered (file, _("arm_dump_tdep: have_wmmx_registers = %i\n"),
+		    (int) tdep->have_wmmx_registers);
+  fprintf_filtered (file, _("arm_dump_tdep: vfp_register_count = %i\n"),
+		    (int) tdep->vfp_register_count);
+  fprintf_filtered (file, _("arm_dump_tdep: have_s_pseudos = %s\n"),
+		    tdep->have_s_pseudos? "true" : "false");
+  fprintf_filtered (file, _("arm_dump_tdep: s_pseudo_base = %i\n"),
+		    (int) tdep->s_pseudo_base);
+  fprintf_filtered (file, _("arm_dump_tdep: s_pseudo_count = %i\n"),
+		    (int) tdep->s_pseudo_count);
+  fprintf_filtered (file, _("arm_dump_tdep: have_q_pseudos = %s\n"),
+		    tdep->have_q_pseudos? "true" : "false");
+  fprintf_filtered (file, _("arm_dump_tdep: q_pseudo_base = %i\n"),
+		    (int) tdep->q_pseudo_base);
+  fprintf_filtered (file, _("arm_dump_tdep: q_pseudo_count = %i\n"),
+		    (int) tdep->q_pseudo_count);
+  fprintf_filtered (file, _("arm_dump_tdep: have_neon = %i\n"),
+		    (int) tdep->have_neon);
+  fprintf_filtered (file, _("arm_dump_tdep: have_mve = %s\n"),
+		    tdep->have_mve? "yes" : "no");
+  fprintf_filtered (file, _("arm_dump_tdep: mve_vpr_regnum = %i\n"),
+		    tdep->mve_vpr_regnum);
+  fprintf_filtered (file, _("arm_dump_tdep: mve_pseudo_base = %i\n"),
+		    tdep->mve_pseudo_base);
+  fprintf_filtered (file, _("arm_dump_tdep: mve_pseudo_count = %i\n"),
+		    tdep->mve_pseudo_count);
+  fprintf_filtered (file, _("arm_dump_tdep: Lowest pc = 0x%lx\n"),
+		    (unsigned long) tdep->lowest_pc);
 }
 
 #if GDB_SELF_TEST
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 7db05a721d9..9698d32069d 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3863,12 +3863,12 @@ cris_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
   cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   if (tdep != NULL)
     {
-      fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_version = %i\n",
-			  tdep->cris_version);
-      fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_mode = %s\n",
-			  tdep->cris_mode);
-      fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_dwarf2_cfi = %i\n",
-			  tdep->cris_dwarf2_cfi);
+      fprintf_filtered (file, "cris_dump_tdep: tdep->cris_version = %i\n",
+			tdep->cris_version);
+      fprintf_filtered (file, "cris_dump_tdep: tdep->cris_mode = %s\n",
+			tdep->cris_mode);
+      fprintf_filtered (file, "cris_dump_tdep: tdep->cris_dwarf2_cfi = %i\n",
+			tdep->cris_dwarf2_cfi);
     }
 }
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 28b257a6369..3f7a1e35789 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -613,805 +613,805 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
 #if defined (GDB_NM_FILE)
   gdb_nm_file = GDB_NM_FILE;
 #endif
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
 		      "gdbarch_dump: GDB_NM_FILE = %s\n",
 		      gdb_nm_file);
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: bfd_arch_info = %s\n",
                       gdbarch_bfd_arch_info (gdbarch)->printable_name);
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: byte_order = %s\n",
                       plongest (gdbarch->byte_order));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: byte_order_for_code = %s\n",
                       plongest (gdbarch->byte_order_for_code));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: osabi = %s\n",
                       plongest (gdbarch->osabi));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: target_desc = %s\n",
                       host_address_to_string (gdbarch->target_desc));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: short_bit = %s\n",
                       plongest (gdbarch->short_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: int_bit = %s\n",
                       plongest (gdbarch->int_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: long_bit = %s\n",
                       plongest (gdbarch->long_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: long_long_bit = %s\n",
                       plongest (gdbarch->long_long_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: bfloat16_bit = %s\n",
                       plongest (gdbarch->bfloat16_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: bfloat16_format = %s\n",
                       pformat (gdbarch->bfloat16_format));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: half_bit = %s\n",
                       plongest (gdbarch->half_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: half_format = %s\n",
                       pformat (gdbarch->half_format));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: float_bit = %s\n",
                       plongest (gdbarch->float_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: float_format = %s\n",
                       pformat (gdbarch->float_format));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: double_bit = %s\n",
                       plongest (gdbarch->double_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: double_format = %s\n",
                       pformat (gdbarch->double_format));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: long_double_bit = %s\n",
                       plongest (gdbarch->long_double_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: long_double_format = %s\n",
                       pformat (gdbarch->long_double_format));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: wchar_bit = %s\n",
                       plongest (gdbarch->wchar_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: wchar_signed = %s\n",
                       plongest (gdbarch->wchar_signed));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: floatformat_for_type = <%s>\n",
                       host_address_to_string (gdbarch->floatformat_for_type));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: ptr_bit = %s\n",
                       plongest (gdbarch->ptr_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: addr_bit = %s\n",
                       plongest (gdbarch->addr_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: dwarf2_addr_size = %s\n",
                       plongest (gdbarch->dwarf2_addr_size));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: char_signed = %s\n",
                       plongest (gdbarch->char_signed));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_read_pc_p() = %d\n",
                       gdbarch_read_pc_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: read_pc = <%s>\n",
                       host_address_to_string (gdbarch->read_pc));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_write_pc_p() = %d\n",
                       gdbarch_write_pc_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: write_pc = <%s>\n",
                       host_address_to_string (gdbarch->write_pc));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: virtual_frame_pointer = <%s>\n",
                       host_address_to_string (gdbarch->virtual_frame_pointer));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n",
                       gdbarch_pseudo_register_read_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: pseudo_register_read = <%s>\n",
                       host_address_to_string (gdbarch->pseudo_register_read));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_pseudo_register_read_value_p() = %d\n",
                       gdbarch_pseudo_register_read_value_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: pseudo_register_read_value = <%s>\n",
                       host_address_to_string (gdbarch->pseudo_register_read_value));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n",
                       gdbarch_pseudo_register_write_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: pseudo_register_write = <%s>\n",
                       host_address_to_string (gdbarch->pseudo_register_write));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: num_regs = %s\n",
                       plongest (gdbarch->num_regs));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: num_pseudo_regs = %s\n",
                       plongest (gdbarch->num_pseudo_regs));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_ax_pseudo_register_collect_p() = %d\n",
                       gdbarch_ax_pseudo_register_collect_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: ax_pseudo_register_collect = <%s>\n",
                       host_address_to_string (gdbarch->ax_pseudo_register_collect));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_ax_pseudo_register_push_stack_p() = %d\n",
                       gdbarch_ax_pseudo_register_push_stack_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: ax_pseudo_register_push_stack = <%s>\n",
                       host_address_to_string (gdbarch->ax_pseudo_register_push_stack));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_report_signal_info_p() = %d\n",
                       gdbarch_report_signal_info_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: report_signal_info = <%s>\n",
                       host_address_to_string (gdbarch->report_signal_info));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: sp_regnum = %s\n",
                       plongest (gdbarch->sp_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: pc_regnum = %s\n",
                       plongest (gdbarch->pc_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: ps_regnum = %s\n",
                       plongest (gdbarch->ps_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: fp0_regnum = %s\n",
                       plongest (gdbarch->fp0_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stab_reg_to_regnum = <%s>\n",
                       host_address_to_string (gdbarch->stab_reg_to_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: ecoff_reg_to_regnum = <%s>\n",
                       host_address_to_string (gdbarch->ecoff_reg_to_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: sdb_reg_to_regnum = <%s>\n",
                       host_address_to_string (gdbarch->sdb_reg_to_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: dwarf2_reg_to_regnum = <%s>\n",
                       host_address_to_string (gdbarch->dwarf2_reg_to_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: register_name = <%s>\n",
                       host_address_to_string (gdbarch->register_name));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_register_type_p() = %d\n",
                       gdbarch_register_type_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: register_type = <%s>\n",
                       host_address_to_string (gdbarch->register_type));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: dummy_id = <%s>\n",
                       host_address_to_string (gdbarch->dummy_id));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: deprecated_fp_regnum = %s\n",
                       plongest (gdbarch->deprecated_fp_regnum));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
                       gdbarch_push_dummy_call_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: push_dummy_call = <%s>\n",
                       host_address_to_string (gdbarch->push_dummy_call));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: call_dummy_location = %s\n",
                       plongest (gdbarch->call_dummy_location));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n",
                       gdbarch_push_dummy_code_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: push_dummy_code = <%s>\n",
                       host_address_to_string (gdbarch->push_dummy_code));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: code_of_frame_writable = <%s>\n",
                       host_address_to_string (gdbarch->code_of_frame_writable));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: print_registers_info = <%s>\n",
                       host_address_to_string (gdbarch->print_registers_info));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: print_float_info = <%s>\n",
                       host_address_to_string (gdbarch->print_float_info));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n",
                       gdbarch_print_vector_info_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: print_vector_info = <%s>\n",
                       host_address_to_string (gdbarch->print_vector_info));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: register_sim_regno = <%s>\n",
                       host_address_to_string (gdbarch->register_sim_regno));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: cannot_fetch_register = <%s>\n",
                       host_address_to_string (gdbarch->cannot_fetch_register));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: cannot_store_register = <%s>\n",
                       host_address_to_string (gdbarch->cannot_store_register));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n",
                       gdbarch_get_longjmp_target_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: get_longjmp_target = <%s>\n",
                       host_address_to_string (gdbarch->get_longjmp_target));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: believe_pcc_promotion = %s\n",
                       plongest (gdbarch->believe_pcc_promotion));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: convert_register_p = <%s>\n",
                       host_address_to_string (gdbarch->convert_register_p));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: register_to_value = <%s>\n",
                       host_address_to_string (gdbarch->register_to_value));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: value_to_register = <%s>\n",
                       host_address_to_string (gdbarch->value_to_register));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: value_from_register = <%s>\n",
                       host_address_to_string (gdbarch->value_from_register));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: pointer_to_address = <%s>\n",
                       host_address_to_string (gdbarch->pointer_to_address));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: address_to_pointer = <%s>\n",
                       host_address_to_string (gdbarch->address_to_pointer));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
                       gdbarch_integer_to_address_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: integer_to_address = <%s>\n",
                       host_address_to_string (gdbarch->integer_to_address));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_return_value_p() = %d\n",
                       gdbarch_return_value_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: return_value = <%s>\n",
                       host_address_to_string (gdbarch->return_value));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: return_in_first_hidden_param_p = <%s>\n",
                       host_address_to_string (gdbarch->return_in_first_hidden_param_p));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: skip_prologue = <%s>\n",
                       host_address_to_string (gdbarch->skip_prologue));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n",
                       gdbarch_skip_main_prologue_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: skip_main_prologue = <%s>\n",
                       host_address_to_string (gdbarch->skip_main_prologue));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_skip_entrypoint_p() = %d\n",
                       gdbarch_skip_entrypoint_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: skip_entrypoint = <%s>\n",
                       host_address_to_string (gdbarch->skip_entrypoint));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: inner_than = <%s>\n",
                       host_address_to_string (gdbarch->inner_than));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: breakpoint_from_pc = <%s>\n",
                       host_address_to_string (gdbarch->breakpoint_from_pc));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: breakpoint_kind_from_pc = <%s>\n",
                       host_address_to_string (gdbarch->breakpoint_kind_from_pc));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: sw_breakpoint_from_kind = <%s>\n",
                       host_address_to_string (gdbarch->sw_breakpoint_from_kind));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: breakpoint_kind_from_current_state = <%s>\n",
                       host_address_to_string (gdbarch->breakpoint_kind_from_current_state));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n",
                       gdbarch_adjust_breakpoint_address_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: adjust_breakpoint_address = <%s>\n",
                       host_address_to_string (gdbarch->adjust_breakpoint_address));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: memory_insert_breakpoint = <%s>\n",
                       host_address_to_string (gdbarch->memory_insert_breakpoint));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: memory_remove_breakpoint = <%s>\n",
                       host_address_to_string (gdbarch->memory_remove_breakpoint));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: decr_pc_after_break = %s\n",
                       core_addr_to_string_nz (gdbarch->decr_pc_after_break));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: deprecated_function_start_offset = %s\n",
                       core_addr_to_string_nz (gdbarch->deprecated_function_start_offset));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: remote_register_number = <%s>\n",
                       host_address_to_string (gdbarch->remote_register_number));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_fetch_tls_load_module_address_p() = %d\n",
                       gdbarch_fetch_tls_load_module_address_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: fetch_tls_load_module_address = <%s>\n",
                       host_address_to_string (gdbarch->fetch_tls_load_module_address));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_get_thread_local_address_p() = %d\n",
                       gdbarch_get_thread_local_address_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: get_thread_local_address = <%s>\n",
                       host_address_to_string (gdbarch->get_thread_local_address));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: frame_args_skip = %s\n",
                       core_addr_to_string_nz (gdbarch->frame_args_skip));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: unwind_pc = <%s>\n",
                       host_address_to_string (gdbarch->unwind_pc));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: unwind_sp = <%s>\n",
                       host_address_to_string (gdbarch->unwind_sp));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_frame_num_args_p() = %d\n",
                       gdbarch_frame_num_args_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: frame_num_args = <%s>\n",
                       host_address_to_string (gdbarch->frame_num_args));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_frame_align_p() = %d\n",
                       gdbarch_frame_align_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: frame_align = <%s>\n",
                       host_address_to_string (gdbarch->frame_align));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stabs_argument_has_addr = <%s>\n",
                       host_address_to_string (gdbarch->stabs_argument_has_addr));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: frame_red_zone_size = %s\n",
                       plongest (gdbarch->frame_red_zone_size));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: convert_from_func_ptr_addr = <%s>\n",
                       host_address_to_string (gdbarch->convert_from_func_ptr_addr));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: addr_bits_remove = <%s>\n",
                       host_address_to_string (gdbarch->addr_bits_remove));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: significant_addr_bit = %s\n",
                       plongest (gdbarch->significant_addr_bit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: memtag_to_string = <%s>\n",
                       host_address_to_string (gdbarch->memtag_to_string));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: tagged_address_p = <%s>\n",
                       host_address_to_string (gdbarch->tagged_address_p));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: memtag_matches_p = <%s>\n",
                       host_address_to_string (gdbarch->memtag_matches_p));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: set_memtags = <%s>\n",
                       host_address_to_string (gdbarch->set_memtags));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: get_memtag = <%s>\n",
                       host_address_to_string (gdbarch->get_memtag));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: memtag_granule_size = %s\n",
                       core_addr_to_string_nz (gdbarch->memtag_granule_size));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
                       gdbarch_software_single_step_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: software_single_step = <%s>\n",
                       host_address_to_string (gdbarch->software_single_step));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n",
                       gdbarch_single_step_through_delay_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: single_step_through_delay = <%s>\n",
                       host_address_to_string (gdbarch->single_step_through_delay));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: print_insn = <%s>\n",
                       host_address_to_string (gdbarch->print_insn));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: skip_trampoline_code = <%s>\n",
                       host_address_to_string (gdbarch->skip_trampoline_code));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: skip_solib_resolver = <%s>\n",
                       host_address_to_string (gdbarch->skip_solib_resolver));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: in_solib_return_trampoline = <%s>\n",
                       host_address_to_string (gdbarch->in_solib_return_trampoline));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: in_indirect_branch_thunk = <%s>\n",
                       host_address_to_string (gdbarch->in_indirect_branch_thunk));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stack_frame_destroyed_p = <%s>\n",
                       host_address_to_string (gdbarch->stack_frame_destroyed_p));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_elf_make_msymbol_special_p() = %d\n",
                       gdbarch_elf_make_msymbol_special_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: elf_make_msymbol_special = <%s>\n",
                       host_address_to_string (gdbarch->elf_make_msymbol_special));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: coff_make_msymbol_special = <%s>\n",
                       host_address_to_string (gdbarch->coff_make_msymbol_special));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: make_symbol_special = <%s>\n",
                       host_address_to_string (gdbarch->make_symbol_special));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: adjust_dwarf2_addr = <%s>\n",
                       host_address_to_string (gdbarch->adjust_dwarf2_addr));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: adjust_dwarf2_line = <%s>\n",
                       host_address_to_string (gdbarch->adjust_dwarf2_line));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: cannot_step_breakpoint = %s\n",
                       plongest (gdbarch->cannot_step_breakpoint));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: have_nonsteppable_watchpoint = %s\n",
                       plongest (gdbarch->have_nonsteppable_watchpoint));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_address_class_type_flags_p() = %d\n",
                       gdbarch_address_class_type_flags_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: address_class_type_flags = <%s>\n",
                       host_address_to_string (gdbarch->address_class_type_flags));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n",
                       gdbarch_address_class_type_flags_to_name_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: address_class_type_flags_to_name = <%s>\n",
                       host_address_to_string (gdbarch->address_class_type_flags_to_name));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: execute_dwarf_cfa_vendor_op = <%s>\n",
                       host_address_to_string (gdbarch->execute_dwarf_cfa_vendor_op));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n",
                       gdbarch_address_class_name_to_type_flags_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: address_class_name_to_type_flags = <%s>\n",
                       host_address_to_string (gdbarch->address_class_name_to_type_flags));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: register_reggroup_p = <%s>\n",
                       host_address_to_string (gdbarch->register_reggroup_p));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n",
                       gdbarch_fetch_pointer_argument_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: fetch_pointer_argument = <%s>\n",
                       host_address_to_string (gdbarch->fetch_pointer_argument));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_iterate_over_regset_sections_p() = %d\n",
                       gdbarch_iterate_over_regset_sections_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: iterate_over_regset_sections = <%s>\n",
                       host_address_to_string (gdbarch->iterate_over_regset_sections));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_make_corefile_notes_p() = %d\n",
                       gdbarch_make_corefile_notes_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: make_corefile_notes = <%s>\n",
                       host_address_to_string (gdbarch->make_corefile_notes));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_find_memory_regions_p() = %d\n",
                       gdbarch_find_memory_regions_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: find_memory_regions = <%s>\n",
                       host_address_to_string (gdbarch->find_memory_regions));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n",
                       gdbarch_core_xfer_shared_libraries_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: core_xfer_shared_libraries = <%s>\n",
                       host_address_to_string (gdbarch->core_xfer_shared_libraries));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_core_xfer_shared_libraries_aix_p() = %d\n",
                       gdbarch_core_xfer_shared_libraries_aix_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: core_xfer_shared_libraries_aix = <%s>\n",
                       host_address_to_string (gdbarch->core_xfer_shared_libraries_aix));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_core_pid_to_str_p() = %d\n",
                       gdbarch_core_pid_to_str_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: core_pid_to_str = <%s>\n",
                       host_address_to_string (gdbarch->core_pid_to_str));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_core_thread_name_p() = %d\n",
                       gdbarch_core_thread_name_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: core_thread_name = <%s>\n",
                       host_address_to_string (gdbarch->core_thread_name));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_core_xfer_siginfo_p() = %d\n",
                       gdbarch_core_xfer_siginfo_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: core_xfer_siginfo = <%s>\n",
                       host_address_to_string (gdbarch->core_xfer_siginfo));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_gcore_bfd_target_p() = %d\n",
                       gdbarch_gcore_bfd_target_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gcore_bfd_target = %s\n",
                       pstring (gdbarch->gcore_bfd_target));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: vtable_function_descriptors = %s\n",
                       plongest (gdbarch->vtable_function_descriptors));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: vbit_in_delta = %s\n",
                       plongest (gdbarch->vbit_in_delta));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: skip_permanent_breakpoint = <%s>\n",
                       host_address_to_string (gdbarch->skip_permanent_breakpoint));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_max_insn_length_p() = %d\n",
                       gdbarch_max_insn_length_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: max_insn_length = %s\n",
                       plongest (gdbarch->max_insn_length));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_displaced_step_copy_insn_p() = %d\n",
                       gdbarch_displaced_step_copy_insn_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: displaced_step_copy_insn = <%s>\n",
                       host_address_to_string (gdbarch->displaced_step_copy_insn));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: displaced_step_hw_singlestep = <%s>\n",
                       host_address_to_string (gdbarch->displaced_step_hw_singlestep));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_displaced_step_fixup_p() = %d\n",
                       gdbarch_displaced_step_fixup_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: displaced_step_fixup = <%s>\n",
                       host_address_to_string (gdbarch->displaced_step_fixup));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_displaced_step_prepare_p() = %d\n",
                       gdbarch_displaced_step_prepare_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: displaced_step_prepare = <%s>\n",
                       host_address_to_string (gdbarch->displaced_step_prepare));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: displaced_step_finish = <%s>\n",
                       host_address_to_string (gdbarch->displaced_step_finish));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_displaced_step_copy_insn_closure_by_addr_p() = %d\n",
                       gdbarch_displaced_step_copy_insn_closure_by_addr_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: displaced_step_copy_insn_closure_by_addr = <%s>\n",
                       host_address_to_string (gdbarch->displaced_step_copy_insn_closure_by_addr));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: displaced_step_restore_all_in_ptid = <%s>\n",
                       host_address_to_string (gdbarch->displaced_step_restore_all_in_ptid));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_relocate_instruction_p() = %d\n",
                       gdbarch_relocate_instruction_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: relocate_instruction = <%s>\n",
                       host_address_to_string (gdbarch->relocate_instruction));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_overlay_update_p() = %d\n",
                       gdbarch_overlay_update_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: overlay_update = <%s>\n",
                       host_address_to_string (gdbarch->overlay_update));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_core_read_description_p() = %d\n",
                       gdbarch_core_read_description_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: core_read_description = <%s>\n",
                       host_address_to_string (gdbarch->core_read_description));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: sofun_address_maybe_missing = %s\n",
                       plongest (gdbarch->sofun_address_maybe_missing));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_process_record_p() = %d\n",
                       gdbarch_process_record_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: process_record = <%s>\n",
                       host_address_to_string (gdbarch->process_record));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_process_record_signal_p() = %d\n",
                       gdbarch_process_record_signal_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: process_record_signal = <%s>\n",
                       host_address_to_string (gdbarch->process_record_signal));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_gdb_signal_from_target_p() = %d\n",
                       gdbarch_gdb_signal_from_target_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdb_signal_from_target = <%s>\n",
                       host_address_to_string (gdbarch->gdb_signal_from_target));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_gdb_signal_to_target_p() = %d\n",
                       gdbarch_gdb_signal_to_target_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdb_signal_to_target = <%s>\n",
                       host_address_to_string (gdbarch->gdb_signal_to_target));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_get_siginfo_type_p() = %d\n",
                       gdbarch_get_siginfo_type_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: get_siginfo_type = <%s>\n",
                       host_address_to_string (gdbarch->get_siginfo_type));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_record_special_symbol_p() = %d\n",
                       gdbarch_record_special_symbol_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: record_special_symbol = <%s>\n",
                       host_address_to_string (gdbarch->record_special_symbol));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_get_syscall_number_p() = %d\n",
                       gdbarch_get_syscall_number_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: get_syscall_number = <%s>\n",
                       host_address_to_string (gdbarch->get_syscall_number));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: xml_syscall_file = %s\n",
                       pstring (gdbarch->xml_syscall_file));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: syscalls_info = %s\n",
                       host_address_to_string (gdbarch->syscalls_info));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_integer_prefixes = %s\n",
                       pstring_list (gdbarch->stap_integer_prefixes));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_integer_suffixes = %s\n",
                       pstring_list (gdbarch->stap_integer_suffixes));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_register_prefixes = %s\n",
                       pstring_list (gdbarch->stap_register_prefixes));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_register_suffixes = %s\n",
                       pstring_list (gdbarch->stap_register_suffixes));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_register_indirection_prefixes = %s\n",
                       pstring_list (gdbarch->stap_register_indirection_prefixes));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_register_indirection_suffixes = %s\n",
                       pstring_list (gdbarch->stap_register_indirection_suffixes));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_gdb_register_prefix = %s\n",
                       pstring (gdbarch->stap_gdb_register_prefix));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_gdb_register_suffix = %s\n",
                       pstring (gdbarch->stap_gdb_register_suffix));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n",
                       gdbarch_stap_is_single_operand_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_is_single_operand = <%s>\n",
                       host_address_to_string (gdbarch->stap_is_single_operand));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_stap_parse_special_token_p() = %d\n",
                       gdbarch_stap_parse_special_token_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_parse_special_token = <%s>\n",
                       host_address_to_string (gdbarch->stap_parse_special_token));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_stap_adjust_register_p() = %d\n",
                       gdbarch_stap_adjust_register_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: stap_adjust_register = <%s>\n",
                       host_address_to_string (gdbarch->stap_adjust_register));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_dtrace_parse_probe_argument_p() = %d\n",
                       gdbarch_dtrace_parse_probe_argument_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: dtrace_parse_probe_argument = <%s>\n",
                       host_address_to_string (gdbarch->dtrace_parse_probe_argument));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_dtrace_probe_is_enabled_p() = %d\n",
                       gdbarch_dtrace_probe_is_enabled_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: dtrace_probe_is_enabled = <%s>\n",
                       host_address_to_string (gdbarch->dtrace_probe_is_enabled));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_dtrace_enable_probe_p() = %d\n",
                       gdbarch_dtrace_enable_probe_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: dtrace_enable_probe = <%s>\n",
                       host_address_to_string (gdbarch->dtrace_enable_probe));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_dtrace_disable_probe_p() = %d\n",
                       gdbarch_dtrace_disable_probe_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: dtrace_disable_probe = <%s>\n",
                       host_address_to_string (gdbarch->dtrace_disable_probe));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: has_global_solist = %s\n",
                       plongest (gdbarch->has_global_solist));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: has_global_breakpoints = %s\n",
                       plongest (gdbarch->has_global_breakpoints));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: has_shared_address_space = <%s>\n",
                       host_address_to_string (gdbarch->has_shared_address_space));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: fast_tracepoint_valid_at = <%s>\n",
                       host_address_to_string (gdbarch->fast_tracepoint_valid_at));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: guess_tracepoint_registers = <%s>\n",
                       host_address_to_string (gdbarch->guess_tracepoint_registers));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: auto_charset = <%s>\n",
                       host_address_to_string (gdbarch->auto_charset));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: auto_wide_charset = <%s>\n",
                       host_address_to_string (gdbarch->auto_wide_charset));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: solib_symbols_extension = %s\n",
                       pstring (gdbarch->solib_symbols_extension));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: has_dos_based_file_system = %s\n",
                       plongest (gdbarch->has_dos_based_file_system));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gen_return_address = <%s>\n",
                       host_address_to_string (gdbarch->gen_return_address));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_info_proc_p() = %d\n",
                       gdbarch_info_proc_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: info_proc = <%s>\n",
                       host_address_to_string (gdbarch->info_proc));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_core_info_proc_p() = %d\n",
                       gdbarch_core_info_proc_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: core_info_proc = <%s>\n",
                       host_address_to_string (gdbarch->core_info_proc));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: iterate_over_objfiles_in_search_order = <%s>\n",
                       host_address_to_string (gdbarch->iterate_over_objfiles_in_search_order));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: ravenscar_ops = %s\n",
                       host_address_to_string (gdbarch->ravenscar_ops));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: insn_is_call = <%s>\n",
                       host_address_to_string (gdbarch->insn_is_call));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: insn_is_ret = <%s>\n",
                       host_address_to_string (gdbarch->insn_is_ret));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: insn_is_jump = <%s>\n",
                       host_address_to_string (gdbarch->insn_is_jump));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: program_breakpoint_here_p = <%s>\n",
                       host_address_to_string (gdbarch->program_breakpoint_here_p));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gdbarch_auxv_parse_p() = %d\n",
                       gdbarch_auxv_parse_p (gdbarch));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: auxv_parse = <%s>\n",
                       host_address_to_string (gdbarch->auxv_parse));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: print_auxv_entry = <%s>\n",
                       host_address_to_string (gdbarch->print_auxv_entry));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: vsyscall_range = <%s>\n",
                       host_address_to_string (gdbarch->vsyscall_range));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: infcall_mmap = <%s>\n",
                       host_address_to_string (gdbarch->infcall_mmap));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: infcall_munmap = <%s>\n",
                       host_address_to_string (gdbarch->infcall_munmap));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gcc_target_options = <%s>\n",
                       host_address_to_string (gdbarch->gcc_target_options));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: gnu_triplet_regexp = <%s>\n",
                       host_address_to_string (gdbarch->gnu_triplet_regexp));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: addressable_memory_unit_size = <%s>\n",
                       host_address_to_string (gdbarch->addressable_memory_unit_size));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: disassembler_options_implicit = %s\n",
                       pstring (gdbarch->disassembler_options_implicit));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: disassembler_options = %s\n",
                       pstring_ptr (gdbarch->disassembler_options));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: valid_disassembler_options = %s\n",
                       host_address_to_string (gdbarch->valid_disassembler_options));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: type_align = <%s>\n",
                       host_address_to_string (gdbarch->type_align));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: get_pc_address_flags = <%s>\n",
                       host_address_to_string (gdbarch->get_pc_address_flags));
-  fprintf_unfiltered (file,
+  fprintf_filtered (file,
                       "gdbarch_dump: read_core_file_mappings = <%s>\n",
                       host_address_to_string (gdbarch->read_core_file_mappings));
   if (gdbarch->dump_tdep != NULL)
diff --git a/gdb/gdbarch.py b/gdb/gdbarch.py
index c490a6cb11e..9b538a7d5c6 100755
--- a/gdb/gdbarch.py
+++ b/gdb/gdbarch.py
@@ -401,19 +401,19 @@ with open("gdbarch.c", "w") as f:
     print("#if defined (GDB_NM_FILE)", file=f)
     print("  gdb_nm_file = GDB_NM_FILE;", file=f)
     print("#endif", file=f)
-    print("  fprintf_unfiltered (file,", file=f)
+    print("  fprintf_filtered (file,", file=f)
     print("""		      "gdbarch_dump: GDB_NM_FILE = %s\\n",""", file=f)
     print("		      gdb_nm_file);", file=f)
     for c in components:
         if c.predicate:
-            print("  fprintf_unfiltered (file,", file=f)
+            print("  fprintf_filtered (file,", file=f)
             print(
                 f"""                      "gdbarch_dump: gdbarch_{c.name}_p() = %d\\n",""",
                 file=f,
             )
             print(f"                      gdbarch_{c.name}_p (gdbarch));", file=f)
         if isinstance(c, Function):
-            print("  fprintf_unfiltered (file,", file=f)
+            print("  fprintf_filtered (file,", file=f)
             print(
                 f"""                      "gdbarch_dump: {c.name} = <%s>\\n",""", file=f
             )
@@ -428,7 +428,7 @@ with open("gdbarch.c", "w") as f:
                 printer = f"core_addr_to_string_nz (gdbarch->{c.name})"
             else:
                 printer = f"plongest (gdbarch->{c.name})"
-            print("  fprintf_unfiltered (file,", file=f)
+            print("  fprintf_filtered (file,", file=f)
             print(
                 f"""                      "gdbarch_dump: {c.name} = %s\\n",""", file=f
             )
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index ee8b8d1362d..6c6e538e822 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -3162,9 +3162,9 @@ hppa_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
 {
   hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
-  fprintf_unfiltered (file, "bytes_per_address = %d\n", 
-		      tdep->bytes_per_address);
-  fprintf_unfiltered (file, "elf = %s\n", tdep->is_elf ? "yes" : "no");
+  fprintf_filtered (file, "bytes_per_address = %d\n", 
+		    tdep->bytes_per_address);
+  fprintf_filtered (file, "elf = %s\n", tdep->is_elf ? "yes" : "no");
 }
 
 void _initialize_hppa_tdep ();
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 7f646d2b459..7f8018360dd 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -8929,34 +8929,34 @@ mips_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
 	}
       /* Determine the size of a pointer.  */
       ef_mips_32bitmode = (tdep->elf_flags & EF_MIPS_32BITMODE);
-      fprintf_unfiltered (file,
-			  "mips_dump_tdep: tdep->elf_flags = 0x%x\n",
-			  tdep->elf_flags);
-      fprintf_unfiltered (file,
-			  "mips_dump_tdep: ef_mips_32bitmode = %d\n",
-			  ef_mips_32bitmode);
-      fprintf_unfiltered (file,
-			  "mips_dump_tdep: ef_mips_arch = %d\n",
-			  ef_mips_arch);
-      fprintf_unfiltered (file,
-			  "mips_dump_tdep: tdep->mips_abi = %d (%s)\n",
-			  tdep->mips_abi, mips_abi_strings[tdep->mips_abi]);
-      fprintf_unfiltered (file,
-			  "mips_dump_tdep: "
-			  "mips_mask_address_p() %d (default %d)\n",
-			  mips_mask_address_p (tdep),
-			  tdep->default_mask_address_p);
+      fprintf_filtered (file,
+			"mips_dump_tdep: tdep->elf_flags = 0x%x\n",
+			tdep->elf_flags);
+      fprintf_filtered (file,
+			"mips_dump_tdep: ef_mips_32bitmode = %d\n",
+			ef_mips_32bitmode);
+      fprintf_filtered (file,
+			"mips_dump_tdep: ef_mips_arch = %d\n",
+			ef_mips_arch);
+      fprintf_filtered (file,
+			"mips_dump_tdep: tdep->mips_abi = %d (%s)\n",
+			tdep->mips_abi, mips_abi_strings[tdep->mips_abi]);
+      fprintf_filtered (file,
+			"mips_dump_tdep: "
+			"mips_mask_address_p() %d (default %d)\n",
+			mips_mask_address_p (tdep),
+			tdep->default_mask_address_p);
     }
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: MIPS_DEFAULT_FPU_TYPE = %d (%s)\n",
-		      MIPS_DEFAULT_FPU_TYPE,
-		      mips_fpu_type_str (MIPS_DEFAULT_FPU_TYPE));
-  fprintf_unfiltered (file, "mips_dump_tdep: MIPS_EABI = %d\n",
-		      mips_eabi (gdbarch));
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n",
-		      mips_get_fpu_type (gdbarch),
-		      mips_fpu_type_str (mips_get_fpu_type (gdbarch)));
+  fprintf_filtered (file,
+		    "mips_dump_tdep: MIPS_DEFAULT_FPU_TYPE = %d (%s)\n",
+		    MIPS_DEFAULT_FPU_TYPE,
+		    mips_fpu_type_str (MIPS_DEFAULT_FPU_TYPE));
+  fprintf_filtered (file, "mips_dump_tdep: MIPS_EABI = %d\n",
+		    mips_eabi (gdbarch));
+  fprintf_filtered (file,
+		    "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n",
+		    mips_get_fpu_type (gdbarch),
+		    mips_fpu_type_str (mips_get_fpu_type (gdbarch)));
 }
 
 void _initialize_mips_tdep ();
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 03b725267ec..02efd84d638 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1413,8 +1413,8 @@ static void
 mn10300_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
 {
   mn10300_gdbarch_tdep *tdep = (mn10300_gdbarch_tdep *) gdbarch_tdep (gdbarch);
-  fprintf_unfiltered (file, "mn10300_dump_tdep: am33_mode = %d\n",
-		      tdep->am33_mode);
+  fprintf_filtered (file, "mn10300_dump_tdep: am33_mode = %d\n",
+		    tdep->am33_mode);
 }
 
 void _initialize_mn10300_tdep ();
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index 3a631abd398..1e01df223ad 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -1290,10 +1290,10 @@ or1k_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
   if (NULL == tdep)
     return; /* Nothing to report */
 
-  fprintf_unfiltered (file, "or1k_dump_tdep: %d bytes per word\n",
-		      tdep->bytes_per_word);
-  fprintf_unfiltered (file, "or1k_dump_tdep: %d bytes per address\n",
-		      tdep->bytes_per_address);
+  fprintf_filtered (file, "or1k_dump_tdep: %d bytes per word\n",
+		    tdep->bytes_per_word);
+  fprintf_filtered (file, "or1k_dump_tdep: %d bytes per address\n",
+		    tdep->bytes_per_address);
 }
 \f
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 02/12] Use filtered output in target-descriptions.c
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
  2022-01-01 17:55 ` [PATCH 01/12] Use filtered output for gdbarch dump Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-01 17:55 ` [PATCH 03/12] Use filtered output in files_info implementations Tom Tromey
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

target-descriptions.c uses unfiltered output.  However, if you happen
to invoke this command interactively, it's probably better for it to
use filtering.  For non-interactive use, this doesn't matter.
---
 gdb/target-descriptions.c | 152 +++++++++++++++++++-------------------
 1 file changed, 76 insertions(+), 76 deletions(-)

diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 824112094ba..282729df9e6 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1347,7 +1347,7 @@ class print_c_tdesc : public tdesc_element_visitor
     *outp = '\0';
 
     /* Standard boilerplate.  */
-    printf_unfiltered ("/* THIS FILE IS GENERATED.  "
+    printf_filtered ("/* THIS FILE IS GENERATED.  "
 		       "-*- buffer-read-only: t -*- vi"
 		       ":set ro:\n");
   }
@@ -1359,56 +1359,56 @@ class print_c_tdesc : public tdesc_element_visitor
 
   void visit_pre (const target_desc *e) override
   {
-    printf_unfiltered ("  Original: %s */\n\n",
-		       lbasename (m_filename_after_features.c_str ()));
-
-    printf_unfiltered ("#include \"defs.h\"\n");
-    printf_unfiltered ("#include \"osabi.h\"\n");
-    printf_unfiltered ("#include \"target-descriptions.h\"\n");
-    printf_unfiltered ("\n");
-
-    printf_unfiltered ("struct target_desc *tdesc_%s;\n", m_function);
-    printf_unfiltered ("static void\n");
-    printf_unfiltered ("initialize_tdesc_%s (void)\n", m_function);
-    printf_unfiltered ("{\n");
-    printf_unfiltered
+    printf_filtered ("  Original: %s */\n\n",
+		     lbasename (m_filename_after_features.c_str ()));
+
+    printf_filtered ("#include \"defs.h\"\n");
+    printf_filtered ("#include \"osabi.h\"\n");
+    printf_filtered ("#include \"target-descriptions.h\"\n");
+    printf_filtered ("\n");
+
+    printf_filtered ("struct target_desc *tdesc_%s;\n", m_function);
+    printf_filtered ("static void\n");
+    printf_filtered ("initialize_tdesc_%s (void)\n", m_function);
+    printf_filtered ("{\n");
+    printf_filtered
       ("  target_desc_up result = allocate_target_description ();\n");
 
     if (tdesc_architecture (e) != NULL)
       {
-	printf_unfiltered
+	printf_filtered
 	  ("  set_tdesc_architecture (result.get (), bfd_scan_arch (\"%s\"));\n",
 	   tdesc_architecture (e)->printable_name);
-	printf_unfiltered ("\n");
+	printf_filtered ("\n");
       }
     if (tdesc_osabi (e) > GDB_OSABI_UNKNOWN
 	&& tdesc_osabi (e) < GDB_OSABI_INVALID)
       {
-	printf_unfiltered
+	printf_filtered
 	  ("  set_tdesc_osabi (result.get (), osabi_from_tdesc_string (\"%s\"));\n",
 	   gdbarch_osabi_name (tdesc_osabi (e)));
-	printf_unfiltered ("\n");
+	printf_filtered ("\n");
       }
 
     for (const tdesc_compatible_info_up &compatible : e->compatible)
-      printf_unfiltered
+      printf_filtered
 	("  tdesc_add_compatible (result.get (), bfd_scan_arch (\"%s\"));\n",
 	 compatible->arch ()->printable_name);
 
     if (!e->compatible.empty ())
-      printf_unfiltered ("\n");
+      printf_filtered ("\n");
 
     for (const property &prop : e->properties)
-      printf_unfiltered ("  set_tdesc_property (result.get (), \"%s\", \"%s\");\n",
-			 prop.key.c_str (), prop.value.c_str ());
+      printf_filtered ("  set_tdesc_property (result.get (), \"%s\", \"%s\");\n",
+		       prop.key.c_str (), prop.value.c_str ());
 
-    printf_unfiltered ("  struct tdesc_feature *feature;\n");
+    printf_filtered ("  struct tdesc_feature *feature;\n");
   }
 
   void visit_pre (const tdesc_feature *e) override
   {
-    printf_unfiltered ("\n  feature = tdesc_create_feature (result.get (), \"%s\");\n",
-		       e->name.c_str ());
+    printf_filtered ("\n  feature = tdesc_create_feature (result.get (), \"%s\");\n",
+		     e->name.c_str ());
   }
 
   void visit_post (const tdesc_feature *e) override
@@ -1416,8 +1416,8 @@ class print_c_tdesc : public tdesc_element_visitor
 
   void visit_post (const target_desc *e) override
   {
-    printf_unfiltered ("\n  tdesc_%s = result.release ();\n", m_function);
-    printf_unfiltered ("}\n");
+    printf_filtered ("\n  tdesc_%s = result.release ();\n", m_function);
+    printf_filtered ("}\n");
   }
 
   void visit (const tdesc_type_builtin *type) override
@@ -1429,25 +1429,25 @@ class print_c_tdesc : public tdesc_element_visitor
   {
     if (!m_printed_element_type)
       {
-	printf_unfiltered ("  tdesc_type *element_type;\n");
+	printf_filtered ("  tdesc_type *element_type;\n");
 	m_printed_element_type = true;
       }
 
-    printf_unfiltered
+    printf_filtered
       ("  element_type = tdesc_named_type (feature, \"%s\");\n",
        type->element_type->name.c_str ());
-    printf_unfiltered
+    printf_filtered
       ("  tdesc_create_vector (feature, \"%s\", element_type, %d);\n",
        type->name.c_str (), type->count);
 
-    printf_unfiltered ("\n");
+    printf_filtered ("\n");
   }
 
   void visit (const tdesc_type_with_fields *type) override
   {
     if (!m_printed_type_with_fields)
       {
-	printf_unfiltered ("  tdesc_type_with_fields *type_with_fields;\n");
+	printf_filtered ("  tdesc_type_with_fields *type_with_fields;\n");
 	m_printed_type_with_fields = true;
       }
 
@@ -1457,16 +1457,16 @@ class print_c_tdesc : public tdesc_element_visitor
       case TDESC_TYPE_FLAGS:
 	if (type->kind == TDESC_TYPE_STRUCT)
 	  {
-	    printf_unfiltered
+	    printf_filtered
 	      ("  type_with_fields = tdesc_create_struct (feature, \"%s\");\n",
 	       type->name.c_str ());
 	    if (type->size != 0)
-	      printf_unfiltered
+	      printf_filtered
 		("  tdesc_set_struct_size (type_with_fields, %d);\n", type->size);
 	  }
 	else
 	  {
-	    printf_unfiltered
+	    printf_filtered
 	      ("  type_with_fields = tdesc_create_flags (feature, \"%s\", %d);\n",
 	       type->name.c_str (), type->size);
 	  }
@@ -1485,7 +1485,7 @@ class print_c_tdesc : public tdesc_element_visitor
 		if (f.type->kind == TDESC_TYPE_BOOL)
 		  {
 		    gdb_assert (f.start == f.end);
-		    printf_unfiltered
+		    printf_filtered
 		      ("  tdesc_add_flag (type_with_fields, %d, \"%s\");\n",
 		       f.start, f.name.c_str ());
 		  }
@@ -1493,7 +1493,7 @@ class print_c_tdesc : public tdesc_element_visitor
 			 || (type->size == 8
 			     && f.type->kind == TDESC_TYPE_UINT64))
 		  {
-		    printf_unfiltered
+		    printf_filtered
 		      ("  tdesc_add_bitfield (type_with_fields, \"%s\", %d, %d);\n",
 		       f.name.c_str (), f.start, f.end);
 		  }
@@ -1502,7 +1502,7 @@ class print_c_tdesc : public tdesc_element_visitor
 		    printf_field_type_assignment
 		      ("tdesc_named_type (feature, \"%s\");\n",
 		       type_name);
-		    printf_unfiltered
+		    printf_filtered
 		      ("  tdesc_add_typed_bitfield (type_with_fields, \"%s\","
 		       " %d, %d, field_type);\n",
 		       f.name.c_str (), f.start, f.end);
@@ -1514,31 +1514,31 @@ class print_c_tdesc : public tdesc_element_visitor
 		gdb_assert (type->kind == TDESC_TYPE_STRUCT);
 		printf_field_type_assignment
 		  ("tdesc_named_type (feature, \"%s\");\n", type_name);
-		printf_unfiltered
+		printf_filtered
 		  ("  tdesc_add_field (type_with_fields, \"%s\", field_type);\n",
 		   f.name.c_str ());
 	      }
 	  }
 	break;
       case TDESC_TYPE_UNION:
-	printf_unfiltered
+	printf_filtered
 	  ("  type_with_fields = tdesc_create_union (feature, \"%s\");\n",
 	   type->name.c_str ());
 	for (const tdesc_type_field &f : type->fields)
 	  {
 	    printf_field_type_assignment
 	      ("tdesc_named_type (feature, \"%s\");\n", f.type->name.c_str ());
-	    printf_unfiltered
+	    printf_filtered
 	      ("  tdesc_add_field (type_with_fields, \"%s\", field_type);\n",
 	       f.name.c_str ());
 	  }
 	break;
       case TDESC_TYPE_ENUM:
-	printf_unfiltered
+	printf_filtered
 	  ("  type_with_fields = tdesc_create_enum (feature, \"%s\", %d);\n",
 	   type->name.c_str (), type->size);
 	for (const tdesc_type_field &f : type->fields)
-	  printf_unfiltered
+	  printf_filtered
 	    ("  tdesc_add_enum_value (type_with_fields, %d, \"%s\");\n",
 	     f.start, f.name.c_str ());
 	break;
@@ -1546,19 +1546,19 @@ class print_c_tdesc : public tdesc_element_visitor
 	error (_("C output is not supported type \"%s\"."), type->name.c_str ());
       }
 
-    printf_unfiltered ("\n");
+    printf_filtered ("\n");
   }
 
   void visit (const tdesc_reg *reg) override
   {
-    printf_unfiltered ("  tdesc_create_reg (feature, \"%s\", %ld, %d, ",
-		       reg->name.c_str (), reg->target_regnum,
-		       reg->save_restore);
+    printf_filtered ("  tdesc_create_reg (feature, \"%s\", %ld, %d, ",
+		     reg->name.c_str (), reg->target_regnum,
+		     reg->save_restore);
     if (!reg->group.empty ())
-      printf_unfiltered ("\"%s\", ", reg->group.c_str ());
+      printf_filtered ("\"%s\", ", reg->group.c_str ());
     else
-      printf_unfiltered ("NULL, ");
-    printf_unfiltered ("%d, \"%s\");\n", reg->bitsize, reg->type.c_str ());
+      printf_filtered ("NULL, ");
+    printf_filtered ("%d, \"%s\");\n", reg->bitsize, reg->type.c_str ());
   }
 
 protected:
@@ -1573,15 +1573,15 @@ class print_c_tdesc : public tdesc_element_visitor
   {
     if (!m_printed_field_type)
       {
-	printf_unfiltered ("  tdesc_type *field_type;\n");
+	printf_filtered ("  tdesc_type *field_type;\n");
 	m_printed_field_type = true;
       }
 
-    printf_unfiltered ("  field_type = ");
+    printf_filtered ("  field_type = ");
 
     va_list args;
     va_start (args, fmt);
-    vprintf_unfiltered (fmt, args);
+    vprintf_filtered (fmt, args);
     va_end (args);
   }
 
@@ -1613,11 +1613,11 @@ class print_c_feature : public print_c_tdesc
 
   void visit_pre (const target_desc *e) override
   {
-    printf_unfiltered ("  Original: %s */\n\n",
-		       lbasename (m_filename_after_features.c_str ()));
+    printf_filtered ("  Original: %s */\n\n",
+		     lbasename (m_filename_after_features.c_str ()));
 
-    printf_unfiltered ("#include \"gdbsupport/tdesc.h\"\n");
-    printf_unfiltered ("\n");
+    printf_filtered ("#include \"gdbsupport/tdesc.h\"\n");
+    printf_filtered ("\n");
   }
 
   void visit_post (const target_desc *e) override
@@ -1633,22 +1633,22 @@ class print_c_feature : public print_c_tdesc
     std::replace (name.begin (), name.end (), '/', '_');
     std::replace (name.begin (), name.end (), '-', '_');
 
-    printf_unfiltered ("static int\n");
-    printf_unfiltered ("create_feature_%s ", name.c_str ());
-    printf_unfiltered ("(struct target_desc *result, long regnum)\n");
+    printf_filtered ("static int\n");
+    printf_filtered ("create_feature_%s ", name.c_str ());
+    printf_filtered ("(struct target_desc *result, long regnum)\n");
 
-    printf_unfiltered ("{\n");
-    printf_unfiltered ("  struct tdesc_feature *feature;\n");
+    printf_filtered ("{\n");
+    printf_filtered ("  struct tdesc_feature *feature;\n");
 
-    printf_unfiltered
+    printf_filtered
       ("\n  feature = tdesc_create_feature (result, \"%s\");\n",
        e->name.c_str ());
   }
 
   void visit_post (const tdesc_feature *e) override
   {
-    printf_unfiltered ("  return regnum;\n");
-    printf_unfiltered ("}\n");
+    printf_filtered ("  return regnum;\n");
+    printf_filtered ("}\n");
   }
 
   void visit (const tdesc_reg *reg) override
@@ -1681,27 +1681,27 @@ class print_c_feature : public print_c_tdesc
 	  and also print the message so that it can be saved in the
 	  generated c file.  */
 
-	printf_unfiltered ("ERROR: \"regnum\" attribute %ld ",
-			   reg->target_regnum);
-	printf_unfiltered ("is not the largest number (%d).\n",
-			   m_next_regnum);
+	printf_filtered ("ERROR: \"regnum\" attribute %ld ",
+			 reg->target_regnum);
+	printf_filtered ("is not the largest number (%d).\n",
+			 m_next_regnum);
 	error (_("\"regnum\" attribute %ld is not the largest number (%d)."),
 	       reg->target_regnum, m_next_regnum);
       }
 
     if (reg->target_regnum > m_next_regnum)
       {
-	printf_unfiltered ("  regnum = %ld;\n", reg->target_regnum);
+	printf_filtered ("  regnum = %ld;\n", reg->target_regnum);
 	m_next_regnum = reg->target_regnum;
       }
 
-    printf_unfiltered ("  tdesc_create_reg (feature, \"%s\", regnum++, %d, ",
-		       reg->name.c_str (), reg->save_restore);
+    printf_filtered ("  tdesc_create_reg (feature, \"%s\", regnum++, %d, ",
+		     reg->name.c_str (), reg->save_restore);
     if (!reg->group.empty ())
-      printf_unfiltered ("\"%s\", ", reg->group.c_str ());
+      printf_filtered ("\"%s\", ", reg->group.c_str ());
     else
-      printf_unfiltered ("NULL, ");
-    printf_unfiltered ("%d, \"%s\");\n", reg->bitsize, reg->type.c_str ());
+      printf_filtered ("NULL, ");
+    printf_filtered ("%d, \"%s\");\n", reg->bitsize, reg->type.c_str ());
 
     m_next_regnum++;
   }
@@ -1858,7 +1858,7 @@ maint_print_xml_tdesc_cmd (const char *args, int from_tty)
   std::string buf;
   print_xml_feature v (&buf);
   tdesc->accept (v);
-  puts_unfiltered (buf.c_str ());
+  puts_filtered (buf.c_str ());
 }
 
 namespace selftests {
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 03/12] Use filtered output in files_info implementations
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
  2022-01-01 17:55 ` [PATCH 01/12] Use filtered output for gdbarch dump Tom Tromey
  2022-01-01 17:55 ` [PATCH 02/12] Use filtered output in target-descriptions.c Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-05 11:48   ` Andrew Burgess
  2022-01-01 17:55 ` [PATCH 04/12] Use filtered output in language_info Tom Tromey
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes the implementations of the target files_info method to
use filtered output.  This makes sense because the sole caller of this
method is an ordinary command (info_program_command).  This patch
changes this command to use filtered output as well.
---
 gdb/go32-nat.c    |  2 +-
 gdb/nto-procfs.c  |  8 ++++----
 gdb/remote-sim.c  |  6 +++---
 gdb/target.c      | 10 +++++-----
 gdb/windows-nat.c |  6 +++---
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 970e9e00c54..204c2121006 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -663,7 +663,7 @@ static cmdline_t child_cmd;	/* Parsed child's command line kept here.  */
 void
 go32_nat_target::files_info ()
 {
-  printf_unfiltered ("You are running a DJGPP V2 program.\n");
+  printf_filtered ("You are running a DJGPP V2 program.\n");
 }
 
 void
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 7ae71d9d519..bf869df1dab 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -656,10 +656,10 @@ nto_procfs_target::files_info ()
 {
   struct inferior *inf = current_inferior ();
 
-  printf_unfiltered ("\tUsing the running image of %s %s via %s.\n",
-		     inf->attach_flag ? "attached" : "child",
-		     target_pid_to_str (inferior_ptid).c_str (),
-		     (nodestr != NULL) ? nodestr : "local node");
+  printf_filtered ("\tUsing the running image of %s %s via %s.\n",
+		   inf->attach_flag ? "attached" : "child",
+		   target_pid_to_str (inferior_ptid).c_str (),
+		   (nodestr != NULL) ? nodestr : "local node");
 }
 
 /* Target to_pid_to_exec_file implementation.  */
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 7a029c93e91..f6c369d0c35 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -1110,12 +1110,12 @@ gdbsim_target::files_info ()
     file = bfd_get_filename (current_program_space->exec_bfd ());
 
   if (remote_debug)
-    fprintf_unfiltered (gdb_stdlog, "gdbsim_files_info: file \"%s\"\n", file);
+    fprintf_filtered (gdb_stdlog, "gdbsim_files_info: file \"%s\"\n", file);
 
   if (current_program_space->exec_bfd ())
     {
-      fprintf_unfiltered (gdb_stdlog, "\tAttached to %s running program %s\n",
-			  target_shortname (), file);
+      fprintf_filtered (gdb_stdlog, "\tAttached to %s running program %s\n",
+			target_shortname (), file);
       sim_info (sim_data->gdbsim_desc, 0);
     }
 }
diff --git a/gdb/target.c b/gdb/target.c
index e10b295c797..b3b1bbd06b2 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2444,8 +2444,8 @@ info_target_command (const char *args, int from_tty)
   if (current_program_space->symfile_object_file != NULL)
     {
       objfile *objf = current_program_space->symfile_object_file;
-      printf_unfiltered (_("Symbols from \"%s\".\n"),
-			 objfile_name (objf));
+      printf_filtered (_("Symbols from \"%s\".\n"),
+		       objfile_name (objf));
     }
 
   for (target_ops *t = current_inferior ()->top_target ();
@@ -2458,9 +2458,9 @@ info_target_command (const char *args, int from_tty)
       if ((int) (t->stratum ()) <= (int) dummy_stratum)
 	continue;
       if (has_all_mem)
-	printf_unfiltered (_("\tWhile running this, "
-			     "GDB does not access memory from...\n"));
-      printf_unfiltered ("%s:\n", t->longname ());
+	printf_filtered (_("\tWhile running this, "
+			   "GDB does not access memory from...\n"));
+      printf_filtered ("%s:\n", t->longname ());
       t->files_info ();
       has_all_mem = t->has_all_memory ();
     }
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 76332541f8e..03447e0922a 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2090,9 +2090,9 @@ windows_nat_target::files_info ()
 {
   struct inferior *inf = current_inferior ();
 
-  printf_unfiltered ("\tUsing the running image of %s %s.\n",
-		     inf->attach_flag ? "attached" : "child",
-		     target_pid_to_str (inferior_ptid).c_str ());
+  printf_filtered ("\tUsing the running image of %s %s.\n",
+		   inf->attach_flag ? "attached" : "child",
+		   target_pid_to_str (inferior_ptid).c_str ());
 }
 
 /* Modify CreateProcess parameters for use of a new separate console.
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 04/12] Use filtered output in language_info
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (2 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 03/12] Use filtered output in files_info implementations Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-01 17:55 ` [PATCH 05/12] Use filtered output in ordinary commands Tom Tromey
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Change language_info to use filtered output.  This is ok because the
sole caller uses filtered output elsewhere, and because this function
calls show_language_command, which also uses filtered output.
---
 gdb/language.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/language.c b/gdb/language.c
index 132ff769817..0e6a1a4bcdb 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -383,7 +383,7 @@ language_info ()
     return;
 
   expected_language = current_language;
-  printf_unfiltered (_("Current language:  %s\n"), language);
+  printf_filtered (_("Current language:  %s\n"), language);
   show_language_command (NULL, 1, NULL, NULL);
 }
 \f
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 05/12] Use filtered output in ordinary commands
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (3 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 04/12] Use filtered output in language_info Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-05 11:52   ` Andrew Burgess
  2022-01-01 17:55 ` [PATCH 06/12] Use filtered output in kill command Tom Tromey
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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.
---
 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 () == 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');
 }
 \f
 /* 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 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));
 
   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 d659a0dc2ef..dd3728b6387 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -97,8 +97,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;
     }
 
@@ -110,18 +110,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;
@@ -159,8 +159,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 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"));
 }
 
 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_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 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);
 
-  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 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"));
 
       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 == 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 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 == 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 4693d582904..509f62c21c7 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 c08988b5426..3c936811fe4 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 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 ");
 }
 
 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_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 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 ();
   }
 
-  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 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 == 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 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;
 
-      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 06fb96888de..d6702011ce0 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");
+  fprintf_filtered (gdb_stdout, " %-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);
+    fprintf_filtered (gdb_stdout, " %-11s %3d\n", reg->name, regnum);
 }
 
 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 = 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"));
     }
 }
 \f
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 06/12] Use filtered output in kill command
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (4 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 05/12] Use filtered output in ordinary commands Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-01 17:55 ` [PATCH 07/12] Use filtered output in some dumping commands Tom Tromey
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes the kill command to use filtered output.  I split this
one into its own patch because, out of an abundance of caution, I
changed the function to call bfd_cache_close_all a bit earlier, in
case pagination caused an exception.
---
 gdb/infcmd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index e0e317d0757..8bf58018bdd 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2349,12 +2349,11 @@ kill_command (const char *arg, int from_tty)
   int infnum = current_inferior ()->num;
 
   target_kill ();
+  bfd_cache_close_all ();
 
   if (print_inferior_events)
-    printf_unfiltered (_("[Inferior %d (%s) killed]\n"),
-		       infnum, pid_str.c_str ());
-
-  bfd_cache_close_all ();
+    printf_filtered (_("[Inferior %d (%s) killed]\n"),
+		     infnum, pid_str.c_str ());
 }
 
 /* Used in `attach&' command.  Proceed threads of inferior INF iff
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 07/12] Use filtered output in some dumping commands
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (5 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 06/12] Use filtered output in kill command Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-01 17:55 ` [PATCH 08/12] Use filtered output in btrace-related commands Tom Tromey
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

There are several commands that may optionally send their output to a
file -- they take an optional filename argument and open a file.  This
patch changes these commands to use filtered output.  The rationale
here is that, when printing to gdb_stdout, filtering is appropriate --
it is, and should be, the default for all commands.  And, when writing
to a file, paging will not happen anyway (it only happens when the
stream==gdb_stdout), so using the _filtered form will not change
anything.
---
 gdb/dummy-frame.c        |  8 +++----
 gdb/maint-test-options.c | 32 ++++++++++++++--------------
 gdb/regcache-dump.c      | 30 +++++++++++++-------------
 gdb/regcache.c           | 46 ++++++++++++++++++++--------------------
 gdb/reggroups.c          |  6 +++---
 5 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 70c2777aa01..41c0bdeb945 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -405,10 +405,10 @@ fprint_dummy_frames (struct ui_file *file)
   struct dummy_frame *s;
 
   for (s = dummy_frame_stack; s != NULL; s = s->next)
-    fprintf_unfiltered (file, "%s: id=%s, ptid=%s\n",
-			host_address_to_string (s),
-			s->id.id.to_string ().c_str (),
-			target_pid_to_str (s->id.thread->ptid).c_str ());
+    fprintf_filtered (file, "%s: id=%s, ptid=%s\n",
+		      host_address_to_string (s),
+		      s->id.id.to_string ().c_str (),
+		      target_pid_to_str (s->id.thread->ptid).c_str ());
 }
 
 static void
diff --git a/gdb/maint-test-options.c b/gdb/maint-test-options.c
index 87e810d8384..b9b538d78bb 100644
--- a/gdb/maint-test-options.c
+++ b/gdb/maint-test-options.c
@@ -143,22 +143,22 @@ struct test_options_opts
      arguments.  */
   void dump (ui_file *file, const char *args) const
   {
-    fprintf_unfiltered (file,
-			_("-flag %d -xx1 %d -xx2 %d -bool %d "
-			  "-enum %s -uint %s -zuint-unl %s -string '%s' -- %s\n"),
-			flag_opt,
-			xx1_opt,
-			xx2_opt,
-			boolean_opt,
-			enum_opt,
-			(uint_opt == UINT_MAX
-			 ? "unlimited"
-			 : pulongest (uint_opt)),
-			(zuint_unl_opt == -1
-			 ? "unlimited"
-			 : plongest (zuint_unl_opt)),
-			string_opt.c_str (),
-			args);
+    fprintf_filtered (file,
+		      _("-flag %d -xx1 %d -xx2 %d -bool %d "
+			"-enum %s -uint %s -zuint-unl %s -string '%s' -- %s\n"),
+		      flag_opt,
+		      xx1_opt,
+		      xx2_opt,
+		      boolean_opt,
+		      enum_opt,
+		      (uint_opt == UINT_MAX
+		       ? "unlimited"
+		       : pulongest (uint_opt)),
+		      (zuint_unl_opt == -1
+		       ? "unlimited"
+		       : plongest (zuint_unl_opt)),
+		      string_opt.c_str (),
+		      args);
   }
 };
 
diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c
index 83c277f6681..f59345032ed 100644
--- a/gdb/regcache-dump.c
+++ b/gdb/regcache-dump.c
@@ -43,9 +43,9 @@ class register_dump_regcache : public register_dump
     if (regnum < 0)
       {
 	if (m_dump_pseudo)
-	  fprintf_unfiltered (file, "Cooked value");
+	  fprintf_filtered (file, "Cooked value");
 	else
-	  fprintf_unfiltered (file, "Raw value");
+	  fprintf_filtered (file, "Raw value");
       }
     else
       {
@@ -60,9 +60,9 @@ class register_dump_regcache : public register_dump
 	    auto status = m_regcache->cooked_read (regnum, buf.data ());
 
 	    if (status == REG_UNKNOWN)
-	      fprintf_unfiltered (file, "<invalid>");
+	      fprintf_filtered (file, "<invalid>");
 	    else if (status == REG_UNAVAILABLE)
-	      fprintf_unfiltered (file, "<unavailable>");
+	      fprintf_filtered (file, "<unavailable>");
 	    else
 	      {
 		print_hex_chars (file, buf.data (), size,
@@ -73,7 +73,7 @@ class register_dump_regcache : public register_dump
 	  {
 	    /* Just print "<cooked>" for pseudo register when
 	       regcache_dump_raw.  */
-	    fprintf_unfiltered (file, "<cooked>");
+	    fprintf_filtered (file, "<cooked>");
 	  }
       }
   }
@@ -102,9 +102,9 @@ class register_dump_reg_buffer : public register_dump, reg_buffer
     if (regnum < 0)
       {
 	if (m_has_pseudo)
-	  fprintf_unfiltered (file, "Cooked value");
+	  fprintf_filtered (file, "Cooked value");
 	else
-	  fprintf_unfiltered (file, "Raw value");
+	  fprintf_filtered (file, "Raw value");
       }
     else
       {
@@ -120,15 +120,15 @@ class register_dump_reg_buffer : public register_dump, reg_buffer
 	    gdb_assert (status != REG_VALID);
 
 	    if (status == REG_UNKNOWN)
-	      fprintf_unfiltered (file, "<invalid>");
+	      fprintf_filtered (file, "<invalid>");
 	    else
-	      fprintf_unfiltered (file, "<unavailable>");
+	      fprintf_filtered (file, "<unavailable>");
 	  }
 	else
 	  {
 	    /* Just print "<cooked>" for pseudo register when
 	       regcache_dump_raw.  */
-	    fprintf_unfiltered (file, "<cooked>");
+	    fprintf_filtered (file, "<cooked>");
 	  }
       }
   }
@@ -162,7 +162,7 @@ class register_dump_remote : public register_dump
   {
     if (regnum < 0)
       {
-	fprintf_unfiltered (file, "Rmt Nr  g/G Offset");
+	fprintf_filtered (file, "Rmt Nr  g/G Offset");
       }
     else if (regnum < gdbarch_num_regs (m_gdbarch))
       {
@@ -170,7 +170,7 @@ class register_dump_remote : public register_dump
 
 	if (remote_register_number_and_offset (m_gdbarch, regnum,
 					       &pnum, &poffset))
-	  fprintf_unfiltered (file, "%7d %11d", pnum, poffset);
+	  fprintf_filtered (file, "%7d %11d", pnum, poffset);
       }
   }
 };
@@ -188,7 +188,7 @@ class register_dump_groups : public register_dump
   void dump_reg (ui_file *file, int regnum) override
   {
     if (regnum < 0)
-      fprintf_unfiltered (file, "Groups");
+      fprintf_filtered (file, "Groups");
     else
       {
 	const char *sep = "";
@@ -200,8 +200,8 @@ class register_dump_groups : public register_dump
 	  {
 	    if (gdbarch_register_reggroup_p (m_gdbarch, regnum, group))
 	      {
-		fprintf_unfiltered (file,
-				    "%s%s", sep, reggroup_name (group));
+		fprintf_filtered (file,
+				  "%s%s", sep, reggroup_name (group));
 		sep = ",";
 	      }
 	  }
diff --git a/gdb/regcache.c b/gdb/regcache.c
index f6e2cdda27a..ab45277e3b6 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1436,7 +1436,7 @@ register_dump::dump (ui_file *file)
     {
       /* Name.  */
       if (regnum < 0)
-	fprintf_unfiltered (file, " %-10s", "Name");
+	fprintf_filtered (file, " %-10s", "Name");
       else
 	{
 	  const char *p = gdbarch_register_name (m_gdbarch, regnum);
@@ -1445,31 +1445,31 @@ register_dump::dump (ui_file *file)
 	    p = "";
 	  else if (p[0] == '\0')
 	    p = "''";
-	  fprintf_unfiltered (file, " %-10s", p);
+	  fprintf_filtered (file, " %-10s", p);
 	}
 
       /* Number.  */
       if (regnum < 0)
-	fprintf_unfiltered (file, " %4s", "Nr");
+	fprintf_filtered (file, " %4s", "Nr");
       else
-	fprintf_unfiltered (file, " %4d", regnum);
+	fprintf_filtered (file, " %4d", regnum);
 
       /* Relative number.  */
       if (regnum < 0)
-	fprintf_unfiltered (file, " %4s", "Rel");
+	fprintf_filtered (file, " %4s", "Rel");
       else if (regnum < gdbarch_num_regs (m_gdbarch))
-	fprintf_unfiltered (file, " %4d", regnum);
+	fprintf_filtered (file, " %4d", regnum);
       else
-	fprintf_unfiltered (file, " %4d",
-			    (regnum - gdbarch_num_regs (m_gdbarch)));
+	fprintf_filtered (file, " %4d",
+			  (regnum - gdbarch_num_regs (m_gdbarch)));
 
       /* Offset.  */
       if (regnum < 0)
-	fprintf_unfiltered (file, " %6s  ", "Offset");
+	fprintf_filtered (file, " %6s  ", "Offset");
       else
 	{
-	  fprintf_unfiltered (file, " %6ld",
-			      descr->register_offset[regnum]);
+	  fprintf_filtered (file, " %6ld",
+			    descr->register_offset[regnum]);
 	  if (register_offset != descr->register_offset[regnum]
 	      || (regnum > 0
 		  && (descr->register_offset[regnum]
@@ -1479,19 +1479,19 @@ register_dump::dump (ui_file *file)
 	    {
 	      if (!footnote_register_offset)
 		footnote_register_offset = ++footnote_nr;
-	      fprintf_unfiltered (file, "*%d", footnote_register_offset);
+	      fprintf_filtered (file, "*%d", footnote_register_offset);
 	    }
 	  else
-	    fprintf_unfiltered (file, "  ");
+	    fprintf_filtered (file, "  ");
 	  register_offset = (descr->register_offset[regnum]
 			     + descr->sizeof_register[regnum]);
 	}
 
       /* Size.  */
       if (regnum < 0)
-	fprintf_unfiltered (file, " %5s ", "Size");
+	fprintf_filtered (file, " %5s ", "Size");
       else
-	fprintf_unfiltered (file, " %5ld", descr->sizeof_register[regnum]);
+	fprintf_filtered (file, " %5ld", descr->sizeof_register[regnum]);
 
       /* Type.  */
       {
@@ -1517,24 +1517,24 @@ register_dump::dump (ui_file *file)
 	    if (startswith (t, blt))
 	      t += strlen (blt);
 	  }
-	fprintf_unfiltered (file, " %-15s", t);
+	fprintf_filtered (file, " %-15s", t);
       }
 
       /* Leading space always present.  */
-      fprintf_unfiltered (file, " ");
+      fprintf_filtered (file, " ");
 
       dump_reg (file, regnum);
 
-      fprintf_unfiltered (file, "\n");
+      fprintf_filtered (file, "\n");
     }
 
   if (footnote_register_offset)
-    fprintf_unfiltered (file, "*%d: Inconsistent register offsets.\n",
-			footnote_register_offset);
+    fprintf_filtered (file, "*%d: Inconsistent register offsets.\n",
+		      footnote_register_offset);
   if (footnote_register_type_name_null)
-    fprintf_unfiltered (file,
-			"*%d: Register type's name NULL.\n",
-			footnote_register_type_name_null);
+    fprintf_filtered (file,
+		      "*%d: Register type's name NULL.\n",
+		      footnote_register_type_name_null);
 }
 
 #if GDB_SELF_TEST
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index 38861c9a675..2b612fbd040 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -251,7 +251,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
 	  name = "Group";
 	else
 	  name = reggroup_name (group);
-	fprintf_unfiltered (file, " %-10s", name);
+	fprintf_filtered (file, " %-10s", name);
       }
       
       /* Group type.  */
@@ -274,13 +274,13 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
 		internal_error (__FILE__, __LINE__, _("bad switch"));
 	      }
 	  }
-	fprintf_unfiltered (file, " %-10s", type);
+	fprintf_filtered (file, " %-10s", type);
       }
 
       /* Note: If you change this, be sure to also update the
 	 documentation.  */
       
-      fprintf_unfiltered (file, "\n");
+      fprintf_filtered (file, "\n");
 
       group = reggroup_next (gdbarch, group);
     }
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 08/12] Use filtered output in btrace-related commands
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (6 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 07/12] Use filtered output in some dumping commands Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-10 11:56   ` Metzger, Markus T
  2022-01-01 17:55 ` [PATCH 09/12] Use filtered output in *-tdep commands Tom Tromey
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes btrace.c and record-btrace.c to use filtered output in
the commands implemented there.
---
 gdb/btrace.c        | 126 ++++++++++++++++++++++----------------------
 gdb/record-btrace.c |  46 ++++++++--------
 2 files changed, 86 insertions(+), 86 deletions(-)

diff --git a/gdb/btrace.c b/gdb/btrace.c
index 3962636d993..ba10f78e7bf 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -2852,122 +2852,122 @@ pt_print_packet (const struct pt_packet *packet)
   switch (packet->type)
     {
     default:
-      printf_unfiltered (("[??: %x]"), packet->type);
+      printf_filtered (("[??: %x]"), packet->type);
       break;
 
     case ppt_psb:
-      printf_unfiltered (("psb"));
+      printf_filtered (("psb"));
       break;
 
     case ppt_psbend:
-      printf_unfiltered (("psbend"));
+      printf_filtered (("psbend"));
       break;
 
     case ppt_pad:
-      printf_unfiltered (("pad"));
+      printf_filtered (("pad"));
       break;
 
     case ppt_tip:
-      printf_unfiltered (("tip %u: 0x%" PRIx64 ""),
-			 packet->payload.ip.ipc,
-			 packet->payload.ip.ip);
+      printf_filtered (("tip %u: 0x%" PRIx64 ""),
+		       packet->payload.ip.ipc,
+		       packet->payload.ip.ip);
       break;
 
     case ppt_tip_pge:
-      printf_unfiltered (("tip.pge %u: 0x%" PRIx64 ""),
-			 packet->payload.ip.ipc,
-			 packet->payload.ip.ip);
+      printf_filtered (("tip.pge %u: 0x%" PRIx64 ""),
+		       packet->payload.ip.ipc,
+		       packet->payload.ip.ip);
       break;
 
     case ppt_tip_pgd:
-      printf_unfiltered (("tip.pgd %u: 0x%" PRIx64 ""),
-			 packet->payload.ip.ipc,
-			 packet->payload.ip.ip);
+      printf_filtered (("tip.pgd %u: 0x%" PRIx64 ""),
+		       packet->payload.ip.ipc,
+		       packet->payload.ip.ip);
       break;
 
     case ppt_fup:
-      printf_unfiltered (("fup %u: 0x%" PRIx64 ""),
-			 packet->payload.ip.ipc,
-			 packet->payload.ip.ip);
+      printf_filtered (("fup %u: 0x%" PRIx64 ""),
+		       packet->payload.ip.ipc,
+		       packet->payload.ip.ip);
       break;
 
     case ppt_tnt_8:
-      printf_unfiltered (("tnt-8 %u: 0x%" PRIx64 ""),
-			 packet->payload.tnt.bit_size,
-			 packet->payload.tnt.payload);
+      printf_filtered (("tnt-8 %u: 0x%" PRIx64 ""),
+		       packet->payload.tnt.bit_size,
+		       packet->payload.tnt.payload);
       break;
 
     case ppt_tnt_64:
-      printf_unfiltered (("tnt-64 %u: 0x%" PRIx64 ""),
-			 packet->payload.tnt.bit_size,
-			 packet->payload.tnt.payload);
+      printf_filtered (("tnt-64 %u: 0x%" PRIx64 ""),
+		       packet->payload.tnt.bit_size,
+		       packet->payload.tnt.payload);
       break;
 
     case ppt_pip:
-      printf_unfiltered (("pip %" PRIx64 "%s"), packet->payload.pip.cr3,
-			 packet->payload.pip.nr ? (" nr") : (""));
+      printf_filtered (("pip %" PRIx64 "%s"), packet->payload.pip.cr3,
+		       packet->payload.pip.nr ? (" nr") : (""));
       break;
 
     case ppt_tsc:
-      printf_unfiltered (("tsc %" PRIx64 ""), packet->payload.tsc.tsc);
+      printf_filtered (("tsc %" PRIx64 ""), packet->payload.tsc.tsc);
       break;
 
     case ppt_cbr:
-      printf_unfiltered (("cbr %u"), packet->payload.cbr.ratio);
+      printf_filtered (("cbr %u"), packet->payload.cbr.ratio);
       break;
 
     case ppt_mode:
       switch (packet->payload.mode.leaf)
 	{
 	default:
-	  printf_unfiltered (("mode %u"), packet->payload.mode.leaf);
+	  printf_filtered (("mode %u"), packet->payload.mode.leaf);
 	  break;
 
 	case pt_mol_exec:
-	  printf_unfiltered (("mode.exec%s%s"),
-			     packet->payload.mode.bits.exec.csl
-			     ? (" cs.l") : (""),
-			     packet->payload.mode.bits.exec.csd
-			     ? (" cs.d") : (""));
+	  printf_filtered (("mode.exec%s%s"),
+			   packet->payload.mode.bits.exec.csl
+			   ? (" cs.l") : (""),
+			   packet->payload.mode.bits.exec.csd
+			   ? (" cs.d") : (""));
 	  break;
 
 	case pt_mol_tsx:
-	  printf_unfiltered (("mode.tsx%s%s"),
-			     packet->payload.mode.bits.tsx.intx
-			     ? (" intx") : (""),
-			     packet->payload.mode.bits.tsx.abrt
-			     ? (" abrt") : (""));
+	  printf_filtered (("mode.tsx%s%s"),
+			   packet->payload.mode.bits.tsx.intx
+			   ? (" intx") : (""),
+			   packet->payload.mode.bits.tsx.abrt
+			   ? (" abrt") : (""));
 	  break;
 	}
       break;
 
     case ppt_ovf:
-      printf_unfiltered (("ovf"));
+      printf_filtered (("ovf"));
       break;
 
     case ppt_stop:
-      printf_unfiltered (("stop"));
+      printf_filtered (("stop"));
       break;
 
     case ppt_vmcs:
-      printf_unfiltered (("vmcs %" PRIx64 ""), packet->payload.vmcs.base);
+      printf_filtered (("vmcs %" PRIx64 ""), packet->payload.vmcs.base);
       break;
 
     case ppt_tma:
-      printf_unfiltered (("tma %x %x"), packet->payload.tma.ctc,
-			 packet->payload.tma.fc);
+      printf_filtered (("tma %x %x"), packet->payload.tma.ctc,
+		       packet->payload.tma.fc);
       break;
 
     case ppt_mtc:
-      printf_unfiltered (("mtc %x"), packet->payload.mtc.ctc);
+      printf_filtered (("mtc %x"), packet->payload.mtc.ctc);
       break;
 
     case ppt_cyc:
-      printf_unfiltered (("cyc %" PRIx64 ""), packet->payload.cyc.value);
+      printf_filtered (("cyc %" PRIx64 ""), packet->payload.cyc.value);
       break;
 
     case ppt_mnt:
-      printf_unfiltered (("mnt %" PRIx64 ""), packet->payload.mnt.payload);
+      printf_filtered (("mnt %" PRIx64 ""), packet->payload.mnt.payload);
       break;
     }
 }
@@ -3149,9 +3149,9 @@ btrace_maint_print_packets (struct btrace_thread_info *btinfo,
 	  {
 	    const btrace_block &block = blocks.at (blk);
 
-	    printf_unfiltered ("%u\tbegin: %s, end: %s\n", blk,
-			       core_addr_to_string_nz (block.begin),
-			       core_addr_to_string_nz (block.end));
+	    printf_filtered ("%u\tbegin: %s, end: %s\n", blk,
+			     core_addr_to_string_nz (block.begin),
+			     core_addr_to_string_nz (block.end));
 	  }
 
 	btinfo->maint.variant.bts.packet_history.begin = begin;
@@ -3170,15 +3170,15 @@ btrace_maint_print_packets (struct btrace_thread_info *btinfo,
 	  {
 	    const struct btrace_pt_packet &packet = packets.at (pkt);
 
-	    printf_unfiltered ("%u\t", pkt);
-	    printf_unfiltered ("0x%" PRIx64 "\t", packet.offset);
+	    printf_filtered ("%u\t", pkt);
+	    printf_filtered ("0x%" PRIx64 "\t", packet.offset);
 
 	    if (packet.errcode == pte_ok)
 	      pt_print_packet (&packet.packet);
 	    else
-	      printf_unfiltered ("[error: %s]", pt_errstr (packet.errcode));
+	      printf_filtered ("[error: %s]", pt_errstr (packet.errcode));
 
-	    printf_unfiltered ("\n");
+	    printf_filtered ("\n");
 	  }
 
 	btinfo->maint.variant.pt.packet_history.begin = begin;
@@ -3256,7 +3256,7 @@ maint_btrace_packet_history_cmd (const char *arg, int from_tty)
   btrace_maint_update_packets (btinfo, &begin, &end, &from, &to);
   if (begin == end)
     {
-      printf_unfiltered (_("No trace.\n"));
+      printf_filtered (_("No trace.\n"));
       return;
     }
 
@@ -3398,8 +3398,8 @@ maint_info_btrace_cmd (const char *args, int from_tty)
   if (conf == NULL)
     error (_("No btrace configuration."));
 
-  printf_unfiltered (_("Format: %s.\n"),
-		     btrace_format_string (conf->format));
+  printf_filtered (_("Format: %s.\n"),
+		   btrace_format_string (conf->format));
 
   switch (conf->format)
     {
@@ -3407,8 +3407,8 @@ maint_info_btrace_cmd (const char *args, int from_tty)
       break;
 
     case BTRACE_FORMAT_BTS:
-      printf_unfiltered (_("Number of packets: %zu.\n"),
-			 btinfo->data.variant.bts.blocks->size ());
+      printf_filtered (_("Number of packets: %zu.\n"),
+		       btinfo->data.variant.bts.blocks->size ());
       break;
 
 #if defined (HAVE_LIBIPT)
@@ -3417,14 +3417,14 @@ maint_info_btrace_cmd (const char *args, int from_tty)
 	struct pt_version version;
 
 	version = pt_library_version ();
-	printf_unfiltered (_("Version: %u.%u.%u%s.\n"), version.major,
-			   version.minor, version.build,
-			   version.ext != NULL ? version.ext : "");
+	printf_filtered (_("Version: %u.%u.%u%s.\n"), version.major,
+			 version.minor, version.build,
+			 version.ext != NULL ? version.ext : "");
 
 	btrace_maint_update_pt_packets (btinfo);
-	printf_unfiltered (_("Number of packets: %zu.\n"),
-			   ((btinfo->maint.variant.pt.packets == nullptr)
-			    ? 0 : btinfo->maint.variant.pt.packets->size ()));
+	printf_filtered (_("Number of packets: %zu.\n"),
+			 ((btinfo->maint.variant.pt.packets == nullptr)
+			  ? 0 : btinfo->maint.variant.pt.packets->size ()));
       }
       break;
 #endif /* defined (HAVE_LIBIPT)  */
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 108b3861446..c659d68e444 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -506,7 +506,7 @@ record_btrace_print_bts_conf (const struct btrace_config_bts *conf)
   if (size > 0)
     {
       suffix = record_btrace_adjust_size (&size);
-      printf_unfiltered (_("Buffer size: %u%s.\n"), size, suffix);
+      printf_filtered (_("Buffer size: %u%s.\n"), size, suffix);
     }
 }
 
@@ -522,7 +522,7 @@ record_btrace_print_pt_conf (const struct btrace_config_pt *conf)
   if (size > 0)
     {
       suffix = record_btrace_adjust_size (&size);
-      printf_unfiltered (_("Buffer size: %u%s.\n"), size, suffix);
+      printf_filtered (_("Buffer size: %u%s.\n"), size, suffix);
     }
 }
 
@@ -531,8 +531,8 @@ record_btrace_print_pt_conf (const struct btrace_config_pt *conf)
 static void
 record_btrace_print_conf (const struct btrace_config *conf)
 {
-  printf_unfiltered (_("Recording format: %s.\n"),
-		     btrace_format_string (conf->format));
+  printf_filtered (_("Recording format: %s.\n"),
+		   btrace_format_string (conf->format));
 
   switch (conf->format)
     {
@@ -602,14 +602,14 @@ record_btrace_target::info_record ()
       gaps = btinfo->ngaps;
     }
 
-  printf_unfiltered (_("Recorded %u instructions in %u functions (%u gaps) "
-		       "for thread %s (%s).\n"), insns, calls, gaps,
-		     print_thread_id (tp),
-		     target_pid_to_str (tp->ptid).c_str ());
+  printf_filtered (_("Recorded %u instructions in %u functions (%u gaps) "
+		     "for thread %s (%s).\n"), insns, calls, gaps,
+		   print_thread_id (tp),
+		   target_pid_to_str (tp->ptid).c_str ());
 
   if (btrace_is_replaying (tp))
-    printf_unfiltered (_("Replay in progress.  At instruction %u.\n"),
-		       btrace_insn_number (btinfo->replay));
+    printf_filtered (_("Replay in progress.  At instruction %u.\n"),
+		     btrace_insn_number (btinfo->replay));
 }
 
 /* Print a decode error.  */
@@ -938,9 +938,9 @@ record_btrace_target::insn_history (int size, gdb_disassembly_flags flags)
   else
     {
       if (size < 0)
-	printf_unfiltered (_("At the start of the branch trace record.\n"));
+	printf_filtered (_("At the start of the branch trace record.\n"));
       else
-	printf_unfiltered (_("At the end of the branch trace record.\n"));
+	printf_filtered (_("At the end of the branch trace record.\n"));
     }
 
   btrace_set_insn_history (btinfo, &begin, &end);
@@ -1295,9 +1295,9 @@ record_btrace_target::call_history (int size, record_print_flags flags)
   else
     {
       if (size < 0)
-	printf_unfiltered (_("At the start of the branch trace record.\n"));
+	printf_filtered (_("At the start of the branch trace record.\n"));
       else
-	printf_unfiltered (_("At the end of the branch trace record.\n"));
+	printf_filtered (_("At the end of the branch trace record.\n"));
     }
 
   btrace_set_call_history (btinfo, &begin, &end);
@@ -3037,11 +3037,11 @@ cmd_show_record_btrace_cpu (const char *args, int from_tty)
   switch (record_btrace_cpu_state)
     {
     case CS_AUTO:
-      printf_unfiltered (_("btrace cpu is 'auto'.\n"));
+      printf_filtered (_("btrace cpu is 'auto'.\n"));
       return;
 
     case CS_NONE:
-      printf_unfiltered (_("btrace cpu is 'none'.\n"));
+      printf_filtered (_("btrace cpu is 'none'.\n"));
       return;
 
     case CS_CPU:
@@ -3049,14 +3049,14 @@ cmd_show_record_btrace_cpu (const char *args, int from_tty)
 	{
 	case CV_INTEL:
 	  if (record_btrace_cpu.stepping == 0)
-	    printf_unfiltered (_("btrace cpu is 'intel: %u/%u'.\n"),
-			       record_btrace_cpu.family,
-			       record_btrace_cpu.model);
+	    printf_filtered (_("btrace cpu is 'intel: %u/%u'.\n"),
+			     record_btrace_cpu.family,
+			     record_btrace_cpu.model);
 	  else
-	    printf_unfiltered (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
-			       record_btrace_cpu.family,
-			       record_btrace_cpu.model,
-			       record_btrace_cpu.stepping);
+	    printf_filtered (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
+			     record_btrace_cpu.family,
+			     record_btrace_cpu.model,
+			     record_btrace_cpu.stepping);
 	  return;
 	}
     }
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 09/12] Use filtered output in *-tdep commands
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (7 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 08/12] Use filtered output in btrace-related commands Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-01 17:55 ` [PATCH 10/12] Use filtered output in gnu-nat.c commands Tom Tromey
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Various targets introduce their own commands, which then use
unfiltered output.  It's better to use filtered output by default, so
this patch fixes the instances I found.
---
 gdb/avr-tdep.c  |  2 +-
 gdb/hppa-tdep.c | 30 +++++++++++++++---------------
 gdb/i386-tdep.c |  6 +++---
 gdb/mips-tdep.c |  6 +++---
 gdb/s12z-tdep.c |  2 +-
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 9ead25d5386..7f79ef94bdf 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1589,7 +1589,7 @@ avr_io_reg_read_command (const char *args, int from_tty)
       return;
     }
 
-  printf_unfiltered (_("Target has %u io registers:\n\n"), nreg);
+  printf_filtered (_("Target has %u io registers:\n\n"), nreg);
 
   /* only fetch up to 8 registers at a time to keep the buffer small */
   int step = 8;
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 6c6e538e822..32c54357045 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2572,19 +2572,19 @@ unwind_command (const char *exp, int from_tty)
 
   if (!u)
     {
-      printf_unfiltered ("Can't find unwind table entry for %s\n", exp);
+      printf_filtered ("Can't find unwind table entry for %s\n", exp);
       return;
     }
 
-  printf_unfiltered ("unwind_table_entry (%s):\n", host_address_to_string (u));
+  printf_filtered ("unwind_table_entry (%s):\n", host_address_to_string (u));
 
-  printf_unfiltered ("\tregion_start = %s\n", hex_string (u->region_start));
+  printf_filtered ("\tregion_start = %s\n", hex_string (u->region_start));
 
-  printf_unfiltered ("\tregion_end = %s\n", hex_string (u->region_end));
+  printf_filtered ("\tregion_end = %s\n", hex_string (u->region_end));
 
-#define pif(FLD) if (u->FLD) printf_unfiltered (" "#FLD);
+#define pif(FLD) if (u->FLD) printf_filtered (" "#FLD);
 
-  printf_unfiltered ("\n\tflags =");
+  printf_filtered ("\n\tflags =");
   pif (Cannot_unwind);
   pif (Millicode);
   pif (Millicode_save_sr0);
@@ -2609,9 +2609,9 @@ unwind_command (const char *exp, int from_tty)
   pif (Large_frame);
   pif (alloca_frame);
 
-  putchar_unfiltered ('\n');
+  putchar_filtered ('\n');
 
-#define pin(FLD) printf_unfiltered ("\t"#FLD" = 0x%x\n", u->FLD);
+#define pin(FLD) printf_filtered ("\t"#FLD" = 0x%x\n", u->FLD);
 
   pin (Region_description);
   pin (Entry_FR);
@@ -2620,26 +2620,26 @@ unwind_command (const char *exp, int from_tty)
 
   if (u->stub_unwind.stub_type)
     {
-      printf_unfiltered ("\tstub type = ");
+      printf_filtered ("\tstub type = ");
       switch (u->stub_unwind.stub_type)
 	{
 	  case LONG_BRANCH:
-	    printf_unfiltered ("long branch\n");
+	    printf_filtered ("long branch\n");
 	    break;
 	  case PARAMETER_RELOCATION:
-	    printf_unfiltered ("parameter relocation\n");
+	    printf_filtered ("parameter relocation\n");
 	    break;
 	  case EXPORT:
-	    printf_unfiltered ("export\n");
+	    printf_filtered ("export\n");
 	    break;
 	  case IMPORT:
-	    printf_unfiltered ("import\n");
+	    printf_filtered ("import\n");
 	    break;
 	  case IMPORT_SHLIB:
-	    printf_unfiltered ("import shlib\n");
+	    printf_filtered ("import shlib\n");
 	    break;
 	  default:
-	    printf_unfiltered ("unknown (%d)\n", u->stub_unwind.stub_type);
+	    printf_filtered ("unknown (%d)\n", u->stub_unwind.stub_type);
 	}
     }
 }
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 6d8a43fb4f8..aaa5592f40a 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8992,14 +8992,14 @@ i386_mpx_info_bounds (const char *args, int from_tty)
   if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_i386
       || !i386_mpx_enabled ())
     {
-      printf_unfiltered (_("Intel Memory Protection Extensions not "
-			   "supported on this target.\n"));
+      printf_filtered (_("Intel Memory Protection Extensions not "
+			 "supported on this target.\n"));
       return;
     }
 
   if (args == NULL)
     {
-      printf_unfiltered (_("Address of pointer variable expected.\n"));
+      printf_filtered (_("Address of pointer variable expected.\n"));
       return;
     }
 
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 7f8018360dd..e5f8c6b2053 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -6916,7 +6916,7 @@ show_mipsfpu_command (const char *args, int from_tty)
 
   if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
     {
-      printf_unfiltered
+      printf_filtered
 	("The MIPS floating-point coprocessor is unknown "
 	 "because the current architecture is not MIPS.\n");
       return;
@@ -6937,11 +6937,11 @@ show_mipsfpu_command (const char *args, int from_tty)
       internal_error (__FILE__, __LINE__, _("bad switch"));
     }
   if (mips_fpu_type_auto)
-    printf_unfiltered ("The MIPS floating-point coprocessor "
+    printf_filtered ("The MIPS floating-point coprocessor "
 		       "is set automatically (currently %s)\n",
 		       fpu);
   else
-    printf_unfiltered
+    printf_filtered
       ("The MIPS floating-point coprocessor is assumed to be %s\n", fpu);
 }
 
diff --git a/gdb/s12z-tdep.c b/gdb/s12z-tdep.c
index 24ebc6a8516..3f9740f0dfe 100644
--- a/gdb/s12z-tdep.c
+++ b/gdb/s12z-tdep.c
@@ -635,7 +635,7 @@ show_bdccsr_command (const char *args, int from_tty)
   struct string_file output;
   target_rcmd ("bdccsr", &output);
 
-  printf_unfiltered ("The current BDCCSR value is %s\n", output.string().c_str());
+  printf_filtered ("The current BDCCSR value is %s\n", output.string().c_str());
 }
 
 static struct gdbarch *
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 10/12] Use filtered output in gnu-nat.c commands
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (8 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 09/12] Use filtered output in *-tdep commands Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-05 11:57   ` Andrew Burgess
  2022-01-01 17:55 ` [PATCH 11/12] Use filtered output in terminal_info implementations Tom Tromey
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

gnu-nat.c has a number of ordinary commands that should use filtered
output.  In a few cases, I changed the output to use gdb_stderr as
well.  I can't compile this file, so this patch is split out as a
"best effort".
---
 gdb/gnu-nat.c | 102 ++++++++++++++++++++++++++------------------------
 1 file changed, 53 insertions(+), 49 deletions(-)

diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 4b22e21bb8e..b7b486904e8 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2704,29 +2704,33 @@ struct cmd_list_element *show_thread_default_cmd_list = NULL;
 static void
 set_thread_cmd (const char *args, int from_tty)
 {
-  printf_unfiltered ("\"set thread\" must be followed by the "
-		     "name of a thread property, or \"default\".\n");
+  fprintf_filtered (gdb_stderr,
+		    "\"set thread\" must be followed by the "
+		    "name of a thread property, or \"default\".\n");
 }
 
 static void
 show_thread_cmd (const char *args, int from_tty)
 {
-  printf_unfiltered ("\"show thread\" must be followed by the "
-		     "name of a thread property, or \"default\".\n");
+  fprintf_unfiltered (gdb_stderr,
+		      "\"show thread\" must be followed by the "
+		      "name of a thread property, or \"default\".\n");
 }
 
 static void
 set_thread_default_cmd (const char *args, int from_tty)
 {
-  printf_unfiltered ("\"set thread default\" must be followed "
-		     "by the name of a thread property.\n");
+  fprintf_unfiltered (gdb_stderr,
+		      "\"set thread default\" must be followed "
+		      "by the name of a thread property.\n");
 }
 
 static void
 show_thread_default_cmd (const char *args, int from_tty)
 {
-  printf_unfiltered ("\"show thread default\" must be followed "
-		     "by the name of a thread property.\n");
+  fprintf_unfiltered (gdb_stderr,
+		      "\"show thread default\" must be followed "
+		      "by the name of a thread property.\n");
 }
 
 static int
@@ -2818,10 +2822,10 @@ show_task_pause_cmd (const char *args, int from_tty)
   struct inf *inf = cur_inf ();
 
   check_empty (args, "show task pause");
-  printf_unfiltered ("The inferior task %s suspended while gdb has control.\n",
-		     inf->task
-		     ? (inf->pause_sc == 0 ? "isn't" : "is")
-		     : (inf->pause_sc == 0 ? "won't be" : "will be"));
+  printf_filtered ("The inferior task %s suspended while gdb has control.\n",
+		   inf->task
+		   ? (inf->pause_sc == 0 ? "isn't" : "is")
+		   : (inf->pause_sc == 0 ? "won't be" : "will be"));
 }
 
 static void
@@ -2835,9 +2839,9 @@ static void
 show_task_detach_sc_cmd (const char *args, int from_tty)
 {
   check_empty (args, "show task detach-suspend-count");
-  printf_unfiltered ("The inferior task will be left with a "
-		     "suspend count of %d when detaching.\n",
-		     cur_inf ()->detach_sc);
+  printf_filtered ("The inferior task will be left with a "
+		   "suspend count of %d when detaching.\n",
+		   cur_inf ()->detach_sc);
 }
 
 \f
@@ -2857,9 +2861,9 @@ show_thread_default_pause_cmd (const char *args, int from_tty)
   int sc = inf->default_thread_pause_sc;
 
   check_empty (args, "show thread default pause");
-  printf_unfiltered ("New threads %s suspended while gdb has control%s.\n",
-		     sc ? "are" : "aren't",
-		     !sc && inf->pause_sc ? " (but the task is)" : "");
+  printf_filtered ("New threads %s suspended while gdb has control%s.\n",
+		   sc ? "are" : "aren't",
+		   !sc && inf->pause_sc ? " (but the task is)" : "");
 }
 
 static void
@@ -2877,8 +2881,8 @@ show_thread_default_run_cmd (const char *args, int from_tty)
   struct inf *inf = cur_inf ();
 
   check_empty (args, "show thread default run");
-  printf_unfiltered ("New threads %s allowed to run.\n",
-		     inf->default_thread_run_sc == 0 ? "are" : "aren't");
+  printf_filtered ("New threads %s allowed to run.\n",
+		   inf->default_thread_run_sc == 0 ? "are" : "aren't");
 }
 
 static void
@@ -2892,8 +2896,8 @@ static void
 show_thread_default_detach_sc_cmd (const char *args, int from_tty)
 {
   check_empty (args, "show thread default detach-suspend-count");
-  printf_unfiltered ("New threads will get a detach-suspend-count of %d.\n",
-		     cur_inf ()->default_thread_detach_sc);
+  printf_filtered ("New threads will get a detach-suspend-count of %d.\n",
+		   cur_inf ()->default_thread_detach_sc);
 }
 
 \f
@@ -2956,8 +2960,8 @@ show_stopped_cmd (const char *args, int from_tty)
   struct inf *inf = active_inf ();
 
   check_empty (args, "show stopped");
-  printf_unfiltered ("The inferior process %s stopped.\n",
-		     inf->stopped ? "is" : "isn't");
+  printf_filtered ("The inferior process %s stopped.\n",
+		   inf->stopped ? "is" : "isn't");
 }
 
 static void
@@ -2985,10 +2989,10 @@ show_sig_thread_cmd (const char *args, int from_tty)
 
   check_empty (args, "show signal-thread");
   if (inf->signal_thread)
-    printf_unfiltered ("The signal thread is %s.\n",
-		       proc_string (inf->signal_thread));
+    printf_filtered ("The signal thread is %s.\n",
+		     proc_string (inf->signal_thread));
   else
-    printf_unfiltered ("There is no signal thread.\n");
+    printf_filtered ("There is no signal thread.\n");
 }
 
 \f
@@ -3016,10 +3020,10 @@ show_signals_cmd (const char *args, int from_tty)
   struct inf *inf = cur_inf ();
 
   check_empty (args, "show signals");
-  printf_unfiltered ("The inferior process's signals %s intercepted.\n",
-		     inf->task
-		     ? (inf->traced ? "are" : "aren't")
-		     : (inf->want_signals ? "will be" : "won't be"));
+  printf_filtered ("The inferior process's signals %s intercepted.\n",
+		   inf->task
+		   ? (inf->traced ? "are" : "aren't")
+		   : (inf->want_signals ? "will be" : "won't be"));
 }
 
 static void
@@ -3045,18 +3049,18 @@ show_exceptions_cmd (const char *args, int from_tty)
   struct inf *inf = cur_inf ();
 
   check_empty (args, "show exceptions");
-  printf_unfiltered ("Exceptions in the inferior %s trapped.\n",
-		     inf->task
-		     ? (inf->want_exceptions ? "are" : "aren't")
-		     : (inf->want_exceptions ? "will be" : "won't be"));
+  printf_filtered ("Exceptions in the inferior %s trapped.\n",
+		   inf->task
+		   ? (inf->want_exceptions ? "are" : "aren't")
+		   : (inf->want_exceptions ? "will be" : "won't be"));
 }
 
 \f
 static void
 set_task_cmd (const char *args, int from_tty)
 {
-  printf_unfiltered ("\"set task\" must be followed by the name"
-		     " of a task property.\n");
+  printf_filtered ("\"set task\" must be followed by the name"
+		   " of a task property.\n");
 }
 
 static void
@@ -3320,10 +3324,10 @@ show_thread_pause_cmd (const char *args, int from_tty)
   int sc = thread->pause_sc;
 
   check_empty (args, "show task pause");
-  printf_unfiltered ("Thread %s %s suspended while gdb has control%s.\n",
-		     proc_string (thread),
-		     sc ? "is" : "isn't",
-		     !sc && thread->inf->pause_sc ? " (but the task is)" : "");
+  printf_filtered ("Thread %s %s suspended while gdb has control%s.\n",
+		   proc_string (thread),
+		   sc ? "is" : "isn't",
+		   !sc && thread->inf->pause_sc ? " (but the task is)" : "");
 }
 
 static void
@@ -3340,9 +3344,9 @@ show_thread_run_cmd (const char *args, int from_tty)
   struct proc *thread = cur_thread ();
 
   check_empty (args, "show thread run");
-  printf_unfiltered ("Thread %s %s allowed to run.",
-		     proc_string (thread),
-		     thread->run_sc == 0 ? "is" : "isn't");
+  printf_filtered ("Thread %s %s allowed to run.",
+		   proc_string (thread),
+		   thread->run_sc == 0 ? "is" : "isn't");
 }
 
 static void
@@ -3358,10 +3362,10 @@ show_thread_detach_sc_cmd (const char *args, int from_tty)
   struct proc *thread = cur_thread ();
 
   check_empty (args, "show thread detach-suspend-count");
-  printf_unfiltered ("Thread %s will be left with a suspend count"
-		     " of %d when detaching.\n",
-		     proc_string (thread),
-		     thread->detach_sc);
+  printf_filtered ("Thread %s will be left with a suspend count"
+		   " of %d when detaching.\n",
+		   proc_string (thread),
+		   thread->detach_sc);
 }
 
 static void
@@ -3403,7 +3407,7 @@ thread_takeover_sc_cmd (const char *args, int from_tty)
     error (("%s."), safe_strerror (err));
   thread->sc = info->suspend_count;
   if (from_tty)
-    printf_unfiltered ("Suspend count was %d.\n", thread->sc);
+    printf_filtered ("Suspend count was %d.\n", thread->sc);
   if (info != &_info)
     vm_deallocate (mach_task_self (), (vm_address_t) info,
 		   info_len * sizeof (int));
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 11/12] Use filtered output in terminal_info implementations
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (9 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 10/12] Use filtered output in gnu-nat.c commands Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-01 17:55 ` [PATCH 12/12] Filtered output cleanup in expression dumping Tom Tromey
  2022-01-05 11:59 ` [PATCH 00/12] More filtered output cleanups Andrew Burgess
  12 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes one terminal_info implementation, and
default_terminal_info, to use filtered output.  Other implementations
of this method already use filtered output.

I can't compile go32-nat.c, so this is a 'best effort' patch.
---
 gdb/go32-nat.c | 14 +++++++-------
 gdb/target.c   |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 204c2121006..91fae3dd7f4 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -899,9 +899,9 @@ go32_nat_target::terminal_init ()
 void
 go32_nat_target::terminal_info (const char *args, int from_tty)
 {
-  printf_unfiltered ("Inferior's terminal is in %s mode.\n",
-		     !inf_mode_valid
-		     ? "default" : inf_terminal_mode ? "raw" : "cooked");
+  printf_filtered ("Inferior's terminal is in %s mode.\n",
+		   !inf_mode_valid
+		   ? "default" : inf_terminal_mode ? "raw" : "cooked");
 
 #if __DJGPP_MINOR__ > 2
   if (child_cmd.redirection)
@@ -911,15 +911,15 @@ go32_nat_target::terminal_info (const char *args, int from_tty)
       for (i = 0; i < DBG_HANDLES; i++)
 	{
 	  if (child_cmd.redirection[i]->file_name)
-	    printf_unfiltered ("\tFile handle %d is redirected to `%s'.\n",
-			       i, child_cmd.redirection[i]->file_name);
+	    printf_filtered ("\tFile handle %d is redirected to `%s'.\n",
+			     i, child_cmd.redirection[i]->file_name);
 	  else if (_get_dev_info (child_cmd.redirection[i]->inf_handle) == -1)
-	    printf_unfiltered
+	    printf_filtered
 	      ("\tFile handle %d appears to be closed by inferior.\n", i);
 	  /* Mask off the raw/cooked bit when comparing device info words.  */
 	  else if ((_get_dev_info (child_cmd.redirection[i]->inf_handle) & 0xdf)
 		   != (_get_dev_info (i) & 0xdf))
-	    printf_unfiltered
+	    printf_filtered
 	      ("\tFile handle %d appears to be redirected by inferior.\n", i);
 	}
     }
diff --git a/gdb/target.c b/gdb/target.c
index b3b1bbd06b2..1a072297fa6 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1127,7 +1127,7 @@ noprocess (void)
 static void
 default_terminal_info (struct target_ops *self, const char *args, int from_tty)
 {
-  printf_unfiltered (_("No saved terminal information.\n"));
+  printf_filtered (_("No saved terminal information.\n"));
 }
 
 /* A default implementation for the to_get_ada_task_ptid target method.
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 12/12] Filtered output cleanup in expression dumping
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (10 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 11/12] Use filtered output in terminal_info implementations Tom Tromey
@ 2022-01-01 17:55 ` Tom Tromey
  2022-01-05 11:59 ` [PATCH 00/12] More filtered output cleanups Andrew Burgess
  12 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-01 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Most of the expression-dumping code uses filtered output, but a few
functions did not.  This patch cleans up these instance.

Note that this won't cause any behavior change, because the only calls
to dump_prefix_expression pass in gdb_stdlog.  However, in the long
run it's easier to audit the code if the number of uses of _unfiltered
is reduced.
---
 gdb/expprint.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/gdb/expprint.c b/gdb/expprint.c
index f6dbde29469..381a10d85be 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -138,9 +138,9 @@ dump_for_expression (struct ui_file *stream, int depth,
 {
   fprintf_filtered (stream, _("%*sType flags: "), depth, "");
   if (flags & TYPE_INSTANCE_FLAG_CONST)
-    fputs_unfiltered ("const ", stream);
+    fputs_filtered ("const ", stream);
   if (flags & TYPE_INSTANCE_FLAG_VOLATILE)
-    fputs_unfiltered ("volatile", stream);
+    fputs_filtered ("volatile", stream);
   fprintf_filtered (stream, "\n");
 }
 
@@ -152,24 +152,24 @@ dump_for_expression (struct ui_file *stream, int depth,
   switch (flags & ~C_CHAR)
     {
     case C_WIDE_STRING:
-      fputs_unfiltered (_("wide "), stream);
+      fputs_filtered (_("wide "), stream);
       break;
     case C_STRING_16:
-      fputs_unfiltered (_("u16 "), stream);
+      fputs_filtered (_("u16 "), stream);
       break;
     case C_STRING_32:
-      fputs_unfiltered (_("u32 "), stream);
+      fputs_filtered (_("u32 "), stream);
       break;
     default:
-      fputs_unfiltered (_("ordinary "), stream);
+      fputs_filtered (_("ordinary "), stream);
       break;
     }
 
   if ((flags & C_CHAR) != 0)
-    fputs_unfiltered (_("char"), stream);
+    fputs_filtered (_("char"), stream);
   else
-    fputs_unfiltered (_("string"), stream);
-  fputs_unfiltered ("\n", stream);
+    fputs_filtered (_("string"), stream);
+  fputs_filtered ("\n", stream);
 }
 
 void
@@ -178,13 +178,13 @@ dump_for_expression (struct ui_file *stream, int depth,
 {
   fprintf_filtered (stream, _("%*sRange:"), depth, "");
   if ((flags & RANGE_LOW_BOUND_DEFAULT) != 0)
-    fputs_unfiltered (_("low-default "), stream);
+    fputs_filtered (_("low-default "), stream);
   if ((flags & RANGE_HIGH_BOUND_DEFAULT) != 0)
-    fputs_unfiltered (_("high-default "), stream);
+    fputs_filtered (_("high-default "), stream);
   if ((flags & RANGE_HIGH_BOUND_EXCLUSIVE) != 0)
-    fputs_unfiltered (_("high-exclusive "), stream);
+    fputs_filtered (_("high-exclusive "), stream);
   if ((flags & RANGE_HAS_STRIDE) != 0)
-    fputs_unfiltered (_("has-stride"), stream);
+    fputs_filtered (_("has-stride"), stream);
   fprintf_filtered (stream, "\n");
 }
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 03/12] Use filtered output in files_info implementations
  2022-01-01 17:55 ` [PATCH 03/12] Use filtered output in files_info implementations Tom Tromey
@ 2022-01-05 11:48   ` Andrew Burgess
  2022-01-05 18:28     ` Tom Tromey
  0 siblings, 1 reply; 26+ messages in thread
From: Andrew Burgess @ 2022-01-05 11:48 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

* Tom Tromey <tom@tromey.com> [2022-01-01 10:55:11 -0700]:

> This changes the implementations of the target files_info method to
> use filtered output.  This makes sense because the sole caller of this
> method is an ordinary command (info_program_command).  This patch
> changes this command to use filtered output as well.
> ---
>  gdb/go32-nat.c    |  2 +-
>  gdb/nto-procfs.c  |  8 ++++----
>  gdb/remote-sim.c  |  6 +++---
>  gdb/target.c      | 10 +++++-----
>  gdb/windows-nat.c |  6 +++---
>  5 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
> index 970e9e00c54..204c2121006 100644
> --- a/gdb/go32-nat.c
> +++ b/gdb/go32-nat.c
> @@ -663,7 +663,7 @@ static cmdline_t child_cmd;	/* Parsed child's command line kept here.  */
>  void
>  go32_nat_target::files_info ()
>  {
> -  printf_unfiltered ("You are running a DJGPP V2 program.\n");
> +  printf_filtered ("You are running a DJGPP V2 program.\n");
>  }
>  
>  void
> diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
> index 7ae71d9d519..bf869df1dab 100644
> --- a/gdb/nto-procfs.c
> +++ b/gdb/nto-procfs.c
> @@ -656,10 +656,10 @@ nto_procfs_target::files_info ()
>  {
>    struct inferior *inf = current_inferior ();
>  
> -  printf_unfiltered ("\tUsing the running image of %s %s via %s.\n",
> -		     inf->attach_flag ? "attached" : "child",
> -		     target_pid_to_str (inferior_ptid).c_str (),
> -		     (nodestr != NULL) ? nodestr : "local node");
> +  printf_filtered ("\tUsing the running image of %s %s via %s.\n",
> +		   inf->attach_flag ? "attached" : "child",
> +		   target_pid_to_str (inferior_ptid).c_str (),
> +		   (nodestr != NULL) ? nodestr : "local node");
>  }
>  
>  /* Target to_pid_to_exec_file implementation.  */
> diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
> index 7a029c93e91..f6c369d0c35 100644
> --- a/gdb/remote-sim.c
> +++ b/gdb/remote-sim.c
> @@ -1110,12 +1110,12 @@ gdbsim_target::files_info ()
>      file = bfd_get_filename (current_program_space->exec_bfd ());
>  
>    if (remote_debug)
> -    fprintf_unfiltered (gdb_stdlog, "gdbsim_files_info: file \"%s\"\n", file);
> +    fprintf_filtered (gdb_stdlog, "gdbsim_files_info: file \"%s\"\n", file);

Does this change make sense?  I only ask because, if I understand
correctly, all debugging under the new debug scheme is done unfiltered
(see debug_vprintf in gdb/debug.c).

Maybe the question is irrelevant, as it would be better, I think, to
change this line to use remote_debug_printf instead, and remove the
preceding if (remote_debug) check.

>  
>    if (current_program_space->exec_bfd ())
>      {
> -      fprintf_unfiltered (gdb_stdlog, "\tAttached to %s running program %s\n",
> -			  target_shortname (), file);
> +      fprintf_filtered (gdb_stdlog, "\tAttached to %s running program %s\n",
> +			target_shortname (), file);

I think you said in the cover letter that filtering is only done on
gdb_stdout.  So, if I understand correctly, this change will make no
difference here, is this correct?

I wonder why this output is being sent to gdb_stdlog?  I'd be tempted
to suggest it should be going to gdb_stdout these days maybe?

Thanks,
Andrew

>        sim_info (sim_data->gdbsim_desc, 0);
>      }
>  }
> diff --git a/gdb/target.c b/gdb/target.c
> index e10b295c797..b3b1bbd06b2 100644
> --- a/gdb/target.c
> +++ b/gdb/target.c
> @@ -2444,8 +2444,8 @@ info_target_command (const char *args, int from_tty)
>    if (current_program_space->symfile_object_file != NULL)
>      {
>        objfile *objf = current_program_space->symfile_object_file;
> -      printf_unfiltered (_("Symbols from \"%s\".\n"),
> -			 objfile_name (objf));
> +      printf_filtered (_("Symbols from \"%s\".\n"),
> +		       objfile_name (objf));
>      }
>  
>    for (target_ops *t = current_inferior ()->top_target ();
> @@ -2458,9 +2458,9 @@ info_target_command (const char *args, int from_tty)
>        if ((int) (t->stratum ()) <= (int) dummy_stratum)
>  	continue;
>        if (has_all_mem)
> -	printf_unfiltered (_("\tWhile running this, "
> -			     "GDB does not access memory from...\n"));
> -      printf_unfiltered ("%s:\n", t->longname ());
> +	printf_filtered (_("\tWhile running this, "
> +			   "GDB does not access memory from...\n"));
> +      printf_filtered ("%s:\n", t->longname ());
>        t->files_info ();
>        has_all_mem = t->has_all_memory ();
>      }
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index 76332541f8e..03447e0922a 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -2090,9 +2090,9 @@ windows_nat_target::files_info ()
>  {
>    struct inferior *inf = current_inferior ();
>  
> -  printf_unfiltered ("\tUsing the running image of %s %s.\n",
> -		     inf->attach_flag ? "attached" : "child",
> -		     target_pid_to_str (inferior_ptid).c_str ());
> +  printf_filtered ("\tUsing the running image of %s %s.\n",
> +		   inf->attach_flag ? "attached" : "child",
> +		   target_pid_to_str (inferior_ptid).c_str ());
>  }
>  
>  /* Modify CreateProcess parameters for use of a new separate console.
> -- 
> 2.31.1
> 
> 


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 05/12] Use filtered output in ordinary commands
  2022-01-01 17:55 ` [PATCH 05/12] Use filtered output in ordinary commands Tom Tromey
@ 2022-01-05 11:52   ` Andrew Burgess
  2022-01-05 18:35     ` Tom Tromey
  0 siblings, 1 reply; 26+ messages in thread
From: Andrew Burgess @ 2022-01-05 11:52 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

* Tom Tromey <tom@tromey.com> [2022-01-01 10:55:13 -0700]:

> 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.
> ---
>  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 () == 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');
>  }
>  \f
>  /* 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 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));
>  
>    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 d659a0dc2ef..dd3728b6387 100644
> --- a/gdb/cli/cli-logging.c
> +++ b/gdb/cli/cli-logging.c
> @@ -97,8 +97,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;
>      }
>  
> @@ -110,18 +110,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;
> @@ -159,8 +159,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 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"));
>  }
>  
>  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_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 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);
>  
> -  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 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"));
>  
>        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 == 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 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 == 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 4693d582904..509f62c21c7 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 c08988b5426..3c936811fe4 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 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 ");
>  }
>  
>  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_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 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 ();
>    }
>  
> -  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 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 == 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 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;
>  
> -      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 06fb96888de..d6702011ce0 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");
> +  fprintf_filtered (gdb_stdout, " %-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);
> +    fprintf_filtered (gdb_stdout, " %-11s %3d\n", reg->name, regnum);

Would this be another good place to replace 

  fprintf_filtered (gdb_stdout,

with:

  printf_filtered (

unless the hard-coding of gdb_stdout here provides some benefit that
I'm missing?

Thanks,
Andrew

>  }
>  
>  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 = 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"));
>      }
>  }
>  \f
> -- 
> 2.31.1
> 
> 


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 10/12] Use filtered output in gnu-nat.c commands
  2022-01-01 17:55 ` [PATCH 10/12] Use filtered output in gnu-nat.c commands Tom Tromey
@ 2022-01-05 11:57   ` Andrew Burgess
  2022-01-05 18:37     ` Tom Tromey
  0 siblings, 1 reply; 26+ messages in thread
From: Andrew Burgess @ 2022-01-05 11:57 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

* Tom Tromey <tom@tromey.com> [2022-01-01 10:55:18 -0700]:

> gnu-nat.c has a number of ordinary commands that should use filtered
> output.  In a few cases, I changed the output to use gdb_stderr as
> well.  I can't compile this file, so this patch is split out as a
> "best effort".
> ---
>  gdb/gnu-nat.c | 102 ++++++++++++++++++++++++++------------------------
>  1 file changed, 53 insertions(+), 49 deletions(-)
> 
> diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
> index 4b22e21bb8e..b7b486904e8 100644
> --- a/gdb/gnu-nat.c
> +++ b/gdb/gnu-nat.c
> @@ -2704,29 +2704,33 @@ struct cmd_list_element *show_thread_default_cmd_list = NULL;
>  static void
>  set_thread_cmd (const char *args, int from_tty)
>  {
> -  printf_unfiltered ("\"set thread\" must be followed by the "
> -		     "name of a thread property, or \"default\".\n");
> +  fprintf_filtered (gdb_stderr,
> +		    "\"set thread\" must be followed by the "
> +		    "name of a thread property, or \"default\".\n");

I'd be tempted to suggest that these should all be replaced with calls
to error.  If the user runs one of these from a command script, it
feels like hitting one of these cases should be something that stops
the script running due to the incorrectly formed command, rather than
just printing a message and continuing...

Thanks,
Andrew


>  }
>  
>  static void
>  show_thread_cmd (const char *args, int from_tty)
>  {
> -  printf_unfiltered ("\"show thread\" must be followed by the "
> -		     "name of a thread property, or \"default\".\n");
> +  fprintf_unfiltered (gdb_stderr,
> +		      "\"show thread\" must be followed by the "
> +		      "name of a thread property, or \"default\".\n");
>  }
>  
>  static void
>  set_thread_default_cmd (const char *args, int from_tty)
>  {
> -  printf_unfiltered ("\"set thread default\" must be followed "
> -		     "by the name of a thread property.\n");
> +  fprintf_unfiltered (gdb_stderr,
> +		      "\"set thread default\" must be followed "
> +		      "by the name of a thread property.\n");
>  }
>  
>  static void
>  show_thread_default_cmd (const char *args, int from_tty)
>  {
> -  printf_unfiltered ("\"show thread default\" must be followed "
> -		     "by the name of a thread property.\n");
> +  fprintf_unfiltered (gdb_stderr,
> +		      "\"show thread default\" must be followed "
> +		      "by the name of a thread property.\n");
>  }
>  
>  static int
> @@ -2818,10 +2822,10 @@ show_task_pause_cmd (const char *args, int from_tty)
>    struct inf *inf = cur_inf ();
>  
>    check_empty (args, "show task pause");
> -  printf_unfiltered ("The inferior task %s suspended while gdb has control.\n",
> -		     inf->task
> -		     ? (inf->pause_sc == 0 ? "isn't" : "is")
> -		     : (inf->pause_sc == 0 ? "won't be" : "will be"));
> +  printf_filtered ("The inferior task %s suspended while gdb has control.\n",
> +		   inf->task
> +		   ? (inf->pause_sc == 0 ? "isn't" : "is")
> +		   : (inf->pause_sc == 0 ? "won't be" : "will be"));
>  }
>  
>  static void
> @@ -2835,9 +2839,9 @@ static void
>  show_task_detach_sc_cmd (const char *args, int from_tty)
>  {
>    check_empty (args, "show task detach-suspend-count");
> -  printf_unfiltered ("The inferior task will be left with a "
> -		     "suspend count of %d when detaching.\n",
> -		     cur_inf ()->detach_sc);
> +  printf_filtered ("The inferior task will be left with a "
> +		   "suspend count of %d when detaching.\n",
> +		   cur_inf ()->detach_sc);
>  }
>  
>  \f
> @@ -2857,9 +2861,9 @@ show_thread_default_pause_cmd (const char *args, int from_tty)
>    int sc = inf->default_thread_pause_sc;
>  
>    check_empty (args, "show thread default pause");
> -  printf_unfiltered ("New threads %s suspended while gdb has control%s.\n",
> -		     sc ? "are" : "aren't",
> -		     !sc && inf->pause_sc ? " (but the task is)" : "");
> +  printf_filtered ("New threads %s suspended while gdb has control%s.\n",
> +		   sc ? "are" : "aren't",
> +		   !sc && inf->pause_sc ? " (but the task is)" : "");
>  }
>  
>  static void
> @@ -2877,8 +2881,8 @@ show_thread_default_run_cmd (const char *args, int from_tty)
>    struct inf *inf = cur_inf ();
>  
>    check_empty (args, "show thread default run");
> -  printf_unfiltered ("New threads %s allowed to run.\n",
> -		     inf->default_thread_run_sc == 0 ? "are" : "aren't");
> +  printf_filtered ("New threads %s allowed to run.\n",
> +		   inf->default_thread_run_sc == 0 ? "are" : "aren't");
>  }
>  
>  static void
> @@ -2892,8 +2896,8 @@ static void
>  show_thread_default_detach_sc_cmd (const char *args, int from_tty)
>  {
>    check_empty (args, "show thread default detach-suspend-count");
> -  printf_unfiltered ("New threads will get a detach-suspend-count of %d.\n",
> -		     cur_inf ()->default_thread_detach_sc);
> +  printf_filtered ("New threads will get a detach-suspend-count of %d.\n",
> +		   cur_inf ()->default_thread_detach_sc);
>  }
>  
>  \f
> @@ -2956,8 +2960,8 @@ show_stopped_cmd (const char *args, int from_tty)
>    struct inf *inf = active_inf ();
>  
>    check_empty (args, "show stopped");
> -  printf_unfiltered ("The inferior process %s stopped.\n",
> -		     inf->stopped ? "is" : "isn't");
> +  printf_filtered ("The inferior process %s stopped.\n",
> +		   inf->stopped ? "is" : "isn't");
>  }
>  
>  static void
> @@ -2985,10 +2989,10 @@ show_sig_thread_cmd (const char *args, int from_tty)
>  
>    check_empty (args, "show signal-thread");
>    if (inf->signal_thread)
> -    printf_unfiltered ("The signal thread is %s.\n",
> -		       proc_string (inf->signal_thread));
> +    printf_filtered ("The signal thread is %s.\n",
> +		     proc_string (inf->signal_thread));
>    else
> -    printf_unfiltered ("There is no signal thread.\n");
> +    printf_filtered ("There is no signal thread.\n");
>  }
>  
>  \f
> @@ -3016,10 +3020,10 @@ show_signals_cmd (const char *args, int from_tty)
>    struct inf *inf = cur_inf ();
>  
>    check_empty (args, "show signals");
> -  printf_unfiltered ("The inferior process's signals %s intercepted.\n",
> -		     inf->task
> -		     ? (inf->traced ? "are" : "aren't")
> -		     : (inf->want_signals ? "will be" : "won't be"));
> +  printf_filtered ("The inferior process's signals %s intercepted.\n",
> +		   inf->task
> +		   ? (inf->traced ? "are" : "aren't")
> +		   : (inf->want_signals ? "will be" : "won't be"));
>  }
>  
>  static void
> @@ -3045,18 +3049,18 @@ show_exceptions_cmd (const char *args, int from_tty)
>    struct inf *inf = cur_inf ();
>  
>    check_empty (args, "show exceptions");
> -  printf_unfiltered ("Exceptions in the inferior %s trapped.\n",
> -		     inf->task
> -		     ? (inf->want_exceptions ? "are" : "aren't")
> -		     : (inf->want_exceptions ? "will be" : "won't be"));
> +  printf_filtered ("Exceptions in the inferior %s trapped.\n",
> +		   inf->task
> +		   ? (inf->want_exceptions ? "are" : "aren't")
> +		   : (inf->want_exceptions ? "will be" : "won't be"));
>  }
>  
>  \f
>  static void
>  set_task_cmd (const char *args, int from_tty)
>  {
> -  printf_unfiltered ("\"set task\" must be followed by the name"
> -		     " of a task property.\n");
> +  printf_filtered ("\"set task\" must be followed by the name"
> +		   " of a task property.\n");
>  }
>  
>  static void
> @@ -3320,10 +3324,10 @@ show_thread_pause_cmd (const char *args, int from_tty)
>    int sc = thread->pause_sc;
>  
>    check_empty (args, "show task pause");
> -  printf_unfiltered ("Thread %s %s suspended while gdb has control%s.\n",
> -		     proc_string (thread),
> -		     sc ? "is" : "isn't",
> -		     !sc && thread->inf->pause_sc ? " (but the task is)" : "");
> +  printf_filtered ("Thread %s %s suspended while gdb has control%s.\n",
> +		   proc_string (thread),
> +		   sc ? "is" : "isn't",
> +		   !sc && thread->inf->pause_sc ? " (but the task is)" : "");
>  }
>  
>  static void
> @@ -3340,9 +3344,9 @@ show_thread_run_cmd (const char *args, int from_tty)
>    struct proc *thread = cur_thread ();
>  
>    check_empty (args, "show thread run");
> -  printf_unfiltered ("Thread %s %s allowed to run.",
> -		     proc_string (thread),
> -		     thread->run_sc == 0 ? "is" : "isn't");
> +  printf_filtered ("Thread %s %s allowed to run.",
> +		   proc_string (thread),
> +		   thread->run_sc == 0 ? "is" : "isn't");
>  }
>  
>  static void
> @@ -3358,10 +3362,10 @@ show_thread_detach_sc_cmd (const char *args, int from_tty)
>    struct proc *thread = cur_thread ();
>  
>    check_empty (args, "show thread detach-suspend-count");
> -  printf_unfiltered ("Thread %s will be left with a suspend count"
> -		     " of %d when detaching.\n",
> -		     proc_string (thread),
> -		     thread->detach_sc);
> +  printf_filtered ("Thread %s will be left with a suspend count"
> +		   " of %d when detaching.\n",
> +		   proc_string (thread),
> +		   thread->detach_sc);
>  }
>  
>  static void
> @@ -3403,7 +3407,7 @@ thread_takeover_sc_cmd (const char *args, int from_tty)
>      error (("%s."), safe_strerror (err));
>    thread->sc = info->suspend_count;
>    if (from_tty)
> -    printf_unfiltered ("Suspend count was %d.\n", thread->sc);
> +    printf_filtered ("Suspend count was %d.\n", thread->sc);
>    if (info != &_info)
>      vm_deallocate (mach_task_self (), (vm_address_t) info,
>  		   info_len * sizeof (int));
> -- 
> 2.31.1
> 
> 


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 00/12] More filtered output cleanups
  2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
                   ` (11 preceding siblings ...)
  2022-01-01 17:55 ` [PATCH 12/12] Filtered output cleanup in expression dumping Tom Tromey
@ 2022-01-05 11:59 ` Andrew Burgess
  2022-01-05 18:38   ` Tom Tromey
  12 siblings, 1 reply; 26+ messages in thread
From: Andrew Burgess @ 2022-01-05 11:59 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

* Tom Tromey <tom@tromey.com> [2022-01-01 10:55:08 -0700]:

> I found a number of places that use unfiltered output, but that
> probably ought to use filtered output.  This patch fixes nearly all of
> them (I'll send the remaining patches separately).
> 
> The default for user commands should always be to use filtered output.
> This way, users will get the correct paging behavior.  And, because
> the filter only applies to gdb_stdout anyway, it's safest to use the
> _filtered forms in most places.
> 
> In the longer run, I think it would be best to reimplement the pager
> directly in the gdb_stdout ui_file.  That way, almost no code will
> need to make the filtered/unfiltered distinction -- it will be done by
> choice of stream.  I'm working on some patches toward this goal.  This
> series is a useful step toward that, and IMO desirable on its own as
> well.

That sounds fantastic!  Super excited to see how this pans out.

I've looked through the series and left feedback on a couple of
patches.  Everything else looks good to me.

Thanks,
Andrew


> 
> Regression tested on x86-64 Fedora 34.
> 
> Tom
> 
> 
> 


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 03/12] Use filtered output in files_info implementations
  2022-01-05 11:48   ` Andrew Burgess
@ 2022-01-05 18:28     ` Tom Tromey
  0 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-05 18:28 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Tom Tromey, gdb-patches

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

>> if (remote_debug)
>> -    fprintf_unfiltered (gdb_stdlog, "gdbsim_files_info: file \"%s\"\n", file);
>> +    fprintf_filtered (gdb_stdlog, "gdbsim_files_info: file \"%s\"\n", file);

Andrew> Does this change make sense?  I only ask because, if I understand
Andrew> correctly, all debugging under the new debug scheme is done unfiltered
Andrew> (see debug_vprintf in gdb/debug.c).

Andrew> Maybe the question is irrelevant, as it would be better, I think, to
Andrew> change this line to use remote_debug_printf instead, and remove the
Andrew> preceding if (remote_debug) check.

Oops, yeah.

It doesn't really matter either way, it could be left as it is in the
patch.  But, I think I will just back this hunk out.  It will be caught
by my script to rewrite all the names later on.

>> +      fprintf_filtered (gdb_stdlog, "\tAttached to %s running program %s\n",
>> +			target_shortname (), file);

Andrew> I think you said in the cover letter that filtering is only done on
Andrew> gdb_stdout.  So, if I understand correctly, this change will make no
Andrew> difference here, is this correct?

Andrew> I wonder why this output is being sent to gdb_stdlog?  I'd be tempted
Andrew> to suggest it should be going to gdb_stdout these days maybe?

Yes, this one I will change to plain printf_filtered.

Tom

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 05/12] Use filtered output in ordinary commands
  2022-01-05 11:52   ` Andrew Burgess
@ 2022-01-05 18:35     ` Tom Tromey
  0 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-05 18:35 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Tom Tromey, gdb-patches

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

>> -  fprintf_unfiltered (gdb_stdout, " %-11s %3s\n", "Name", "Nr");
>> +  fprintf_filtered (gdb_stdout, " %-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);
>> +    fprintf_filtered (gdb_stdout, " %-11s %3d\n", reg->name, regnum);

Andrew> Would this be another good place to replace 
Andrew>   fprintf_filtered (gdb_stdout,
Andrew> with:
Andrew>   printf_filtered (
Andrew> unless the hard-coding of gdb_stdout here provides some benefit that
Andrew> I'm missing?

Yes, thanks.  I've made this change.

I have another patch (not submitted yet) that cleans this up across the
entire tree, but I double-checked and I missed this hunk there as well.
So, I'll do another pass before submitting that one to see if I can find
other ones I missed.

Tom

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 10/12] Use filtered output in gnu-nat.c commands
  2022-01-05 11:57   ` Andrew Burgess
@ 2022-01-05 18:37     ` Tom Tromey
  2022-01-06 10:07       ` Andrew Burgess
  0 siblings, 1 reply; 26+ messages in thread
From: Tom Tromey @ 2022-01-05 18:37 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Tom Tromey, gdb-patches

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

>> +  fprintf_filtered (gdb_stderr,
>> +		    "\"set thread\" must be followed by the "
>> +		    "name of a thread property, or \"default\".\n");

Andrew> I'd be tempted to suggest that these should all be replaced with calls
Andrew> to error.  If the user runs one of these from a command script, it
Andrew> feels like hitting one of these cases should be something that stops
Andrew> the script running due to the incorrectly formed command, rather than
Andrew> just printing a message and continuing...

I considered that, but I didn't want to make that kind of change without
input from someone who uses and can actually build gnu-nat.c.

Tom

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 00/12] More filtered output cleanups
  2022-01-05 11:59 ` [PATCH 00/12] More filtered output cleanups Andrew Burgess
@ 2022-01-05 18:38   ` Tom Tromey
  0 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-05 18:38 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Tom Tromey, gdb-patches

Andrew> That sounds fantastic!  Super excited to see how this pans out.

See the branch t/ui-file-sanity on my github if you want.
I've already submitted many of the preparatory patches that are in
there, I'll send a few more today.

Andrew> I've looked through the series and left feedback on a couple of
Andrew> patches.  Everything else looks good to me.

Thank you.  I've made the changes and I'm going to check it in soon.

Tom

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 10/12] Use filtered output in gnu-nat.c commands
  2022-01-05 18:37     ` Tom Tromey
@ 2022-01-06 10:07       ` Andrew Burgess
  2022-01-06 13:06         ` Andrew Burgess
  2022-01-06 15:29         ` Tom Tromey
  0 siblings, 2 replies; 26+ messages in thread
From: Andrew Burgess @ 2022-01-06 10:07 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

* Tom Tromey <tom@tromey.com> [2022-01-05 11:37:15 -0700]:

> >>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
> 
> >> +  fprintf_filtered (gdb_stderr,
> >> +		    "\"set thread\" must be followed by the "
> >> +		    "name of a thread property, or \"default\".\n");
> 
> Andrew> I'd be tempted to suggest that these should all be replaced with calls
> Andrew> to error.  If the user runs one of these from a command script, it
> Andrew> feels like hitting one of these cases should be something that stops
> Andrew> the script running due to the incorrectly formed command, rather than
> Andrew> just printing a message and continuing...
> 
> I considered that, but I didn't want to make that kind of change without
> input from someone who uses and can actually build gnu-nat.c.

I have a VM in which I can build GDB on GNU Hurd, it's pretty slow,
but I'll give this a test today.

If looks good then I'll post a patch to change these too errors.  I
have no objection to you merging this first though.

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 10/12] Use filtered output in gnu-nat.c commands
  2022-01-06 10:07       ` Andrew Burgess
@ 2022-01-06 13:06         ` Andrew Burgess
  2022-01-06 15:29         ` Tom Tromey
  1 sibling, 0 replies; 26+ messages in thread
From: Andrew Burgess @ 2022-01-06 13:06 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

* Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> [2022-01-06 10:07:10 +0000]:

> * Tom Tromey <tom@tromey.com> [2022-01-05 11:37:15 -0700]:
> 
> > >>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
> > 
> > >> +  fprintf_filtered (gdb_stderr,
> > >> +		    "\"set thread\" must be followed by the "
> > >> +		    "name of a thread property, or \"default\".\n");
> > 
> > Andrew> I'd be tempted to suggest that these should all be replaced with calls
> > Andrew> to error.  If the user runs one of these from a command script, it
> > Andrew> feels like hitting one of these cases should be something that stops
> > Andrew> the script running due to the incorrectly formed command, rather than
> > Andrew> just printing a message and continuing...
> > 
> > I considered that, but I didn't want to make that kind of change without
> > input from someone who uses and can actually build gnu-nat.c.
> 
> I have a VM in which I can build GDB on GNU Hurd, it's pretty slow,
> but I'll give this a test today.
> 
> If looks good then I'll post a patch to change these too errors.  I
> have no objection to you merging this first though.

I've got this patch:

  https://sourceware.org/pipermail/gdb-patches/2022-January/184860.html

Which would replace the part of the patch we've been discussing.

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 10/12] Use filtered output in gnu-nat.c commands
  2022-01-06 10:07       ` Andrew Burgess
  2022-01-06 13:06         ` Andrew Burgess
@ 2022-01-06 15:29         ` Tom Tromey
  1 sibling, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-06 15:29 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Tom Tromey, gdb-patches

Andrew> If looks good then I'll post a patch to change these too errors.  I
Andrew> have no objection to you merging this first though.

I had already done it, I'm afraid.  I didn't read your comments as a
firm objection or a reason to wait.  Next time I'll be more patient.

Tom

^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [PATCH 08/12] Use filtered output in btrace-related commands
  2022-01-01 17:55 ` [PATCH 08/12] Use filtered output in btrace-related commands Tom Tromey
@ 2022-01-10 11:56   ` Metzger, Markus T
  2022-01-10 14:44     ` Tom Tromey
  0 siblings, 1 reply; 26+ messages in thread
From: Metzger, Markus T @ 2022-01-10 11:56 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

Btrace is not using any of the GDB printf format specifiers.  IIUC the motivation for those changes is to fix pagination.  There should probably be a comment in utils.h discouraging the use of printf_unfiltered.  The way I read it now is that one needs to use printf_filtered if one wants to use some additional format specififiers.  The default, in that case, would be to use printf_unfiltered.  But that's not what we want people to use, apparently.

Regards,
Markus.

>-----Original Message-----
>From: Gdb-patches <gdb-patches-
>bounces+markus.t.metzger=intel.com@sourceware.org> On Behalf Of Tom
>Tromey
>Sent: Saturday, January 1, 2022 6:55 PM
>To: gdb-patches@sourceware.org
>Cc: Tom Tromey <tom@tromey.com>
>Subject: [PATCH 08/12] Use filtered output in btrace-related commands
>
>This changes btrace.c and record-btrace.c to use filtered output in
>the commands implemented there.
>---
> gdb/btrace.c        | 126 ++++++++++++++++++++++----------------------
> gdb/record-btrace.c |  46 ++++++++--------
> 2 files changed, 86 insertions(+), 86 deletions(-)
>
>diff --git a/gdb/btrace.c b/gdb/btrace.c
>index 3962636d993..ba10f78e7bf 100644
>--- a/gdb/btrace.c
>+++ b/gdb/btrace.c
>@@ -2852,122 +2852,122 @@ pt_print_packet (const struct pt_packet *packet)
>   switch (packet->type)
>     {
>     default:
>-      printf_unfiltered (("[??: %x]"), packet->type);
>+      printf_filtered (("[??: %x]"), packet->type);
>       break;
>
>     case ppt_psb:
>-      printf_unfiltered (("psb"));
>+      printf_filtered (("psb"));
>       break;
>
>     case ppt_psbend:
>-      printf_unfiltered (("psbend"));
>+      printf_filtered (("psbend"));
>       break;
>
>     case ppt_pad:
>-      printf_unfiltered (("pad"));
>+      printf_filtered (("pad"));
>       break;
>
>     case ppt_tip:
>-      printf_unfiltered (("tip %u: 0x%" PRIx64 ""),
>-			 packet->payload.ip.ipc,
>-			 packet->payload.ip.ip);
>+      printf_filtered (("tip %u: 0x%" PRIx64 ""),
>+		       packet->payload.ip.ipc,
>+		       packet->payload.ip.ip);
>       break;
>
>     case ppt_tip_pge:
>-      printf_unfiltered (("tip.pge %u: 0x%" PRIx64 ""),
>-			 packet->payload.ip.ipc,
>-			 packet->payload.ip.ip);
>+      printf_filtered (("tip.pge %u: 0x%" PRIx64 ""),
>+		       packet->payload.ip.ipc,
>+		       packet->payload.ip.ip);
>       break;
>
>     case ppt_tip_pgd:
>-      printf_unfiltered (("tip.pgd %u: 0x%" PRIx64 ""),
>-			 packet->payload.ip.ipc,
>-			 packet->payload.ip.ip);
>+      printf_filtered (("tip.pgd %u: 0x%" PRIx64 ""),
>+		       packet->payload.ip.ipc,
>+		       packet->payload.ip.ip);
>       break;
>
>     case ppt_fup:
>-      printf_unfiltered (("fup %u: 0x%" PRIx64 ""),
>-			 packet->payload.ip.ipc,
>-			 packet->payload.ip.ip);
>+      printf_filtered (("fup %u: 0x%" PRIx64 ""),
>+		       packet->payload.ip.ipc,
>+		       packet->payload.ip.ip);
>       break;
>
>     case ppt_tnt_8:
>-      printf_unfiltered (("tnt-8 %u: 0x%" PRIx64 ""),
>-			 packet->payload.tnt.bit_size,
>-			 packet->payload.tnt.payload);
>+      printf_filtered (("tnt-8 %u: 0x%" PRIx64 ""),
>+		       packet->payload.tnt.bit_size,
>+		       packet->payload.tnt.payload);
>       break;
>
>     case ppt_tnt_64:
>-      printf_unfiltered (("tnt-64 %u: 0x%" PRIx64 ""),
>-			 packet->payload.tnt.bit_size,
>-			 packet->payload.tnt.payload);
>+      printf_filtered (("tnt-64 %u: 0x%" PRIx64 ""),
>+		       packet->payload.tnt.bit_size,
>+		       packet->payload.tnt.payload);
>       break;
>
>     case ppt_pip:
>-      printf_unfiltered (("pip %" PRIx64 "%s"), packet->payload.pip.cr3,
>-			 packet->payload.pip.nr ? (" nr") : (""));
>+      printf_filtered (("pip %" PRIx64 "%s"), packet->payload.pip.cr3,
>+		       packet->payload.pip.nr ? (" nr") : (""));
>       break;
>
>     case ppt_tsc:
>-      printf_unfiltered (("tsc %" PRIx64 ""), packet->payload.tsc.tsc);
>+      printf_filtered (("tsc %" PRIx64 ""), packet->payload.tsc.tsc);
>       break;
>
>     case ppt_cbr:
>-      printf_unfiltered (("cbr %u"), packet->payload.cbr.ratio);
>+      printf_filtered (("cbr %u"), packet->payload.cbr.ratio);
>       break;
>
>     case ppt_mode:
>       switch (packet->payload.mode.leaf)
> 	{
> 	default:
>-	  printf_unfiltered (("mode %u"), packet->payload.mode.leaf);
>+	  printf_filtered (("mode %u"), packet->payload.mode.leaf);
> 	  break;
>
> 	case pt_mol_exec:
>-	  printf_unfiltered (("mode.exec%s%s"),
>-			     packet->payload.mode.bits.exec.csl
>-			     ? (" cs.l") : (""),
>-			     packet->payload.mode.bits.exec.csd
>-			     ? (" cs.d") : (""));
>+	  printf_filtered (("mode.exec%s%s"),
>+			   packet->payload.mode.bits.exec.csl
>+			   ? (" cs.l") : (""),
>+			   packet->payload.mode.bits.exec.csd
>+			   ? (" cs.d") : (""));
> 	  break;
>
> 	case pt_mol_tsx:
>-	  printf_unfiltered (("mode.tsx%s%s"),
>-			     packet->payload.mode.bits.tsx.intx
>-			     ? (" intx") : (""),
>-			     packet->payload.mode.bits.tsx.abrt
>-			     ? (" abrt") : (""));
>+	  printf_filtered (("mode.tsx%s%s"),
>+			   packet->payload.mode.bits.tsx.intx
>+			   ? (" intx") : (""),
>+			   packet->payload.mode.bits.tsx.abrt
>+			   ? (" abrt") : (""));
> 	  break;
> 	}
>       break;
>
>     case ppt_ovf:
>-      printf_unfiltered (("ovf"));
>+      printf_filtered (("ovf"));
>       break;
>
>     case ppt_stop:
>-      printf_unfiltered (("stop"));
>+      printf_filtered (("stop"));
>       break;
>
>     case ppt_vmcs:
>-      printf_unfiltered (("vmcs %" PRIx64 ""), packet->payload.vmcs.base);
>+      printf_filtered (("vmcs %" PRIx64 ""), packet->payload.vmcs.base);
>       break;
>
>     case ppt_tma:
>-      printf_unfiltered (("tma %x %x"), packet->payload.tma.ctc,
>-			 packet->payload.tma.fc);
>+      printf_filtered (("tma %x %x"), packet->payload.tma.ctc,
>+		       packet->payload.tma.fc);
>       break;
>
>     case ppt_mtc:
>-      printf_unfiltered (("mtc %x"), packet->payload.mtc.ctc);
>+      printf_filtered (("mtc %x"), packet->payload.mtc.ctc);
>       break;
>
>     case ppt_cyc:
>-      printf_unfiltered (("cyc %" PRIx64 ""), packet->payload.cyc.value);
>+      printf_filtered (("cyc %" PRIx64 ""), packet->payload.cyc.value);
>       break;
>
>     case ppt_mnt:
>-      printf_unfiltered (("mnt %" PRIx64 ""), packet->payload.mnt.payload);
>+      printf_filtered (("mnt %" PRIx64 ""), packet->payload.mnt.payload);
>       break;
>     }
> }
>@@ -3149,9 +3149,9 @@ btrace_maint_print_packets (struct btrace_thread_info
>*btinfo,
> 	  {
> 	    const btrace_block &block = blocks.at (blk);
>
>-	    printf_unfiltered ("%u\tbegin: %s, end: %s\n", blk,
>-			       core_addr_to_string_nz (block.begin),
>-			       core_addr_to_string_nz (block.end));
>+	    printf_filtered ("%u\tbegin: %s, end: %s\n", blk,
>+			     core_addr_to_string_nz (block.begin),
>+			     core_addr_to_string_nz (block.end));
> 	  }
>
> 	btinfo->maint.variant.bts.packet_history.begin = begin;
>@@ -3170,15 +3170,15 @@ btrace_maint_print_packets (struct
>btrace_thread_info *btinfo,
> 	  {
> 	    const struct btrace_pt_packet &packet = packets.at (pkt);
>
>-	    printf_unfiltered ("%u\t", pkt);
>-	    printf_unfiltered ("0x%" PRIx64 "\t", packet.offset);
>+	    printf_filtered ("%u\t", pkt);
>+	    printf_filtered ("0x%" PRIx64 "\t", packet.offset);
>
> 	    if (packet.errcode == pte_ok)
> 	      pt_print_packet (&packet.packet);
> 	    else
>-	      printf_unfiltered ("[error: %s]", pt_errstr (packet.errcode));
>+	      printf_filtered ("[error: %s]", pt_errstr (packet.errcode));
>
>-	    printf_unfiltered ("\n");
>+	    printf_filtered ("\n");
> 	  }
>
> 	btinfo->maint.variant.pt.packet_history.begin = begin;
>@@ -3256,7 +3256,7 @@ maint_btrace_packet_history_cmd (const char *arg, int
>from_tty)
>   btrace_maint_update_packets (btinfo, &begin, &end, &from, &to);
>   if (begin == end)
>     {
>-      printf_unfiltered (_("No trace.\n"));
>+      printf_filtered (_("No trace.\n"));
>       return;
>     }
>
>@@ -3398,8 +3398,8 @@ maint_info_btrace_cmd (const char *args, int from_tty)
>   if (conf == NULL)
>     error (_("No btrace configuration."));
>
>-  printf_unfiltered (_("Format: %s.\n"),
>-		     btrace_format_string (conf->format));
>+  printf_filtered (_("Format: %s.\n"),
>+		   btrace_format_string (conf->format));
>
>   switch (conf->format)
>     {
>@@ -3407,8 +3407,8 @@ maint_info_btrace_cmd (const char *args, int from_tty)
>       break;
>
>     case BTRACE_FORMAT_BTS:
>-      printf_unfiltered (_("Number of packets: %zu.\n"),
>-			 btinfo->data.variant.bts.blocks->size ());
>+      printf_filtered (_("Number of packets: %zu.\n"),
>+		       btinfo->data.variant.bts.blocks->size ());
>       break;
>
> #if defined (HAVE_LIBIPT)
>@@ -3417,14 +3417,14 @@ maint_info_btrace_cmd (const char *args, int
>from_tty)
> 	struct pt_version version;
>
> 	version = pt_library_version ();
>-	printf_unfiltered (_("Version: %u.%u.%u%s.\n"), version.major,
>-			   version.minor, version.build,
>-			   version.ext != NULL ? version.ext : "");
>+	printf_filtered (_("Version: %u.%u.%u%s.\n"), version.major,
>+			 version.minor, version.build,
>+			 version.ext != NULL ? version.ext : "");
>
> 	btrace_maint_update_pt_packets (btinfo);
>-	printf_unfiltered (_("Number of packets: %zu.\n"),
>-			   ((btinfo->maint.variant.pt.packets == nullptr)
>-			    ? 0 : btinfo->maint.variant.pt.packets->size ()));
>+	printf_filtered (_("Number of packets: %zu.\n"),
>+			 ((btinfo->maint.variant.pt.packets == nullptr)
>+			  ? 0 : btinfo->maint.variant.pt.packets->size ()));
>       }
>       break;
> #endif /* defined (HAVE_LIBIPT)  */
>diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
>index 108b3861446..c659d68e444 100644
>--- a/gdb/record-btrace.c
>+++ b/gdb/record-btrace.c
>@@ -506,7 +506,7 @@ record_btrace_print_bts_conf (const struct
>btrace_config_bts *conf)
>   if (size > 0)
>     {
>       suffix = record_btrace_adjust_size (&size);
>-      printf_unfiltered (_("Buffer size: %u%s.\n"), size, suffix);
>+      printf_filtered (_("Buffer size: %u%s.\n"), size, suffix);
>     }
> }
>
>@@ -522,7 +522,7 @@ record_btrace_print_pt_conf (const struct
>btrace_config_pt *conf)
>   if (size > 0)
>     {
>       suffix = record_btrace_adjust_size (&size);
>-      printf_unfiltered (_("Buffer size: %u%s.\n"), size, suffix);
>+      printf_filtered (_("Buffer size: %u%s.\n"), size, suffix);
>     }
> }
>
>@@ -531,8 +531,8 @@ record_btrace_print_pt_conf (const struct
>btrace_config_pt *conf)
> static void
> record_btrace_print_conf (const struct btrace_config *conf)
> {
>-  printf_unfiltered (_("Recording format: %s.\n"),
>-		     btrace_format_string (conf->format));
>+  printf_filtered (_("Recording format: %s.\n"),
>+		   btrace_format_string (conf->format));
>
>   switch (conf->format)
>     {
>@@ -602,14 +602,14 @@ record_btrace_target::info_record ()
>       gaps = btinfo->ngaps;
>     }
>
>-  printf_unfiltered (_("Recorded %u instructions in %u functions (%u gaps) "
>-		       "for thread %s (%s).\n"), insns, calls, gaps,
>-		     print_thread_id (tp),
>-		     target_pid_to_str (tp->ptid).c_str ());
>+  printf_filtered (_("Recorded %u instructions in %u functions (%u gaps) "
>+		     "for thread %s (%s).\n"), insns, calls, gaps,
>+		   print_thread_id (tp),
>+		   target_pid_to_str (tp->ptid).c_str ());
>
>   if (btrace_is_replaying (tp))
>-    printf_unfiltered (_("Replay in progress.  At instruction %u.\n"),
>-		       btrace_insn_number (btinfo->replay));
>+    printf_filtered (_("Replay in progress.  At instruction %u.\n"),
>+		     btrace_insn_number (btinfo->replay));
> }
>
> /* Print a decode error.  */
>@@ -938,9 +938,9 @@ record_btrace_target::insn_history (int size,
>gdb_disassembly_flags flags)
>   else
>     {
>       if (size < 0)
>-	printf_unfiltered (_("At the start of the branch trace record.\n"));
>+	printf_filtered (_("At the start of the branch trace record.\n"));
>       else
>-	printf_unfiltered (_("At the end of the branch trace record.\n"));
>+	printf_filtered (_("At the end of the branch trace record.\n"));
>     }
>
>   btrace_set_insn_history (btinfo, &begin, &end);
>@@ -1295,9 +1295,9 @@ record_btrace_target::call_history (int size,
>record_print_flags flags)
>   else
>     {
>       if (size < 0)
>-	printf_unfiltered (_("At the start of the branch trace record.\n"));
>+	printf_filtered (_("At the start of the branch trace record.\n"));
>       else
>-	printf_unfiltered (_("At the end of the branch trace record.\n"));
>+	printf_filtered (_("At the end of the branch trace record.\n"));
>     }
>
>   btrace_set_call_history (btinfo, &begin, &end);
>@@ -3037,11 +3037,11 @@ cmd_show_record_btrace_cpu (const char *args, int
>from_tty)
>   switch (record_btrace_cpu_state)
>     {
>     case CS_AUTO:
>-      printf_unfiltered (_("btrace cpu is 'auto'.\n"));
>+      printf_filtered (_("btrace cpu is 'auto'.\n"));
>       return;
>
>     case CS_NONE:
>-      printf_unfiltered (_("btrace cpu is 'none'.\n"));
>+      printf_filtered (_("btrace cpu is 'none'.\n"));
>       return;
>
>     case CS_CPU:
>@@ -3049,14 +3049,14 @@ cmd_show_record_btrace_cpu (const char *args, int
>from_tty)
> 	{
> 	case CV_INTEL:
> 	  if (record_btrace_cpu.stepping == 0)
>-	    printf_unfiltered (_("btrace cpu is 'intel: %u/%u'.\n"),
>-			       record_btrace_cpu.family,
>-			       record_btrace_cpu.model);
>+	    printf_filtered (_("btrace cpu is 'intel: %u/%u'.\n"),
>+			     record_btrace_cpu.family,
>+			     record_btrace_cpu.model);
> 	  else
>-	    printf_unfiltered (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
>-			       record_btrace_cpu.family,
>-			       record_btrace_cpu.model,
>-			       record_btrace_cpu.stepping);
>+	    printf_filtered (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
>+			     record_btrace_cpu.family,
>+			     record_btrace_cpu.model,
>+			     record_btrace_cpu.stepping);
> 	  return;
> 	}
>     }
>--
>2.31.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 08/12] Use filtered output in btrace-related commands
  2022-01-10 11:56   ` Metzger, Markus T
@ 2022-01-10 14:44     ` Tom Tromey
  0 siblings, 0 replies; 26+ messages in thread
From: Tom Tromey @ 2022-01-10 14:44 UTC (permalink / raw)
  To: Metzger, Markus T; +Cc: Tom Tromey, gdb-patches

>> Btrace is not using any of the GDB printf format specifiers.  IIUC the
>> motivation for those changes is to fix pagination.  There should
>> probably be a comment in utils.h discouraging the use of
>> printf_unfiltered.  The way I read it now is that one needs to use
>> printf_filtered if one wants to use some additional format
>> specififiers.  The default, in that case, would be to use
>> printf_unfiltered.  But that's not what we want people to use,
>> apparently.

The next series will greatly reduce the number of calls to _unfiltered.
Instead paging will be based on stream (and in some cases a temporary
setting of pagination_enabled).

Unfiltered calls are less friendly to users.  At least for ordinary
commands, users expect and should get paging behavior by default.

I've been thinking gdb should also probably move to having styling and
printf extensions always enabled -- then strip the formatting at final
output time, if desired.  This way you could use styling in error(),
etc.  This isn't hard to do, though there's still the question of
whether gdb should try to handle things like the user using printf  to
change styling even when "set style enabled off".

Tom

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-01-10 14:44 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-01 17:55 [PATCH 00/12] More filtered output cleanups Tom Tromey
2022-01-01 17:55 ` [PATCH 01/12] Use filtered output for gdbarch dump Tom Tromey
2022-01-01 17:55 ` [PATCH 02/12] Use filtered output in target-descriptions.c Tom Tromey
2022-01-01 17:55 ` [PATCH 03/12] Use filtered output in files_info implementations Tom Tromey
2022-01-05 11:48   ` Andrew Burgess
2022-01-05 18:28     ` Tom Tromey
2022-01-01 17:55 ` [PATCH 04/12] Use filtered output in language_info Tom Tromey
2022-01-01 17:55 ` [PATCH 05/12] Use filtered output in ordinary commands Tom Tromey
2022-01-05 11:52   ` Andrew Burgess
2022-01-05 18:35     ` Tom Tromey
2022-01-01 17:55 ` [PATCH 06/12] Use filtered output in kill command Tom Tromey
2022-01-01 17:55 ` [PATCH 07/12] Use filtered output in some dumping commands Tom Tromey
2022-01-01 17:55 ` [PATCH 08/12] Use filtered output in btrace-related commands Tom Tromey
2022-01-10 11:56   ` Metzger, Markus T
2022-01-10 14:44     ` Tom Tromey
2022-01-01 17:55 ` [PATCH 09/12] Use filtered output in *-tdep commands Tom Tromey
2022-01-01 17:55 ` [PATCH 10/12] Use filtered output in gnu-nat.c commands Tom Tromey
2022-01-05 11:57   ` Andrew Burgess
2022-01-05 18:37     ` Tom Tromey
2022-01-06 10:07       ` Andrew Burgess
2022-01-06 13:06         ` Andrew Burgess
2022-01-06 15:29         ` Tom Tromey
2022-01-01 17:55 ` [PATCH 11/12] Use filtered output in terminal_info implementations Tom Tromey
2022-01-01 17:55 ` [PATCH 12/12] Filtered output cleanup in expression dumping Tom Tromey
2022-01-05 11:59 ` [PATCH 00/12] More filtered output cleanups Andrew Burgess
2022-01-05 18:38   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).