breakpoint handling cleanup

This commit is contained in:
Stefani Seibold 2015-12-01 18:57:29 +01:00
parent bf23453ea1
commit 65e33d33d0
3 changed files with 17 additions and 16 deletions

19
event.c
View File

@ -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);
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;
}

6
task.c
View File

@ -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)
{
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)

View File

@ -64,10 +64,8 @@ int skip_breakpoint(struct task *task, struct breakpoint *bp)
set_timer(&start, &skip_bp_time);
if (unlikely(ret)) {
if (unlikely(ret == 1)) {
breakpoint_put(task->skip_bp);
if (unlikely(ret == 1))
task->skip_bp = breakpoint_get(bp);
}
return ret;
}
}