summaryrefslogtreecommitdiff
path: root/src/debug/daccess
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-12-27 16:46:08 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2016-12-27 16:46:08 +0900
commitdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch)
treee5435159cd1bf0519276363a6fe1663d1721bed3 /src/debug/daccess
parent4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff)
downloadcoreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'src/debug/daccess')
-rw-r--r--src/debug/daccess/daccess.cpp18
-rw-r--r--src/debug/daccess/daccess.targets6
-rw-r--r--src/debug/daccess/dacdbiimpl.cpp35
-rw-r--r--src/debug/daccess/dacdbiimpl.h10
-rw-r--r--src/debug/daccess/dacfn.cpp4
-rw-r--r--src/debug/daccess/enummem.cpp11
-rw-r--r--src/debug/daccess/fntableaccess.cpp5
-rw-r--r--src/debug/daccess/fntableaccess.h3
-rw-r--r--src/debug/daccess/nidump.cpp21
-rw-r--r--src/debug/daccess/request.cpp78
-rw-r--r--src/debug/daccess/request_svr.cpp4
11 files changed, 121 insertions, 74 deletions
diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp
index ba3995b1f7..69167ab07e 100644
--- a/src/debug/daccess/daccess.cpp
+++ b/src/debug/daccess/daccess.cpp
@@ -5888,14 +5888,15 @@ ClrDataAccess::RawGetMethodName(
LPCWSTR wszStubManagerName = pStubManager->GetStubManagerName(TO_TADDR(address));
_ASSERTE(wszStubManagerName != NULL);
- HRESULT hr = StringCchPrintfW(
+ int result = _snwprintf_s(
symbolBuf,
bufLen,
+ _TRUNCATE,
s_wszFormatNameWithStubManager,
wszStubManagerName, // Arg 1 = stub name
TO_TADDR(address)); // Arg 2 = stub hex address
- if (hr == S_OK)
+ if (result != -1)
{
// Printf succeeded, so we have an exact char count to return
if (symbolLen)
@@ -5951,13 +5952,14 @@ NameFromMethodDesc:
// XXX Microsoft - Should this case have a more specific name?
static WCHAR s_wszFormatNameAddressOnly[] = W("CLRStub@%I64x");
- HRESULT hr = StringCchPrintfW(
+ int result = _snwprintf_s(
symbolBuf,
bufLen,
+ _TRUNCATE,
s_wszFormatNameAddressOnly,
TO_TADDR(address));
- if (hr == S_OK)
+ if (result != -1)
{
// Printf succeeded, so we have an exact char count to return
if (symbolLen)
@@ -7352,7 +7354,7 @@ Exit:
//----------------------------------------------------------------------------
//
-// IsExceptionFromManagedCode - report if pExceptionRecord points to a exception belonging to the current runtime
+// IsExceptionFromManagedCode - report if pExceptionRecord points to an exception belonging to the current runtime
//
// Arguments:
// pExceptionRecord - the exception record
@@ -7974,7 +7976,7 @@ HRESULT DacHandleWalker::Init(ClrDataAccess *dac, UINT types[], UINT typeCount,
{
SUPPORTS_DAC;
- if (gen < 0 || gen > (int)GCHeap::GetMaxGeneration())
+ if (gen < 0 || gen > (int)GCHeapUtilities::GetMaxGeneration())
return E_INVALIDARG;
mGenerationFilter = gen;
@@ -8033,7 +8035,7 @@ bool DacHandleWalker::FetchMoreHandles(HANDLESCANPROC callback)
int max_slots = 1;
#ifdef FEATURE_SVR_GC
- if (GCHeap::IsServerHeap())
+ if (GCHeapUtilities::IsServerHeap())
max_slots = GCHeapCount();
#endif // FEATURE_SVR_GC
@@ -8089,7 +8091,7 @@ bool DacHandleWalker::FetchMoreHandles(HANDLESCANPROC callback)
HndScanHandlesForGC(hTable, callback,
(LPARAM)&param, 0,
&handleType, 1,
- mGenerationFilter, GCHeap::GetMaxGeneration(), 0);
+ mGenerationFilter, GCHeapUtilities::GetMaxGeneration(), 0);
else
HndEnumHandles(hTable, &handleType, 1, callback, (LPARAM)&param, 0, FALSE);
}
diff --git a/src/debug/daccess/daccess.targets b/src/debug/daccess/daccess.targets
index a7d9e41554..43da554f47 100644
--- a/src/debug/daccess/daccess.targets
+++ b/src/debug/daccess/daccess.targets
@@ -4,6 +4,12 @@
<!--from the original SOURCES/DIRS file by the KBC tool.-->
<!--*****************************************************-->
<!--Import the settings-->
+ <PropertyGroup>
+ <!-- Work around problems with loading System.Private.CoreLib.dll, -->
+ <!-- caused by inconsistent setting of UseLegacyCompiler and FeatureSpanOfT -->
+ <!-- between System.Private.CoreLib.dll and the runtime. -->
+ <UseLegacyCompiler>true</UseLegacyCompiler>
+ </PropertyGroup>
<Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\clr.props" />
<Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\dac.props" />
<Import Project="..\SetDebugTargetLocal.props" />
diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp
index 9b17f4cd46..ae266e8a6f 100644
--- a/src/debug/daccess/dacdbiimpl.cpp
+++ b/src/debug/daccess/dacdbiimpl.cpp
@@ -90,7 +90,7 @@ IDacDbiInterface::IAllocator * g_pAllocator = NULL;
//
// Need a class to serve as a tag that we can use to overload New/Delete.
-#define forDbi (*(forDbiWorker *)NULL)
+forDbiWorker forDbi;
void * operator new(size_t lenBytes, const forDbiWorker &)
{
@@ -2364,10 +2364,12 @@ TypeHandle DacDbiInterfaceImpl::FindLoadedFnptrType(DWORD numTypeArgs, TypeHandl
// Lookup operations run the class loader in non-load mode.
ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE();
- // @dbgtodo : Do we need to worry about calling convention here?
- return ClassLoader::LoadFnptrTypeThrowing(0,
- numTypeArgs,
- pInst,
+ // @dbgtodo : Do we need to worry about calling convention here?
+ // LoadFnptrTypeThrowing expects the count of arguments, not
+ // including return value, so we subtract 1 from numTypeArgs.
+ return ClassLoader::LoadFnptrTypeThrowing(0,
+ numTypeArgs - 1,
+ pInst,
ClassLoader::DontLoadTypes);
} // DacDbiInterfaceImpl::FindLoadedFnptrType
@@ -6517,7 +6519,7 @@ HRESULT DacHeapWalker::Init(CORDB_ADDRESS start, CORDB_ADDRESS end)
if (thread == NULL)
continue;
- alloc_context *ctx = thread->GetAllocContext();
+ gc_alloc_context *ctx = thread->GetAllocContext();
if (ctx == NULL)
continue;
@@ -6533,7 +6535,7 @@ HRESULT DacHeapWalker::Init(CORDB_ADDRESS start, CORDB_ADDRESS end)
}
#ifdef FEATURE_SVR_GC
- HRESULT hr = GCHeap::IsServerHeap() ? InitHeapDataSvr(mHeaps, mHeapCount) : InitHeapDataWks(mHeaps, mHeapCount);
+ HRESULT hr = GCHeapUtilities::IsServerHeap() ? InitHeapDataSvr(mHeaps, mHeapCount) : InitHeapDataWks(mHeaps, mHeapCount);
#else
HRESULT hr = InitHeapDataWks(mHeaps, mHeapCount);
#endif
@@ -6777,7 +6779,7 @@ HRESULT DacDbiInterfaceImpl::GetHeapSegments(OUT DacDbiArrayList<COR_SEGMENT> *p
HeapData *heaps = 0;
#ifdef FEATURE_SVR_GC
- HRESULT hr = GCHeap::IsServerHeap() ? DacHeapWalker::InitHeapDataSvr(heaps, heapCount) : DacHeapWalker::InitHeapDataWks(heaps, heapCount);
+ HRESULT hr = GCHeapUtilities::IsServerHeap() ? DacHeapWalker::InitHeapDataSvr(heaps, heapCount) : DacHeapWalker::InitHeapDataWks(heaps, heapCount);
#else
HRESULT hr = DacHeapWalker::InitHeapDataWks(heaps, heapCount);
#endif
@@ -6987,6 +6989,21 @@ HRESULT DacDbiInterfaceImpl::GetTypeID(CORDB_ADDRESS dbgObj, COR_TYPEID *pID)
return hr;
}
+HRESULT DacDbiInterfaceImpl::GetTypeIDForType(VMPTR_TypeHandle vmTypeHandle, COR_TYPEID *pID)
+{
+ DD_ENTER_MAY_THROW;
+
+ _ASSERTE(pID != NULL);
+ _ASSERTE(!vmTypeHandle.IsNull());
+
+ TypeHandle th = TypeHandle::FromPtr(vmTypeHandle.GetDacPtr());
+ PTR_MethodTable pMT = th.GetMethodTable();
+ pID->token1 = pMT.GetAddr();
+ _ASSERTE(pID->token1 != 0);
+ pID->token2 = 0;
+ return S_OK;
+}
+
HRESULT DacDbiInterfaceImpl::GetObjectFields(COR_TYPEID id, ULONG32 celt, COR_FIELD *layout, ULONG32 *pceltFetched)
{
if (layout == NULL || pceltFetched == NULL)
@@ -7171,7 +7188,7 @@ void DacDbiInterfaceImpl::GetGCHeapInformation(COR_HEAPINFO * pHeapInfo)
pHeapInfo->areGCStructuresValid = GCScan::GetGcRuntimeStructuresValid();
#ifdef FEATURE_SVR_GC
- if (GCHeap::IsServerHeap())
+ if (GCHeapUtilities::IsServerHeap())
{
pHeapInfo->gcType = CorDebugServerGC;
pHeapInfo->numHeaps = DacGetNumHeaps();
diff --git a/src/debug/daccess/dacdbiimpl.h b/src/debug/daccess/dacdbiimpl.h
index 56d7b0d1d7..a86072325c 100644
--- a/src/debug/daccess/dacdbiimpl.h
+++ b/src/debug/daccess/dacdbiimpl.h
@@ -138,11 +138,13 @@ public:
HRESULT WalkRefs(RefWalkHandle handle, ULONG count, OUT DacGcReference * objects, OUT ULONG *pFetched);
HRESULT GetTypeID(CORDB_ADDRESS obj, COR_TYPEID *pID);
+
+ HRESULT GetTypeIDForType(VMPTR_TypeHandle vmTypeHandle, COR_TYPEID *pID);
- HRESULT GetObjectFields(COR_TYPEID id, ULONG32 celt, COR_FIELD *layout, ULONG32 *pceltFetched);
- HRESULT GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT *pLayout);
- HRESULT GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT *pLayout);
- void GetGCHeapInformation(COR_HEAPINFO * pHeapInfo);
+ HRESULT GetObjectFields(COR_TYPEID id, ULONG32 celt, COR_FIELD *layout, ULONG32 *pceltFetched);
+ HRESULT GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT *pLayout);
+ HRESULT GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT *pLayout);
+ void GetGCHeapInformation(COR_HEAPINFO * pHeapInfo);
HRESULT GetPEFileMDInternalRW(VMPTR_PEFile vmPEFile, OUT TADDR* pAddrMDInternalRW);
HRESULT GetReJitInfo(VMPTR_Module vmModule, mdMethodDef methodTk, OUT VMPTR_ReJitInfo* pReJitInfo);
HRESULT GetReJitInfo(VMPTR_MethodDesc vmMethod, CORDB_ADDRESS codeStartAddress, OUT VMPTR_ReJitInfo* pReJitInfo);
diff --git a/src/debug/daccess/dacfn.cpp b/src/debug/daccess/dacfn.cpp
index 88d45993b3..d8bae7746f 100644
--- a/src/debug/daccess/dacfn.cpp
+++ b/src/debug/daccess/dacfn.cpp
@@ -217,7 +217,7 @@ DacWriteAll(TADDR addr, PVOID buffer, ULONG32 size, bool throwEx)
return S_OK;
}
-#if defined(WIN64EXCEPTIONS) && defined(FEATURE_PAL)
+#ifdef FEATURE_PAL
HRESULT
DacVirtualUnwind(DWORD threadId, PCONTEXT context, PT_KNONVOLATILE_CONTEXT_POINTERS contextPointers)
{
@@ -242,7 +242,7 @@ DacVirtualUnwind(DWORD threadId, PCONTEXT context, PT_KNONVOLATILE_CONTEXT_POINT
return hr;
}
-#endif // defined(WIN64EXCEPTIONS) && defined(FEATURE_PAL)
+#endif // FEATURE_PAL
// DacAllocVirtual - Allocate memory from the target process
// Note: this is only available to clients supporting the legacy
diff --git a/src/debug/daccess/enummem.cpp b/src/debug/daccess/enummem.cpp
index 068c2f2b13..d66af05769 100644
--- a/src/debug/daccess/enummem.cpp
+++ b/src/debug/daccess/enummem.cpp
@@ -250,9 +250,9 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
ReportMem(m_globalBase + g_dacGlobals.SharedDomain__m_pSharedDomain,
sizeof(SharedDomain));
- // We need GCHeap pointer to make EEVersion work
+ // We need IGCHeap pointer to make EEVersion work
ReportMem(m_globalBase + g_dacGlobals.dac__g_pGCHeap,
- sizeof(GCHeap *));
+ sizeof(IGCHeap *));
// see synblk.cpp, the pointer is pointed to a static byte[]
SyncBlockCache::s_pSyncBlockCache.EnumMem();
@@ -292,7 +292,9 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pValueTypeClass.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pEnumClass.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pThreadClass.EnumMem(); )
+#ifdef FEATURE_CER
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pCriticalFinalizerObjectClass.EnumMem(); )
+#endif
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pFreeObjectMethodTable.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pObjectCtorMD.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_fHostConfig.EnumMem(); )
@@ -316,7 +318,7 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
#ifdef FEATURE_SVR_GC
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
(
- GCHeap::gcHeapType.EnumMem();
+ IGCHeap::gcHeapType.EnumMem();
);
#endif // FEATURE_SVR_GC
@@ -796,10 +798,9 @@ HRESULT ClrDataAccess::EnumMemWalkStackHelper(CLRDataEnumMemoryFlags flags,
currentSP = dac_cast<TADDR>(pThread->GetCachedStackLimit()) + sizeof(TADDR);
// exhaust the frames using DAC api
- bool frameHadContext;
for (; status == S_OK; )
{
- frameHadContext = false;
+ bool frameHadContext = false;
status = pStackWalk->GetFrame(&pFrame);
PCODE addr = NULL;
if (status == S_OK && pFrame != NULL)
diff --git a/src/debug/daccess/fntableaccess.cpp b/src/debug/daccess/fntableaccess.cpp
index e7b96ec3e0..6dcd5844e4 100644
--- a/src/debug/daccess/fntableaccess.cpp
+++ b/src/debug/daccess/fntableaccess.cpp
@@ -11,6 +11,7 @@
#include "stdafx.h"
+#ifndef FEATURE_PAL
#ifndef _TARGET_X86_
//
@@ -388,6 +389,7 @@ static NTSTATUS OutOfProcessFunctionTableCallback_Stub(IN ReadMemoryFunction
#endif // DEBUGSUPPORT_STUBS_HAVE_UNWIND_INFO
+
BOOL ReadMemory(PVOID pUserContext, LPCVOID lpBaseAddress, PVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesRead)
{
HANDLE hProcess = (HANDLE)pUserContext;
@@ -456,6 +458,5 @@ extern "C" NTSTATUS OutOfProcessFunctionTableCallbackEx()
return STATUS_UNSUCCESSFUL;
}
-
-
#endif // !_TARGET_X86_
+#endif // !FEATURE_PAL \ No newline at end of file
diff --git a/src/debug/daccess/fntableaccess.h b/src/debug/daccess/fntableaccess.h
index 0dbabdf8c9..b5ea5452f6 100644
--- a/src/debug/daccess/fntableaccess.h
+++ b/src/debug/daccess/fntableaccess.h
@@ -51,6 +51,9 @@ typedef struct _FakeHpRealCodeHdr
LPVOID phdrDebugInfo;
LPVOID phdrJitEHInfo; // changed from EE_ILEXCEPTION*
LPVOID phdrJitGCInfo; // changed from BYTE*
+#if defined (FEATURE_GDBJIT)
+ LPVOID pCalledMethods;
+#endif
LPVOID hdrMDesc; // changed from MethodDesc*
DWORD nUnwindInfos;
T_RUNTIME_FUNCTION unwindInfos[0];
diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp
index 32eab498d3..23e76c4fe4 100644
--- a/src/debug/daccess/nidump.cpp
+++ b/src/debug/daccess/nidump.cpp
@@ -1187,12 +1187,12 @@ NativeImageDumper::DumpNativeImage()
mscorlib->fIsMscorlib = TRUE;
_ASSERTE(mscorlib->fIsHardbound);
}
+
+ _ASSERTE(mscorlib != NULL);
if( mscorlib->fIsHardbound )
{
m_isMscorlibHardBound = true;
}
-
- _ASSERTE(mscorlib != NULL);
if( m_isMscorlibHardBound )
{
//go through the module to the binder.
@@ -3120,7 +3120,7 @@ void NativeImageDumper::DumpCompleteMethod(PTR_Module module, MethodIterator& mi
#ifdef _TARGET_X86_
InfoHdr hdr;
stringOutFn( "method info Block:\n" );
- curGCInfoPtr += gcDump.DumpInfoHdr(PTR_CBYTE(gcInfoToken.Info), &hdr, &methodSize, 0);
+ curGCInfoPtr += gcDump.DumpInfoHdr(curGCInfoPtr, &hdr, &methodSize, 0);
stringOutFn( "\n" );
#endif
@@ -4088,6 +4088,7 @@ void NativeImageDumper::DumpModule( PTR_Module module )
(int)(module->m_maxDynamicEntries
* sizeof(*(module->m_pDynamicStaticsInfo))));
+#ifdef FEATURE_CER
DisplayWriteFieldInt( m_dwReliabilityContract,
module->m_dwReliabilityContract, Module, MODULE );
@@ -4105,6 +4106,7 @@ void NativeImageDumper::DumpModule( PTR_Module module )
offsetof(Module, m_pCerNgenRootTable),
fieldsize(Module, m_pCerNgenRootTable) );
}
+#endif
_ASSERTE(module->m_debuggerSpecificData.m_pDynamicILCrst == NULL);
@@ -4152,6 +4154,7 @@ bool NativeImageDumper::isPrecode(TADDR maybePrecode)
return !!module->IsZappedPrecode(maybePrecode);
}
+#ifdef FEATURE_CER
void NativeImageDumper::DumpNgenRootTable( PTR_CerNgenRootTable table,
const char * name, unsigned offset,
unsigned fieldSize )
@@ -4231,6 +4234,8 @@ void NativeImageDumper::DumpNgenRootTable( PTR_CerNgenRootTable table,
DisplayEndStructure( MODULE ); //CERNgenRootTable
}
+#endif // FEATURE_CER
+
void NativeImageDumper::IterateTypeDefToMTCallback( TADDR mtTarget,
TADDR flags,
PTR_LookupMapBase map,
@@ -9034,12 +9039,14 @@ NativeImageDumper::DumpEEClassForMethodTable( PTR_MethodTable mt )
DisplayWriteFieldInt( m_cbModuleDynamicID, pClassOptional->m_cbModuleDynamicID,
EEClassOptionalFields, EECLASSES );
+#ifdef FEATURE_CER
/* REVISIT_TODO Fri 10/14/2005
* Use the macros from ConstrainedExecutionRegion.cpp on this?
*/
DisplayWriteFieldUInt( m_dwReliabilityContract,
clazz->GetReliabilityContract(),
EEClassOptionalFields, EECLASSES );
+#endif
DisplayWriteFieldEnumerated( m_SecProps, clazz->GetSecurityProperties()->dwFlags,
EEClassOptionalFields, s_SecurityProperties, W("|"),
@@ -9439,10 +9446,12 @@ void NativeImageDumper::DumpReadyToRunMethod(PCODE pEntryPoint, PTR_RUNTIME_FUNC
g_holdStringOutData.Clear();
GCDump gcDump(GCINFO_VERSION);
gcDump.gcPrintf = stringOutFn;
-#if !defined(_TARGET_X86_) && defined(USE_GC_INFO_DECODER)
UINT32 r2rversion = m_pReadyToRunHeader->MajorVersion;
UINT32 gcInfoVersion = GCInfoToken::ReadyToRunVersionToGcInfoVersion(r2rversion);
- GcInfoDecoder gcInfoDecoder({ curGCInfoPtr, gcInfoVersion }, DECODE_CODE_LENGTH);
+ GCInfoToken gcInfoToken = { curGCInfoPtr, gcInfoVersion };
+
+#if !defined(_TARGET_X86_) && defined(USE_GC_INFO_DECODER)
+ GcInfoDecoder gcInfoDecoder(gcInfoToken, DECODE_CODE_LENGTH);
methodSize = gcInfoDecoder.GetCodeLength();
#endif
@@ -9541,8 +9550,10 @@ mdTypeRef NativeImageDumper::FindTypeRefForMT( PTR_MethodTable mt )
#undef GC_NOTRIGGER
#if defined _DEBUG && defined _TARGET_X86_
+#ifdef _MSC_VER
// disable FPO for checked build
#pragma optimize("y", off)
+#endif // _MSC_VER
#endif
#undef _ASSERTE
diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp
index a30ec37eac..35ab5a0814 100644
--- a/src/debug/daccess/request.cpp
+++ b/src/debug/daccess/request.cpp
@@ -725,7 +725,7 @@ ClrDataAccess::GetHeapAllocData(unsigned int count, struct DacpGenerationAllocDa
SOSDacEnter();
#if defined(FEATURE_SVR_GC)
- if (GCHeap::IsServerHeap())
+ if (GCHeapUtilities::IsServerHeap())
{
hr = GetServerAllocData(count, data, pNeeded);
}
@@ -2809,7 +2809,7 @@ ClrDataAccess::GetGCHeapDetails(CLRDATA_ADDRESS heap, struct DacpGcHeapDetails *
SOSDacEnter();
// doesn't make sense to call this on WKS mode
- if (!GCHeap::IsServerHeap())
+ if (!GCHeapUtilities::IsServerHeap())
hr = E_INVALIDARG;
else
#ifdef FEATURE_SVR_GC
@@ -2884,7 +2884,7 @@ ClrDataAccess::GetHeapSegmentData(CLRDATA_ADDRESS seg, struct DacpHeapSegmentDat
SOSDacEnter();
- if (GCHeap::IsServerHeap())
+ if (GCHeapUtilities::IsServerHeap())
{
#if !defined(FEATURE_SVR_GC)
_ASSERTE(0);
@@ -2924,7 +2924,7 @@ ClrDataAccess::GetGCHeapList(unsigned int count, CLRDATA_ADDRESS heaps[], unsign
SOSDacEnter();
// make sure we called this in appropriate circumstances (i.e., we have multiple heaps)
- if (GCHeap::IsServerHeap())
+ if (GCHeapUtilities::IsServerHeap())
{
#if !defined(FEATURE_SVR_GC)
_ASSERTE(0);
@@ -2960,45 +2960,49 @@ ClrDataAccess::GetGCHeapData(struct DacpGcHeapData *gcheapData)
SOSDacEnter();
- // Now get the heap type. The first data member of the GCHeap class is the GC_HEAP_TYPE, which has
- // three possible values:
+ // for server GC-capable builds only, we need to check and see if IGCHeap::gcHeapType
+ // is GC_HEAP_INVALID, in which case we fail.
+ // IGCHeap::gcHeapType doesn't exist on non-server-GC capable builds.
+#ifdef FEATURE_SVR_GC
+ ULONG32 gcHeapValue = IGCHeap::gcHeapType;
+
+ // GC_HEAP_TYPE has three possible values:
// GC_HEAP_INVALID = 0,
// GC_HEAP_WKS = 1,
// GC_HEAP_SVR = 2
+ // If we get something other than that, we probably read the wrong location.
+ _ASSERTE(gcHeapValue >= IGCHeap::GC_HEAP_INVALID && gcHeapValue <= IGCHeap::GC_HEAP_SVR);
- TADDR gcHeapLocation = g_pGCHeap.GetAddrRaw (); // get the starting address of the global GCHeap instance
- size_t gcHeapValue = 0; // this will hold the heap type
- ULONG32 returned = 0;
-
- // @todo Microsoft: we should probably be capturing the HRESULT from ReadVirtual. We could
- // provide a more informative error message. E_FAIL is a wretchedly vague thing to return.
- hr = m_pTarget->ReadVirtual(gcHeapLocation, (PBYTE)&gcHeapValue, sizeof(gcHeapValue), &returned);
-
- //@todo Microsoft: We have an enumerated type, we probably should use the symbolic name
// we have GC_HEAP_INVALID if gcHeapValue == 0, so we're done
- if (SUCCEEDED(hr) && ((returned != sizeof(gcHeapValue)) || (gcHeapValue == 0)))
+ if (gcHeapValue == IGCHeap::GC_HEAP_INVALID)
+ {
hr = E_FAIL;
+ goto cleanup;
+ }
+#endif
- if (SUCCEEDED(hr))
+ // Now we can get other important information about the heap
+ gcheapData->g_max_generation = GCHeapUtilities::GetMaxGeneration();
+ gcheapData->bServerMode = GCHeapUtilities::IsServerHeap();
+ gcheapData->bGcStructuresValid = GCScan::GetGcRuntimeStructuresValid();
+ if (GCHeapUtilities::IsServerHeap())
{
- // Now we can get other important information about the heap
- gcheapData->g_max_generation = GCHeap::GetMaxGeneration();
- gcheapData->bServerMode = GCHeap::IsServerHeap();
- gcheapData->bGcStructuresValid = GCScan::GetGcRuntimeStructuresValid();
- if (GCHeap::IsServerHeap())
- {
#if !defined (FEATURE_SVR_GC)
- _ASSERTE(0);
- gcheapData->HeapCount = 1;
+ _ASSERTE(0);
+ gcheapData->HeapCount = 1;
#else // !defined (FEATURE_SVR_GC)
- gcheapData->HeapCount = GCHeapCount();
+ gcheapData->HeapCount = GCHeapCount();
#endif // !defined (FEATURE_SVR_GC)
- }
- else
- {
- gcheapData->HeapCount = 1;
- }
}
+ else
+ {
+ gcheapData->HeapCount = 1;
+ }
+
+#ifdef FEATURE_SVR_GC
+cleanup:
+ ;
+#endif
SOSDacLeave();
return hr;
@@ -3014,7 +3018,7 @@ ClrDataAccess::GetOOMStaticData(struct DacpOomData *oomData)
memset(oomData, 0, sizeof(DacpOomData));
- if (!GCHeap::IsServerHeap())
+ if (!GCHeapUtilities::IsServerHeap())
{
oom_history* pOOMInfo = &(WKS::gc_heap::oom_info);
oomData->reason = pOOMInfo->reason;
@@ -3043,7 +3047,7 @@ ClrDataAccess::GetOOMData(CLRDATA_ADDRESS oomAddr, struct DacpOomData *data)
SOSDacEnter();
memset(data, 0, sizeof(DacpOomData));
- if (!GCHeap::IsServerHeap())
+ if (!GCHeapUtilities::IsServerHeap())
hr = E_FAIL; // doesn't make sense to call this on WKS mode
#ifdef FEATURE_SVR_GC
@@ -3090,7 +3094,7 @@ ClrDataAccess::GetGCInterestingInfoStaticData(struct DacpGCInterestingInfoData *
SOSDacEnter();
memset(data, 0, sizeof(DacpGCInterestingInfoData));
- if (!GCHeap::IsServerHeap())
+ if (!GCHeapUtilities::IsServerHeap())
{
for (int i = 0; i < NUM_GC_DATA_POINTS; i++)
data->interestingDataPoints[i] = WKS::interesting_data_per_heap[i];
@@ -3123,7 +3127,7 @@ ClrDataAccess::GetGCInterestingInfoData(CLRDATA_ADDRESS interestingInfoAddr, str
SOSDacEnter();
memset(data, 0, sizeof(DacpGCInterestingInfoData));
- if (!GCHeap::IsServerHeap())
+ if (!GCHeapUtilities::IsServerHeap())
hr = E_FAIL; // doesn't make sense to call this on WKS mode
#ifdef FEATURE_SVR_GC
@@ -3149,7 +3153,7 @@ ClrDataAccess::GetHeapAnalyzeData(CLRDATA_ADDRESS addr, struct DacpGcHeapAnalyz
SOSDacEnter();
- if (!GCHeap::IsServerHeap())
+ if (!GCHeapUtilities::IsServerHeap())
hr = E_FAIL; // doesn't make sense to call this on WKS mode
#ifdef FEATURE_SVR_GC
@@ -3856,7 +3860,7 @@ ClrDataAccess::EnumWksGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
// enumerating the generations from max (which is normally gen2) to max+1 gives you
// the segment list for all the normal segements plus the large heap segment (max+1)
// this is the convention in the GC so it is repeated here
- for (ULONG i = GCHeap::GetMaxGeneration(); i <= GCHeap::GetMaxGeneration()+1; i++)
+ for (ULONG i = GCHeapUtilities::GetMaxGeneration(); i <= GCHeapUtilities::GetMaxGeneration()+1; i++)
{
__DPtr<WKS::heap_segment> seg = dac_cast<TADDR>(WKS::generation_table[i].start_segment);
while (seg)
diff --git a/src/debug/daccess/request_svr.cpp b/src/debug/daccess/request_svr.cpp
index 429f30020f..1fe20e2b60 100644
--- a/src/debug/daccess/request_svr.cpp
+++ b/src/debug/daccess/request_svr.cpp
@@ -256,7 +256,7 @@ ClrDataAccess::EnumSvrGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
// enumerating the generations from max (which is normally gen2) to max+1 gives you
// the segment list for all the normal segements plus the large heap segment (max+1)
// this is the convention in the GC so it is repeated here
- for (ULONG i = GCHeap::GetMaxGeneration(); i <= GCHeap::GetMaxGeneration()+1; i++)
+ for (ULONG i = GCHeapUtilities::GetMaxGeneration(); i <= GCHeapUtilities::GetMaxGeneration()+1; i++)
{
__DPtr<SVR::heap_segment> seg = dac_cast<TADDR>(pHeap->generation_table[i].start_segment);
while (seg)
@@ -271,7 +271,7 @@ ClrDataAccess::EnumSvrGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
DWORD DacGetNumHeaps()
{
- if (GCHeap::IsServerHeap())
+ if (GCHeapUtilities::IsServerHeap())
return (DWORD)SVR::gc_heap::n_heaps;
// workstation gc