[Pdbg] [PATCH 03/10] gdbserver: use TRAP for step stop reason
Nicholas Piggin
npiggin at gmail.com
Tue May 31 19:14:50 AEST 2022
gdb expects single step to provide the TRAP stop reason, otherwise it
considers it an unknown / other stop. This makes it print odd thread
stop messages when single stepping, and it also causes it to break
unexpectedly when continuing threads that had hit a breakpoint because
it steps those threads over the breakpoint address before continuing,
and that step causes it to break again unless the stop reason is TRAP.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
src/pdbgproxy.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index 2d579a4a..29845762 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -66,6 +66,7 @@ struct gdb_thread {
bool attn_set;
bool initial_stopped;
bool stop_attn;
+ bool stop_sstep;
bool stop_ctrlc;
};
@@ -208,7 +209,7 @@ static void send_stop_for_thread(struct pdbg_target *target)
int sig;
int i;
- if (gdb_thread->stop_attn)
+ if (gdb_thread->stop_attn || gdb_thread->stop_sstep)
sig = 5; /* TRAP */
else if (gdb_thread->stop_ctrlc)
sig = 2; /* INT */
@@ -853,8 +854,9 @@ static void v_conts(uint64_t *stack, void *priv)
thread_step(thread_target, 1);
- gdb_thread->stop_ctrlc = false;
gdb_thread->stop_attn = false;
+ gdb_thread->stop_sstep = true;
+ gdb_thread->stop_ctrlc = false;
send_stop_for_thread(thread_target);
}
@@ -901,6 +903,7 @@ static void start_all(void)
gdb_thread = thread->gdbserver_priv;
gdb_thread->stop_attn = false;
+ gdb_thread->stop_sstep = false;
gdb_thread->stop_ctrlc = false;
}
--
2.35.1
More information about the Pdbg
mailing list