diff --git a/src/coreclr/vm/stackwalk.cpp b/src/coreclr/vm/stackwalk.cpp index 6390b064d43a59..4cd7214f44693f 100644 --- a/src/coreclr/vm/stackwalk.cpp +++ b/src/coreclr/vm/stackwalk.cpp @@ -421,6 +421,19 @@ PCODE Thread::VirtualUnwindCallFrame(T_CONTEXT* pContext, EECodeInfo * pCodeInfo /*= NULL*/ ARM64_ARG(TADDR * pSpForPacSign /*= NULL*/)) { +#ifdef TARGET_WASM + // WASM has a custom RtlVirtualUnwind (vm/wasm/helpers.cpp) that handles + // R2R-WASM frames keyed by virtual IPs. For interpreter-only WASM (e.g., + // the WASI corerun) there is no R2R unwind info and no virtual IP, so + // walking past such a frame is not supported and the call into the body + // would corrupt the register display. Fail fast in that case; let R2R + // frames flow through the regular path below. + if (!ExecutionManager::IsVirtualIP(GetIP(pContext))) + { + _ASSERTE(!"VirtualUnwindCallFrame: non-virtual-IP context on WebAssembly"); + return 0; + } +#endif // TARGET_WASM CONTRACTL { NOTHROW;