aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-11-05 20:43:36 +0000
committerAndrew Cagney <cagney@redhat.com>2002-11-05 20:43:36 +0000
commit87647bb0c7edc3274f99f3173a325eece2d2af06 (patch)
tree23b08b94419fa40b6779d4ab29809f2555a3a962 /gdb
parent8155455b32badf3054bbd60fe6b3ffae28001b77 (diff)
downloadgdb-87647bb0c7edc3274f99f3173a325eece2d2af06.zip
gdb-87647bb0c7edc3274f99f3173a325eece2d2af06.tar.gz
gdb-87647bb0c7edc3274f99f3173a325eece2d2af06.tar.bz2
2002-11-05 Andrew Cagney <ac131313@redhat.com>
* sparc-tdep.c (sparc_print_register_hook): Make static. (sparc_print_registers_info): New function. (sparc_do_registers_info): New function. (sparclet_print_registers_info): New function. (sparclet_do_registers_info): New function. (do_sparc_print_registers_info): New function. (sparc_print_registers): New static function, clone of infcmd.c's default_print_registers_info. * config/sparc/tm-sparclet.h (PRINT_REGISTER_HOOK): Delete macro. (sparclet_do_registers_info): Declare. (DEPRECATED_DO_REGISTERS_INFO): Re-define. * config/sparc/tm-sparc.h (DEPRECATED_DO_REGISTERS_INFO): Re-define. (sparc_do_registers_info): Declare. (PRINT_REGISTER_HOOK): Delete macro. (sparc_print_register_hook): Delete declaration.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog19
-rw-r--r--gdb/config/sparc/tm-sparc.h11
-rw-r--r--gdb/config/sparc/tm-sparclet.h6
-rw-r--r--gdb/sparc-tdep.c142
4 files changed, 167 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 66bcaf4..dc5146a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+2002-11-05 Andrew Cagney <ac131313@redhat.com>
+
+ * sparc-tdep.c (sparc_print_register_hook): Make static.
+ (sparc_print_registers_info): New function.
+ (sparc_do_registers_info): New function.
+ (sparclet_print_registers_info): New function.
+ (sparclet_do_registers_info): New function.
+ (do_sparc_print_registers_info): New function.
+ (sparc_print_registers): New static function, clone of infcmd.c's
+ default_print_registers_info.
+ * config/sparc/tm-sparclet.h (PRINT_REGISTER_HOOK): Delete macro.
+ (sparclet_do_registers_info): Declare.
+ (DEPRECATED_DO_REGISTERS_INFO): Re-define.
+ * config/sparc/tm-sparc.h (DEPRECATED_DO_REGISTERS_INFO):
+ Re-define.
+ (sparc_do_registers_info): Declare.
+ (PRINT_REGISTER_HOOK): Delete macro.
+ (sparc_print_register_hook): Delete declaration.
+
2002-11-05 David Carlton <carlton@math.stanford.edu>
* symtab.c (lookup_symbol_aux): Move chunks of code into separate
diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h
index 8cac258..6042ac6 100644
--- a/gdb/config/sparc/tm-sparc.h
+++ b/gdb/config/sparc/tm-sparc.h
@@ -736,14 +736,9 @@ extern void sparc_software_single_step (enum target_signal, int);
#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *);
-/* To print every pair of float registers as a double, we use this hook.
- We also print the condition code registers in a readable format
- (FIXME: can expand this to all control regs). */
-
-#undef PRINT_REGISTER_HOOK
-#define PRINT_REGISTER_HOOK(regno) \
- sparc_print_register_hook (regno)
-extern void sparc_print_register_hook (int regno);
+extern void sparc_do_registers_info (int regnum, int all);
+#undef DEPRECATED_DO_REGISTERS_INFO
+#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparc_do_registers_info (REGNUM, ALL)
/* Optimization for storing registers to the inferior. The hook
DO_DEFERRED_STORES
diff --git a/gdb/config/sparc/tm-sparclet.h b/gdb/config/sparc/tm-sparclet.h
index fd25f5b..9fd1ace 100644
--- a/gdb/config/sparc/tm-sparclet.h
+++ b/gdb/config/sparc/tm-sparclet.h
@@ -127,8 +127,10 @@ enum {
#endif /* GDB_MULTI_ARCH */
-#undef PRINT_REGISTER_HOOK
-#define PRINT_REGISTER_HOOK(regno)
+extern void sparclet_do_registers_info (int regnum, int all);
+#undef DEPRECATED_DO_REGISTERS_INFO
+#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparclet_do_registers_info (REGNUM, ALL)
+
/* Offsets into jmp_buf. Not defined by Sun, but at least documented in a
comment in <machine/setjmp.h>! */
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 0fce473..4613744 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1858,7 +1858,7 @@ decode_asi (int val)
Pretty print various registers. */
/* FIXME: Would be nice if this did some fancy things for 32 bit sparc. */
-void
+static void
sparc_print_register_hook (int regno)
{
ULONGEST val;
@@ -2028,6 +2028,146 @@ sparc_print_register_hook (int regno)
#undef BITS
}
+
+static void
+sparc_print_registers (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ struct frame_info *frame,
+ int regnum, int print_all,
+ void (*print_register_hook) (int))
+{
+ int i;
+ const int numregs = NUM_REGS + NUM_PSEUDO_REGS;
+ char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+ char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
+
+ for (i = 0; i < numregs; i++)
+ {
+ /* Decide between printing all regs, non-float / vector regs, or
+ specific reg. */
+ if (regnum == -1)
+ {
+ if (!print_all)
+ {
+ if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+ continue;
+ if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)))
+ continue;
+ }
+ }
+ else
+ {
+ if (i != regnum)
+ continue;
+ }
+
+ /* If the register name is empty, it is undefined for this
+ processor, so don't display anything. */
+ if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
+ continue;
+
+ fputs_filtered (REGISTER_NAME (i), file);
+ print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file);
+
+ /* Get the data in raw format. */
+ if (! frame_register_read (frame, i, raw_buffer))
+ {
+ fprintf_filtered (file, "*value not available*\n");
+ continue;
+ }
+
+ /* FIXME: cagney/2002-08-03: This code shouldn't be necessary.
+ The function frame_register_read() should have returned the
+ pre-cooked register so no conversion is necessary. */
+ /* Convert raw data to virtual format if necessary. */
+ if (REGISTER_CONVERTIBLE (i))
+ {
+ REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
+ raw_buffer, virtual_buffer);
+ }
+ else
+ {
+ memcpy (virtual_buffer, raw_buffer,
+ REGISTER_VIRTUAL_SIZE (i));
+ }
+
+ /* If virtual format is floating, print it that way, and in raw
+ hex. */
+ if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+ {
+ int j;
+
+ val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+ file, 0, 1, 0, Val_pretty_default);
+
+ fprintf_filtered (file, "\t(raw 0x");
+ for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
+ {
+ int idx;
+ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+ idx = j;
+ else
+ idx = REGISTER_RAW_SIZE (i) - 1 - j;
+ fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]);
+ }
+ fprintf_filtered (file, ")");
+ }
+ else
+ {
+ /* Print the register in hex. */
+ val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+ file, 'x', 1, 0, Val_pretty_default);
+ /* If not a vector register, print it also according to its
+ natural format. */
+ if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
+ {
+ fprintf_filtered (file, "\t");
+ val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+ file, 0, 1, 0, Val_pretty_default);
+ }
+ }
+
+ /* Some sparc specific info. */
+ if (print_register_hook != NULL)
+ print_register_hook (i);
+
+ fprintf_filtered (file, "\n");
+ }
+}
+
+static void
+sparc_print_registers_info (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ struct frame_info *frame,
+ int regnum, int print_all)
+{
+ sparc_print_registers (gdbarch, file, frame, regnum, print_all,
+ sparc_print_register_hook);
+}
+
+void
+sparc_do_registers_info (int regnum, int all)
+{
+ sparc_print_registers_info (current_gdbarch, gdb_stdout, selected_frame,
+ regnum, all);
+}
+
+static void
+sparclet_print_registers_info (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ struct frame_info *frame,
+ int regnum, int print_all)
+{
+ sparc_print_registers (gdbarch, file, frame, regnum, print_all, NULL);
+}
+
+void
+sparclet_do_registers_info (int regnum, int all)
+{
+ sparclet_print_registers_info (current_gdbarch, gdb_stdout, selected_frame,
+ regnum, all);
+}
+
int
gdb_print_insn_sparc (bfd_vma memaddr, disassemble_info *info)