As discussed in dotnet/coreclr#6525, PAL_VirtualUnwind sometimes fails during GC.
This GC failure leads to very unpredicatble behavior (which is very hard to
analyze).
This commit tries to stop the execution at the point where error
happens.
Commit migrated from https://github.com/dotnet/coreclr/commit/
deb00ad58acf627763b6c0a7833fa789e3bb1cd0
DacError(hr);
}
#else
- PAL_VirtualUnwind(&ctx, &nonVolRegPtrs);
+ BOOL success = PAL_VirtualUnwind(&ctx, &nonVolRegPtrs);
+ if (!success)
+ {
+ _ASSERTE(!"unwindLazyState: Unwinding failed");
+ EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
+ }
#endif // DACCESS_COMPILE
pvControlPc = GetIP(&ctx);
DacError(hr);
}
#else // DACCESS_COMPILE
- PAL_VirtualUnwind(&ctx, &nonVolRegPtrs);
+ BOOL success = PAL_VirtualUnwind(&ctx, &nonVolRegPtrs);
+ if (!success)
+ {
+ _ASSERTE(!"unwindLazyState: Unwinding failed");
+ EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
+ }
#endif // DACCESS_COMPILE
pvControlPc = GetIP(&ctx);
#endif // !FEATURE_PAL
DacError(hr);
}
#else // DACCESS_COMPILE
- PAL_VirtualUnwind(&context, &nonVolContextPtrs);
+ BOOL success = PAL_VirtualUnwind(&ctx, &nonVolContextPtrs);
+ if (!success)
+ {
+ _ASSERTE(!"unwindLazyState: Unwinding failed");
+ EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
+ }
#endif // DACCESS_COMPILE
pvControlPc = GetIP(&context);
#endif // !FEATURE_PAL