[PATCH 5/6] Remove the print_vector_info gdbarch hook

Tom Tromey tom@tromey.com
Mon Nov 4 21:14:15 GMT 2024


The print_vector_info gdbarch hook has apparently never been set by
any arch.  This patch removes it.
---
 gdb/gdbarch-gen.c         | 32 --------------------------------
 gdb/gdbarch-gen.h         |  6 ------
 gdb/gdbarch_components.py | 11 -----------
 gdb/infcmd.c              | 21 +++++++--------------
 4 files changed, 7 insertions(+), 63 deletions(-)

diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c
index 534ed35f3bba3b6ebe1a034198f5f7e16e756e72..47f068967cce0e44f1e3e6a5b7eee485320ae705 100644
--- a/gdb/gdbarch-gen.c
+++ b/gdb/gdbarch-gen.c
@@ -99,7 +99,6 @@ struct gdbarch
   gdbarch_code_of_frame_writable_ftype *code_of_frame_writable = default_code_of_frame_writable;
   gdbarch_print_registers_info_ftype *print_registers_info = default_print_registers_info;
   gdbarch_print_float_info_ftype *print_float_info = default_print_float_info;
-  gdbarch_print_vector_info_ftype *print_vector_info = nullptr;
   gdbarch_register_sim_regno_ftype *register_sim_regno = legacy_register_sim_regno;
   gdbarch_cannot_fetch_register_ftype *cannot_fetch_register = cannot_register_not;
   gdbarch_cannot_store_register_ftype *cannot_store_register = cannot_register_not;
@@ -357,7 +356,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of code_of_frame_writable, invalid_p == 0.  */
   /* Skip verify of print_registers_info, invalid_p == 0.  */
   /* Skip verify of print_float_info, invalid_p == 0.  */
-  /* Skip verify of print_vector_info, has predicate.  */
   /* Skip verify of register_sim_regno, invalid_p == 0.  */
   /* Skip verify of cannot_fetch_register, invalid_p == 0.  */
   /* Skip verify of cannot_store_register, invalid_p == 0.  */
@@ -740,12 +738,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   gdb_printf (file,
 	      "gdbarch_dump: print_float_info = <%s>\n",
 	      host_address_to_string (gdbarch->print_float_info));
-  gdb_printf (file,
-	      "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n",
-	      gdbarch_print_vector_info_p (gdbarch));
-  gdb_printf (file,
-	      "gdbarch_dump: print_vector_info = <%s>\n",
-	      host_address_to_string (gdbarch->print_vector_info));
   gdb_printf (file,
 	      "gdbarch_dump: register_sim_regno = <%s>\n",
 	      host_address_to_string (gdbarch->register_sim_regno));
@@ -2354,30 +2346,6 @@ set_gdbarch_print_float_info (struct gdbarch *gdbarch,
   gdbarch->print_float_info = print_float_info;
 }
 
-bool
-gdbarch_print_vector_info_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->print_vector_info != NULL;
-}
-
-void
-gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, const frame_info_ptr &frame, const char *args)
-{
-  gdb_assert (gdbarch != NULL);
-  gdb_assert (gdbarch->print_vector_info != NULL);
-  if (gdbarch_debug >= 2)
-    gdb_printf (gdb_stdlog, "gdbarch_print_vector_info called\n");
-  gdbarch->print_vector_info (gdbarch, file, frame, args);
-}
-
-void
-set_gdbarch_print_vector_info (struct gdbarch *gdbarch,
-			       gdbarch_print_vector_info_ftype print_vector_info)
-{
-  gdbarch->print_vector_info = print_vector_info;
-}
-
 int
 gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
 {
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 6b5ebcc28516f942ffa33c288e5d6c1aab7d9aac..d96bbe94f07b17a5ed173bdf20b3bfee7ff70cfa 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -372,12 +372,6 @@ typedef void (gdbarch_print_float_info_ftype) (struct gdbarch *gdbarch, struct u
 extern void gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, const frame_info_ptr &frame, const char *args);
 extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info);
 
-extern bool gdbarch_print_vector_info_p (struct gdbarch *gdbarch);
-
-typedef void (gdbarch_print_vector_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, const frame_info_ptr &frame, const char *args);
-extern void gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, const frame_info_ptr &frame, const char *args);
-extern void set_gdbarch_print_vector_info (struct gdbarch *gdbarch, gdbarch_print_vector_info_ftype *print_vector_info);
-
 /* MAP a GDB RAW register number onto a simulator register number.  See
    also include/...-sim.h. */
 
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index f79d61559b8e4c50a66258284376f454072f4112..78d9521154f629740bced42a44300c20a1e2b2cb 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -719,17 +719,6 @@ Method(
     invalid=False,
 )
 
-Method(
-    type="void",
-    name="print_vector_info",
-    params=[
-        ("struct ui_file *", "file"),
-        ("const frame_info_ptr &", "frame"),
-        ("const char *", "args"),
-    ],
-    predicate=True,
-)
-
 Method(
     comment="""
 MAP a GDB RAW register number onto a simulator register number.  See
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 74873b9f7c80fa2ec299f528cde748161882c175..db9d6e66b57b700b7dc9b7bd6176fdc0ac888ef3 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2404,25 +2404,18 @@ print_vector_info (struct ui_file *file,
 		   const frame_info_ptr &frame, const char *args)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
+  int printed_something = 0;
 
-  if (gdbarch_print_vector_info_p (gdbarch))
-    gdbarch_print_vector_info (gdbarch, file, frame, args);
-  else
+  for (int regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch); regnum++)
     {
-      int regnum;
-      int printed_something = 0;
-
-      for (regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch); regnum++)
+      if (gdbarch_register_reggroup_p (gdbarch, regnum, vector_reggroup))
 	{
-	  if (gdbarch_register_reggroup_p (gdbarch, regnum, vector_reggroup))
-	    {
-	      printed_something = 1;
-	      gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
-	    }
+	  printed_something = 1;
+	  gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
 	}
-      if (!printed_something)
-	gdb_printf (file, "No vector information\n");
     }
+  if (!printed_something)
+    gdb_printf (file, "No vector information\n");
 }
 
 static void

-- 
2.46.1



More information about the Gdb-patches mailing list