2002-08-15 Andrew Cagney <ac131313@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Fri, 16 Aug 2002 00:27:46 +0000 (00:27 +0000)
committerAndrew Cagney <cagney@redhat.com>
Fri, 16 Aug 2002 00:27:46 +0000 (00:27 +0000)
* infcmd.c (vector_info): New function.
(_initialize_infcmd): Add command "info vector".
(print_vector_info): New function.

* gdbarch.sh (PRINT_VECTOR_INFO): New method
* gdbarch.h, gdbarch.c: Regenerate.

Index: doc/ChangeLog
2002-08-15  Andrew Cagney  <ac131313@redhat.com>

* gdbint.texinfo (Target Architecture Definition): Document
PRINT_VECTOR_INFO.
* gdb.texinfo (Vector Unit): Document "info vectors" command.

gdb/ChangeLog
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/doc/gdbint.texinfo
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/infcmd.c

index 87eb84f..9102944 100644 (file)
@@ -1,5 +1,14 @@
 2002-08-15  Andrew Cagney  <ac131313@redhat.com>
 
+       * infcmd.c (vector_info): New function.
+       (_initialize_infcmd): Add command "info vector".
+       (print_vector_info): New function.
+
+       * gdbarch.sh (PRINT_VECTOR_INFO): New method
+       * gdbarch.h, gdbarch.c: Regenerate.
+
+2002-08-15  Andrew Cagney  <ac131313@redhat.com>
+
        * infcmd.c (do_registers_info): Rename parameter ``fpregs'' to
        ``print_all''.  Only print vector registers when ``print_all''.
 
index e7a4c54..585fe88 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-15  Andrew Cagney  <ac131313@redhat.com>
+
+       * gdbint.texinfo (Target Architecture Definition): Document
+       PRINT_VECTOR_INFO.
+       * gdb.texinfo (Vector Unit): Document "info vectors" command.
+
 2002-08-13  Andrew Cagney  <ac131313@redhat.com>
 
        * gdb.texinfo (Maintenance Commands): Document "maint print
index f77ed53..ac6b8e3 100644 (file)
@@ -5583,6 +5583,20 @@ floating point chip.  Currently, @samp{info float} is supported on
 the ARM and x86 machines.
 @end table
 
+@node Vector Unit
+@section Vector Unit
+@cindex vector unit
+
+Depending on the configuration, @value{GDBN} may be able to give you
+more information about the status of the vector unit.
+
+@table @code
+@kindex info vector
+@item info vector
+Display information about the vector unit.  The exact contents and
+layout vary depending on the hardware.
+@end table
+
 @node Memory Region Attributes
 @section Memory region attributes 
 @cindex memory region attributes
index 433844a..d560c36 100644 (file)
@@ -3099,6 +3099,14 @@ If defined, use this to print the value of a register or all registers.
 If defined, then the @samp{info float} command will print information about
 the processor's floating point unit.
 
+@item PRINT_VECTOR_INFO()
+@findex PRINT_VECTOR_INFO
+If defined, then the @samp{info vector} command will call this function
+to print information about the processor's vector unit.
+
+By default, the @samp{info vector} command will print all vector
+registers (the register's type having the vector attribute).
+
 @item DWARF_REG_TO_REGNUM
 @findex DWARF_REG_TO_REGNUM
 Convert DWARF register number into @value{GDBN} regnum.  If not defined,
index abc7483..c8e3c17 100644 (file)
@@ -173,6 +173,7 @@ struct gdbarch
   gdbarch_register_virtual_type_ftype *register_virtual_type;
   gdbarch_do_registers_info_ftype *do_registers_info;
   gdbarch_print_float_info_ftype *print_float_info;
+  gdbarch_print_vector_info_ftype *print_vector_info;
   gdbarch_register_sim_regno_ftype *register_sim_regno;
   gdbarch_register_bytes_ok_ftype *register_bytes_ok;
   gdbarch_cannot_fetch_register_ftype *cannot_fetch_register;
@@ -406,6 +407,7 @@ struct gdbarch startup_gdbarch =
   0,
   0,
   0,
+  0,
   generic_in_function_epilogue_p,
   construct_inferior_arguments,
   0,
@@ -637,6 +639,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
     fprintf_unfiltered (log, "\n\tregister_virtual_type");
   /* Skip verify of do_registers_info, invalid_p == 0 */
   /* Skip verify of print_float_info, has predicate */
+  /* Skip verify of print_vector_info, has predicate */
   /* Skip verify of register_sim_regno, invalid_p == 0 */
   /* Skip verify of register_bytes_ok, has predicate */
   /* Skip verify of cannot_fetch_register, invalid_p == 0 */
@@ -1548,6 +1551,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
     fprintf_unfiltered (file,
                         "gdbarch_dump: print_float_info = 0x%08lx\n",
                         (long) current_gdbarch->print_float_info);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: print_vector_info = 0x%08lx\n",
+                        (long) current_gdbarch->print_vector_info);
 #ifdef PROLOGUE_FRAMELESS_P
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -3020,6 +3027,32 @@ set_gdbarch_print_float_info (struct gdbarch *gdbarch,
 }
 
 int
+gdbarch_print_vector_info_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->print_vector_info != 0;
+}
+
+void
+gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->print_vector_info == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_print_vector_info invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (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)
 {
   gdb_assert (gdbarch != NULL);
index 7857b09..ccdc050 100644 (file)
@@ -801,6 +801,12 @@ 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, struct frame_info *frame, const char *args);
 extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info);
 
+extern int gdbarch_print_vector_info_p (struct gdbarch *gdbarch);
+
+typedef void (gdbarch_print_vector_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
+extern void gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *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. */
 
index d5e0e9c..87700da 100755 (executable)
@@ -469,6 +469,7 @@ v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
 f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
 f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
 M:2:PRINT_FLOAT_INFO:void:print_float_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args
+M:2:PRINT_VECTOR_INFO:void:print_vector_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args
 # MAP a GDB RAW register number onto a simulator register number.  See
 # also include/...-sim.h.
 f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::legacy_register_sim_regno::0
index 07b8cf4..95ee3e6 100644 (file)
@@ -1710,6 +1710,39 @@ nofp_registers_info (char *addr_exp, int from_tty)
 {
   registers_info (addr_exp, 0);
 }
+
+static void
+print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
+                  struct frame_info *frame, const char *args)
+{
+  if (gdbarch_print_vector_info_p (gdbarch))
+    gdbarch_print_vector_info (gdbarch, file, frame, args);
+  else
+    {
+      int regnum;
+      int printed_something = 0;
+      for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
+       {
+         if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (regnum)))
+           {
+             printed_something = 1;
+#if 0
+             gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
+#else
+             do_registers_info (regnum, 1);
+#endif
+           }
+       }
+      if (!printed_something)
+       fprintf_filtered (file, "No vector information\n");
+    }
+}
+
+static void
+vector_info (char *args, int from_tty)
+{
+  print_vector_info (current_gdbarch, gdb_stdout, selected_frame, args);
+}
 \f
 
 /*
@@ -2083,6 +2116,9 @@ Register name as argument means describe only that register.");
   add_info ("float", float_info,
            "Print the status of the floating point unit\n");
 
+  add_info ("vector", vector_info,
+           "Print the status of the vector unit\n");
+
   inferior_environ = make_environ ();
   init_environ (inferior_environ);
 }