public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Enze Li <enze.li@hotmail.com>
To: Jiangshuai Li <jiangshuai_li@c-sky.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/csky modify registers list for general_reggroup
Date: Tue, 12 Jul 2022 11:31:34 +0800	[thread overview]
Message-ID: <OS3P286MB21529BB792346B2A038531F5F0869@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <OS3P286MB215214342EA17D53DEE6A675F0869@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM>

On Tue, 2022-07-12 at 11:21 +0800, Enze Li via Gdb-patches wrote:
> Hi Jiangshuai,
> 
> Thanks for doing this.  I found some minor nits with the coding
> style.
> Pls see below.
> 
> On Tue, 2022-07-12 at 10:23 +0800, Jiangshuai Li wrote:
> > there are two modification points here:
>   ^^^^^
> there -> There
> 
> > 1. for the debugging of csky architecture, after executing "info
> > register",
> >    we hope to print out GPRs, PC and the registers related to
> > exceptions
> > 2. with tdesc-xml, users can view the register groups described in
> > XML
> > ---
> >  gdb/csky-tdep.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
> > index 502b01e33e1..fcdb865eb87 100644
> > --- a/gdb/csky-tdep.c
> > +++ b/gdb/csky-tdep.c
> > @@ -2518,7 +2518,11 @@ csky_register_reggroup_p (struct gdbarch
> > *gdbarch, int regnum,
> >    if (reggroup == save_reggroup || reggroup == restore_reggroup)
> >      return raw_p;
> >  
> > -  if (((regnum >= CSKY_R0_REGNUM) && (regnum <= CSKY_R0_REGNUM +
> > 31))
> > +  if ((((regnum >= CSKY_R0_REGNUM) && (regnum <= CSKY_R0_REGNUM +
> > 31))
> > +       || (regnum == CSKY_PC_REGNUM)
> > +       || (regnum == CSKY_EPC_REGNUM)
> > +       || (regnum == CSKY_CR0_REGNUM)
> > +       || (regnum == CSKY_EPSR_REGNUM))
> >        && (reggroup == general_reggroup))
> >      return 1;
> >  
> > @@ -2548,6 +2552,10 @@ csky_register_reggroup_p (struct gdbarch
> > *gdbarch, int regnum,
> >        && (reggroup == fr_reggroup))
> >      return 6;
> >  
> > +  if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))
> > +    if (tdesc_register_in_reggroup_p (gdbarch, regnum, reggroup) >
> > 0)
> > +      return 7;
> > +
> 
> Accounting to the GDB C/C++ coding standards (See here[1]), "Any two
> or
> more lines in code should be wrapped in braces".
> 
> I think this part should be like this:
> 
> ```
> if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))  {
>     if (tdesc_register_in_reggroup_p (gdbarch, regnum, reggroup) > 0)
> 	return 7;
>   }
> ```

Correction:

if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))
  {
    if (tdesc_register_in_reggroup_p (gdbarch, regnum, reggroup) > 0)
	return 7;
  }

> 
> [1] 
> https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Whitespaces
> 
> Thanks,
> Enze
> 
> >    return 0;
> >  }
> >  
> > @@ -3020,6 +3028,8 @@ csky_gdbarch_init (struct gdbarch_info info,
> > struct gdbarch_list *arches)
> >        set_gdbarch_num_regs (gdbarch, (num_regs + 1));
> >        tdesc_use_registers (gdbarch, info.target_desc, std::move
> > (tdesc_data));
> >        set_gdbarch_register_type (gdbarch, csky_register_type);
> > +      set_gdbarch_register_reggroup_p (gdbarch,
> > +                                       csky_register_reggroup_p);
> >      }
> >  
> >    if (tdep->fv_pseudo_registers_count)
>   }
> 


      reply	other threads:[~2022-07-12  3:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12  2:23 Jiangshuai Li
2022-07-12  3:21 ` Enze Li
2022-07-12  3:31   ` Enze Li [this message]

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=OS3P286MB21529BB792346B2A038531F5F0869@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM \
    --to=enze.li@hotmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jiangshuai_li@c-sky.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).