This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/3] Refactor gdbarch method print_float_info
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Wed, 17 Dec 2014 13:24:22 +0000
- Subject: Re: [PATCH 2/3] Refactor gdbarch method print_float_info
- Authentication-results: sourceware.org; auth=none
- References: <1418798765-23198-1-git-send-email-yao at codesourcery dot com> <1418798765-23198-3-git-send-email-yao at codesourcery dot com>
Thanks! I took another look and I have a few
further comments. Sorry I didn't send them the first
time around.
On 12/17/2014 06:46 AM, Yao Qi wrote:
> 2. we want to simply the caller of print_float_info,
"simplify"
> +void
> +default_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
> + struct frame_info *frame, const char *args)
Could you add an "See inferior.h." comment?
> +{
> + 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))
> + {
> + 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");
> +}
> +
> static void
> print_float_info (struct ui_file *file,
> struct frame_info *frame, const char *args)
> {
> struct gdbarch *gdbarch = get_frame_arch (frame);
>
> - if (gdbarch_print_float_info_p (gdbarch))
> - gdbarch_print_float_info (gdbarch, file, frame, args);
> - else
> - {
> - int regnum;
> - int printed_something = 0;
> + gdbarch_print_float_info (gdbarch, file, frame, args);
I think there's only one caller of print_float_info,
so we could inline this there and eliminate print_float_info.
> index eebc034..e10197a 100644
> --- a/gdb/inferior.h
> +++ b/gdb/inferior.h
> @@ -106,6 +106,11 @@ extern void default_print_registers_info (struct gdbarch *gdbarch,
> struct frame_info *frame,
> int regnum, int all);
>
> +extern void default_print_float_info (struct gdbarch *gdbarch,
> + struct ui_file *file,
> + struct frame_info *frame,
> + const char *args);
> +
Could you add an intro comment? Something like:
/* Default implementation of gdbarch_print_float_info. Prints
the values of all floating point registers. */
> extern void child_terminal_info (struct target_ops *self, const char *, int);
>
> extern void term_info (char *, int);
>
> } elseif [istarget "mips*-*-*"] then {
> - gdb_test "info float" "f0:.*flt:.*dbl:.*" "info float"
> + gdb_test_multiple "info float" "info float" {
> + -re "fpu type: none*" {
> + pass "info float (without FPU)"
> + }
> + -re "fpu type:.*cause.*mask.*flags.*round.*flush.*" {
> + pass "info float (with FPU)"
> + }
Missing "$gdb_prompt $" at the end of those regexs.
Also, with v2 we still print the register values.
So ISTM that it'd be good if the "f0:.*flt:.*dbl:.*" regex is
still part of the expected output? And if in the none case
we _shouldn't see those, then the test could make sure
that's how things work?
Thanks,
Pedro Alves