From: Andrew Cagney Date: Fri, 16 Aug 2002 00:27:46 +0000 (+0000) Subject: 2002-08-15 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e76f1f2e332de69d2a48bd8ac7bf6d0390991f43;p=binutils-gdb.git 2002-08-15 Andrew Cagney * 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 * gdbint.texinfo (Target Architecture Definition): Document PRINT_VECTOR_INFO. * gdb.texinfo (Vector Unit): Document "info vectors" command. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 87eb84fae80..9102944c797 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2002-08-15 Andrew Cagney + + * 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 * infcmd.c (do_registers_info): Rename parameter ``fpregs'' to diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index e7a4c5417ed..585fe88f818 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2002-08-15 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Document + PRINT_VECTOR_INFO. + * gdb.texinfo (Vector Unit): Document "info vectors" command. + 2002-08-13 Andrew Cagney * gdb.texinfo (Maintenance Commands): Document "maint print diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f77ed536c59..ac6b8e304b0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -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 diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 433844aa004..d560c3658a0 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -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, diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index abc7483a03b..c8e3c17234d 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -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", @@ -3019,6 +3026,32 @@ set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch->print_float_info = print_float_info; } +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) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 7857b09005c..ccdc0502a98 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -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. */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index d5e0e9c4e50..87700da48e7 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -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 diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 07b8cf4e794..95ee3e6195d 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -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); +} /* @@ -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); }