Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: LoongArch: Recognize LoongArch v1.10 store conditional instructions
@ 2025-08-19  7:33 Xi Ruoyao
  2025-08-19  8:45 ` Tiezhu Yang
  2025-08-25 12:12 ` Tiezhu Yang
  0 siblings, 2 replies; 5+ messages in thread
From: Xi Ruoyao @ 2025-08-19  7:33 UTC (permalink / raw)
  To: gdb-patches
  Cc: Tiezhu Yang, Hui Li, Lulu Cheng, Mingcong Bai, Xuerui Wang, Xi Ruoyao

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-25 12:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-19  7:33 [PATCH] gdb: LoongArch: Recognize LoongArch v1.10 store conditional instructions Xi Ruoyao
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox