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
19
event.c
19
event.c
@ -285,20 +285,21 @@ static void handle_breakpoint(struct task *task)
|
|||||||
if (unlikely(options.verbose))
|
if (unlikely(options.verbose))
|
||||||
++bp->count;
|
++bp->count;
|
||||||
|
|
||||||
if (unlikely(bp->deleted)) {
|
if (unlikely(task->skip_bp)) {
|
||||||
struct breakpoint *nbp = breakpoint_find(task, bp->addr);
|
struct breakpoint *skip_bp = task->skip_bp;
|
||||||
|
|
||||||
if (!nbp)
|
task->skip_bp = NULL;
|
||||||
nbp = bp;
|
|
||||||
|
|
||||||
skip_breakpoint(task, nbp);
|
breakpoint_put(skip_bp);
|
||||||
|
|
||||||
|
if (likely(skip_bp == bp)) {
|
||||||
|
skip_breakpoint(task, bp);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely(task->skip_bp == bp)) {
|
if (unlikely(bp->deleted)) {
|
||||||
breakpoint_put(task->skip_bp);
|
continue_task(task, 0);
|
||||||
task->skip_bp = NULL;
|
|
||||||
skip_breakpoint(task, bp);
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6
task.c
6
task.c
@ -399,7 +399,7 @@ int task_fork(struct task *task, struct task *newtask)
|
|||||||
else
|
else
|
||||||
newtask->breakpoint = NULL;
|
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));
|
newtask->skip_bp = breakpoint_get(breakpoint_find(newtask, newtask->skip_bp->addr));
|
||||||
else
|
else
|
||||||
newtask->skip_bp = NULL;
|
newtask->skip_bp = NULL;
|
||||||
@ -420,10 +420,12 @@ fail:
|
|||||||
|
|
||||||
void task_reset_bp(struct task *task)
|
void task_reset_bp(struct task *task)
|
||||||
{
|
{
|
||||||
|
if (task->skip_bp) {
|
||||||
breakpoint_put(task->skip_bp);
|
breakpoint_put(task->skip_bp);
|
||||||
|
task->skip_bp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
task->breakpoint = NULL;
|
task->breakpoint = NULL;
|
||||||
task->skip_bp = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct task *open_one_pid(pid_t pid)
|
static struct task *open_one_pid(pid_t pid)
|
||||||
|
|||||||
4
trace.c
4
trace.c
@ -64,10 +64,8 @@ int skip_breakpoint(struct task *task, struct breakpoint *bp)
|
|||||||
set_timer(&start, &skip_bp_time);
|
set_timer(&start, &skip_bp_time);
|
||||||
|
|
||||||
if (unlikely(ret)) {
|
if (unlikely(ret)) {
|
||||||
if (unlikely(ret == 1)) {
|
if (unlikely(ret == 1))
|
||||||
breakpoint_put(task->skip_bp);
|
|
||||||
task->skip_bp = breakpoint_get(bp);
|
task->skip_bp = breakpoint_get(bp);
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user