From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7873) id 423F4385EC55; Mon, 23 May 2022 14:32:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 423F4385EC55 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tiezhu Yang To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: LoongArch: Implement the iterate_over_regset_sections gdbarch method X-Act-Checkin: binutils-gdb X-Git-Author: Tiezhu Yang X-Git-Refname: refs/heads/master X-Git-Oldrev: 01a62a6d5fa99cffe25d35721c16e9bc81ed7389 X-Git-Newrev: a6b446b22270b52dd4739e9ab094e11b307ff0b5 Message-Id: <20220523143248.423F4385EC55@sourceware.org> Date: Mon, 23 May 2022 14:32:48 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2022 14:32:48 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da6b446b22270= b52dd4739e9ab094e11b307ff0b5 commit a6b446b22270b52dd4739e9ab094e11b307ff0b5 Author: Tiezhu Yang Date: Mon May 23 15:53:06 2022 +0800 gdb: LoongArch: Implement the iterate_over_regset_sections gdbarch meth= od =20 When execute the following command on LoongArch: =20 make check-gdb TESTS=3D"gdb.base/auxv.exp" =20 there exist the following unsupported and failed testcases: =20 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 =20 we can see the following messages in gdb/testsuite/gdb.log: =20 gcore /home/loongson/build.git/gdb/testsuite/outputs/gdb.base/auxv/au= xv.gcore Target does not support core file generation. (gdb) UNSUPPORTED: gdb.base/auxv.exp: gcore =20 In order to fix the above issues, implement the iterate_over_regset_sec= tions gdbarch method to iterate over core file register note sections on Loon= gArch. =20 By the way, with this patch, the failed testcases in gdb.base/corefile.= exp and gdb.base/gcore.exp can also be fixed. =20 Signed-off-by: Tiezhu Yang 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 @@ =20 #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_sig= frame =3D NULL }; =20 +/* 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. */ =20 static void @@ -186,6 +199,9 @@ loongarch_linux_init_abi (struct gdbarch_info info, str= uct gdbarch *gdbarch) =20 /* 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_ove= r_regset_sections); } =20 /* Initialize LoongArch Linux target support. */