public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: 李江帅 <jiangshuai_li@c-sky.com>
To: "Tom Tromey" <tom@tromey.com>
Cc: "gdb-patches" <gdb-patches@sourceware.org>
Subject: [PATCH] gdb:csky add support target-descriptions for CSKY arch
Date: Mon, 30 May 2022 11:31:29 +0800	[thread overview]
Message-ID: <6c6a9f9b-a74c-4109-b4e8-3c14bd5ad998.jiangshuai_li@c-sky.com> (raw)

Thanks Tom.  

I have modified what you said, except:
>> +struct csky_supported_tdesc_register
>> +{
>> +  char name[16];
>
>I think "const char *" here is probably better as well, just because
>it's more idiomatic.

because i need Automatically generate register names for "cpxcpy", like:

+      case 26: /* Bank28.  */
+      case 27: /* Bank29.  */
+      case 28: /* Bank30.  */
+      case 29: /* Bank31.  */
+        {
+          /* Regitsers in Bank16~31 have continuous regno with start 660.  */
+          sprintf (tdesc_reg.name, "cp%dcr%d", (multi + 2), remain);
+          tdesc_reg.num = 660 + ((multi - 14) * 32) + remain;
+        }
+        break;

here is the new [PATCH v2]: https://sourceware.org/pipermail/gdb-patches/2022-May/189548.html


------------------------------------------------------------------
发件人:Tom Tromey <tom@tromey.com>
发送时间:2022年4月7日(星期四) 23:32
收件人:李江帅 <jiangshuai_li@c-sky.com>
抄 送:gdb-patches <gdb-patches@sourceware.org>
主 题:Re: [PATCH] gdb:csky add support target-descriptions for CSKY arch

>>>>> Jiangshuai Li <jiangshuai_li@c-sky.com> writes:

Thank you for the patch.

I don't know anything about csky and so I can't really review any of the
architecture details.  I'll just take your word for that.

> diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
> index 04f558cf14b..447baa1ed58 100644
> --- a/gdb/csky-tdep.c
> +++ b/gdb/csky-tdep.c
> @@ -67,6 +67,424 @@ static struct reggroup *vr_reggroup;
>  static struct reggroup *mmu_reggroup;
>  static struct reggroup *prof_reggroup;

> +static char *csky_supported_tdesc_feature_names[] = {
> +  (char *)"org.gnu.csky.abiv2.gpr",

I think the casts here are a red flag, you ought to make the array use
"const char *".

> +struct csky_supported_tdesc_register
> +{
> +  char name[16];

I think "const char *" here is probably better as well, just because
it's more idiomatic.

> +/* Get csky supported registers's count for tdesc xml.  */
> +static int
> +csky_get_supported_tdesc_registers_count()
> +{
> +  int count = 0;
> +  int size = sizeof (struct csky_supported_tdesc_register);
> +  count += sizeof (csky_supported_gpr_regs)/size;
> +  count += sizeof (csky_supported_fpu_regs)/size;

I suggest using the ARRAY_SIZE macro instead.

> +/* Return a supported register according to index.  */
> +static struct csky_supported_tdesc_register *
> +csky_get_supported_register_by_index (int index)
> +{
> +  static struct csky_supported_tdesc_register tdesc_reg;
> +  int count = 0;
> +  int multi, remain;
> +  int size = sizeof (struct csky_supported_tdesc_register);
> +  int count_gpr = sizeof (csky_supported_gpr_regs)/size;

Here too.

> +/* Check whether xml has discribled the essential regs.  */

Typo, "described".

Tom


             reply	other threads:[~2022-05-30  3:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30  3:31 李江帅 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-03-28  2:03 Jiangshuai Li
2022-04-07 15:32 ` Tom Tromey

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=6c6a9f9b-a74c-4109-b4e8-3c14bd5ad998.jiangshuai_li@c-sky.com \
    --to=jiangshuai_li@c-sky.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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).