summaryrefslogtreecommitdiff
path: root/src/debug/daccess/enummem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug/daccess/enummem.cpp')
-rw-r--r--src/debug/daccess/enummem.cpp103
1 files changed, 49 insertions, 54 deletions
diff --git a/src/debug/daccess/enummem.cpp b/src/debug/daccess/enummem.cpp
index 027fe59543..9305bba488 100644
--- a/src/debug/daccess/enummem.cpp
+++ b/src/debug/daccess/enummem.cpp
@@ -22,6 +22,10 @@
#include "binder.h"
#include "win32threadpool.h"
+#ifdef FEATURE_PAL
+#include <dactablerva.h>
+#endif
+
#ifdef FEATURE_APPX
#include "appxutil.h"
#endif // FEATURE_APPX
@@ -220,6 +224,11 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
#define DEFINE_DACVAR_SVR(id_type, size_type, id, var) \
ReportMem(m_globalBase + g_dacGlobals.id, sizeof(size_type));
+#ifdef FEATURE_PAL
+ // Add the dac table memory in coreclr
+ CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED ( ReportMem(m_globalBase + DAC_TABLE_RVA, sizeof(g_dacGlobals)); )
+#endif
+
// Cannot use CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
// around conditional preprocessor directives in a sane fashion.
EX_TRY
@@ -233,39 +242,33 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
}
EX_END_CATCH(RethrowCancelExceptions)
- CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
- (
- // StressLog is not defined on Rotor build for DAC
- ReportMem(m_globalBase + g_dacGlobals.dac__g_pStressLog, sizeof(StressLog *));
- );
+ // StressLog is not defined on Rotor build for DAC
+ CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED ( ReportMem(m_globalBase + g_dacGlobals.dac__g_pStressLog, sizeof(StressLog *)); )
EX_TRY
{
// These two static pointers are pointed to static data of byte[]
// then run constructor in place
//
- ReportMem(m_globalBase + g_dacGlobals.SystemDomain__m_pSystemDomain,
- sizeof(SystemDomain));
- ReportMem(m_globalBase + g_dacGlobals.SharedDomain__m_pSharedDomain,
- sizeof(SharedDomain));
+ ReportMem(m_globalBase + g_dacGlobals.SystemDomain__m_pSystemDomain, sizeof(SystemDomain));
+ ReportMem(m_globalBase + g_dacGlobals.SharedDomain__m_pSharedDomain, sizeof(SharedDomain));
// We need IGCHeap pointer to make EEVersion work
- ReportMem(m_globalBase + g_dacGlobals.dac__g_pGCHeap,
- sizeof(IGCHeap *));
+ ReportMem(m_globalBase + g_dacGlobals.dac__g_pGCHeap, sizeof(IGCHeap *));
// see synblk.cpp, the pointer is pointed to a static byte[]
SyncBlockCache::s_pSyncBlockCache.EnumMem();
#ifndef FEATURE_IMPLICIT_TLS
- ReportMem(m_globalBase + g_dacGlobals.dac__gThreadTLSIndex,
- sizeof(DWORD));
- ReportMem(m_globalBase + g_dacGlobals.dac__gAppDomainTLSIndex,
- sizeof(DWORD));
+ ReportMem(m_globalBase + g_dacGlobals.dac__gThreadTLSIndex, sizeof(DWORD));
+ ReportMem(m_globalBase + g_dacGlobals.dac__gAppDomainTLSIndex, sizeof(DWORD));
#endif
- ReportMem( m_globalBase + g_dacGlobals.dac__g_FCDynamicallyAssignedImplementations,
+ ReportMem(m_globalBase + g_dacGlobals.dac__g_FCDynamicallyAssignedImplementations,
sizeof(TADDR)*ECall::NUM_DYNAMICALLY_ASSIGNED_FCALL_IMPLEMENTATIONS);
+ ReportMem(g_gcDacGlobals.GetAddr(), sizeof(GcDacVars));
+
// We need all of the dac variables referenced by the GC DAC global struct.
// This struct contains pointers to pointers, so we first dereference the pointers
// to obtain the location of the variable that's reported.
@@ -316,11 +319,8 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( StubManager::EnumMemoryRegions(flags); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pFinalizerThread.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pSuspensionThread.EnumMem(); )
-
- CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
- (
- g_heap_type.EnumMem();
- );
+
+ CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_heap_type.EnumMem(); )
m_dumpStats.m_cbClrStatics = m_cbMemoryReported - cbMemoryReported;
@@ -345,8 +345,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerHeap(IN CLRDataEnumMemoryFlags fla
HRESULT status = S_OK;
- m_instances.ClearEnumMemMarker();
-
// clear all of the previous cached memory
Flush();
@@ -365,7 +363,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerHeap(IN CLRDataEnumMemoryFlags fla
// would be true, but I don't think we have that guarantee here.
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpModuleList(flags); );
-#ifdef FEATURE_LAZY_COW_PAGES
// Iterating to all threads' stacks, as we have to collect data stored inside (core)clr.dll
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpAllThreadsStack(flags); )
@@ -377,11 +374,11 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerHeap(IN CLRDataEnumMemoryFlags fla
// now dump the memory get dragged in by using DAC API implicitly.
m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
-#endif // FEATURE_LAZY_COW_PAGES
-
- // end of code
status = m_memStatus;
+ // Do not let any remaining implicitly enumerated memory leak out.
+ Flush();
+
return S_OK;
} // EnumMemoryRegionsWorkerHeap
@@ -976,16 +973,19 @@ HRESULT ClrDataAccess::EnumMemWalkStackHelper(CLRDataEnumMemoryFlags flags,
{
EECodeInfo codeInfo(addr);
- // We want IsFilterFunclet to work for anything on the stack
- codeInfo.GetJitManager()->IsFilterFunclet(&codeInfo);
-
- // The stackwalker needs GC info to find the parent 'stack pointer' or PSP
- GCInfoToken gcInfoToken = codeInfo.GetGCInfoToken();
- PTR_BYTE pGCInfo = dac_cast<PTR_BYTE>(gcInfoToken.Info);
- if (pGCInfo != NULL)
+ if (codeInfo.IsValid())
{
- GcInfoDecoder gcDecoder(gcInfoToken, DECODE_PSP_SYM, 0);
- DacEnumMemoryRegion(dac_cast<TADDR>(pGCInfo), gcDecoder.GetNumBytesRead(), true);
+ // We want IsFilterFunclet to work for anything on the stack
+ codeInfo.GetJitManager()->IsFilterFunclet(&codeInfo);
+
+ // The stackwalker needs GC info to find the parent 'stack pointer' or PSP
+ GCInfoToken gcInfoToken = codeInfo.GetGCInfoToken();
+ PTR_BYTE pGCInfo = dac_cast<PTR_BYTE>(gcInfoToken.Info);
+ if (pGCInfo != NULL)
+ {
+ GcInfoDecoder gcDecoder(gcInfoToken, DECODE_PSP_SYM, 0);
+ DacEnumMemoryRegion(dac_cast<TADDR>(pGCInfo), gcDecoder.GetNumBytesRead(), true);
+ }
}
}
#endif // WIN64EXCEPTIONS && USE_GC_INFO_DECODER
@@ -1603,10 +1603,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerSkinny(IN CLRDataEnumMemoryFlags f
// collect CLR static
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemCLRStatic(flags); )
- // now dump the memory get dragged in by using DAC API implicitly.
- m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
- status = m_memStatus;
-
// Dump AppDomain-specific info needed for MiniDumpNormal.
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpAppDomainInfo(flags); )
@@ -1618,6 +1614,10 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerSkinny(IN CLRDataEnumMemoryFlags f
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( EnumStreams(flags); )
#endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+ // now dump the memory get dragged in by using DAC API implicitly.
+ m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
+ status = m_memStatus;
+
// Do not let any remaining implicitly enumerated memory leak out.
Flush();
@@ -1654,10 +1654,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerMicroTriage(IN CLRDataEnumMemoryFl
// collect CLR static
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemCLRStatic(flags); )
- // now dump the memory get dragged in by using DAC API implicitly.
- m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
- status = m_memStatus;
-
// Dump AppDomain-specific info needed for triage dumps methods enumeration (k command).
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpAppDomainInfo(flags); )
@@ -1669,6 +1665,10 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerMicroTriage(IN CLRDataEnumMemoryFl
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( EnumStreams(flags); )
#endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+ // now dump the memory get dragged in by using DAC API implicitly.
+ m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
+ status = m_memStatus;
+
// Do not let any remaining implicitly enumerated memory leak out.
Flush();
@@ -1847,17 +1847,17 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWrapper(IN CLRDataEnumMemoryFlags flags)
// The various EnumMemoryRegions() implementations should understand
// CLRDATA_ENUM_MEM_MINI to mean that the bare minimimum memory
// to make a MiniDumpNormal work should be included.
- if ( flags == CLRDATA_ENUM_MEM_MINI)
+ if (flags == CLRDATA_ENUM_MEM_MINI)
{
// skinny mini-dump
status = EnumMemoryRegionsWorkerSkinny(flags);
}
- else if ( flags == CLRDATA_ENUM_MEM_TRIAGE)
+ else if (flags == CLRDATA_ENUM_MEM_TRIAGE)
{
// triage micro-dump
status = EnumMemoryRegionsWorkerMicroTriage(flags);
}
- else if ( flags == CLRDATA_ENUM_MEM_HEAP)
+ else if (flags == CLRDATA_ENUM_MEM_HEAP)
{
status = EnumMemoryRegionsWorkerHeap(flags);
}
@@ -1874,12 +1874,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWrapper(IN CLRDataEnumMemoryFlags flags)
return status;
}
-#define MiniDumpWithPrivateReadWriteMemory 0x00000200
-#define MiniDumpWithFullAuxiliaryState 0x00008000
-#define MiniDumpFilterTriage 0x00100000
-
-
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Entry function for generating CLR aware dump. This function is called
@@ -1972,6 +1966,7 @@ ClrDataAccess::EnumMemoryRegions(IN ICLRDataEnumMemoryRegionsCallback* callback,
status = EnumMemoryRegionsWrapper(CLRDATA_ENUM_MEM_MINI);
}
+#ifndef FEATURE_PAL
// For all dump types, we need to capture the chain to the IMAGE_DIRECTORY_ENTRY_DEBUG
// contents, so that DAC can validate against the TimeDateStamp even if the
// debugger can't find the main CLR module on disk.
@@ -1986,7 +1981,7 @@ ClrDataAccess::EnumMemoryRegions(IN ICLRDataEnumMemoryRegionsCallback* callback,
m_instances.DumpAllInstances(m_enumMemCb);
}
}
-
+#endif
Flush();
}
EX_CATCH