Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner via Gdb-patches <gdb-patches@sourceware.org>
To: Feiyang Chen <chenfeiyang@loongson.cn>
Cc: chris.chenfeiyang@gmail.com, zhoubinbin@loongson.cn,
	gdb-patches@sourceware.org, chenhuacai@loongson.cn
Subject: Re: [PATCH] gdb: LoongArch: Support LBT registers
Date: Mon, 28 Aug 2023 19:49:43 -0700	[thread overview]
Message-ID: <20230828194943.122e1848@f37-zws-nv> (raw)
In-Reply-To: <20230825101113.3527944-1-chenfeiyang@loongson.cn>

I have one nit regarding an enum name...

On Fri, 25 Aug 2023 18:11:13 +0800
Feiyang Chen <chenfeiyang@loongson.cn> wrote:


> diff --git a/gdb/arch/loongarch.h b/gdb/arch/loongarch.h
> index d0a63dc2ac5..73f3d64fb16 100644
> --- a/gdb/arch/loongarch.h
> +++ b/gdb/arch/loongarch.h
> @@ -41,6 +41,11 @@ enum loongarch_regnum
>    LOONGARCH_FIRST_FCC_REGNUM = LOONGARCH_FIRST_FP_REGNUM + LOONGARCH_LINUX_NUM_FPREGSET,
>    LOONGARCH_LINUX_NUM_FCC = 8,
>    LOONGARCH_FCSR_REGNUM = LOONGARCH_FIRST_FCC_REGNUM + LOONGARCH_LINUX_NUM_FCC,
> +  LOONGARCH_FIRST_SCR_REGNUM = LOONGARCH_FCSR_REGNUM + 1,
> +  LOONGARCH_LINUX_NUM_SCR = 4,
> +  LOONGARCH_SCR_REGNUM = LOONGARCH_FCSR_REGNUM + LOONGARCH_LINUX_NUM_SCR,

Instead of LOONGARCH_SCR_REGNUM, I recommend that it be named
LOONGARCH_LAST_SCR_REGNUM instead.  This fits in with its usage in the
range tests, e.g. this one from loongarch_supply_lbtregset:

> +  else if (regnum >= LOONGARCH_FIRST_SCR_REGNUM && regnum <= LOONGARCH_SCR_REGNUM)
> +    {
> +      buf = (const gdb_byte*) regs + scrsize * (regnum - LOONGARCH_FIRST_SCR_REGNUM);
> +      regcache->raw_supply (regnum, (const void *) buf);
> +    }

Naming it LOONGARCH_SCR_REGNUM suggested to me that the index in
question was for the (one and only) SCR register, but that's clearly
not the case since there are 4 of them.

Also, it appears to me that source code corresponding to some of the
lines in your patch will exceed 80 characters, so those should be
adjusted as well.  See:

https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Column_limits

Kevin


      reply	other threads:[~2023-08-29  2:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 10:11 Feiyang Chen
2023-08-29  2:49 ` Kevin Buettner via Gdb-patches [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=20230828194943.122e1848@f37-zws-nv \
    --to=gdb-patches@sourceware.org \
    --cc=chenfeiyang@loongson.cn \
    --cc=chenhuacai@loongson.cn \
    --cc=chris.chenfeiyang@gmail.com \
    --cc=kevinb@redhat.com \
    --cc=zhoubinbin@loongson.cn \
    /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