public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] Refactor gdbarch method print_float_info
Date: Wed, 17 Dec 2014 13:24:00 -0000	[thread overview]
Message-ID: <54918406.9050005@redhat.com> (raw)
In-Reply-To: <1418798765-23198-3-git-send-email-yao@codesourcery.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

  reply	other threads:[~2014-12-17 13:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17  6:46 [PATCH 0/3, V2] MIPS: Provide FPU info and decode FCSR in `info float' Yao Qi
2014-12-17  6:46 ` [PATCH 2/3] Refactor gdbarch method print_float_info Yao Qi
2014-12-17 13:24   ` Pedro Alves [this message]
2014-12-18  1:02     ` Yao Qi
2014-12-18 11:14       ` Pedro Alves
2014-12-17  6:46 ` [PATCH 3/3] MIPS: Provide FPU info and decode FCSR in `info float' Yao Qi
2014-12-17 10:53   ` Pedro Alves
2014-12-17 12:40     ` Yao Qi
2014-12-18  1:07       ` Yao Qi
2014-12-18 11:16         ` Pedro Alves
2014-12-21  0:14     ` Maciej W. Rozycki
2014-12-17  6:46 ` [PATCH 1/3] Remove h8300_print_float_info Yao Qi
2014-12-18 12:52 ` [PATCH 0/3, V2] MIPS: Provide FPU info and decode FCSR in `info float' Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54918406.9050005@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).