[Pdbg] [PATCH v2 12/39] gdbserver: fix interrupt double stop reason response
Nicholas Piggin
npiggin at gmail.com
Wed Apr 20 16:49:46 AEST 2022
The interrupt command sends a stop reason (TRAP) response, then the main
loop notices that the thread was stopped and also sends a stop reason
response.
Prevent the second response by having the interrupt handler move
the state to IDLE.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
src/pdbgproxy.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index 9e5e7d80..1668126f 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -320,11 +320,20 @@ static void v_contc(uint64_t *stack, void *priv)
static void interrupt(uint64_t *stack, void *priv)
{
- PR_INFO("Interrupt\n");
+ struct thread_state status;
+
+ PR_INFO("Interrupt from gdb client\n");
+
thread_stop(thread_target);
- send_response(fd, TRAP);
- return;
+ status = thread_status(thread_target);
+ if (!(status.quiesced)) {
+ PR_ERROR("Could not quiesce thread\n");
+ return;
+ }
+ state = IDLE;
+ poll_interval = VCONT_POLL_DELAY;
+ send_response(fd, TRAP);
}
static void poll(void)
--
2.35.1
More information about the Pdbg
mailing list