Install false-branch breakpoint only if the opcode is conditional.

This commit is contained in:
Dr. Chat 2015-12-06 18:45:58 -06:00 committed by Ben Vanik
parent f9de61ceed
commit 3007a98d2d
1 changed files with 17 additions and 3 deletions

View File

@ -819,10 +819,22 @@ uint32_t XThread::StepIntoBranch(uint32_t pc) {
fence.Signal();
};
bool conditional = true;
if (i.type->opcode = 0x40000000) {
// bx
if (cpu::frontend::select_bits(i.B.BO, 4, 4)) {
conditional = false;
}
} else {
// bctrx/blrx
if (cpu::frontend::select_bits(i.XL.BO, 4, 4)) {
conditional = false;
}
}
cpu::Breakpoint bpt(kernel_state()->processor(), callback);
cpu::Breakpoint bpf(kernel_state()->processor(), pc + 4, callback);
if (!bpf.Install()) {
// FIXME: This won't work on non-conditional conditional branches.
if (conditional && !bpf.Install()) {
XELOGE("XThread: Could not install breakpoint to step forward!");
assert_always();
}
@ -854,8 +866,10 @@ uint32_t XThread::StepIntoBranch(uint32_t pc) {
thread_->Resume();
fence.Wait();
bpf.Uninstall();
bpt.Uninstall();
if (conditional) {
bpf.Uninstall();
}
}
return pc;