From: Konstantin Baladurin Date: Tue, 7 Aug 2018 23:25:07 +0000 (+0300) Subject: FillRegDisplay: initialize volatileCurrContextPointers for ARM and ARM64 (dotnet... X-Git-Tag: submit/tizen/20210909.063632~11030^2~4195 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=148b6f5b0e5e3f24f9c0dcf0323645df4f14e8a7;p=platform%2Fupstream%2Fdotnet%2Fruntime.git FillRegDisplay: initialize volatileCurrContextPointers for ARM and ARM64 (dotnet/coreclr#19332) We need to initialize volatileCurrContextPointers because they could be used by GC in the case of the leaf frame. This patch fixes crashes during GC when we are single stepping using managed debugger. Commit migrated from https://github.com/dotnet/coreclr/commit/c488296b594db3054e7cd2af2dab10428ccf0e42 --- diff --git a/src/coreclr/src/inc/regdisp.h b/src/coreclr/src/inc/regdisp.h index eb84fdf..ed60f4b 100644 --- a/src/coreclr/src/inc/regdisp.h +++ b/src/coreclr/src/inc/regdisp.h @@ -406,9 +406,20 @@ inline void FillRegDisplay(const PREGDISPLAY pRD, PT_CONTEXT pctx, PT_CONTEXT pC FillContextPointers(&pRD->ctxPtrsOne, pctx); #if defined(_TARGET_ARM_) + // Fill volatile context pointers. They can be used by GC in the case of the leaf frame + pRD->volatileCurrContextPointers.R0 = &pctx->R0; + pRD->volatileCurrContextPointers.R1 = &pctx->R1; + pRD->volatileCurrContextPointers.R2 = &pctx->R2; + pRD->volatileCurrContextPointers.R3 = &pctx->R3; + pRD->volatileCurrContextPointers.R12 = &pctx->R12; + pRD->ctxPtrsOne.Lr = &pctx->Lr; pRD->pPC = &pRD->pCurrentContext->Pc; -#endif // _TARGET_ARM_ +#elif defined(_TARGET_ARM64_) // _TARGET_ARM_ + // Fill volatile context pointers. They can be used by GC in the case of the leaf frame + for (int i=0; i < 18; i++) + pRD->volatileCurrContextPointers.X[i] = &pctx->X[i]; +#endif // _TARGET_ARM64_ #ifdef DEBUG_REGDISPLAY pRD->_pThread = NULL;