From 0cd617e2636bb2c9b5b6f92ea28fd4a5dfd6a874 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 23 Nov 2018 19:14:03 +0100 Subject: [PATCH] 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 --- src/coreclr/src/debug/di/rsclass.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) 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 -- 2.7.4