Refactor gdbarch method print_float_info

This patch is to change print_float_info gdbarch method for the
following two reasons,

 1. we want to add a default implementation of print_float_info to
    dump the float pointer registers.  It can be reused by backend to
    print something more than float point registers.
 2. we want to simplify the caller of print_float_info,
    infcmd.c:print_float_info.

gdb:

2014-12-18  Yao Qi  <yao@codesourcery.com>

 	* gdbarch.sh (print_float_info): Change its type from 'M' to 'm'.
	* gdbarch.c: Re-generated.
	* gdbarch.h: Likewise.
	* infcmd.c (default_print_float_info): New function.
	(print_float_info): Removed.  Move code to
	default_print_float_info.
	(float_info): Adjust to call gdbarch_print_float_info.
	* inferior.h (default_print_float_info): Declare it.
This commit is contained in:
Yao Qi 2014-12-18 20:47:28 +08:00
parent 2ad47ec433
commit cc86d1cb95
6 changed files with 43 additions and 37 deletions

View file

@ -2867,43 +2867,41 @@ interrupt_command (char *args, int from_tty)
}
}
static void
print_float_info (struct ui_file *file,
struct frame_info *frame, const char *args)
/* See inferior.h. */
void
default_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, const char *args)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int regnum;
int printed_something = 0;
if (gdbarch_print_float_info_p (gdbarch))
gdbarch_print_float_info (gdbarch, file, frame, args);
else
for (regnum = 0;
regnum < gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch);
regnum++)
{
int regnum;
int printed_something = 0;
for (regnum = 0;
regnum < gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch);
regnum++)
if (gdbarch_register_reggroup_p (gdbarch, regnum, float_reggroup))
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, float_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)
fprintf_filtered (file, "No floating-point info "
"available for this processor.\n");
}
if (!printed_something)
fprintf_filtered (file, "No floating-point info "
"available for this processor.\n");
}
static void
float_info (char *args, int from_tty)
{
struct frame_info *frame;
if (!target_has_registers)
error (_("The program has no registers now."));
print_float_info (gdb_stdout, get_selected_frame (NULL), args);
frame = get_selected_frame (NULL);
gdbarch_print_float_info (get_frame_arch (frame), gdb_stdout, frame, args);
}
static void