[1/1] gdb:csky rm tdesc_has_registers in csky_register_name

Message ID 20210715072211.14917-2-jiangshuai_li@c-sky.com
State New
Headers show
Series
  • Improve CSKY arch support
Related show

Commit Message

=?UTF-8?B?5p2O5rGf5biF?= July 15, 2021, 7:22 a.m.
As CSKY arch has not parsed target-description.xml in csky_gdbarch_init,
when a remote server, like csky-qemu or gdbserver, send a target-description.xml
to gdb, tdesc_has_registers will return ture, but tdesc_register_name (gdbarch, 0)
will return NULL, so a cmd "info registers r0" will not work.

Function of parsing target-description.xml will be add later for CSKY arch,
now it is temporarily removed to allow me to do other supported tests.

2021-07-15 Jiangshuai Li  <jiangshuai_li@c-sky.com>

            * csky-tdep.c : not using tdesc funtions in csky_register_name
---
 gdb/csky-tdep.c | 3 ---
 1 file changed, 3 deletions(-)

-- 
2.17.1

Comments

Andrew Burgess Aug. 3, 2021, 10:19 a.m. | #1
* Jiangshuai Li <jiangshuai_li@c-sky.com> [2021-07-15 15:22:11 +0800]:

> As CSKY arch has not parsed target-description.xml in csky_gdbarch_init,

> when a remote server, like csky-qemu or gdbserver, send a target-description.xml

> to gdb, tdesc_has_registers will return ture, but tdesc_register_name (gdbarch, 0)

> will return NULL, so a cmd "info registers r0" will not work.

> 

> Function of parsing target-description.xml will be add later for CSKY arch,

> now it is temporarily removed to allow me to do other supported tests.

> 

> 2021-07-15 Jiangshuai Li  <jiangshuai_li@c-sky.com>

> 

>             * csky-tdep.c : not using tdesc funtions in csky_register_name


LGTM.  Please go ahead an commit.

Thanks,
Andrew

> ---

>  gdb/csky-tdep.c | 3 ---

>  1 file changed, 3 deletions(-)

> 

> diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c

> index 5940429e192..657ba75d080 100644

> --- a/gdb/csky-tdep.c

> +++ b/gdb/csky-tdep.c

> @@ -235,9 +235,6 @@ static const char * const csky_register_names[] =

>  static const char *

>  csky_register_name (struct gdbarch *gdbarch, int reg_nr)

>  {

> -  if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))

> -    return tdesc_register_name (gdbarch, reg_nr);

> -

>    if (reg_nr < 0)

>      return NULL;

>  

> -- 

> 2.17.1

>
Andrew Burgess Aug. 12, 2021, 8:51 a.m. | #2
* Andrew Burgess <andrew.burgess@embecosm.com> [2021-08-03 11:19:03 +0100]:

> * Jiangshuai Li <jiangshuai_li@c-sky.com> [2021-07-15 15:22:11 +0800]:

> 

> > As CSKY arch has not parsed target-description.xml in csky_gdbarch_init,

> > when a remote server, like csky-qemu or gdbserver, send a target-description.xml

> > to gdb, tdesc_has_registers will return ture, but tdesc_register_name (gdbarch, 0)

> > will return NULL, so a cmd "info registers r0" will not work.

> > 

> > Function of parsing target-description.xml will be add later for CSKY arch,

> > now it is temporarily removed to allow me to do other supported tests.

> > 

> > 2021-07-15 Jiangshuai Li  <jiangshuai_li@c-sky.com>

> > 

> >             * csky-tdep.c : not using tdesc funtions in csky_register_name

> 

> LGTM.  Please go ahead an commit.


Jiangshuai Li,

I went ahead an pushed this patch as it is small/obvious.  I don't
know if you have a copyright assignment in place, if you don't you
will need to get one before any larger patches can be merged.  See
here for more details:

  https://sourceware.org/gdb/wiki/ContributionChecklist#FSF_copyright_Assignment

Thanks,
Andrew

Patch

diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 5940429e192..657ba75d080 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -235,9 +235,6 @@  static const char * const csky_register_names[] =
 static const char *
 csky_register_name (struct gdbarch *gdbarch, int reg_nr)
 {
-  if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))
-    return tdesc_register_name (gdbarch, reg_nr);
-
   if (reg_nr < 0)
     return NULL;