WOW64: Use NtRaiseException to raise guest exception

Instead of returning to the currently dispatched exception, which doesn't send a debug event.
This commit is contained in:
Jacek Caban committed 2026-09-06 15:22:43 +02:00
1 parent 064a6e96c7
commit e4c6154be2
1 file changed
+4 -10
+4 -10
View File
@@ -943,22 +943,16 @@ bool BTCpuResetToConsistentStateImpl(EXCEPTION_POINTERS* Ptrs) {
auto& Fault = Thread->CurrentFrame->SynchronousFaultData;
BOOL FirstChance = TRUE;
*Exception = FEX::Windows::HandleGuestException(Fault, *Exception, WowContext.Eip, WowContext.Eax, WowContext.Ecx, FirstChance);
if (Exception->ExceptionCode == EXCEPTION_SINGLE_STEP) {
EXCEPTION_RECORD GuestException =
FEX::Windows::HandleGuestException(Fault, *Exception, WowContext.Eip, WowContext.Eax, WowContext.Ecx, FirstChance);
if (GuestException.ExceptionCode == EXCEPTION_SINGLE_STEP) {
WowContext.EFlags &= ~(1 << FEXCore::X86State::RFLAG_TF_RAW_LOC);
}
// wow64.dll will handle adjusting PC in the dispatched context after a breakpoint
BTCpuSetContext(GetCurrentThread(), GetCurrentProcess(), nullptr, &WowContext);
Context::UnlockJITContext(TLS);
if (!FirstChance) {
NtRaiseException(Exception, TLS.EntryContext(), FirstChance);
}
// Replace the host context with one captured before JIT entry so host code can unwind
memcpy(Context, TLS.EntryContext(), sizeof(*Context));
NtRaiseException(&GuestException, TLS.EntryContext(), FirstChance);
return false;
}