qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] gdbstub: Protect gdb_handlesig() with EXCLUSIVE_GUARD()


From: Ilya Leoshkevich
Subject: [PATCH 3/3] gdbstub: Protect gdb_handlesig() with EXCLUSIVE_GUARD()
Date: Mon, 13 Jan 2025 14:36:29 +0100

If multiple threads hit a breakpoint at the same time, GDB gets
confused [1]. Prevent this situation by stopping the other threads once
a thread hits a breakpoint.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=32023

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 gdbstub/user.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdbstub/user.c b/gdbstub/user.c
index 0b4bfa9c488..d72f8ca6106 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -200,6 +200,8 @@ int gdb_handlesig(CPUState *cpu, int sig, const char 
*reason, void *siginfo,
     char buf[256];
     int n;
 
+    EXCLUSIVE_GUARD();
+
     if (!gdbserver_state.init || gdbserver_user_state.fd < 0) {
         return sig;
     }
-- 
2.47.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]