Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: gdb-patches@sourceware.org
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>, Hui Li <lihui@loongson.cn>,
	Lulu Cheng <chenglulu@loongson.cn>,
	Mingcong Bai <jeffbai@aosc.io>, Xuerui Wang <i@xen0n.name>,
	Xi Ruoyao <xry111@xry111.site>
Subject: [PATCH] gdb: LoongArch: Recognize LoongArch v1.10 store conditional instructions
Date: Tue, 19 Aug 2025 15:33:44 +0800	[thread overview]
Message-ID: <20250819073626.46815-1-xry111@xry111.site> (raw)

We can't put a breakpoint in the middle of a ll/sc atomic sequence,
recognize the sc.q, screl.w, and screl.d instructions added in LoongArch
v1.10 so a ll/sc atomic sequence using them won't loop forever being
debugged.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 gdb/loongarch-tdep.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index cc75cd4a3d3..7556b81a9fa 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -98,7 +98,9 @@ static bool
 loongarch_insn_is_ll (insn_t insn)
 {
   if ((insn & 0xff000000) == 0x20000000		/* ll.w  */
-      || (insn & 0xff000000) == 0x22000000)	/* ll.d  */
+      || (insn & 0xff000000) == 0x22000000	/* ll.d  */
+      || (insn & 0xfffffc00) == 0x38578000	/* llacq.w  */
+      || (insn & 0xfffffc00) == 0x38578800)	/* llacq.d  */
     return true;
   return false;
 }
@@ -109,7 +111,10 @@ static bool
 loongarch_insn_is_sc (insn_t insn)
 {
   if ((insn & 0xff000000) == 0x21000000		/* sc.w  */
-      || (insn & 0xff000000) == 0x23000000)	/* sc.d  */
+      || (insn & 0xff000000) == 0x23000000	/* sc.d  */
+      || (insn & 0xffff8000) == 0x38570000	/* sc.q  */
+      || (insn & 0xfffffc00) == 0x38578400	/* screl.w  */
+      || (insn & 0xfffffc00) == 0x38578c00)	/* screl.d  */
     return true;
   return false;
 }
-- 
2.50.1


             reply	other threads:[~2025-08-19  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19  7:33 Xi Ruoyao [this message]
2025-08-19  8:45 ` Tiezhu Yang
2025-08-20 10:57   ` WANG Xuerui
2025-08-21  1:18     ` Tiezhu Yang
2025-08-25 12:12 ` Tiezhu Yang

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=20250819073626.46815-1-xry111@xry111.site \
    --to=xry111@xry111.site \
    --cc=chenglulu@loongson.cn \
    --cc=gdb-patches@sourceware.org \
    --cc=i@xen0n.name \
    --cc=jeffbai@aosc.io \
    --cc=lihui@loongson.cn \
    --cc=yangtiezhu@loongson.cn \
    /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