mirror of
https://github.com/sstefani/mtrace.git
synced 2025-12-06 16:56:41 +08:00
breakpoint handling cleanup
This commit is contained in:
parent
bf23453ea1
commit
65e33d33d0
21
event.c
21
event.c
@ -285,20 +285,21 @@ static void handle_breakpoint(struct task *task)
|
||||
if (unlikely(options.verbose))
|
||||
++bp->count;
|
||||
|
||||
if (unlikely(bp->deleted)) {
|
||||
struct breakpoint *nbp = breakpoint_find(task, bp->addr);
|
||||
if (unlikely(task->skip_bp)) {
|
||||
struct breakpoint *skip_bp = task->skip_bp;
|
||||
|
||||
if (!nbp)
|
||||
nbp = bp;
|
||||
task->skip_bp = NULL;
|
||||
|
||||
skip_breakpoint(task, nbp);
|
||||
goto end;
|
||||
breakpoint_put(skip_bp);
|
||||
|
||||
if (likely(skip_bp == bp)) {
|
||||
skip_breakpoint(task, bp);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (unlikely(task->skip_bp == bp)) {
|
||||
breakpoint_put(task->skip_bp);
|
||||
task->skip_bp = NULL;
|
||||
skip_breakpoint(task, bp);
|
||||
if (unlikely(bp->deleted)) {
|
||||
continue_task(task, 0);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
8
task.c
8
task.c
@ -399,7 +399,7 @@ int task_fork(struct task *task, struct task *newtask)
|
||||
else
|
||||
newtask->breakpoint = NULL;
|
||||
|
||||
if (task->skip_bp)
|
||||
if (task->skip_bp && !task->skip_bp->deleted)
|
||||
newtask->skip_bp = breakpoint_get(breakpoint_find(newtask, newtask->skip_bp->addr));
|
||||
else
|
||||
newtask->skip_bp = NULL;
|
||||
@ -420,10 +420,12 @@ fail:
|
||||
|
||||
void task_reset_bp(struct task *task)
|
||||
{
|
||||
breakpoint_put(task->skip_bp);
|
||||
if (task->skip_bp) {
|
||||
breakpoint_put(task->skip_bp);
|
||||
task->skip_bp = NULL;
|
||||
}
|
||||
|
||||
task->breakpoint = NULL;
|
||||
task->skip_bp = NULL;
|
||||
}
|
||||
|
||||
static struct task *open_one_pid(pid_t pid)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user