]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: LoongArch: Handle newly added llsc instructions
authorXi Ruoyao <xry111@xry111.site>
Tue, 19 Aug 2025 07:33:44 +0000 (15:33 +0800)
committerTiezhu Yang <yangtiezhu@loongson.cn>
Mon, 25 Aug 2025 11:58:08 +0000 (19:58 +0800)
We can't put a breakpoint in the middle of a ll/sc atomic sequence,
handle the instructions sc.q, llacq.{w/d}, screl.{w/d} newly added
in the LoongArch Reference Manual v1.10 so a ll/sc atomic sequence
using them won't loop forever being debugged.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
gdb/loongarch-tdep.c

index 3bf47d2c6d28f1b92bdb60d8c4b59b7e71b880f1..e497848bfce576f5f0e8ec77fe247f1561b5dd18 100644 (file)
@@ -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;
 }