From 41945242524f9ecc795138fdb5beb31362f7826a Mon Sep 17 00:00:00 2001 From: Malfurious Date: Thu, 28 Sep 2023 15:05:51 -0400 Subject: dbg_realcont for testing purposes Signed-off-by: Malfurious --- debugger.c | 19 +++++++++++++++++++ debugger.h | 1 + misplays.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/debugger.c b/debugger.c index ca774e8..572231c 100644 --- a/debugger.c +++ b/debugger.c @@ -499,6 +499,25 @@ int dbg_cont(struct thread *th, int cont) { return 0; } +int dbg_realcont(struct thread *th) { + if (th->id < 0 || !th->stopped) { + return -1; + } + + struct list *threads = &th->proc->threads; + for (struct thread *t = threads->head; t != threads->end; t = t->next) { + ptrace(PTRACE_CONT, t->id, NULL, NULL); + + t->stopped = 0; + t->signal = 0; + t->cont = 0; + t->status = "RUNNING"; + t->clearstates = 1; + } + + return 0; +} + int dbg_step(struct thread *th, int stepover) { // todo: support step-out //if (th->id < 0 || !th->stopped) { diff --git a/debugger.h b/debugger.h index 845bf69..2705f92 100644 --- a/debugger.h +++ b/debugger.h @@ -68,6 +68,7 @@ extern int dbg_wait(struct thread *th, int recursion); extern int dbg_intr(struct thread *th); extern int dbg_cont(struct thread *th, int cont); +extern int dbg_realcont(struct thread *th); extern int dbg_step(struct thread *th, int stepover); extern int dbg_pets(struct thread *th); diff --git a/misplays.c b/misplays.c index 0910012..272a60a 100644 --- a/misplays.c +++ b/misplays.c @@ -265,6 +265,9 @@ int main(int argc, char **argv) { case 'c': dbg_cont(th, PTRACE_CONT); break; + case 'C': + dbg_realcont(th); + break; case 'p': dbg_intr(th); break; -- cgit v1.2.3