[PATCH 09/12] Use filtered output in *-tdep commands

Tom Tromey tom@tromey.com
Sat Jan 1 17:55:17 GMT 2022


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



More information about the Gdb-patches mailing list