Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 06/13] Add enum for mips breakpoint kinds
Date: Thu, 27 Oct 2016 14:54:00 -0000	[thread overview]
Message-ID: <781ba8eb-ba42-58e0-1ead-ae44d8a39409@redhat.com> (raw)
In-Reply-To: <1472655965-12212-7-git-send-email-yao.qi@linaro.org>

On 08/31/2016 04:05 PM, Yao Qi wrote:
> This patch adds an enum mips_breakpoint_kinds to avoid using magic
> numbers as much as possible.
> 
> gdb:
> 
> 2016-08-31  Yao Qi  <yao.qi@linaro.org>
> 
> 	* mips-tdep.c (mips_breakpoint_kinds): New enum.
> 	(mips_breakpoint_from_pc): Use it.
> 	(mips_remote_breakpoint_from_pc): Likewise.
> ---
>  gdb/mips-tdep.c | 37 ++++++++++++++++++++++---------------
>  1 file changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
> index 4e4d79e..34df8d0 100644
> --- a/gdb/mips-tdep.c
> +++ b/gdb/mips-tdep.c
> @@ -107,6 +107,20 @@ static const char *const mips_abi_strings[] = {
>    NULL
>  };
>  
> +/* Enum describing the different kinds of breakpoints.  */
> +
> +enum mips_breakpoint_kinds

IMO that should be singular.  Imagine you put one of these
in a variable.  Like:

  enum mips_breakpoint_kinds kind;

This would be more natural, IMO:

  enum mips_breakpoint_kind kind;

> +{
> +  /* 16-bit MIPS16 mode breakpoint */
> +  MIPS_BP_KIND_16BIT_MIPS16 = 2,
> +  /* 16-bit microMIPS mode breakpoint */
> +  MIPS_BP_KIND_16BIT_MICROMIPS = 3,
> +  /* 32-bit standard MIPS mode breakpoint */
> +  MIPS_BP_KIND_32BIT = 4,
> +  /* 32-bit microMIPS mode breakpoint */
> +  MIPS_BP_KIND_32BIT_MICROMIPS = 5,

IMO a line break between these makes it much more readable.

  /* 16-bit MIPS16 mode breakpoint */
  MIPS_BP_KIND_16BIT_MIPS16 = 2,

  /* 16-bit microMIPS mode breakpoint */
  MIPS_BP_KIND_16BIT_MICROMIPS = 3,

etc.

> +};
> +
>  /* For backwards compatibility we default to MIPS16.  This flag is
>     overridden as soon as unambiguous ELF file flags tell us the
>     compressed ISA encoding used.  */
> @@ -7143,16 +7157,7 @@ mips_breakpoint_from_pc (struct gdbarch *gdbarch,
>      }
>  }
>  
> -/* Determine the remote breakpoint kind suitable for the PC.  The following
> -   kinds are used:
> -
> -   * 2 -- 16-bit MIPS16 mode breakpoint,
> -
> -   * 3 -- 16-bit microMIPS mode breakpoint,
> -
> -   * 4 -- 32-bit standard MIPS mode breakpoint,
> -
> -   * 5 -- 32-bit microMIPS mode breakpoint.  */

In a latter patch you seem to read this comment.

> +/* Determine the remote breakpoint kind suitable for the PC.  */

Thanks,
Pedro Alves


  reply	other threads:[~2016-10-27 14:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 15:06 [PATCH 00/13] Split brekapoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kind Yao Qi
2016-08-31 15:06 ` [PATCH 01/13] Remove v850_dbtrap_breakpoint_from_pc Yao Qi
2016-08-31 15:06 ` [PATCH 12/13] Determine the kind of single step breakpoint Yao Qi
2016-10-27 14:55   ` Pedro Alves
2016-08-31 15:06 ` [PATCH 08/13] New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind Yao Qi
2016-08-31 15:06 ` [PATCH 11/13] Add default_breakpoint_from_pc Yao Qi
2016-08-31 15:06 ` [PATCH 03/13] gdbarch_breakpoint_from_pc doesn't return NULL Yao Qi
2016-09-28 15:23   ` Michael Eager
2016-08-31 15:06 ` [PATCH 07/13] Split brekapoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kind Yao Qi
2016-10-10 10:05   ` Yao Qi
2016-10-27 14:55   ` Pedro Alves
2016-10-28 19:44     ` Maciej W. Rozycki
2016-08-31 15:06 ` [PATCH 13/13] Remove arm_override_mode Yao Qi
2016-10-27 14:56   ` Pedro Alves
2016-08-31 15:06 ` [PATCH 02/13] Rename 'arch' by 'gdbarch' in m32c_gdbarch_init Yao Qi
2016-08-31 15:06 ` [PATCH 06/13] Add enum for mips breakpoint kinds Yao Qi
2016-10-27 14:54   ` Pedro Alves [this message]
2016-10-28 19:39     ` Maciej W. Rozycki
2016-08-31 15:06 ` [PATCH 05/13] Share enum arm_breakpoint_kinds Yao Qi
2016-08-31 15:06 ` [PATCH 10/13] Remove gdbarch_remote_breakpoint_from_pc Yao Qi
2016-10-27 14:55   ` Pedro Alves
2016-08-31 15:06 ` [PATCH 09/13] Rename placed_size to kind Yao Qi
2016-08-31 15:06 ` [PATCH 04/13] GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION Yao Qi
2016-10-10 10:17 ` [PATCH 00/13] Split brekapoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kind Yao Qi
2016-10-26 15:43   ` Yao Qi
2016-10-27 14:58     ` Pedro Alves
2016-10-27 15:41       ` Yao Qi
2016-10-27 17:55         ` Pedro Alves

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=781ba8eb-ba42-58e0-1ead-ae44d8a39409@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.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