diff options
Diffstat (limited to 'debugger.c')
-rw-r--r-- | debugger.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -65,26 +65,26 @@ static int detect_breakpoint(struct thread *th) { return restart; } -static void install_breakpoints(struct process *proc) { - struct list *breaks = &proc->breakpoints; +static void install_breakpoints(struct thread *th) { + struct list *breaks = &th->proc->breakpoints; for (struct breakpoint *b = breaks->head; b != breaks->end; b = b->next) { if (!b->installed) { unsigned long word; - word = ptrace(PTRACE_PEEKTEXT, proc->id, b->address, NULL); + word = ptrace(PTRACE_PEEKTEXT, th->id, b->address, NULL); b->text = word; word = (word & ~0xff) | BREAKPOINT_INSN; - ptrace(PTRACE_POKETEXT, proc->id, b->address, word); + ptrace(PTRACE_POKETEXT, th->id, b->address, word); b->installed = 1; } } } -static void uninstall_breakpoints(struct process *proc) { - struct list *breaks = &proc->breakpoints; +static void uninstall_breakpoints(struct thread *th) { + struct list *breaks = &th->proc->breakpoints; for (struct breakpoint *b = breaks->tail; b != breaks->end; b = b->prev) { if (b->installed) { - ptrace(PTRACE_POKETEXT, proc->id, b->address, b->text); + ptrace(PTRACE_POKETEXT, th->id, b->address, b->text); b->installed = 0; } @@ -288,7 +288,7 @@ struct process *dbg_attach(pid_t pid, int child) { int dbg_detach(struct process *proc) { interrupt_all_threads(proc); - uninstall_breakpoints(proc); + uninstall_breakpoints(proc->threads.head); free_breakpoints(proc); if (proc->child) { @@ -362,7 +362,7 @@ int dbg_wait(struct thread *th, int recursion) { if (!recursion) { stopped = interrupt_all_threads(th->proc); - uninstall_breakpoints(th->proc); + uninstall_breakpoints(th); capture_state(th, stopped); } @@ -377,7 +377,7 @@ int dbg_wait(struct thread *th, int recursion) { if (!recursion) { stopped = interrupt_all_threads(th->proc); - uninstall_breakpoints(th->proc); + uninstall_breakpoints(th); capture_state(th, stopped); } @@ -392,7 +392,7 @@ int dbg_wait(struct thread *th, int recursion) { if (!recursion) { stopped = interrupt_all_threads(th->proc); - uninstall_breakpoints(th->proc); + uninstall_breakpoints(th); capture_state(th, stopped); } @@ -407,7 +407,7 @@ int dbg_wait(struct thread *th, int recursion) { if (!recursion) { stopped = interrupt_all_threads(th->proc); - uninstall_breakpoints(th->proc); + uninstall_breakpoints(th); capture_state(th, stopped); } @@ -421,7 +421,7 @@ int dbg_wait(struct thread *th, int recursion) { if (th->cont != 0) { /* gdb this portion. are there race conditions * that matter?? */ - install_breakpoints(th->proc); + install_breakpoints(th); ptrace(th->cont, th->id, NULL, NULL); th->cont = 0; th->stopped = 0; @@ -439,7 +439,7 @@ int dbg_wait(struct thread *th, int recursion) { if (!recursion) { stopped = interrupt_all_threads(th->proc); if (!restart) { - uninstall_breakpoints(th->proc); + uninstall_breakpoints(th); capture_state(th, stopped); } } @@ -460,7 +460,7 @@ int dbg_wait(struct thread *th, int recursion) { if (!recursion) { stopped = interrupt_all_threads(th->proc); - uninstall_breakpoints(th->proc); + uninstall_breakpoints(th); capture_state(th, stopped); } |