Skip to content

Commit

Permalink
powerpc, hw_breakpoint: Cooperate better with other single-steppers
Browse files Browse the repository at this point in the history
The code we had to clear the MSR_SE bit was not doing anything because
the caller (ultimately single_step_exception() in traps.c) had already
cleared.  Instead of trying to leave MSR_SE set if the TIF_SINGLESTEP
flag is set (which indicates that the process is being single-stepped
by ptrace), we instead return NOTIFY_DONE in that case, which means
the caller will generate a SIGTRAP for the process.

Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Paul Mackerras committed Jun 23, 2010
1 parent 574cb24 commit 76b0f13
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions arch/powerpc/kernel/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,16 @@ int __kprobes single_step_dabr_instruction(struct die_args *args)
if (!bp_info->extraneous_interrupt)
perf_bp_event(bp, regs);

set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION);
current->thread.last_hit_ubp = NULL;

/*
* Do not disable MSR_SE if the process was already in
* single-stepping mode.
* If the process was being single-stepped by ptrace, let the
* other single-step actions occur (e.g. generate SIGTRAP).
*/
if (!test_thread_flag(TIF_SINGLESTEP))
regs->msr &= ~MSR_SE;
if (test_thread_flag(TIF_SINGLESTEP))
return NOTIFY_DONE;

set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION);
current->thread.last_hit_ubp = NULL;
return NOTIFY_STOP;
}

Expand Down

0 comments on commit 76b0f13

Please sign in to comment.