From: Jan Vorlicek Date: Fri, 23 Nov 2018 18:14:03 +0000 (+0100) Subject: Fix debugger collectible thread statics access (dotnet/coreclr#21175) X-Git-Tag: submit/tizen/20210909.063632~11030^2~3266 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cd617e2636bb2c9b5b6f92ea28fd4a5dfd6a874;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix debugger collectible thread statics access (dotnet/coreclr#21175) The CordbClass::GetStaticFieldValue2 was missing support for accessing thread statics in collectible classes. Fortunately the fix was simple, we can use the same code path as for non-collectible thread statics. Commit migrated from https://github.com/dotnet/coreclr/commit/b5c9edd9ea63639328ec587003f97922b80ef029 --- diff --git a/src/coreclr/src/debug/di/rsclass.cpp b/src/coreclr/src/debug/di/rsclass.cpp index 987f001..bfd02c7 100644 --- a/src/coreclr/src/debug/di/rsclass.cpp +++ b/src/coreclr/src/debug/di/rsclass.cpp @@ -240,25 +240,28 @@ HRESULT CordbClass::GetStaticFieldValue2(CordbModule * pModule, CORDB_ADDRESS pRmtStaticValue = NULL; CordbProcess * pProcess = pModule->GetProcess(); - if (pFieldData->m_fFldIsCollectibleStatic) + if (!pFieldData->m_fFldIsTLS) { - EX_TRY + if (pFieldData->m_fFldIsCollectibleStatic) { - pRmtStaticValue = pProcess->GetDAC()->GetCollectibleTypeStaticAddress(pFieldData->m_vmFieldDesc, - pModule->GetAppDomain()->GetADToken()); + EX_TRY + { + pRmtStaticValue = pProcess->GetDAC()->GetCollectibleTypeStaticAddress(pFieldData->m_vmFieldDesc, + pModule->GetAppDomain()->GetADToken()); + } + EX_CATCH_HRESULT(hr); + if(FAILED(hr)) + { + return hr; + } } - EX_CATCH_HRESULT(hr); - if(FAILED(hr)) + else { - return hr; + // Statics never move, so we always address them using their absolute address. + _ASSERTE(pFieldData->OkToGetOrSetStaticAddress()); + pRmtStaticValue = pFieldData->GetStaticAddress(); } } - else if (!pFieldData->m_fFldIsTLS) - { - // Statics never move, so we always address them using their absolute address. - _ASSERTE(pFieldData->OkToGetOrSetStaticAddress()); - pRmtStaticValue = pFieldData->GetStaticAddress(); - } else { // We've got a thread local static