fuzz_arm: Dump state when exception is thrown
This commit is contained in:
parent
517fe0f18e
commit
2449468ede
1 changed files with 14 additions and 3 deletions
|
@ -239,9 +239,10 @@ void FuzzJitArm(const size_t instruction_count, const size_t instructions_to_exe
|
||||||
|
|
||||||
// Run interpreter
|
// Run interpreter
|
||||||
write_records.clear();
|
write_records.clear();
|
||||||
|
std::vector<WriteRecord> interp_write_records;
|
||||||
interp.NumInstrsToExecute = static_cast<unsigned>(instructions_to_execute_count);
|
interp.NumInstrsToExecute = static_cast<unsigned>(instructions_to_execute_count);
|
||||||
InterpreterMainLoop(&interp);
|
InterpreterMainLoop(&interp);
|
||||||
auto interp_write_records = write_records;
|
interp_write_records = write_records;
|
||||||
{
|
{
|
||||||
bool T = Dynarmic::Common::Bit<5>(interp.Cpsr);
|
bool T = Dynarmic::Common::Bit<5>(interp.Cpsr);
|
||||||
interp.Reg[15] &= T ? 0xFFFFFFFE : 0xFFFFFFFC;
|
interp.Reg[15] &= T ? 0xFFFFFFFE : 0xFFFFFFFC;
|
||||||
|
@ -249,13 +250,21 @@ void FuzzJitArm(const size_t instruction_count, const size_t instructions_to_exe
|
||||||
|
|
||||||
// Run jit
|
// Run jit
|
||||||
write_records.clear();
|
write_records.clear();
|
||||||
|
std::vector<WriteRecord> jit_write_records;
|
||||||
|
try {
|
||||||
jit.Run(static_cast<unsigned>(instructions_to_execute_count));
|
jit.Run(static_cast<unsigned>(instructions_to_execute_count));
|
||||||
auto jit_write_records = write_records;
|
jit_write_records = write_records;
|
||||||
|
} catch (...) {
|
||||||
|
printf("Caught something!\n");
|
||||||
|
goto dump_state;
|
||||||
|
}
|
||||||
|
|
||||||
// Compare
|
// Compare
|
||||||
if (!DoesBehaviorMatch(interp, jit, interp_write_records, jit_write_records)) {
|
if (!DoesBehaviorMatch(interp, jit, interp_write_records, jit_write_records)) {
|
||||||
printf("Failed at execution number %zu\n", run_number);
|
printf("Failed at execution number %zu\n", run_number);
|
||||||
|
|
||||||
|
dump_state:
|
||||||
|
|
||||||
printf("\nInstruction Listing: \n");
|
printf("\nInstruction Listing: \n");
|
||||||
for (size_t i = 0; i < instruction_count; i++) {
|
for (size_t i = 0; i < instruction_count; i++) {
|
||||||
printf("%x: %s\n", code_mem[i], Dynarmic::Arm::DisassembleArm(code_mem[i]).c_str());
|
printf("%x: %s\n", code_mem[i], Dynarmic::Arm::DisassembleArm(code_mem[i]).c_str());
|
||||||
|
@ -306,6 +315,8 @@ void FuzzJitArm(const size_t instruction_count, const size_t instructions_to_exe
|
||||||
num_insts += ir_block.CycleCount();
|
num_insts += ir_block.CycleCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue