public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: LoongArch: Silence warning about core file of lsx and lasx
@ 2024-03-21  1:41 Hui Li
  2024-03-21 14:18 ` Tiezhu Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Li @ 2024-03-21  1:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tiezhu Yang

In loongarch_iterate_over_regset_sections(), the second and third arguments
of the iterate_over_regset_sections_cb callback function should be the regset
size which is regsize * regnum. Otherwise when execute:

make check-gdb TESTS="gdb.base/corefile.exp"

there exists the following failed log:

  (gdb) core-file /home/fedora/community/gdb/build/gdb/testsuite/outputs/gdb.base/corefile/corefile.core
  [New LWP 531099]
  warning: Unexpected size of section `.reg-loongarch-lsx/531099' in core file.
  warning: Unexpected size of section `.reg-loongarch-lasx/531099' in core file.
  Core was generated by `/home/fedora/community/gdb/build/gdb/testsuite/outputs/gdb.base/corefile/corefile'.
  Program terminated with signal SIGABRT, Aborted.
  warning: Unexpected size of section `.reg-loongarch-lsx/531099' in core file.
  warning: Unexpected size of section `.reg-loongarch-lasx/531099' in core file.
  #0  0x00007ffff3081600 in __pthread_kill_implementation.constprop.0 () from /lib64/libc.so.6
  (gdb) FAIL: gdb.base/corefile.exp: core-file warning-free

Signed-off-by: Hui Li <lihui@loongson.cn>
---
 gdb/loongarch-linux-tdep.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c
index 1c7a7cf222c..db6371eb556 100644
--- a/gdb/loongarch-linux-tdep.c
+++ b/gdb/loongarch-linux-tdep.c
@@ -498,7 +498,9 @@ loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
   int fpsize = fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
     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);
+  int lasxsize = lasxrsize * LOONGARCH_LINUX_NUM_LASXREGSET;
   int scrsize = register_size (gdbarch, LOONGARCH_FIRST_SCR_REGNUM);
   int eflagssize = register_size (gdbarch, LOONGARCH_EFLAGS_REGNUM);
   int ftopsize = register_size (gdbarch, LOONGARCH_FTOP_REGNUM);
@@ -507,9 +509,9 @@ loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
   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-loongarch-lsx", lsxrsize, lsxrsize,
+  cb (".reg-loongarch-lsx", lsxsize, lsxsize,
       &loongarch_lsxregset, nullptr, cb_data);
-  cb (".reg-loongarch-lasx", lasxrsize, lasxrsize,
+  cb (".reg-loongarch-lasx", lasxsize, lasxsize,
       &loongarch_lasxregset, nullptr, cb_data);
   cb (".reg-loongarch-lbt", lbtsize, lbtsize,
       &loongarch_lbtregset, nullptr, cb_data);
-- 
2.38.1


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

* Re: [PATCH] gdb: LoongArch: Silence warning about core file of lsx and lasx
  2024-03-21  1:41 [PATCH] gdb: LoongArch: Silence warning about core file of lsx and lasx Hui Li
@ 2024-03-21 14:18 ` Tiezhu Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Tiezhu Yang @ 2024-03-21 14:18 UTC (permalink / raw)
  To: Hui Li, gdb-patches

On 3/21/24 09:41, Hui Li wrote:
> In loongarch_iterate_over_regset_sections(), the second and third arguments
> of the iterate_over_regset_sections_cb callback function should be the regset
> size which is regsize * regnum. Otherwise when execute:
> 
> make check-gdb TESTS="gdb.base/corefile.exp"
> 
> there exists the following failed log:
> 
>    (gdb) core-file /home/fedora/community/gdb/build/gdb/testsuite/outputs/gdb.base/corefile/corefile.core
>    [New LWP 531099]
>    warning: Unexpected size of section `.reg-loongarch-lsx/531099' in core file.
>    warning: Unexpected size of section `.reg-loongarch-lasx/531099' in core file.
>    Core was generated by `/home/fedora/community/gdb/build/gdb/testsuite/outputs/gdb.base/corefile/corefile'.
>    Program terminated with signal SIGABRT, Aborted.
>    warning: Unexpected size of section `.reg-loongarch-lsx/531099' in core file.
>    warning: Unexpected size of section `.reg-loongarch-lasx/531099' in core file.
>    #0  0x00007ffff3081600 in __pthread_kill_implementation.constprop.0 () from /lib64/libc.so.6
>    (gdb) FAIL: gdb.base/corefile.exp: core-file warning-free
> 
> Signed-off-by: Hui Li <lihui@loongson.cn>

Looks good to me. Pushed.

Thanks,
Tiezhu


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

end of thread, other threads:[~2024-03-21 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-21  1:41 [PATCH] gdb: LoongArch: Silence warning about core file of lsx and lasx Hui Li
2024-03-21 14:18 ` Tiezhu Yang

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).