Added --break_condition_gpr, --break_condition_value, --break_condition_truncate for use with --break_on_instruction.

This commit is contained in:
gibbed 2015-06-07 17:50:43 -05:00
parent 889f29c18a
commit 4a796627f2
3 changed files with 20 additions and 1 deletions

View File

@ -28,6 +28,10 @@ DECLARE_bool(trace_function_data);
DECLARE_bool(validate_hir); DECLARE_bool(validate_hir);
DECLARE_uint64(break_on_instruction); DECLARE_uint64(break_on_instruction);
DECLARE_int32(break_condition_gpr);
DECLARE_uint64(break_condition_value);
DECLARE_bool(break_condition_truncate);
DECLARE_bool(break_on_debugbreak); DECLARE_bool(break_on_debugbreak);
#endif // XENIA_CPU_PRIVATE_H_ #endif // XENIA_CPU_PRIVATE_H_

View File

@ -45,4 +45,8 @@ DEFINE_bool(validate_hir, false,
// Breakpoints: // Breakpoints:
DEFINE_uint64(break_on_instruction, 0, DEFINE_uint64(break_on_instruction, 0,
"int3 before the given guest address is executed."); "int3 before the given guest address is executed.");
DEFINE_int32(break_condition_gpr, -1, "GPR compared to");
DEFINE_uint64(break_condition_value, 0, "value compared against");
DEFINE_bool(break_condition_truncate, true, "truncate value to 32-bits");
DEFINE_bool(break_on_debugbreak, true, "int3 on JITed __debugbreak requests."); DEFINE_bool(break_on_debugbreak, true, "int3 on JITed __debugbreak requests.");

View File

@ -129,7 +129,18 @@ bool PPCHIRBuilder::Emit(FunctionInfo* symbol_info, uint32_t flags) {
if (i.address == FLAGS_break_on_instruction) { if (i.address == FLAGS_break_on_instruction) {
Comment("--break-on-instruction target"); Comment("--break-on-instruction target");
if (FLAGS_break_condition_gpr < 0) {
DebugBreak(); DebugBreak();
} else {
auto left = LoadGPR(FLAGS_break_condition_gpr);
auto right = LoadConstant(FLAGS_break_condition_value);
if (FLAGS_break_condition_truncate) {
left = Truncate(left, INT32_TYPE);
right = Truncate(right, INT32_TYPE);
}
TrapTrue(CompareEQ(left, right));
}
} }
if (!i.type->emit || emit(*this, i)) { if (!i.type->emit || emit(*this, i)) {