diff mbox series

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

Message ID 20250113134658.68376-4-iii@linux.ibm.com (mailing list archive)
State New
Headers show
Series gdbstub: Protect gdb_handlesig() with EXCLUSIVE_GUARD() | expand

Commit Message

Ilya Leoshkevich Jan. 13, 2025, 1:36 p.m. UTC
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 mbox series

Patch

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;
     }