Install false-branch breakpoint only if the opcode is conditional.
This commit is contained in:
parent
f9de61ceed
commit
3007a98d2d
|
@ -819,10 +819,22 @@ uint32_t XThread::StepIntoBranch(uint32_t pc) {
|
||||||
fence.Signal();
|
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 bpt(kernel_state()->processor(), callback);
|
||||||
cpu::Breakpoint bpf(kernel_state()->processor(), pc + 4, callback);
|
cpu::Breakpoint bpf(kernel_state()->processor(), pc + 4, callback);
|
||||||
if (!bpf.Install()) {
|
if (conditional && !bpf.Install()) {
|
||||||
// FIXME: This won't work on non-conditional conditional branches.
|
|
||||||
XELOGE("XThread: Could not install breakpoint to step forward!");
|
XELOGE("XThread: Could not install breakpoint to step forward!");
|
||||||
assert_always();
|
assert_always();
|
||||||
}
|
}
|
||||||
|
@ -854,8 +866,10 @@ uint32_t XThread::StepIntoBranch(uint32_t pc) {
|
||||||
|
|
||||||
thread_->Resume();
|
thread_->Resume();
|
||||||
fence.Wait();
|
fence.Wait();
|
||||||
bpf.Uninstall();
|
|
||||||
bpt.Uninstall();
|
bpt.Uninstall();
|
||||||
|
if (conditional) {
|
||||||
|
bpf.Uninstall();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pc;
|
return pc;
|
||||||
|
|
Loading…
Reference in New Issue