aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c81
1 files changed, 46 insertions, 35 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9aa8542..4333325 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1550,23 +1550,33 @@ path_command (char *dirname, int from_tty)
char *gdb_register_names[] = REGISTER_NAMES;
#endif
/* Print out the machine register regnum. If regnum is -1, print all
- registers (all == 1) or all non-float and non-vector registers (all
- == 0).
+ registers (print_all == 1) or all non-float and non-vector
+ registers (print_all == 0).
For most machines, having all_registers_info() print the
- register(s) one per line is good enough. If a different format
- is required, (eg, for MIPS or Pyramid 90x, which both have
- lots of regs), or there is an existing convention for showing
- all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
- to provide that format. */
+ register(s) one per line is good enough. If a different format is
+ required, (eg, for MIPS or Pyramid 90x, which both have lots of
+ regs), or there is an existing convention for showing all the
+ registers, define the architecture method PRINT_REGISTERS_INFO to
+ provide that format. */
void
-do_registers_info (int regnum, int print_all)
+default_print_registers_info (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ struct frame_info *frame,
+ int regnum, int print_all)
{
- register int i;
- int numregs = NUM_REGS + NUM_PSEUDO_REGS;
- char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- char *virtual_buffer = (char*) alloca (MAX_REGISTER_VIRTUAL_SIZE);
+ 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);
+
+ /* FIXME: cagney/2002-03-08: This should be deprecated. */
+ if (DO_REGISTERS_INFO_P ())
+ {
+ DO_REGISTERS_INFO (regnum, print_all);
+ return;
+ }
for (i = 0; i < numregs; i++)
{
@@ -1593,16 +1603,19 @@ do_registers_info (int regnum, int print_all)
if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
continue;
- fputs_filtered (REGISTER_NAME (i), gdb_stdout);
- print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
+ 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 (selected_frame, i, raw_buffer))
+ if (! frame_register_read (frame, i, raw_buffer))
{
- printf_filtered ("*value not available*\n");
+ 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))
{
@@ -1615,22 +1628,26 @@ do_registers_info (int regnum, int print_all)
REGISTER_VIRTUAL_SIZE (i));
}
- /* If virtual format is floating, print it that way, and in raw hex. */
+ /* If virtual format is floating, print it that way, and in raw
+ hex. */
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
{
- register int j;
+ int j;
val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
- gdb_stdout, 0, 1, 0, Val_pretty_default);
+ file, 0, 1, 0, Val_pretty_default);
- printf_filtered ("\t(raw 0x");
+ fprintf_filtered (file, "\t(raw 0x");
for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
{
- register int idx = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? j
- : REGISTER_RAW_SIZE (i) - 1 - j;
- printf_filtered ("%02x", (unsigned char) raw_buffer[idx]);
+ 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]);
}
- printf_filtered (")");
+ fprintf_filtered (file, ")");
}
else
{
@@ -1653,7 +1670,7 @@ do_registers_info (int regnum, int print_all)
PRINT_REGISTER_HOOK (i);
#endif
- printf_filtered ("\n");
+ fprintf_filtered (file, "\n");
}
}
@@ -1670,7 +1687,8 @@ registers_info (char *addr_exp, int fpregs)
if (!addr_exp)
{
- DO_REGISTERS_INFO (-1, fpregs);
+ gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
+ selected_frame, -1, fpregs);
return;
}
@@ -1695,7 +1713,8 @@ registers_info (char *addr_exp, int fpregs)
error ("%.*s: invalid register", (int) (end - addr_exp), addr_exp);
found:
- DO_REGISTERS_INFO (regnum, fpregs);
+ gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
+ selected_frame, regnum, fpregs);
addr_exp = end;
while (*addr_exp == ' ' || *addr_exp == '\t')
@@ -1737,11 +1756,7 @@ print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
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)
@@ -1921,11 +1936,7 @@ print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
{
printed_something = 1;
-#if 0
gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
-#else
- do_registers_info (regnum, 1);
-#endif
}
}
if (!printed_something)