From 6a9e590b847a034d190fe3c89ef37656073d229a Mon Sep 17 00:00:00 2001 From: Malfurious Date: Mon, 25 Sep 2023 14:46:34 -0400 Subject: Don't drop temporary breakpoints when execution is to be restarted Signed-off-by: Malfurious --- debugger.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/debugger.c b/debugger.c index 1ad88c8..73db856 100644 --- a/debugger.c +++ b/debugger.c @@ -51,14 +51,14 @@ static int detect_breakpoint(struct thread *th) { } } - /* this needs moved, we have to finish the for-loop - * to actually know if restart is true or false... */ - if (b->enabled < 0 && !restart) { - struct breakpoint *del = b; - b = b->prev; - list_remove(del); - free(del); - } + ///* this needs moved, we have to finish the for-loop + // * to actually know if restart is true or false... */ + //if (b->enabled < 0 && !restart) { + // struct breakpoint *del = b; + // b = b->prev; + // list_remove(del); + // free(del); + //} } } @@ -87,6 +87,13 @@ static void uninstall_breakpoints(struct process *proc) { ptrace(PTRACE_POKETEXT, proc->id, b->address, b->text); b->installed = 0; } + + if (b->enabled < 0) { + struct breakpoint *del = b; + b = b->next; + list_remove(del); + free(del); + } } } @@ -431,8 +438,8 @@ int dbg_wait(struct thread *th, int recursion) { if (!recursion) { stopped = interrupt_all_threads(th->proc); - uninstall_breakpoints(th->proc); if (!restart) { + uninstall_breakpoints(th->proc); capture_state(th, stopped); } } -- cgit v1.2.3