public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jiangshuai Li <jiangshuai_li@linux.alibaba.com>
To: gdb-patches@sourceware.org
Cc: Jiangshuai Li <jiangshuai_li@linux.alibaba.com>
Subject: [PATCH] gdb/csky just return type from csky_vector_type() for vector resgisters
Date: Wed,  9 Nov 2022 19:55:02 +0800	[thread overview]
Message-ID: <20221109115502.48277-1-jiangshuai_li@linux.alibaba.com> (raw)

Some gdb stub may not describe the type for vector registers in the
tdesc-xml and only send bitsize="128", gdb can't deal with a reg
with default type int with bitsize==128. So Just return csky_vector_type()
for vector resgisters.
---
 gdb/csky-tdep.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index ced1b032a7b..f293d204da2 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -711,6 +711,13 @@ csky_register_type (struct gdbarch *gdbarch, int reg_nr)
 	return builtin_type (gdbarch)->builtin_int32;
     }
 
+  /* Vector register has 128 bits, and only in ck810. Just return
+     csky_vector_type(), not check tdesc_has_registers(), is in case
+     of some GDB stub does not describe type for Vector resgisters
+     in the target-description-xml.  */
+  if ((reg_nr >= CSKY_VR0_REGNUM) && (reg_nr <= CSKY_VR0_REGNUM + 15))
+    return csky_vector_type (gdbarch);
+
   /* If type has been described in tdesc-xml, use it.  */
   if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))
     {
@@ -733,10 +740,6 @@ csky_register_type (struct gdbarch *gdbarch, int reg_nr)
       return arch_float_type (gdbarch, 64, "builtin_type_csky_ext",
 			      floatformats_ieee_double);
 
-  /* Vector register has 128 bits, and only in ck810.  */
-  if ((reg_nr >= CSKY_VR0_REGNUM) && (reg_nr <= CSKY_VR0_REGNUM + 15))
-    return csky_vector_type (gdbarch);
-
   /* Profiling general register has 48 bits, we use 64bit.  */
   if ((reg_nr >= CSKY_PROFGR_REGNUM) && (reg_nr <= CSKY_PROFGR_REGNUM + 44))
     return builtin_type (gdbarch)->builtin_uint64;
-- 
2.34.1


                 reply	other threads:[~2022-11-09 11:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221109115502.48277-1-jiangshuai_li@linux.alibaba.com \
    --to=jiangshuai_li@linux.alibaba.com \
    --cc=gdb-patches@sourceware.org \
    /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).