Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: LoongArch: Clean up loongarch_iterate_over_regset_sections()
@ 2024-03-22  3:35 Tiezhu Yang
  2024-03-22 12:42 ` Tiezhu Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2024-03-22  3:35 UTC (permalink / raw)
  To: gdb-patches

Define a new variable gpsize as gprsize * LOONGARCH_LINUX_NUM_GREGSET
to replace the related code in the first cb(), and also make use of
tabs and spaces in indentation to force the proper alignment of code,
then remove the empty line at the end of the function.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 gdb/loongarch-linux-tdep.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c
index db6371eb556..cc8121bb2b8 100644
--- a/gdb/loongarch-linux-tdep.c
+++ b/gdb/loongarch-linux-tdep.c
@@ -492,11 +492,12 @@ loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
 					const struct regcache *regcache)
 {
   int gprsize = register_size (gdbarch, 0);
+  int gpsize = gprsize * LOONGARCH_LINUX_NUM_GREGSET;
   int fprsize = register_size (gdbarch, LOONGARCH_FIRST_FP_REGNUM);
   int fccsize = register_size (gdbarch, LOONGARCH_FIRST_FCC_REGNUM);
   int fcsrsize = register_size (gdbarch, LOONGARCH_FCSR_REGNUM);
   int fpsize = fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
-    fccsize * LOONGARCH_LINUX_NUM_FCC + fcsrsize;
+	       fccsize * LOONGARCH_LINUX_NUM_FCC + fcsrsize;
   int lsxrsize = register_size (gdbarch, LOONGARCH_FIRST_LSX_REGNUM);
   int lsxsize = lsxrsize * LOONGARCH_LINUX_NUM_LSXREGSET;
   int lasxrsize = register_size (gdbarch, LOONGARCH_FIRST_LASX_REGNUM);
@@ -506,16 +507,16 @@ loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
   int ftopsize = register_size (gdbarch, LOONGARCH_FTOP_REGNUM);
   int lbtsize = scrsize * LOONGARCH_LINUX_NUM_SCR + eflagssize + ftopsize;
 
-  cb (".reg", LOONGARCH_LINUX_NUM_GREGSET * gprsize,
-      LOONGARCH_LINUX_NUM_GREGSET * gprsize, &loongarch_gregset, nullptr, cb_data);
-  cb (".reg2", fpsize, fpsize, &loongarch_fpregset, nullptr, cb_data);
+  cb (".reg", gpsize, gpsize,
+      &loongarch_gregset, nullptr, cb_data);
+  cb (".reg2", fpsize, fpsize,
+      &loongarch_fpregset, nullptr, cb_data);
   cb (".reg-loongarch-lsx", lsxsize, lsxsize,
       &loongarch_lsxregset, nullptr, cb_data);
   cb (".reg-loongarch-lasx", lasxsize, lasxsize,
       &loongarch_lasxregset, nullptr, cb_data);
   cb (".reg-loongarch-lbt", lbtsize, lbtsize,
       &loongarch_lbtregset, nullptr, cb_data);
-
 }
 
 /* The following value is derived from __NR_rt_sigreturn in
-- 
2.42.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] gdb: LoongArch: Clean up loongarch_iterate_over_regset_sections()
  2024-03-22  3:35 [PATCH] gdb: LoongArch: Clean up loongarch_iterate_over_regset_sections() Tiezhu Yang
@ 2024-03-22 12:42 ` Tiezhu Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Tiezhu Yang @ 2024-03-22 12:42 UTC (permalink / raw)
  To: gdb-patches

On 3/22/24 11:35, Tiezhu Yang wrote:
> Define a new variable gpsize as gprsize * LOONGARCH_LINUX_NUM_GREGSET
> to replace the related code in the first cb(), and also make use of
> tabs and spaces in indentation to force the proper alignment of code,
> then remove the empty line at the end of the function.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>   gdb/loongarch-linux-tdep.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c
> index db6371eb556..cc8121bb2b8 100644
> --- a/gdb/loongarch-linux-tdep.c
> +++ b/gdb/loongarch-linux-tdep.c
> @@ -492,11 +492,12 @@ loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
>   					const struct regcache *regcache)
>   {
>     int gprsize = register_size (gdbarch, 0);
> +  int gpsize = gprsize * LOONGARCH_LINUX_NUM_GREGSET;
>     int fprsize = register_size (gdbarch, LOONGARCH_FIRST_FP_REGNUM);
>     int fccsize = register_size (gdbarch, LOONGARCH_FIRST_FCC_REGNUM);
>     int fcsrsize = register_size (gdbarch, LOONGARCH_FCSR_REGNUM);
>     int fpsize = fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
> -    fccsize * LOONGARCH_LINUX_NUM_FCC + fcsrsize;
> +	       fccsize * LOONGARCH_LINUX_NUM_FCC + fcsrsize;
>     int lsxrsize = register_size (gdbarch, LOONGARCH_FIRST_LSX_REGNUM);
>     int lsxsize = lsxrsize * LOONGARCH_LINUX_NUM_LSXREGSET;
>     int lasxrsize = register_size (gdbarch, LOONGARCH_FIRST_LASX_REGNUM);
> @@ -506,16 +507,16 @@ loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
>     int ftopsize = register_size (gdbarch, LOONGARCH_FTOP_REGNUM);
>     int lbtsize = scrsize * LOONGARCH_LINUX_NUM_SCR + eflagssize + ftopsize;
>   
> -  cb (".reg", LOONGARCH_LINUX_NUM_GREGSET * gprsize,
> -      LOONGARCH_LINUX_NUM_GREGSET * gprsize, &loongarch_gregset, nullptr, cb_data);
> -  cb (".reg2", fpsize, fpsize, &loongarch_fpregset, nullptr, cb_data);
> +  cb (".reg", gpsize, gpsize,
> +      &loongarch_gregset, nullptr, cb_data);
> +  cb (".reg2", fpsize, fpsize,
> +      &loongarch_fpregset, nullptr, cb_data);
>     cb (".reg-loongarch-lsx", lsxsize, lsxsize,
>         &loongarch_lsxregset, nullptr, cb_data);
>     cb (".reg-loongarch-lasx", lasxsize, lasxsize,
>         &loongarch_lasxregset, nullptr, cb_data);
>     cb (".reg-loongarch-lbt", lbtsize, lbtsize,
>         &loongarch_lbtregset, nullptr, cb_data);
> -
>   }
>   
>   /* The following value is derived from __NR_rt_sigreturn in

Pushed.

Thanks,
Tiezhu


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-22 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22  3:35 [PATCH] gdb: LoongArch: Clean up loongarch_iterate_over_regset_sections() Tiezhu Yang
2024-03-22 12:42 ` Tiezhu Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox