summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Gillespie <sean.william.g@gmail.com>2016-10-02 11:26:23 -0700
committerGitHub <noreply@github.com>2016-10-02 11:26:23 -0700
commit89bf443d2787e1b4754718bf28e71da248ea7727 (patch)
treebc821c5ed14fc7b18a06804b92a9b544d8e72d96 /src
parent64094911ff730f904fd4a70d59f2a64b9b6408c2 (diff)
downloadcoreclr-89bf443d2787e1b4754718bf28e71da248ea7727.tar.gz
coreclr-89bf443d2787e1b4754718bf28e71da248ea7727.tar.bz2
coreclr-89bf443d2787e1b4754718bf28e71da248ea7727.zip
Fix a bug where the DAC read four more bytes than necessary (#7430)
to retrieve gcHeapType, which failed on crash dumps.
Diffstat (limited to 'src')
-rw-r--r--src/debug/daccess/request.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp
index e38befafa7..35ab5a0814 100644
--- a/src/debug/daccess/request.cpp
+++ b/src/debug/daccess/request.cpp
@@ -2962,31 +2962,19 @@ ClrDataAccess::GetGCHeapData(struct DacpGcHeapData *gcheapData)
// 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.'
+ // IGCHeap::gcHeapType doesn't exist on non-server-GC capable builds.
#ifdef FEATURE_SVR_GC
- size_t gcHeapValue = 0;
- ULONG32 returned = 0;
-
- TADDR gcHeapTypeLocation = m_globalBase + g_dacGlobals.IGCHeap__gcHeapType;
-
- // @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(gcHeapTypeLocation, (PBYTE)&gcHeapValue, sizeof(gcHeapValue), &returned);
- if (!SUCCEEDED(hr))
- {
- goto cleanup;
- }
+ 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 >= 0 && gcHeapValue <= 2);
+ _ASSERTE(gcHeapValue >= IGCHeap::GC_HEAP_INVALID && gcHeapValue <= IGCHeap::GC_HEAP_SVR);
- //@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;