[Emulator] Add access violation details to crash dump messages

This commit is contained in:
Herman S.
2026-03-10 22:12:57 +09:00
parent 4a78428c6b
commit dac9883473

View File

@@ -1288,6 +1288,19 @@ bool Emulator::ExceptionCallback(Exception* ex) {
crash_msg.append(
fmt::format("PC: 0x{:08X}\n",
guest_function->MapMachineCodeToGuestAddress(ex->pc())));
if (ex->code() == Exception::Code::kAccessViolation) {
const char* op_str = "unknown";
if (ex->access_violation_operation() ==
Exception::AccessViolationOperation::kRead)
op_str = "read";
else if (ex->access_violation_operation() ==
Exception::AccessViolationOperation::kWrite)
op_str = "write";
crash_msg.append(fmt::format("Access Violation: {} at 0x{:016X}\n", op_str,
ex->fault_address()));
} else if (ex->code() == Exception::Code::kIllegalInstruction) {
crash_msg.append("Illegal Instruction\n");
}
crash_msg.append("Registers:\n");
for (int i = 0; i < 32; i++) {
crash_msg.append(fmt::format(" r{:<3} = {:016X}\n", i, context->r[i]));