public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb: LoongArch: Implement the iterate_over_regset_sections gdbarch method
Date: Mon, 23 May 2022 14:32:48 +0000 (GMT)	[thread overview]
Message-ID: <20220523143248.423F4385EC55@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a6b446b22270b52dd4739e9ab094e11b307ff0b5

commit a6b446b22270b52dd4739e9ab094e11b307ff0b5
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
Date:   Mon May 23 15:53:06 2022 +0800

    gdb: LoongArch: Implement the iterate_over_regset_sections gdbarch method
    
    When execute the following command on LoongArch:
    
      make check-gdb TESTS="gdb.base/auxv.exp"
    
    there exist the following unsupported and failed testcases:
    
      UNSUPPORTED: gdb.base/auxv.exp: gcore
      FAIL: gdb.base/auxv.exp: load core file for info auxv on native core dump
      FAIL: gdb.base/auxv.exp: info auxv on native core dump
      FAIL: gdb.base/auxv.exp: matching auxv data from live and core
      UNSUPPORTED: gdb.base/auxv.exp: info auxv on gcore-created dump
      UNSUPPORTED: gdb.base/auxv.exp: matching auxv data from live and gcore
    
    we can see the following messages in gdb/testsuite/gdb.log:
    
      gcore /home/loongson/build.git/gdb/testsuite/outputs/gdb.base/auxv/auxv.gcore
      Target does not support core file generation.
      (gdb) UNSUPPORTED: gdb.base/auxv.exp: gcore
    
    In order to fix the above issues, implement the iterate_over_regset_sections
    gdbarch method to iterate over core file register note sections on LoongArch.
    
    By the way, with this patch, the failed testcases in gdb.base/corefile.exp
    and gdb.base/gcore.exp can also be fixed.
    
    Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

Diff:
---
 gdb/loongarch-linux-tdep.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c
index 7e219c4b9a0..f13756dd003 100644
--- a/gdb/loongarch-linux-tdep.c
+++ b/gdb/loongarch-linux-tdep.c
@@ -20,6 +20,7 @@
 
 #include "defs.h"
 #include "glibc-tdep.h"
+#include "gregset.h"
 #include "inferior.h"
 #include "linux-tdep.h"
 #include "loongarch-tdep.h"
@@ -163,6 +164,18 @@ static const struct tramp_frame loongarch_linux_rt_sigframe =
   NULL
 };
 
+/* Implement the "iterate_over_regset_sections" gdbarch method.  */
+
+static void
+loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
+					iterate_over_regset_sections_cb *cb,
+					void *cb_data,
+					const struct regcache *regcache)
+{
+  cb (".reg", sizeof (elf_gregset_t), sizeof (elf_gregset_t),
+      &loongarch_gregset, NULL, cb_data);
+}
+
 /* Initialize LoongArch Linux ABI info.  */
 
 static void
@@ -186,6 +199,9 @@ loongarch_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   /* Prepend tramp frame unwinder for signal.  */
   tramp_frame_prepend_unwinder (gdbarch, &loongarch_linux_rt_sigframe);
+
+  /* Core file support.  */
+  set_gdbarch_iterate_over_regset_sections (gdbarch, loongarch_iterate_over_regset_sections);
 }
 
 /* Initialize LoongArch Linux target support.  */


                 reply	other threads:[~2022-05-23 14:32 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=20220523143248.423F4385EC55@sourceware.org \
    --to=yangtiezhu@sourceware.org \
    --cc=gdb-cvs@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).