Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updates from runtime changes
  • Loading branch information
davmason committed Jun 17, 2020
commit 2b2059700ac00fd654631ffb6ca04bc6192128cc
44 changes: 14 additions & 30 deletions src/SOS/Strike/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,32 +314,12 @@ class GCHeapDetails
{
HRESULT hr = S_OK;
bool success = false;
unsigned int generationCount;
ReleaseHolder<ISOSDacInterface8> sos8;
if (SUCCEEDED(hr = g_sos->QueryInterface(__uuidof(ISOSDacInterface8), &sos8)))
{
if (svrHeapAddr == NULL)
{
hr = sos8->GetGenerationTable(0, NULL, &generationCount);
if (SUCCEEDED(hr) || hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
{
success = true;
*count = generationCount;
}
}
else
{
hr = sos8->GetGenerationTableSvr(svrHeapAddr, 0, NULL, &generationCount);
if (SUCCEEDED(hr) || hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
{
success = true;
*count = generationCount;
}
}
}

if (!success)
if (!SUCCEEDED(hr = g_sos->QueryInterface(__uuidof(ISOSDacInterface8), &sos8))
|| !SUCCEEDED(hr = sos8->GetNumberGenerations(count)))
{
// The runtime will either have the original 4 generations or implement ISOSDacInterface8
// if the call succeeded, count is already populated.
*count = DAC_NUMBERGENERATIONS;
}
}
Expand All @@ -357,15 +337,17 @@ class GCHeapDetails
{
if (svrHeapAddr == NULL)
{
if (SUCCEEDED(hr = sos8->GetGenerationTable(count, data, &generationCount)))
if (SUCCEEDED(hr = sos8->GetGenerationTable(count, data, &generationCount))
&& hr != S_FALSE)
{
success = true;
// Nothing else to do, data is already populated
}
}
else
{
if (SUCCEEDED(hr = sos8->GetGenerationTableSvr(svrHeapAddr, count, data, &generationCount)))
if (SUCCEEDED(hr = sos8->GetGenerationTableSvr(svrHeapAddr, count, data, &generationCount))
&& hr != S_FALSE)
{
success = true;
// Nothing else to do, data is already populated
Expand All @@ -378,7 +360,7 @@ class GCHeapDetails
if (!success)
{
// This would mean that there are additional, unaccounted for, generations
_ASSERTE(hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER));
_ASSERTE(hr != S_FALSE);

// We couldn't get any data from the newer APIs, so fall back to the original data
memcpy(data, &(heap.generation_table), sizeof(DacpGenerationData) * DAC_NUMBERGENERATIONS);
Expand All @@ -398,15 +380,17 @@ class GCHeapDetails
{
if (svrHeapAddr == NULL)
{
if (SUCCEEDED(hr = sos8->GetFinalizationFillPointers(count, data, &fillPointersCount)))
if (SUCCEEDED(hr = sos8->GetFinalizationFillPointers(count, data, &fillPointersCount))
&& hr != S_FALSE)
{
success = true;
// Nothing else to do, data is already populated
}
}
else
{
if (SUCCEEDED(hr = sos8->GetFinalizationFillPointersSvr(svrHeapAddr, count, data, &fillPointersCount)))
if (SUCCEEDED(hr = sos8->GetFinalizationFillPointersSvr(svrHeapAddr, count, data, &fillPointersCount))
&& hr != S_FALSE)
{
success = true;
// Nothing else to do, data is already populated
Expand All @@ -419,7 +403,7 @@ class GCHeapDetails
if (!success)
{
// This would mean that there are additional, unaccounted for, generations
_ASSERTE(hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER));
_ASSERTE(hr != S_FALSE);

// We couldn't get any data from the newer APIs, so fall back to the original data
memcpy(data, &(heap.finalization_fill_pointers), sizeof(CLRDATA_ADDRESS) * (DAC_NUMBERGENERATIONS + 3));
Expand Down
2 changes: 2 additions & 0 deletions src/inc/sospriv.idl
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ interface ISOSDacInterface7 : IUnknown
]
interface ISOSDacInterface8 : IUnknown
{
HRESULT GetNumberGenerations(unsigned int *pGenerations);

// WKS
HRESULT GetGenerationTable(unsigned int cGenerations, struct DacpGenerationData *pGenerationData, unsigned int *pNeeded);
HRESULT GetFinalizationFillPointers(unsigned int cFillPointers, CLRDATA_ADDRESS *pFinalizationFillPointers, unsigned int *pNeeded);
Expand Down
12 changes: 11 additions & 1 deletion src/pal/prebuilt/inc/sospriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* File created by MIDL compiler version 8.01.0622 */
/* at Mon Jan 18 19:14:07 2038
*/
/* Compiler settings for C:/git/diagnostics/src/inc/sospriv.idl:
/* Compiler settings for C:/git/runtime/src/coreclr/src/inc/sospriv.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
Expand Down Expand Up @@ -2523,6 +2523,9 @@ EXTERN_C const IID IID_ISOSDacInterface8;
ISOSDacInterface8 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetNumberGenerations(
unsigned int *pGenerations) = 0;

virtual HRESULT STDMETHODCALLTYPE GetGenerationTable(
unsigned int cGenerations,
struct DacpGenerationData *pGenerationData,
Expand Down Expand Up @@ -2566,6 +2569,10 @@ EXTERN_C const IID IID_ISOSDacInterface8;
ULONG ( STDMETHODCALLTYPE *Release )(
ISOSDacInterface8 * This);

HRESULT ( STDMETHODCALLTYPE *GetNumberGenerations )(
ISOSDacInterface8 * This,
unsigned int *pGenerations);

HRESULT ( STDMETHODCALLTYPE *GetGenerationTable )(
ISOSDacInterface8 * This,
unsigned int cGenerations,
Expand Down Expand Up @@ -2615,6 +2622,9 @@ EXTERN_C const IID IID_ISOSDacInterface8;
( (This)->lpVtbl -> Release(This) )


#define ISOSDacInterface8_GetNumberGenerations(This,pGenerations) \
( (This)->lpVtbl -> GetNumberGenerations(This,pGenerations) )

#define ISOSDacInterface8_GetGenerationTable(This,cGenerations,pGenerationData,pNeeded) \
( (This)->lpVtbl -> GetGenerationTable(This,cGenerations,pGenerationData,pNeeded) )

Expand Down