Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Zewei Yang <yangzewei@loongson.cn>
To: gdb-patches@sourceware.org
Cc: yangtiezhu@loongson.cn
Subject: [PATCH V2] gdb/testsuite: Add LoongArch case in my-syscalls.S
Date: Thu, 23 Oct 2025 09:45:49 +0800	[thread overview]
Message-ID: <20251023014549.1219570-1-yangzewei@loongson.cn> (raw)
In-Reply-To: <20251023012922.1216883-1-yangzewei@loongson.cn>

This patch adds syscall wrappers for LoongArch64 to gdb/testsuite/lib/my-syscalls.S.

- Implements the missing `__loongarch64` section.
- Uses `li.w` to load the syscall number into `$a7`.
- Triggers system calls via `syscall 0`.
- Returns to the caller using `ret`.

This change fixes build errors when running
`gdb.threads/step-over-thread-exit-while-stop-all-threads.exp`
on LoongArch64 targets caused by the absence of the LoongArch-specific
syscall wrappers in `my-syscalls.S`.

Tested on: loongarch64-unknown-linux-gnu
Result: expected testcases passed.

Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
---
 gdb/testsuite/lib/my-syscalls.S | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gdb/testsuite/lib/my-syscalls.S b/gdb/testsuite/lib/my-syscalls.S
index c514b32d..3e2e397d 100644
--- a/gdb/testsuite/lib/my-syscalls.S
+++ b/gdb/testsuite/lib/my-syscalls.S
@@ -63,6 +63,18 @@ NAME:				;\
 NAME ## _syscall:		;\
 	svc #0
 
+#elif defined(__loongarch64)
+
+/* LoongArch 64-bit syscall wrapper */
+#define SYSCALL(NAME, NR)       \
+.global NAME                    ;\
+NAME:                           ;\
+        li.w 	$a7, NR		;\
+        /* syscall number */ \
+NAME ## _syscall:               ;\
+        syscall 0                       ;\
+        ret
+
 #else
 # error "Unsupported architecture"
 #endif
-- 
2.43.0


  reply	other threads:[~2025-10-23  1:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 19:30 [PATCH] fix: support LoongArch64 in my-syscalls.S to resolve step-over-thread-exit-while-stop-all-threads.exp build failure Coder_Y
2025-10-22  8:48 ` Tiezhu Yang
2025-10-22  9:06   ` Tiezhu Yang
2025-10-23  1:29     ` yangzewei
2025-10-23  1:45       ` Zewei Yang [this message]
2025-10-24  2:44         ` [PATCH V2] gdb/testsuite: Add LoongArch case in my-syscalls.S Tiezhu Yang
2025-10-30 14:11           ` 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=20251023014549.1219570-1-yangzewei@loongson.cn \
    --to=yangzewei@loongson.cn \
    --cc=gdb-patches@sourceware.org \
    --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