summaryrefslogtreecommitdiffstats
path: root/debugger.c
diff options
context:
space:
mode:
authorMatt Hunter <m@lfurio.us>2025-08-25 02:37:49 -0400
committerMatt Hunter <m@lfurio.us>2025-09-07 06:41:16 -0400
commitb2d6f5a4c75e8f68cb27edad38455375b500323b (patch)
tree91bd8d29e34b2780a57e85623988be40babe2c85 /debugger.c
parent4c31b8af05f5f388c1eea328a0ec69a6acb3a7f8 (diff)
downloadmisplays-b2d6f5a4c75e8f68cb27edad38455375b500323b.tar.gz
misplays-b2d6f5a4c75e8f68cb27edad38455375b500323b.zip
Always prune step breakpoints when uninstalling from memory
On completion of an initial single step, we can and should discard these breakpoints, even though the thread may not be "stopping" and go on to continue in free-run. They have served their purpose at this point and we would like to avoid any other thread encountering them. Also, whenever uninstall_breakpoints() is called, it is because we are cycling a process's threads and are about to run resume_threads() which currently does the work of re-computing a thread's step breakpoints if a previous single step was interrupted, whether or not the step breakpoints for that instant have already been figured. So this also addresses a bug where one thread, with repeatedly interrupted single steps, would accumulate more and more redundant breakpoint entries until it was finally able to proceed and eventually stop. Signed-off-by: Matt Hunter <m@lfurio.us>
Diffstat (limited to 'debugger.c')
-rw-r--r--debugger.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/debugger.c b/debugger.c
index 173acbd..33bdbc0 100644
--- a/debugger.c
+++ b/debugger.c
@@ -96,7 +96,12 @@ static void uninstall_breakpoints(struct thread *th) {
b->installed = 0;
}
- if (b->previously_installed && b->enabled < 0) {
+ if (b->step) {
+ struct breakpoint *del = b;
+ b = b->next;
+ list_remove(del);
+ free(del);
+ } else if (b->enabled < 0 && b->previously_installed) {
struct thread *t = NULL;
if (b->tid == 0 || ((t = thread_by_id(th->proc, b->tid)) && !t->doing)) {
struct breakpoint *del = b;