public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: John Baldwin <jhb@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix loongarch_iterate_over_regset_sections for non-native targets. Date: Mon, 23 May 2022 18:05:14 +0000 (GMT) [thread overview] Message-ID: <20220523180514.E4CA23858D32@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d9b6e047f60ce2129eff28ad1c6690949293366b commit d9b6e047f60ce2129eff28ad1c6690949293366b Author: John Baldwin <jhb@FreeBSD.org> Date: Mon May 23 10:59:13 2022 -0700 Fix loongarch_iterate_over_regset_sections for non-native targets. Define a constant for the number of registers stored in a register set and use this with register_size to compute the size of the general-purpose register set in core dumps. This also fixes the build on hosts such as FreeBSD that do not define an elf_gregset_t type. Diff: --- gdb/loongarch-linux-tdep.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c index f13756dd003..bbb43abe13f 100644 --- a/gdb/loongarch-linux-tdep.c +++ b/gdb/loongarch-linux-tdep.c @@ -29,6 +29,11 @@ #include "trad-frame.h" #include "tramp-frame.h" +/* The general-purpose regset consists of 32 R registers, plus PC, + and BADV registers. */ + +#define LOONGARCH_LINUX_NUM_GREGSET (34) + /* Unpack an elf_gregset_t into GDB's register cache. */ static void @@ -172,8 +177,13 @@ loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch, void *cb_data, const struct regcache *regcache) { - cb (".reg", sizeof (elf_gregset_t), sizeof (elf_gregset_t), - &loongarch_gregset, NULL, cb_data); + loongarch_gdbarch_tdep *tdep + = (loongarch_gdbarch_tdep *) gdbarch_tdep (gdbarch); + auto regs = tdep->regs; + int regsize = register_size (gdbarch, regs.r); + + cb (".reg", LOONGARCH_LINUX_NUM_GREGSET * regsize, + LOONGARCH_LINUX_NUM_GREGSET * regsize, &loongarch_gregset, NULL, cb_data); } /* Initialize LoongArch Linux ABI info. */
reply other threads:[~2022-05-23 18:05 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=20220523180514.E4CA23858D32@sourceware.org \ --to=jhb@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: linkBe 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).