public inbox for
help / color / mirror / Atom feed
From: Tiezhu Yang <>
Subject: [binutils-gdb] gdbserver: LoongArch: Add orig_a0 processing
Date: Sun, 10 Jul 2022 09:31:17 +0000 (GMT)	[thread overview]
Message-ID: <> (raw);h=74baa6cd1c8168705a39d45f317cc9f79e31ac3a

commit 74baa6cd1c8168705a39d45f317cc9f79e31ac3a
Author: Youling Tang <>
Date:   Sun Jul 10 10:57:33 2022 +0800

    gdbserver: LoongArch: Add orig_a0 processing
    Commit 736918239b16 ("gdb: LoongArch: add orig_a0 into register set")
    introduced orig_a0, similar processing needs to be done in gdbserver.
    At the same time, add orig_a0 related comments.
    Signed-off-by: Youling Tang <>
    Signed-off-by: Tiezhu Yang <>

 gdb/loongarch-linux-nat.c        | 4 ++--
 gdbserver/ | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/loongarch-linux-nat.c b/gdb/loongarch-linux-nat.c
index 1fd1af6c99f..1b4a37c94fb 100644
--- a/gdb/loongarch-linux-nat.c
+++ b/gdb/loongarch-linux-nat.c
@@ -44,7 +44,7 @@ protected:
 			       int store_p) override;
-/* Fill GDB's register array with the general-purpose, pc and badv
+/* Fill GDB's register array with the general-purpose, orig_a0, pc and badv
    register values from the current thread.  */
 static void
@@ -70,7 +70,7 @@ fetch_gregs_from_thread (struct regcache *regcache, int regnum, pid_t tid)
-/* Store to the current thread the valid general-purpose, pc and badv
+/* Store to the current thread the valid general-purpose, orig_a0, pc and badv
    register values in the GDB's register array.  */
 static void
diff --git a/gdbserver/ b/gdbserver/
index 7b81e4b786a..91826b42361 100644
--- a/gdbserver/
+++ b/gdbserver/
@@ -99,6 +99,7 @@ loongarch_fill_gregset (struct regcache *regcache, void *buf)
   for (i = 1; i < 32; i++)
     collect_register (regcache, i, *regset + i);
+  collect_register (regcache, LOONGARCH_ORIG_A0_REGNUM, *regset + LOONGARCH_ORIG_A0_REGNUM);
   collect_register (regcache, LOONGARCH_PC_REGNUM, *regset + LOONGARCH_PC_REGNUM);
   collect_register (regcache, LOONGARCH_BADV_REGNUM, *regset + LOONGARCH_BADV_REGNUM);
@@ -114,6 +115,7 @@ loongarch_store_gregset (struct regcache *regcache, const void *buf)
   supply_register_zeroed (regcache, 0);
   for (i = 1; i < 32; i++)
     supply_register (regcache, i, *regset + i);
+  supply_register (regcache, LOONGARCH_ORIG_A0_REGNUM, *regset + LOONGARCH_ORIG_A0_REGNUM);
   supply_register (regcache, LOONGARCH_PC_REGNUM, *regset + LOONGARCH_PC_REGNUM);
   supply_register (regcache, LOONGARCH_BADV_REGNUM, *regset + LOONGARCH_BADV_REGNUM);

                 reply	other threads:[~2022-07-10  9:31 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

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