diff --git a/src/SOS/Strike/eeheap.cpp b/src/SOS/Strike/eeheap.cpp index 52458e5e69..be5b785715 100644 --- a/src/SOS/Strike/eeheap.cpp +++ b/src/SOS/Strike/eeheap.cpp @@ -3,13 +3,14 @@ // See the LICENSE file in the project root for more information. // ==++== -// - -// +// + +// // ==--== #include #include "sos.h" #include "safemath.h" +#include "holder.h" // This is the increment for the segment lookup data @@ -20,7 +21,7 @@ const int nSegLookupStgIncrement = 100; /**********************************************************************\ * Routine Description: * * * -* This function is called to update GC heap statistics. * +* This function is called to update GC heap statistics. * * * \**********************************************************************/ void HeapStat::Add(DWORD_PTR aData, DWORD aSize) @@ -34,19 +35,19 @@ void HeapStat::Add(DWORD_PTR aData, DWORD aSize) ControlC = TRUE; return; } - + if (bHasStrings) { size_t capacity_pNew = _wcslen((WCHAR*)aData) + 1; WCHAR *pNew = new WCHAR[capacity_pNew]; if (pNew == NULL) { - ReportOOM(); + ReportOOM(); ControlC = TRUE; return; } wcscpy_s(pNew, capacity_pNew, (WCHAR*)aData); - aData = (DWORD_PTR)pNew; + aData = (DWORD_PTR)pNew; } head->data = aData; @@ -58,12 +59,12 @@ void HeapStat::Add(DWORD_PTR aData, DWORD aSize) { if (IsInterrupt()) return; - - cmp = CompareData(aData, walk->data); + + cmp = CompareData(aData, walk->data); if (cmp == 0) break; - + if (cmp < 0) { if (walk->left == NULL) @@ -88,7 +89,7 @@ void HeapStat::Add(DWORD_PTR aData, DWORD aSize) Node *node = new Node(); if (node == NULL) { - ReportOOM(); + ReportOOM(); ControlC = TRUE; return; } @@ -104,10 +105,10 @@ void HeapStat::Add(DWORD_PTR aData, DWORD aSize) return; } wcscpy_s(pNew, capacity_pNew, (WCHAR*)aData); - aData = (DWORD_PTR)pNew; + aData = (DWORD_PTR)pNew; } - - node->data = aData; + + node->data = aData; node->totalSize = aSize; node->count ++; @@ -124,7 +125,7 @@ void HeapStat::Add(DWORD_PTR aData, DWORD aSize) /**********************************************************************\ * Routine Description: * * * -* This function compares two nodes in the tree. * +* This function compares two nodes in the tree. * * * \**********************************************************************/ int HeapStat::CompareData(DWORD_PTR d1, DWORD_PTR d2) @@ -138,13 +139,13 @@ int HeapStat::CompareData(DWORD_PTR d1, DWORD_PTR d2) if (d1 < d2) return -1; - return 0; + return 0; } /**********************************************************************\ * Routine Description: * * * -* This function is called to sort all entries in the heap stat. * +* This function is called to sort all entries in the heap stat. * * * \**********************************************************************/ void HeapStat::Sort () @@ -220,7 +221,7 @@ void HeapStat::ReverseLeftMost (Node *root) /**********************************************************************\ * Routine Description: * * * -* This function is called to help to sort heap stat. * +* This function is called to help to sort heap stat. * * * \**********************************************************************/ void HeapStat::SortAdd (Node *&root, Node *entry) @@ -264,7 +265,7 @@ void HeapStat::LinearAdd(Node *&root, Node *entry) /**********************************************************************\ * Routine Description: * * * -* This function is called to print GC heap statistics. * +* This function is called to print GC heap statistics. * * * \**********************************************************************/ void HeapStat::Print(const char* label /* = NULL */) @@ -285,7 +286,7 @@ void HeapStat::Print(const char* label /* = NULL */) { if (IsInterrupt()) return; - + ncount += root->count; if (bHasStrings) @@ -307,7 +308,7 @@ void HeapStat::Print(const char* label /* = NULL */) } } root = root->right; - + } ExtOut ("Total %d objects\n", ncount); } @@ -352,14 +353,14 @@ MethodTableInfo* MethodTableCache::Lookup (DWORD_PTR aData) for (;;) { - cmp = CompareData(aData, walk->data); + cmp = CompareData(aData, walk->data); if (cmp == 0) return &walk->info; - + if (cmp < 0) { - if (walk->left == NULL) + if (walk->left == NULL) { addHere = &walk->left; break; @@ -390,7 +391,7 @@ MethodTableInfo* MethodTableCache::Lookup (DWORD_PTR aData) /**********************************************************************\ * Routine Description: * * * -* This function compares two nodes in the tree. * +* This function compares two nodes in the tree. * * * \**********************************************************************/ int MethodTableCache::CompareData(DWORD_PTR d1, DWORD_PTR d2) @@ -401,7 +402,7 @@ int MethodTableCache::CompareData(DWORD_PTR d1, DWORD_PTR d2) if (d1 < d2) return -1; - return 0; + return 0; } void MethodTableCache::ReverseLeftMost (Node *root) @@ -436,10 +437,10 @@ size_t AlignLarge(size_t nbytes) /**********************************************************************\ * Routine Description: * * * -* Print the gc heap info. * +* Print the gc heap info. * * * \**********************************************************************/ -void GCPrintGenerationInfo(const DacpGcHeapDetails &heap) +void GCPrintGenerationInfo(const GCHeapDetails &heap) { UINT n; for (n = 0; n <= GetMaxGeneration(); n ++) @@ -465,19 +466,19 @@ void GCPrintGenerationInfo(const DacpGcHeapDetails &heap) } -void GCPrintSegmentInfo(const DacpGcHeapDetails &heap, DWORD_PTR &total_size) +void GCPrintSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_size) { - DWORD_PTR dwAddrSeg; + DWORD_PTR dwAddrSeg; DacpHeapSegmentData segment; - - dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration()].start_segment; + + dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration()].start_segment; total_size = 0; // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments while (dwAddrSeg != (DWORD_PTR)heap.generation_table[0].start_segment) { if (IsInterrupt()) return; - if (segment.Request(g_sos, dwAddrSeg, heap) != S_OK) + if (segment.Request(g_sos, dwAddrSeg, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddrSeg)); return; @@ -490,24 +491,23 @@ void GCPrintSegmentInfo(const DacpGcHeapDetails &heap, DWORD_PTR &total_size) dwAddrSeg = (DWORD_PTR)segment.next; } - if (segment.Request(g_sos, dwAddrSeg, heap) != S_OK) + if (segment.Request(g_sos, dwAddrSeg, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddrSeg)); return; } - + DWORD_PTR end = (DWORD_PTR)heap.alloc_allocated; ExtOut("%p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n", SOS_PTR(dwAddrSeg), SOS_PTR(segment.mem), SOS_PTR(end), (ULONG_PTR)(end - (DWORD_PTR)segment.mem), (ULONG_PTR)(end - (DWORD_PTR)segment.mem)); - + total_size += end - (DWORD_PTR)segment.mem; } - -void GCPrintLargeHeapSegmentInfo(const DacpGcHeapDetails &heap, DWORD_PTR &total_size) +void GCPrintLargeHeapSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_size) { DWORD_PTR dwAddrSeg; DacpHeapSegmentData segment; @@ -519,7 +519,7 @@ void GCPrintLargeHeapSegmentInfo(const DacpGcHeapDetails &heap, DWORD_PTR &total { if (IsInterrupt()) return; - if (segment.Request(g_sos, dwAddrSeg, heap) != S_OK) + if (segment.Request(g_sos, dwAddrSeg, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddrSeg)); return; @@ -533,18 +533,52 @@ void GCPrintLargeHeapSegmentInfo(const DacpGcHeapDetails &heap, DWORD_PTR &total } } -void GCHeapInfo(const DacpGcHeapDetails &heap, DWORD_PTR &total_size) +void GCPrintPinnedHeapSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_size) +{ + DWORD_PTR dwAddrSeg; + DacpHeapSegmentData segment; + dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration() + 2].start_segment; + + // total_size = 0; + // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments + while (dwAddrSeg != NULL) + { + if (IsInterrupt()) + return; + if (segment.Request(g_sos, dwAddrSeg, heap.original_heap_details) != S_OK) + { + ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddrSeg)); + return; + } + ExtOut("%p %p %p 0x%" POINTERSIZE_TYPE "x(%" POINTERSIZE_TYPE "d)\n", SOS_PTR(dwAddrSeg), + SOS_PTR(segment.mem), SOS_PTR(segment.allocated), + (ULONG_PTR)(segment.allocated - segment.mem), + (ULONG_PTR)(segment.allocated - segment.mem)); + total_size += (DWORD_PTR) (segment.allocated - segment.mem); + dwAddrSeg = (DWORD_PTR)segment.next; + } +} + +void GCHeapInfo(const GCHeapDetails &heap, DWORD_PTR &total_size) { GCPrintGenerationInfo(heap); ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", "segment", "begin", "allocated", "size"); GCPrintSegmentInfo(heap, total_size); + ExtOut("Large object heap starts at 0x%p\n", - SOS_PTR(heap.generation_table[GetMaxGeneration()+1].allocation_start)); + SOS_PTR(heap.generation_table[GetMaxGeneration() + 1].allocation_start)); ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", "segment", "begin", "allocated", "size"); - GCPrintLargeHeapSegmentInfo(heap,total_size); + GCPrintLargeHeapSegmentInfo(heap, total_size); + + if (heap.has_poh) + { + ExtOut("Pinned object heap starts at 0x%p\n", + SOS_PTR(heap.generation_table[GetMaxGeneration() + 2].allocation_start)); + GCPrintPinnedHeapSegmentInfo(heap, total_size); + } } -BOOL GCObjInGeneration(TADDR taddrObj, const DacpGcHeapDetails &heap, +BOOL GCObjInGeneration(TADDR taddrObj, const GCHeapDetails &heap, const TADDR_SEGINFO& /*seg*/, int& gen, TADDR_RANGE& allocCtx) { gen = -1; @@ -558,8 +592,8 @@ BOOL GCObjInGeneration(TADDR taddrObj, const DacpGcHeapDetails &heap, } // We also need to look at the gen0 alloc context. - if (heap.generation_table[0].allocContextPtr - && taddrObj >= TO_TADDR(heap.generation_table[0].allocContextPtr) + if (heap.generation_table[0].allocContextPtr + && taddrObj >= TO_TADDR(heap.generation_table[0].allocContextPtr) && taddrObj < TO_TADDR(heap.generation_table[0].allocContextLimit) + Align(min_obj_size)) { gen = 0; @@ -574,19 +608,19 @@ BOOL GCObjInGeneration(TADDR taddrObj, const DacpGcHeapDetails &heap, } -BOOL GCObjInSegment(TADDR taddrObj, const DacpGcHeapDetails &heap, +BOOL GCObjInSegment(TADDR taddrObj, const GCHeapDetails &heap, TADDR_SEGINFO& rngSeg, int& gen, TADDR_RANGE& allocCtx) { - TADDR taddrSeg; + TADDR taddrSeg; DacpHeapSegmentData dacpSeg; - taddrSeg = (TADDR)heap.generation_table[GetMaxGeneration()].start_segment; + taddrSeg = (TADDR)heap.generation_table[GetMaxGeneration()].start_segment; // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments while (taddrSeg != (TADDR)heap.generation_table[0].start_segment) { if (IsInterrupt()) return FALSE; - if (dacpSeg.Request(g_sos, taddrSeg, heap) != S_OK) + if (dacpSeg.Request(g_sos, taddrSeg, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; @@ -604,7 +638,7 @@ BOOL GCObjInSegment(TADDR taddrObj, const DacpGcHeapDetails &heap, } // the ephemeral segment - if (dacpSeg.Request(g_sos, taddrSeg, heap) != S_OK) + if (dacpSeg.Request(g_sos, taddrSeg, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; @@ -624,7 +658,7 @@ BOOL GCObjInSegment(TADDR taddrObj, const DacpGcHeapDetails &heap, return FALSE; } -BOOL GCObjInLargeSegment(TADDR taddrObj, const DacpGcHeapDetails &heap, TADDR_SEGINFO& rngSeg) +BOOL GCObjInLargeSegment(TADDR taddrObj, const GCHeapDetails &heap, TADDR_SEGINFO& rngSeg) { TADDR taddrSeg; DacpHeapSegmentData dacpSeg; @@ -635,7 +669,7 @@ BOOL GCObjInLargeSegment(TADDR taddrObj, const DacpGcHeapDetails &heap, TADDR_SE { if (IsInterrupt()) return FALSE; - if (dacpSeg.Request(g_sos, taddrSeg, heap) != S_OK) + if (dacpSeg.Request(g_sos, taddrSeg, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; @@ -652,28 +686,71 @@ BOOL GCObjInLargeSegment(TADDR taddrObj, const DacpGcHeapDetails &heap, TADDR_SE return FALSE; } -BOOL GCObjInHeap(TADDR taddrObj, const DacpGcHeapDetails &heap, - TADDR_SEGINFO& rngSeg, int& gen, TADDR_RANGE& allocCtx, BOOL &bLarge) +BOOL GCObjInPinnedObjectSegment(TADDR taddrObj, const GCHeapDetails &heap, TADDR_SEGINFO& rngSeg) { + if (!heap.has_poh) + { + return FALSE; + } + + TADDR taddrSeg; + DacpHeapSegmentData dacpSeg; + taddrSeg = (TADDR)heap.generation_table[GetMaxGeneration() + 2].start_segment; + + // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments + while (taddrSeg != NULL) + { + if (IsInterrupt()) + return FALSE; + if (dacpSeg.Request(g_sos, taddrSeg, heap.original_heap_details) != S_OK) + { + ExtOut("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); + return FALSE; + } + if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj && taddrObj < TO_TADDR(dacpSeg.allocated)) + { + rngSeg.segAddr = (TADDR)dacpSeg.segmentAddr; + rngSeg.start = (TADDR)dacpSeg.mem; + rngSeg.end = (TADDR)dacpSeg.allocated; + return TRUE; + } + taddrSeg = (TADDR)dacpSeg.next; + } + return FALSE; +} + +BOOL GCObjInHeap(TADDR taddrObj, const GCHeapDetails &heap, TADDR_SEGINFO& rngSeg, + int& gen, TADDR_RANGE& allocCtx, BOOL &bLarge) +{ + bLarge = FALSE; + if (GCObjInSegment(taddrObj, heap, rngSeg, gen, allocCtx)) { - bLarge = FALSE; return TRUE; } + if (GCObjInLargeSegment(taddrObj, heap, rngSeg)) { bLarge = TRUE; - gen = GetMaxGeneration()+1; + gen = GetMaxGeneration() + 1; + allocCtx.start = allocCtx.end = 0; + return TRUE; + } + + if (GCObjInPinnedObjectSegment(taddrObj, heap, rngSeg)) + { + gen = GetMaxGeneration() + 2; allocCtx.start = allocCtx.end = 0; return TRUE; } + return FALSE; } #ifndef FEATURE_PAL // this function updates genUsage to reflect statistics from the range defined by [start, end) void GCGenUsageStats(TADDR start, TADDR end, const std::unordered_set &liveObjs, - const DacpGcHeapDetails &heap, BOOL bLarge, const AllocInfo *pAllocInfo, GenUsageStat *genUsage) + const GCHeapDetails &heap, BOOL bLarge, BOOL bPinned, const AllocInfo *pAllocInfo, GenUsageStat *genUsage) { // if this is an empty segment or generation return if (start >= end) @@ -696,15 +773,15 @@ void GCGenUsageStats(TADDR start, TADDR end, const std::unordered_set &li taddrMT &= ~3; // skip allocation contexts - if (!bLarge) - { + if (!bLarge && !bPinned) + { // Is this the beginning of an allocation context? int i; for (i = 0; i < pAllocInfo->num; i ++) { if (taddrObj == (TADDR)pAllocInfo->array[i].alloc_ptr) { - ExtDbgOut("Skipping allocation context: [%#p-%#p)\n", + ExtDbgOut("Skipping allocation context: [%#p-%#p)\n", SOS_PTR(pAllocInfo->array[i].alloc_ptr), SOS_PTR(pAllocInfo->array[i].alloc_limit)); taddrObj = (TADDR)pAllocInfo->array[i].alloc_limit + Align(min_obj_size); @@ -745,7 +822,7 @@ void GCGenUsageStats(TADDR start, TADDR end, const std::unordered_set &li continue; } - // at this point we should have a valid objSize, and there whould be no + // at this point we should have a valid objSize, and there whould be no // integer overflow when moving on to next object in heap _ASSERTE(objSize > 0 && taddrObj < taddrObj + objSize); if (objSize == 0 || taddrObj > taddrObj + objSize) @@ -765,7 +842,7 @@ void GCGenUsageStats(TADDR start, TADDR end, const std::unordered_set &li } #endif // !FEATURE_PAL -BOOL GCHeapUsageStats(const DacpGcHeapDetails& heap, BOOL bIncUnreachable, HeapUsageStat *hpUsage) +BOOL GCHeapUsageStats(const GCHeapDetails& heap, BOOL bIncUnreachable, HeapUsageStat *hpUsage) { memset(hpUsage, 0, sizeof(*hpUsage)); @@ -773,7 +850,7 @@ BOOL GCHeapUsageStats(const DacpGcHeapDetails& heap, BOOL bIncUnreachable, HeapU allocInfo.Init(); // 1. Start with small object segments - TADDR taddrSeg; + TADDR taddrSeg; DacpHeapSegmentData dacpSeg; taddrSeg = (TADDR)heap.generation_table[GetMaxGeneration()].start_segment; @@ -783,25 +860,25 @@ BOOL GCHeapUsageStats(const DacpGcHeapDetails& heap, BOOL bIncUnreachable, HeapU GCRootImpl gcroot; std::unordered_set emptyLiveObjs; const std::unordered_set &liveObjs = (bIncUnreachable ? gcroot.GetLiveObjects() : emptyLiveObjs); - + // 1a. enumerate all non-ephemeral segments while (taddrSeg != (TADDR)heap.generation_table[0].start_segment) { if (IsInterrupt()) return FALSE; - if (dacpSeg.Request(g_sos, taddrSeg, heap) != S_OK) + if (dacpSeg.Request(g_sos, taddrSeg, heap.original_heap_details) != S_OK) { ExtErr("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; } - GCGenUsageStats((TADDR)dacpSeg.mem, (TADDR)dacpSeg.allocated, liveObjs, heap, FALSE, &allocInfo, &hpUsage->genUsage[2]); + GCGenUsageStats((TADDR)dacpSeg.mem, (TADDR)dacpSeg.allocated, liveObjs, heap, FALSE, FALSE, &allocInfo, &hpUsage->genUsage[2]); taddrSeg = (TADDR)dacpSeg.next; } #endif // 1b. now handle the ephemeral segment - if (dacpSeg.Request(g_sos, taddrSeg, heap) != S_OK) + if (dacpSeg.Request(g_sos, taddrSeg, heap.original_heap_details) != S_OK) { ExtErr("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; @@ -822,30 +899,52 @@ BOOL GCHeapUsageStats(const DacpGcHeapDetails& heap, BOOL bIncUnreachable, HeapU } #ifndef FEATURE_PAL - GCGenUsageStats(startGen, endGen, liveObjs, heap, FALSE, &allocInfo, &hpUsage->genUsage[n]); + GCGenUsageStats(startGen, endGen, liveObjs, heap, FALSE, FALSE, &allocInfo, &hpUsage->genUsage[n]); #endif endGen = startGen; } // 2. Now process LOH - taddrSeg = (TADDR) heap.generation_table[GetMaxGeneration()+1].start_segment; + taddrSeg = (TADDR) heap.generation_table[GetMaxGeneration() + 1].start_segment; while (taddrSeg != NULL) { if (IsInterrupt()) return FALSE; - if (dacpSeg.Request(g_sos, taddrSeg, heap) != S_OK) + if (dacpSeg.Request(g_sos, taddrSeg, heap.original_heap_details) != S_OK) { ExtErr("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; } #ifndef FEATURE_PAL - GCGenUsageStats((TADDR) dacpSeg.mem, (TADDR) dacpSeg.allocated, liveObjs, heap, TRUE, NULL, &hpUsage->genUsage[3]); + GCGenUsageStats((TADDR) dacpSeg.mem, (TADDR) dacpSeg.allocated, liveObjs, heap, TRUE, FALSE, NULL, &hpUsage->genUsage[3]); #endif taddrSeg = (TADDR)dacpSeg.next; } + // POH + if (heap.has_poh) + { + taddrSeg = (TADDR) heap.generation_table[GetMaxGeneration() + 2].start_segment; + while (taddrSeg != NULL) + { + if (IsInterrupt()) + return FALSE; + + if (dacpSeg.Request(g_sos, taddrSeg, heap.original_heap_details) != S_OK) + { + ExtErr("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); + return FALSE; + } + +#ifndef FEATURE_PAL + GCGenUsageStats((TADDR) dacpSeg.mem, (TADDR) dacpSeg.allocated, liveObjs, heap, FALSE, TRUE, NULL, &hpUsage->genUsage[4]); +#endif + taddrSeg = (TADDR)dacpSeg.next; + } + } + return TRUE; } @@ -900,7 +999,7 @@ static MethodTableInfo* GetMethodTableInfo(DWORD_PTR dwAddrMethTable) return info; } -BOOL GetSizeEfficient(DWORD_PTR dwAddrCurrObj, +BOOL GetSizeEfficient(DWORD_PTR dwAddrCurrObj, DWORD_PTR dwAddrMethTable, BOOL bLarge, size_t& s, BOOL& bContainsPointers) { MethodTableInfo* info = GetMethodTableInfo(dwAddrMethTable); @@ -908,7 +1007,7 @@ BOOL GetSizeEfficient(DWORD_PTR dwAddrCurrObj, { return FALSE; } - + bContainsPointers = info->bContainsPointers; s = info->BaseSize; @@ -919,7 +1018,7 @@ BOOL GetSizeEfficient(DWORD_PTR dwAddrCurrObj, s += info->ComponentSize*GetNumComponents(dwAddrCurrObj); } - // On x64 we do an optimization to save 4 bytes in almost every string we create + // On x64 we do an optimization to save 4 bytes in almost every string we create // IMPORTANT: This cannot be done in ObjectSize, which is a wrapper to this function, // because we must Align only after these changes are made #ifdef _TARGET_WIN64_ @@ -949,7 +1048,7 @@ BOOL GetCollectibleDataEfficient(DWORD_PTR dwAddrMethTable, BOOL& bCollectible, // This function expects stat to be valid, and ready to get statistics. void GatherOneHeapFinalization(DacpGcHeapDetails& heapDetails, HeapStat *stat, BOOL bAllReady, BOOL bShort) { - DWORD_PTR dwAddr=0; + DWORD_PTR dwAddr=0; UINT m; if (!bShort) @@ -958,10 +1057,10 @@ void GatherOneHeapFinalization(DacpGcHeapDetails& heapDetails, HeapStat *stat, B { if (IsInterrupt()) return; - - ExtOut("generation %d has %d finalizable objects ", m, + + ExtOut("generation %d has %d finalizable objects ", m, (SegQueueLimit(heapDetails,gen_segment(m)) - SegQueue(heapDetails,gen_segment(m))) / sizeof(size_t)); - + ExtOut ("(%p->%p)\n", SOS_PTR(SegQueue(heapDetails,gen_segment(m))), SOS_PTR(SegQueueLimit(heapDetails,gen_segment(m)))); @@ -997,17 +1096,17 @@ void GatherOneHeapFinalization(DacpGcHeapDetails& heapDetails, HeapStat *stat, B (DWORD_PTR)SegQueue(heapDetails, gen_segment(GetMaxGeneration()))); for (dwAddr = taddrLowerLimit; dwAddr < (DWORD_PTR)SegQueueLimit(heapDetails, FinalizerListSeg); - dwAddr += sizeof (dwAddr)) + dwAddr += sizeof (dwAddr)) { if (IsInterrupt()) { return; } - - DWORD_PTR objAddr = NULL, + + DWORD_PTR objAddr = NULL, MTAddr = NULL; - if (SUCCEEDED(MOVE(objAddr, dwAddr)) && SUCCEEDED(GetMTOfObject(objAddr, &MTAddr)) && MTAddr) + if (SUCCEEDED(MOVE(objAddr, dwAddr)) && SUCCEEDED(GetMTOfObject(objAddr, &MTAddr)) && MTAddr) { if (bShort) { @@ -1022,30 +1121,32 @@ void GatherOneHeapFinalization(DacpGcHeapDetails& heapDetails, HeapStat *stat, B } } -BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITGCHEAPFUNC pFunc, LPVOID token, BOOL verify) +BOOL GCHeapTraverse(const GCHeapDetails &heap, AllocInfo* pallocInfo, VISITGCHEAPFUNC pFunc, LPVOID token, BOOL verify) { DWORD_PTR begin_youngest; - DWORD_PTR end_youngest; + DWORD_PTR end_youngest; + begin_youngest = (DWORD_PTR)heap.generation_table[0].allocation_start; DWORD_PTR dwAddr = (DWORD_PTR)heap.ephemeral_heap_segment; - DacpHeapSegmentData segment; - + DacpHeapSegmentData segment; + end_youngest = (DWORD_PTR)heap.alloc_allocated; DWORD_PTR dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration()].start_segment; dwAddr = dwAddrSeg; - if (segment.Request(g_sos, dwAddr, heap) != S_OK) + if (segment.Request(g_sos, dwAddr, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddr)); return FALSE; - } - - // DWORD_PTR dwAddrCurrObj = (DWORD_PTR)heap.generation_table[GetMaxGeneration()].allocation_start; + } + + // DWORD_PTR dwAddrCurrObj = (DWORD_PTR)heap.generation_table[GetMaxGeneration()].allocation_start; DWORD_PTR dwAddrCurrObj = (DWORD_PTR)segment.mem; - + size_t s, sPrev=0; BOOL bPrevFree=FALSE; + BOOL bPinnedDone = FALSE; DWORD_PTR dwAddrMethTable; DWORD_PTR dwAddrPrevObj=0; @@ -1078,7 +1179,7 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG if (dwAddrSeg) { dwAddr = dwAddrSeg; - if (segment.Request(g_sos, dwAddr, heap) != S_OK) + if (segment.Request(g_sos, dwAddr, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddr)); return FALSE; @@ -1087,7 +1188,26 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG continue; } else - break; // Done Verifying Heap + { + if (!bPinnedDone && heap.has_poh) + { + bPinnedDone = TRUE; + dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration() + 2].start_segment; + dwAddr = dwAddrSeg; + + if (segment.Request(g_sos, dwAddr, heap.original_heap_details) != S_OK) + { + ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddr)); + return FALSE; + } + + dwAddrCurrObj = (DWORD_PTR)segment.mem; + } + else + { + break; // Done Verifying Heap + } + } } if (dwAddrSeg == (DWORD_PTR)heap.ephemeral_heap_segment @@ -1110,7 +1230,7 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG { return FALSE; } - + dwAddrMethTable = dwAddrMethTable & ~3; if (dwAddrMethTable == 0) { @@ -1145,8 +1265,8 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG DMLOut("curr_object: %s\n", DMLListNearObj(dwAddrCurrObj)); if (dwAddrPrevObj) DMLOut("Last good object: %s\n", DMLObject(dwAddrPrevObj)); - - ExtOut ("----------------\n"); + + ExtOut ("----------------\n"); return FALSE; } @@ -1157,23 +1277,23 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG dwAddrPrevObj = dwAddrCurrObj; sPrev = s; bPrevFree = IsMTForFreeObj(dwAddrMethTable); - + dwAddrCurrObj += s; } // Now for the large object generation: dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration()+1].start_segment; - dwAddr = dwAddrSeg; - - if (segment.Request(g_sos, dwAddr, heap) != S_OK) + dwAddr = dwAddrSeg; + + if (segment.Request(g_sos, dwAddr, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddr)); return FALSE; } - // dwAddrCurrObj = (DWORD_PTR)heap.generation_table[GetMaxGeneration()+1].allocation_start; + // dwAddrCurrObj = (DWORD_PTR)heap.generation_table[GetMaxGeneration()+1].allocation_start; dwAddrCurrObj = (DWORD_PTR)segment.mem; - + dwAddrPrevObj=0; while(1) @@ -1201,7 +1321,7 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG if (dwAddrSeg) { dwAddr = dwAddrSeg; - if (segment.Request(g_sos, dwAddr, heap) != S_OK) + if (segment.Request(g_sos, dwAddr, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(dwAddr)); return FALSE; @@ -1218,7 +1338,7 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG return FALSE; } - dwAddrMethTable = dwAddrMethTable & ~3; + dwAddrMethTable = dwAddrMethTable & ~3; BOOL bContainsPointers; BOOL bMTOk = GetSizeEfficient(dwAddrCurrObj, dwAddrMethTable, TRUE, s, bContainsPointers); if (verify && bMTOk) @@ -1229,15 +1349,15 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG if (dwAddrPrevObj) DMLOut("Last good object: %s\n", dwAddrPrevObj); - - ExtOut ("----------------\n"); + + ExtOut ("----------------\n"); return FALSE; } pFunc (dwAddrCurrObj, s, dwAddrMethTable, token); - + // We believe we did this alignment in ObjectSize above. - assert((s & ALIGNCONSTLARGE) == 0); + assert((s & ALIGNCONSTLARGE) == 0); dwAddrPrevObj = dwAddrCurrObj; dwAddrCurrObj += s; } @@ -1247,19 +1367,20 @@ BOOL GCHeapTraverse(const DacpGcHeapDetails &heap, AllocInfo* pallocInfo, VISITG BOOL GCHeapsTraverse(VISITGCHEAPFUNC pFunc, LPVOID token, BOOL verify) { - // Obtain allocation context for each managed thread. + // Obtain allocation context for each managed thread. AllocInfo allocInfo; allocInfo.Init(); if (!IsServerBuild()) { - DacpGcHeapDetails heapDetails; - if (heapDetails.Request(g_sos) != S_OK) + DacpGcHeapDetails dacHeapDetails; + if (dacHeapDetails.Request(g_sos) != S_OK) { ExtOut("Error requesting gc heap details\n"); return FALSE; } + GCHeapDetails heapDetails(dacHeapDetails); return GCHeapTraverse (heapDetails, &allocInfo, pFunc, token, verify); } else @@ -1284,17 +1405,18 @@ BOOL GCHeapsTraverse(VISITGCHEAPFUNC pFunc, LPVOID token, BOOL verify) ExtOut("Failed to get GCHeaps\n"); return FALSE; } - + DWORD n; for (n = 0; n < dwNHeaps; n ++) { - DacpGcHeapDetails heapDetails; - if (heapDetails.Request(g_sos, heapAddrs[n]) != S_OK) + DacpGcHeapDetails dacHeapDetails; + if (dacHeapDetails.Request(g_sos, heapAddrs[n]) != S_OK) { ExtOut("Error requesting details\n"); return FALSE; } + GCHeapDetails heapDetails(dacHeapDetails, heapAddrs[n]); if (!GCHeapTraverse (heapDetails, &allocInfo, pFunc, token, verify)) { ExtOut("Traversing a gc heap failed\n"); @@ -1306,23 +1428,23 @@ BOOL GCHeapsTraverse(VISITGCHEAPFUNC pFunc, LPVOID token, BOOL verify) return TRUE; } -GCHeapSnapshot::GCHeapSnapshot() -{ - m_isBuilt = FALSE; - m_heapDetails = NULL; +GCHeapSnapshot::GCHeapSnapshot() +{ + m_isBuilt = FALSE; + m_heapDetails = NULL; } /////////////////////////////////////////////////////////// -SegmentLookup::SegmentLookup() -{ - m_iSegmentsSize = m_iSegmentCount = 0; +SegmentLookup::SegmentLookup() +{ + m_iSegmentsSize = m_iSegmentCount = 0; m_segments = new DacpHeapSegmentData[nSegLookupStgIncrement]; if (m_segments == NULL) { ReportOOM(); } - else + else { m_iSegmentsSize = nSegLookupStgIncrement; } @@ -1331,10 +1453,10 @@ SegmentLookup::SegmentLookup() BOOL SegmentLookup::AddSegment(DacpHeapSegmentData *pData) { // appends the address of a new (initialized) instance of DacpHeapSegmentData to the list of segments - // (m_segments) adding space for a segment when necessary. - // @todo Microsoft: The field name m_iSegmentSize is a little misleading. It's not the size in bytes, - // but the number of elements allocated for the array. It probably should have been named something like - // m_iMaxSegments instead. + // (m_segments) adding space for a segment when necessary. + // @todo Microsoft: The field name m_iSegmentSize is a little misleading. It's not the size in bytes, + // but the number of elements allocated for the array. It probably should have been named something like + // m_iMaxSegments instead. if (m_iSegmentCount >= m_iSegmentsSize) { // expand buffer--allocate enough space to hold the elements we already have plus nSegLookupStgIncrement @@ -1345,7 +1467,7 @@ BOOL SegmentLookup::AddSegment(DacpHeapSegmentData *pData) // copy the old elements into the new array memcpy(pNewBuffer, m_segments, sizeof(DacpHeapSegmentData)*m_iSegmentsSize); - + // record the new number of elements available m_iSegmentsSize+=nSegLookupStgIncrement; @@ -1355,10 +1477,10 @@ BOOL SegmentLookup::AddSegment(DacpHeapSegmentData *pData) // set m_segments to point to the new array m_segments = pNewBuffer; } - + // add pData to the array - m_segments[m_iSegmentCount++] = *pData; - + m_segments[m_iSegmentCount++] = *pData; + return TRUE; } @@ -1380,18 +1502,18 @@ CLRDATA_ADDRESS SegmentLookup::GetHeap(CLRDATA_ADDRESS object, BOOL& bFound) { CLRDATA_ADDRESS ret = NULL; bFound = FALSE; - + // Visit our segments for (int i=0; i TO_TADDR(object)) { ret = m_segments[i].gc_heap; bFound = TRUE; break; } - } + } return ret; } @@ -1399,9 +1521,9 @@ CLRDATA_ADDRESS SegmentLookup::GetHeap(CLRDATA_ADDRESS object, BOOL& bFound) /////////////////////////////////////////////////////////////////////////// BOOL GCHeapSnapshot::Build() -{ +{ Clear(); - + m_isBuilt = FALSE; ///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1426,7 +1548,7 @@ BOOL GCHeapSnapshot::Build() if (!ClrSafeInt::multiply(sizeof(CLRDATA_ADDRESS), m_gcheap.HeapCount, AllocSize) || (heapAddrs = new CLRDATA_ADDRESS [m_gcheap.HeapCount]) == NULL) { - ReportOOM(); + ReportOOM(); return FALSE; } @@ -1443,35 +1565,41 @@ BOOL GCHeapSnapshot::Build() /// 3. Get some necessary information about each heap, such as the card table location, the generation /// table, the heap bounds, etc., and retrieve the heap segments ///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // allocate an array to hold the information - m_heapDetails = new DacpGcHeapDetails[m_gcheap.HeapCount]; + m_heapDetails = new GCHeapDetails[m_gcheap.HeapCount]; if (m_heapDetails == NULL) { - ReportOOM(); + ReportOOM(); return FALSE; } - + // get the heap information for each heap // See code:ClrDataAccess::RequestGCHeapDetails for details for (UINT n = 0; n < m_gcheap.HeapCount; n ++) - { + { if (m_gcheap.bServerMode) { - if (m_heapDetails[n].Request(g_sos, heapAddrs[n]) != S_OK) + DacpGcHeapDetails dacHeapDetails; + if (dacHeapDetails.Request(g_sos, heapAddrs[n]) != S_OK) { ExtOut("Error requesting details\n"); return FALSE; } + + m_heapDetails[n].Set(dacHeapDetails, heapAddrs[n]); } else { - if (m_heapDetails[n].Request(g_sos) != S_OK) + DacpGcHeapDetails dacHeapDetails; + if (dacHeapDetails.Request(g_sos) != S_OK) { ExtOut("Error requesting details\n"); return FALSE; } + + m_heapDetails[n].Set(dacHeapDetails); } // now get information about the heap segments for this heap @@ -1483,38 +1611,49 @@ BOOL GCHeapSnapshot::Build() } m_isBuilt = TRUE; - return TRUE; + return TRUE; } -BOOL GCHeapSnapshot::AddSegments(DacpGcHeapDetails& details) +BOOL GCHeapSnapshot::AddSegments(const GCHeapDetails& details) { int n = 0; DacpHeapSegmentData segment; - + // This array of two addresses gives us access to all the segments. The generation segments are linked // to each other, starting with the maxGeneration segment. The second address gives us the large object heap. - CLRDATA_ADDRESS AddrSegs[] = + CLRDATA_ADDRESS AddrSegs[]= { details.generation_table[GetMaxGeneration()].start_segment, - details.generation_table[GetMaxGeneration()+1].start_segment // large object heap + details.generation_table[GetMaxGeneration() + 1].start_segment, // large object heap + NULL }; + if (details.has_poh) + { + AddrSegs[2] = details.generation_table[GetMaxGeneration() + 2].start_segment; // pinned object heap + } + // this loop will get information for all the heap segments in this heap. The outer loop iterates once // for the "normal" generation segments and once for the large object heap. The inner loop follows the chain // of segments rooted at AddrSegs[i] for (unsigned int i = 0; i < sizeof(AddrSegs)/sizeof(AddrSegs[0]); ++i) { + if (AddrSegs[i] == NULL) + { + continue; + } + CLRDATA_ADDRESS AddrSeg = AddrSegs[i]; - + while (AddrSeg != NULL) { if (IsInterrupt()) { return FALSE; } - // Initialize segment by copying fields from the target's heap segment at AddrSeg. - // See code:ClrDataAccess::RequestGCHeapSegment for details. - if (segment.Request(g_sos, AddrSeg, details) != S_OK) + // Initialize segment by copying fields from the target's heap segment at AddrSeg. + // See code:ClrDataAccess::RequestGCHeapSegment for details. + if (segment.Request(g_sos, AddrSeg, details.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p\n", SOS_PTR(AddrSeg)); return FALSE; @@ -1530,12 +1669,12 @@ BOOL GCHeapSnapshot::AddSegments(DacpGcHeapDetails& details) { ExtOut("strike: Failed to store segment\n"); return FALSE; - } + } // get the next segment in the chain AddrSeg = segment.next; } } - + return TRUE; } @@ -1548,16 +1687,16 @@ void GCHeapSnapshot::Clear() } m_segments.Clear(); - + m_isBuilt = FALSE; } GCHeapSnapshot g_snapshot; -DacpGcHeapDetails *GCHeapSnapshot::GetHeap(CLRDATA_ADDRESS objectPointer) +GCHeapDetails *GCHeapSnapshot::GetHeap(CLRDATA_ADDRESS objectPointer) { // We need bFound because heap will be NULL if we are Workstation Mode. - // We still need a way to know if the address was found in our segment + // We still need a way to know if the address was found in our segment // list. BOOL bFound = FALSE; CLRDATA_ADDRESS heap = m_segments.GetHeap(objectPointer, bFound); @@ -1567,7 +1706,7 @@ DacpGcHeapDetails *GCHeapSnapshot::GetHeap(CLRDATA_ADDRESS objectPointer) { if (m_heapDetails[i].heapAddr == heap) return m_heapDetails + i; - } + } } else if (!m_gcheap.bServerMode) { @@ -1576,7 +1715,7 @@ DacpGcHeapDetails *GCHeapSnapshot::GetHeap(CLRDATA_ADDRESS objectPointer) return m_heapDetails; } } - + // Not found return NULL; } @@ -1584,7 +1723,7 @@ DacpGcHeapDetails *GCHeapSnapshot::GetHeap(CLRDATA_ADDRESS objectPointer) // TODO: Do we need to handle the LOH here? int GCHeapSnapshot::GetGeneration(CLRDATA_ADDRESS objectPointer) { - DacpGcHeapDetails *pDetails = GetHeap(objectPointer); + GCHeapDetails *pDetails = GetHeap(objectPointer); if (pDetails == NULL) { ExtOut("Object %p has no generation\n", SOS_PTR(objectPointer)); @@ -1594,7 +1733,7 @@ int GCHeapSnapshot::GetGeneration(CLRDATA_ADDRESS objectPointer) TADDR taObj = TO_TADDR(objectPointer); // The DAC doesn't fill the generation table with true CLRDATA_ADDRESS values // but rather with ULONG64 values (i.e. non-sign-extended 64-bit values) - // We use the TO_TADDR below to ensure we won't break if this will ever + // We use the TO_TADDR below to ensure we won't break if this will ever // be fixed in the DAC. if (taObj >= TO_TADDR(pDetails->generation_table[0].allocation_start) && taObj <= TO_TADDR(pDetails->alloc_allocated)) @@ -1603,7 +1742,7 @@ int GCHeapSnapshot::GetGeneration(CLRDATA_ADDRESS objectPointer) if (taObj >= TO_TADDR(pDetails->generation_table[1].allocation_start) && taObj <= TO_TADDR(pDetails->generation_table[0].allocation_start)) return 1; - + return 2; } @@ -1629,12 +1768,12 @@ void LoaderHeapTraverse(CLRDATA_ADDRESS blockData,size_t blockSize,BOOL blockIsC else break; } - + if (!blockIsCurrentBlock) { g_trav_wastedSize += blockSize - curSize; } - + g_trav_totalSize += curSize; ExtOut("%p(%x:%x) ", SOS_PTR(blockData), blockSize, curSize); } @@ -1651,7 +1790,7 @@ void PrintHeapSize(DWORD_PTR total, DWORD_PTR wasted) { ExtOut("Size: 0x%" POINTERSIZE_TYPE "x (%" POINTERSIZE_TYPE "u) bytes", total, total); if (wasted) - ExtOut(" total, 0x%" POINTERSIZE_TYPE "x (%" POINTERSIZE_TYPE "u) bytes wasted", wasted, wasted); + ExtOut(" total, 0x%" POINTERSIZE_TYPE "x (%" POINTERSIZE_TYPE "u) bytes wasted", wasted, wasted); ExtOut(".\n"); } @@ -1676,7 +1815,7 @@ DWORD_PTR JitHeapInfo() ArrayHolder pArray = new DacpJitManagerInfo[count]; if (pArray==NULL) { - ReportOOM(); + ReportOOM(); return 0; } @@ -1708,7 +1847,7 @@ DWORD_PTR JitHeapInfo() ArrayHolder codeHeapInfo = new DacpJitCodeHeapInfo[heapCount]; if (codeHeapInfo == NULL) { - ReportOOM(); + ReportOOM(); break; } @@ -1772,7 +1911,7 @@ DWORD_PTR LoaderHeapInfo(CLRDATA_ADDRESS pLoaderHeapAddr, DWORD_PTR *wasted) g_sos->TraverseLoaderHeap(pLoaderHeapAddr, LoaderHeapTraverse); PrintHeapSize(g_trav_totalSize, g_trav_wastedSize); - + if (wasted) *wasted += g_trav_wastedSize; return g_trav_totalSize; @@ -1861,7 +2000,7 @@ HRESULT PrintDomainHeapInfo(const char *name, CLRDATA_ADDRESS adPtr, DWORD_PTR * } ExtOut("--------------------------------------\n"); - + const int column = 19; ExtOut("%s:", name); WhitespaceOut(column - (int)strlen(name) - 1); @@ -1910,14 +2049,14 @@ DWORD_PTR PrintModuleHeapInfo(__out_ecount(count) DWORD_PTR *moduleList, int cou { DWORD_PTR toReturn = 0; DWORD_PTR wasted = 0; - + if (IsMiniDumpFile()) { ExtOut("\n"); } else { - DWORD_PTR thunkHeapSize = 0; + DWORD_PTR thunkHeapSize = 0; for (int i = 0; i < count; i++) { diff --git a/src/SOS/Strike/gcroot.cpp b/src/SOS/Strike/gcroot.cpp index 1a2a02813f..7297e2723d 100644 --- a/src/SOS/Strike/gcroot.cpp +++ b/src/SOS/Strike/gcroot.cpp @@ -3,9 +3,9 @@ // See the LICENSE file in the project root for more information. // ==++== -// - -// +// + +// // ==--== /* @@ -24,7 +24,7 @@ * keep track of data have very fast lookups. For example, to keep track of the objects we've considered * we use a unordered_set. Similarly to keep track of MethodTable data we use a unordered_map to track the * mt -> mtinfo mapping. - */ + */ #include "sos.h" #include "disasm.h" @@ -142,7 +142,7 @@ void GCRootImpl::ClearAll() for (itr = mMTs.begin(); itr != mMTs.end(); ++itr) delete itr->second; } - + { std::unordered_map::iterator itr; for (itr = mTargets.begin(); itr != mTargets.end(); ++itr) @@ -155,7 +155,7 @@ void GCRootImpl::ClearAll() mSizes.clear(); mDependentHandleMap.clear(); mCache.ClearStats(); - + mAll = false; mSize = false; } @@ -177,7 +177,7 @@ GCRootImpl::RootNode *GCRootImpl::NewNode(TADDR obj, MTInfo *mtInfo, bool fromDe // To avoid heap fragmentation (and since it's faster), we don't actually new/delete // nodes unless we have to. Instead we keep a stl list with free nodes to use. RootNode *toReturn = NULL; - + if (mRootNewList.size()) { toReturn = mRootNewList.back(); @@ -206,37 +206,37 @@ void GCRootImpl::GetDependentHandleMap(std::unordered_map handles; - + HRESULT hr = g_sos->GetHandleEnumForTypes(&type, 1, &handles); - + if (FAILED(hr)) { ExtOut("Failed to walk dependent handles. GCRoot may miss paths.\n"); return; } - + SOSHandleData data[4]; unsigned int fetched = 0; - + do { hr = handles->Next(_countof(data), data, &fetched); - + if (FAILED(hr)) { ExtOut("Error walking dependent handles. GCRoot may miss paths.\n"); return; } - + for (unsigned int i = 0; i < fetched; ++i) { if (data[i].Secondary != 0) { TADDR obj = 0; TADDR target = TO_TADDR(data[i].Secondary); - + MOVE(obj, TO_TADDR(data[i].Handle)); - + map[obj].push_back(target); } } @@ -250,7 +250,7 @@ int GCRootImpl::PrintRootsForObject(TADDR target, bool all, bool noStacks) { ClearAll(); GetDependentHandleMap(mDependentHandleMap); - + mAll = all; // Add "target" to the mTargets list. @@ -260,10 +260,10 @@ int GCRootImpl::PrintRootsForObject(TADDR target, bool all, bool noStacks) // Look for roots on the HandleTable, FQ, and all threads. int count = 0; - + if (!noStacks) count += PrintRootsOnAllThreads(); - + count += PrintRootsOnHandleTable(); count += PrintRootsOnFQ(); @@ -287,7 +287,7 @@ bool GCRootImpl::PrintPathToObject(TADDR root, TADDR target) { ClearAll(); GetDependentHandleMap(mDependentHandleMap); - + // Add "target" to the mTargets list. TADDR mt = ReadPointerCached(target); RootNode *node = NewNode(target, GetMTInfo(mt)); @@ -305,11 +305,11 @@ bool GCRootImpl::PrintPathToObject(TADDR root, TADDR target) ExtOut(" -> %p %S%s\n",SOS_PTR(path->Object), path->GetTypeName(), path->FromDependentHandle ? " (dependent handle)" : ""); path = path->Next; } - + mCache.PrintStats(__FUNCTION__); return true; } - + mCache.PrintStats(__FUNCTION__); return false; } @@ -319,7 +319,7 @@ size_t GCRootImpl::ObjSize(TADDR root) // Calculates the size of the closure of objects kept alive by root. ClearAll(); GetDependentHandleMap(mDependentHandleMap); - + // mSize tells GCRootImpl to build the "mSizes" table with the total size // each object roots. mSize = true; @@ -329,7 +329,7 @@ size_t GCRootImpl::ObjSize(TADDR root) // the algorithm will scan all objects and never terminate until it has walked // all objects in the closure. FindPathToTarget(root); - + mCache.PrintStats(__FUNCTION__); return mSizes[root]; } @@ -344,7 +344,7 @@ void GCRootImpl::ObjSize() PrintRootsOnAllThreads(); PrintRootsOnHandleTable(); PrintRootsOnFQ(); - + mCache.PrintStats(__FUNCTION__); } @@ -420,7 +420,7 @@ void GCRootImpl::ReportSizeInfo(DWORD thread, const SOSStackRefData &stackRef, T TADDR mt = ReadPointer(obj); MTInfo *mtInfo = GetMTInfo(mt); const WCHAR *type = mtInfo ? mtInfo->GetTypeName() : W("unknown type"); - + size_t size = mSizes[obj]; ExtOut("Thread %x (%S): %S: %d (0x%x) bytes (%S)\n", thread, frame.c_str(), regOutput.c_str(), size, size, type); } @@ -444,7 +444,7 @@ void GCRootImpl::ReportOnePath(DWORD thread, const SOSStackRefData &stackRef, Ro { if (printThread) ExtOut("Thread %x:\n", thread); - + if (printFrame) { if (stackRef.SourceType == SOS_StackSourceIP) @@ -458,10 +458,10 @@ void GCRootImpl::ReportOnePath(DWORD thread, const SOSStackRefData &stackRef, Ro ExtOut(" %p %S\n", SOS_PTR(stackRef.Source), frameName.c_str()); } } - + WString regOutput = BuildRegisterOutput(stackRef, false); ExtOut(" %S\n", regOutput.c_str()); - + while (path) { ExtOut(" -> %p %S%s\n", SOS_PTR(path->Object), path->GetTypeName(), path->FromDependentHandle ? " (dependent handle)" : ""); @@ -525,7 +525,7 @@ int GCRootImpl::PrintRootsInOlderGen() ExtDbgOut("internal_root_array = %#p\n", SOS_PTR(analyzeData.internal_root_array)); ExtDbgOut("internal_root_array_index = %#p\n", SOS_PTR(analyzeData.internal_root_array_index)); - + TADDR start = TO_TADDR(analyzeData.internal_root_array); TADDR stop = TO_TADDR(analyzeData.internal_root_array + sizeof(TADDR) * (size_t)analyzeData.internal_root_array_index); @@ -567,7 +567,7 @@ int GCRootImpl::PrintRootsInOlderGen() ExtDbgOut("internal_root_array = %#p\n", SOS_PTR(analyzeData.internal_root_array)); ExtDbgOut("internal_root_array_index = %#p\n", SOS_PTR(analyzeData.internal_root_array_index)); - + TADDR start = TO_TADDR(analyzeData.internal_root_array); TADDR stop = TO_TADDR(analyzeData.internal_root_array + sizeof(TADDR) * (size_t)analyzeData.internal_root_array_index); @@ -638,7 +638,7 @@ int GCRootImpl::PrintRootsOnFQ(bool notReadyForFinalization) ExtErr("Error requesting heap data for heap %d.\n", n); continue; } - + // If we include objects that are not ready for finalization, we may report // false positives. False positives occur if the object is not ready for finalization // and does not re-register itself for finalization inside the finalizer. @@ -654,7 +654,7 @@ int GCRootImpl::PrintRootsOnFQ(bool notReadyForFinalization) start = TO_TADDR(SegQueue(heapDetails, CriticalFinalizerListSeg)); stop = TO_TADDR(SegQueueLimit(heapDetails, FinalizerListSeg)); } - + total += PrintRootsInRange(cache, start, stop, &GCRootImpl::ReportOneFQEntry, total == 0); } @@ -671,7 +671,7 @@ int GCRootImpl::PrintRootsInRange(LinearReadCache &cache, TADDR start, TADDR sto { if (IsInterrupt()) return total; - + // Use the cache parameter here instead of mCache. If you use mCache it will be reset // when calling into FindPathToTarget. TADDR root = 0; @@ -703,7 +703,7 @@ int GCRootImpl::PrintRootsOnAllThreads() HRESULT hr = GetThreadList(&threadList, &numThreads); if (FAILED(hr) || !threadList) return 0; - + // Walk each thread and process the roots on it. int total = 0; DacpThreadData vThread; @@ -711,14 +711,14 @@ int GCRootImpl::PrintRootsOnAllThreads() { if (IsInterrupt()) return total; - + if (FAILED(vThread.Request(g_sos, threadList[i]))) continue; - + if (vThread.osThreadId) total += PrintRootsOnThread(vThread.osThreadId); } - + return total; } @@ -727,7 +727,7 @@ int GCRootImpl::PrintRootsOnThread(DWORD osThreadId) // Grab all object rootson the thread. unsigned int refCount = 0; ArrayHolder refs = NULL; - + int total = 0; bool first = true; if (FAILED(::GetGCRefs(osThreadId, &refs, &refCount, NULL, NULL))) @@ -743,7 +743,7 @@ int GCRootImpl::PrintRootsOnThread(DWORD osThreadId) { if (IsInterrupt()) return total; - + if (refs[i].Object) { if (mSize) @@ -757,12 +757,12 @@ int GCRootImpl::PrintRootsOnThread(DWORD osThreadId) first = false; total++; } - + if (mSize) ReportSizeInfo(osThreadId, refs[i], TO_TADDR(refs[i].Object)); } } - + return total; } @@ -771,7 +771,7 @@ int GCRootImpl::PrintRootsOnHandleTable(int gen) // Get handle data. ToRelease pEnum = NULL; HRESULT hr = S_OK; - + if (gen == -1 || (ULONG)gen == GetMaxGeneration()) hr = g_sos->GetHandleEnum(&pEnum); else @@ -782,11 +782,11 @@ int GCRootImpl::PrintRootsOnHandleTable(int gen) ExtOut("Failed to walk the HandleTable!\n"); return 0; } - + int total = 0; unsigned int fetched = 0; SOSHandleData handles[8]; - + bool printHeader = true; do { @@ -803,11 +803,11 @@ int GCRootImpl::PrintRootsOnHandleTable(int gen) { if (IsInterrupt()) return total; - + // Ignore handles which aren't actually roots. if (!handles[i].StrongReference) continue; - + // clear the size table if (mAll) ClearSizeData(); @@ -845,7 +845,7 @@ GCRootImpl::RootNode *GCRootImpl::FilterRoots(RootNode *&list) // - Check to see if we've located the target object (or an object which points to the target). RootNode *curr = list; RootNode *keep = NULL; - + while (curr) { // We don't check for Control-C in this loop to avoid inconsistent data. @@ -895,7 +895,7 @@ GCRootImpl::RootNode *GCRootImpl::FindPathToTarget(TADDR root) return targetItr->second; else if (mConsidered.find(root) != mConsidered.end()) return NULL; - + // Add obj as a considered node (since we are considering it now). mConsidered.insert(root); @@ -907,7 +907,7 @@ GCRootImpl::RootNode *GCRootImpl::FindPathToTarget(TADDR root) { if (IsInterrupt()) return NULL; - + // If this is a new reference we are walking, we haven't filled the list of objects // this one points to. Update that first. if (!curr->FilledRefs) @@ -924,7 +924,7 @@ GCRootImpl::RootNode *GCRootImpl::FindPathToTarget(TADDR root) // Link the current to the target. curr->Next = foundTarget; foundTarget->Prev = curr; - + // If the user requested all paths, set each node in the path to be a target. // Normally, we don't consider a node we've already seen, which means if we don't // get a *completely* unique path, it's not printed out. By adding each of the @@ -933,17 +933,17 @@ GCRootImpl::RootNode *GCRootImpl::FindPathToTarget(TADDR root) if (mAll) { RootNode *tmp = path; - + while (tmp) { if (mTargets.find(tmp->Object) != mTargets.end()) break; - + mTargets[tmp->Object] = tmp; tmp = tmp->Next; } } - + return path; } } @@ -972,7 +972,7 @@ GCRootImpl::RootNode *GCRootImpl::FindPathToTarget(TADDR root) curr->Next = next; next->Prev = curr; curr = next; - + // Finally, insert the current object into the considered set. mConsidered.insert(curr->Object); // Now the next iteration will operate on "next". @@ -1003,7 +1003,7 @@ GCRootImpl::RootNode *GCRootImpl::GetGCRefs(RootNode *path, RootNode *node) } node->FilledRefs = true; - + // MTInfo can be null if we encountered an error reading out of the target // process, just early out here as if it has no references. if (!node->MTInfo) @@ -1014,12 +1014,12 @@ GCRootImpl::RootNode *GCRootImpl::GetGCRefs(RootNode *path, RootNode *node) if (mSize || node->MTInfo->ContainsPointers || node->MTInfo->Collectible) { objSize = GetSizeOfObject(obj, node->MTInfo); - + // Update object size list, if requested. if (mSize) { mSizes[obj] = 0; - + while (path) { mSizes[path->Object] += objSize; @@ -1027,11 +1027,11 @@ GCRootImpl::RootNode *GCRootImpl::GetGCRefs(RootNode *path, RootNode *node) } } } - + // Early out: If the object doesn't contain any pointers, return. if (!node->MTInfo->ContainsPointers && !node->MTInfo->Collectible) return NULL; - + // Make sure we have the object's data in the cache. mCache.EnsureRangeInCache(obj, (unsigned int)objSize); @@ -1051,7 +1051,7 @@ GCRootImpl::RootNode *GCRootImpl::GetGCRefs(RootNode *path, RootNode *node) curr = curr->Next; } } - + // Add edges from dependent handles. std::unordered_map>::iterator itr = mDependentHandleMap.find(obj); if (itr != mDependentHandleMap.end()) @@ -1063,7 +1063,7 @@ GCRootImpl::RootNode *GCRootImpl::GetGCRefs(RootNode *path, RootNode *node) curr = curr->Next; } } - + // The gcrefs actually start on refs->Next. curr = refs; refs = refs->Next; @@ -1162,7 +1162,7 @@ GCRootImpl::MTInfo *GCRootImpl::GetMTInfo(TADDR mt) return NULL; } - if (nEntries < 0) + if (nEntries < 0) { curr->ArrayOfVC = true; nEntries = -nEntries; @@ -1176,13 +1176,13 @@ GCRootImpl::MTInfo *GCRootImpl::GetMTInfo(TADDR mt) curr->Buffer = new TADDR[nSlots]; if (curr->Buffer == NULL) - { + { ReportOOM(); delete curr; return NULL; } - if (FAILED(g_ExtData->ReadVirtual(TO_CDADDR(mt - nSlots*sizeof(TADDR)), curr->Buffer, (ULONG)(nSlots*sizeof(TADDR)), NULL))) + if (FAILED(g_ExtData->ReadVirtual(TO_CDADDR(mt - nSlots*sizeof(TADDR)), curr->Buffer, (ULONG)(nSlots*sizeof(TADDR)), NULL))) { ExtOut("Failed to read GCDesc for MethodTable %p.\n", SOS_PTR(mt)); delete curr; @@ -1229,7 +1229,7 @@ UINT FindAllPinnedAndStrong(DWORD_PTR handlearray[], UINT arraySize) unsigned int fetched = 0; SOSHandleData data[64]; UINT pos = 0; - + // We do not call GetHandleEnumByType here with a list of strong handles since we would be // statically setting the list of strong handles, which could change in a future release. // Instead we rely on the dac to provide whether a handle is strong or not. @@ -1241,17 +1241,17 @@ UINT FindAllPinnedAndStrong(DWORD_PTR handlearray[], UINT arraySize) ExtOut("Failed to enumerate GC handles. HRESULT=%x.\n", hr); return 0; } - + do { hr = handles->Next(_countof(data), data, &fetched); - + if (FAILED(hr)) { ExtOut("Failed to enumerate GC handles. HRESULT=%x.\n", hr); break; } - + for (unsigned int i = 0; i < fetched; ++i) { if (pos >= arraySize) @@ -1259,14 +1259,14 @@ UINT FindAllPinnedAndStrong(DWORD_PTR handlearray[], UINT arraySize) ExtOut("Buffer overflow while enumerating handles.\n"); return pos; } - + if (data[i].StrongReference) { handlearray[pos++] = (DWORD_PTR)data[i].Handle; } } } while (fetched == _countof(data)); - + return pos; } @@ -1279,16 +1279,16 @@ void PrintNotReachableInRange(TADDR rngStart, TADDR rngEnd, BOOL bExcludeReadyFo LinearReadCache cache(512); cache.EnsureRangeInCache(rngStart, (unsigned int)(rngEnd-rngStart)); - + for (TADDR p = rngStart; p < rngEnd; p += sizeof(TADDR)) { if (IsInterrupt()) break; - + TADDR header = 0; TADDR obj = 0; TADDR taddrMT = 0; - + bool read = cache.Read(p-sizeof(SIZEOF_OBJHEADER), &header); read = read && cache.Read(p, &obj); if (read && ((header & BIT_SBLK_FINALIZER_RUN) == 0) && liveObjs.find(obj) == liveObjs.end()) @@ -1300,7 +1300,7 @@ void PrintNotReachableInRange(TADDR rngStart, TADDR rngEnd, BOOL bExcludeReadyFo else { DMLOut("%s ", DMLObject(obj)); - if (SUCCEEDED(GetMTOfObject(obj, &taddrMT)) && taddrMT) + if (SUCCEEDED(GetMTOfObject(obj, &taddrMT)) && taddrMT) { size_t s = ObjectSize(obj); if (hpstat) @@ -1311,7 +1311,7 @@ void PrintNotReachableInRange(TADDR rngStart, TADDR rngEnd, BOOL bExcludeReadyFo } } } - + if (!bShort) ExtOut("\n"); } @@ -1323,7 +1323,7 @@ void PrintNotReachableInRange(TADDR rngStart, TADDR rngEnd, BOOL bExcludeReadyFo // #define card_word_width ((size_t)32) -// +// // The value of card_size is determined empirically according to the average size of an object // In the code we also rely on the assumption that one card_table entry (DWORD) covers an entire os page // @@ -1353,16 +1353,16 @@ size_t card_of ( BYTE* object) return (size_t)(object) / card_size; } -BOOL CardIsSet(const DacpGcHeapDetails &heap, TADDR objAddr) +BOOL CardIsSet(const GCHeapDetails &heap, TADDR objAddr) { // The card table has to be translated to look at the refcount, etc. // g_card_table[card_word(card_of(g_lowest_address))]. TADDR card_table = TO_TADDR(heap.card_table); card_table = card_table + card_word(card_of((BYTE *)heap.lowest_address))*sizeof(DWORD); - + do - { + { TADDR card_table_lowest_addr; TADDR card_table_next; @@ -1377,7 +1377,7 @@ BOOL CardIsSet(const DacpGcHeapDetails &heap, TADDR objAddr) ExtErr("Error getting next card table\n"); return FALSE; } - + size_t card = (objAddr - card_table_lowest_addr) / card_size; DWORD value; if (MOVE(value, card_table + card_word(card)*sizeof(DWORD)) != S_OK) @@ -1385,10 +1385,10 @@ BOOL CardIsSet(const DacpGcHeapDetails &heap, TADDR objAddr) ExtErr("Error reading card bits\n"); return FALSE; } - + if (value & 1<= seg.mem) && (addr < seg.reserved); } -void should_check_bgc_mark(const DacpGcHeapDetails &heap, - const DacpHeapSegmentData &seg, - BOOL* consider_bgc_mark_p, +void should_check_bgc_mark(const GCHeapDetails &heap, + const DacpHeapSegmentData &seg, + BOOL* consider_bgc_mark_p, BOOL* check_current_sweep_p, BOOL* check_saved_sweep_p) { @@ -1519,7 +1519,7 @@ void should_check_bgc_mark(const DacpGcHeapDetails &heap, if (heap.current_c_gc_state == c_gc_state_planning) { - // We are doing the next_sweep_obj comparison here because we have yet to + // We are doing the next_sweep_obj comparison here because we have yet to // turn on the swept flag for the segment but in_range_for_segment will return // FALSE if the address is the same as reserved. if ((seg.flags & heap_segment_flags_swept) || (heap.next_sweep_obj == seg.reserved)) @@ -1545,7 +1545,7 @@ void should_check_bgc_mark(const DacpGcHeapDetails &heap, // TODO: FACTOR TOGETHER THE OBJECT MEMBER WALKING CODE FROM // TODO: VerifyObjectMember(), GetListOfRefs(), HeapTraverser::PrintRefs() -BOOL VerifyObjectMember(const DacpGcHeapDetails &heap, DWORD_PTR objAddr) +BOOL VerifyObjectMember(const GCHeapDetails &heap, DWORD_PTR objAddr) { BOOL ret = TRUE; BOOL bCheckCard = TRUE; @@ -1561,7 +1561,7 @@ BOOL VerifyObjectMember(const DacpGcHeapDetails &heap, DWORD_PTR objAddr) } dwAddrCard += card_size; } - + if (bCheckCard) { dwAddrCard = objAddr + size - 2*sizeof(PVOID); @@ -1571,7 +1571,7 @@ BOOL VerifyObjectMember(const DacpGcHeapDetails &heap, DWORD_PTR objAddr) } } } - + for (sos::RefIterator itr(TO_TADDR(objAddr)); itr; ++itr) { TADDR dwAddr1 = (DWORD_PTR)*itr; @@ -1583,7 +1583,7 @@ BOOL VerifyObjectMember(const DacpGcHeapDetails &heap, DWORD_PTR objAddr) BOOL bPointers; TADDR dwAddrMethTable; if (FAILED(GetMTOfObject(dwAddr1, &dwAddrMethTable)) || - (GetSizeEfficient(dwAddr1, dwAddrMethTable, FALSE, s, bPointers) == FALSE)) + (GetSizeEfficient(dwAddr1, dwAddrMethTable, FALSE, s, bPointers) == FALSE)) { DMLOut("object %s: bad member %p at %p\n", DMLObject(objAddr), SOS_PTR(dwAddr1), SOS_PTR(itr.GetOffset())); ret = FALSE; @@ -1611,14 +1611,14 @@ BOOL VerifyObjectMember(const DacpGcHeapDetails &heap, DWORD_PTR objAddr) } // search for can_verify_deep in gc.cpp for examples of how these functions are used. -BOOL VerifyObject(const DacpGcHeapDetails &heap, const DacpHeapSegmentData &seg, DWORD_PTR objAddr, DWORD_PTR MTAddr, size_t objSize, +BOOL VerifyObject(const GCHeapDetails &heap, const DacpHeapSegmentData &seg, DWORD_PTR objAddr, DWORD_PTR MTAddr, size_t objSize, BOOL bVerifyMember) -{ +{ if (IsMTForFreeObj(MTAddr)) { return TRUE; } - + if (objSize < min_obj_size) { DMLOut("object %s: size %d too small\n", DMLObject(objAddr), objSize); @@ -1639,19 +1639,19 @@ BOOL VerifyObject(const DacpGcHeapDetails &heap, const DacpHeapSegmentData &seg, } -BOOL FindSegment(const DacpGcHeapDetails &heap, DacpHeapSegmentData &seg, CLRDATA_ADDRESS addr) +BOOL FindSegment(const GCHeapDetails &heap, DacpHeapSegmentData &seg, CLRDATA_ADDRESS addr) { CLRDATA_ADDRESS dwAddrSeg = heap.generation_table[GetMaxGeneration()].start_segment; // Request the inital segment. - if (seg.Request(g_sos, dwAddrSeg, heap) != S_OK) + if (seg.Request(g_sos, dwAddrSeg, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p.\n", SOS_PTR(dwAddrSeg)); return FALSE; } // Loop while the object is not in range of the segment. - while (addr < TO_TADDR(seg.mem) || + while (addr < TO_TADDR(seg.mem) || addr >= (dwAddrSeg == heap.ephemeral_heap_segment ? heap.alloc_allocated : TO_TADDR(seg.allocated))) { // get the next segment @@ -1661,7 +1661,7 @@ BOOL FindSegment(const DacpGcHeapDetails &heap, DacpHeapSegmentData &seg, CLRDAT if (dwAddrSeg == NULL) return FALSE; - if (seg.Request(g_sos, dwAddrSeg, heap) != S_OK) + if (seg.Request(g_sos, dwAddrSeg, heap.original_heap_details) != S_OK) { ExtOut("Error requesting heap segment %p.\n", SOS_PTR(dwAddrSeg)); return FALSE; @@ -1671,7 +1671,7 @@ BOOL FindSegment(const DacpGcHeapDetails &heap, DacpHeapSegmentData &seg, CLRDAT return TRUE; } -BOOL VerifyObject(const DacpGcHeapDetails &heap, DWORD_PTR objAddr, DWORD_PTR MTAddr, size_t objSize, BOOL bVerifyMember) +BOOL VerifyObject(const GCHeapDetails &heap, DWORD_PTR objAddr, DWORD_PTR MTAddr, size_t objSize, BOOL bVerifyMember) { // This is only used by the other VerifyObject function if bVerifyMember is true, // so we only initialize it if we need it for verifying object members. @@ -1691,8 +1691,8 @@ BOOL VerifyObject(const DacpGcHeapDetails &heap, DWORD_PTR objAddr, DWORD_PTR MT typedef void (*TYPETREEVISIT)(size_t methodTable, size_t ID, LPVOID token); // TODO remove this. MethodTableCache already maps method tables to -// various information. We don't need TypeTree to do this too. -// Straightfoward to do, but low priority. +// various information. We don't need TypeTree to do this too. +// Straightfoward to do, but low priority. class TypeTree { private: @@ -1701,7 +1701,7 @@ class TypeTree TypeTree *pLeft; TypeTree *pRight; -public: +public: TypeTree(size_t MT) : methodTable(MT),ID(0),pLeft(NULL),pRight(NULL) { } BOOL isIn(size_t MT, size_t *pID) @@ -1719,9 +1719,9 @@ class TypeTree else if (MT < pCur->methodTable) pCur = pCur->pLeft; else - pCur = pCur->pRight; + pCur = pCur->pRight; } - + return FALSE; } @@ -1741,16 +1741,16 @@ class TypeTree break; } else if (pCur->pRight) - pCur = pCur->pRight; + pCur = pCur->pRight; else break; - } + } // If we got here, we need to append at the current node. TypeTree *pNewNode = new TypeTree(MT); if (pNewNode == NULL) return FALSE; - + if (MT < pCur->methodTable) pCur->pLeft = pNewNode; else @@ -1768,7 +1768,7 @@ class TypeTree destroy(pCur->pLeft); destroy(pCur->pRight); delete [] pCur; - } + } } static void visit_inorder(TypeTree *pStart, TYPETREEVISIT pFunc, LPVOID token) @@ -1780,7 +1780,7 @@ class TypeTree visit_inorder(pCur->pLeft, pFunc, token); pFunc (pCur->methodTable, pCur->ID, token); visit_inorder(pCur->pRight, pFunc, token); - } + } } static void setTypeIDs(TypeTree *pStart, size_t *pCurID) @@ -1793,9 +1793,9 @@ class TypeTree pCur->ID = *pCurID; (*pCurID)++; setTypeIDs(pCur->pRight, pCurID); - } + } } - + }; /////////////////////////////////////////////////////////////////////////////// @@ -1810,13 +1810,13 @@ HeapTraverser::HeapTraverser(bool verify) m_curNID = 1; m_verify = verify; } - -HeapTraverser::~HeapTraverser() -{ - if (m_pTypeTree) { - TypeTree::destroy(m_pTypeTree); + +HeapTraverser::~HeapTraverser() +{ + if (m_pTypeTree) { + TypeTree::destroy(m_pTypeTree); m_pTypeTree = NULL; - } + } } BOOL HeapTraverser::Initialize() @@ -1845,9 +1845,9 @@ BOOL HeapTraverser::CreateReport (FILE *fp, int format) m_file = fp; m_format = format; - PrintSection(TYPE_START,TRUE); - - PrintSection(TYPE_TYPES,TRUE); + PrintSection(TYPE_START,TRUE); + + PrintSection(TYPE_TYPES,TRUE); TypeTree::visit_inorder(m_pTypeTree, HeapTraverser::PrintOutTree, this); PrintSection(TYPE_TYPES,FALSE); @@ -1856,20 +1856,20 @@ BOOL HeapTraverser::CreateReport (FILE *fp, int format) PrintRootHead(); TraceHandles(); - FindGCRootOnStacks(); + FindGCRootOnStacks(); PrintRootTail(); PrintSection(TYPE_ROOTS,FALSE); - + // now print type tree - PrintSection(TYPE_OBJECTS,TRUE); + PrintSection(TYPE_OBJECTS,TRUE); ExtOut("\nWalking heap...\n"); m_objVisited = 0; // for UI updates GCHeapsTraverse (HeapTraverser::PrintHeap, this, FALSE); // Never verify on the second pass - PrintSection(TYPE_OBJECTS,FALSE); - - PrintSection(TYPE_START,FALSE); - + PrintSection(TYPE_OBJECTS,FALSE); + + PrintSection(TYPE_START,FALSE); + m_file = NULL; return TRUE; } @@ -1903,7 +1903,7 @@ size_t HeapTraverser::getID(size_t mTable) { return ret; } - + return 0; } @@ -1912,7 +1912,7 @@ void replace(std::wstring &str, const WCHAR *toReplace, const WCHAR *replaceWith { const size_t replaceLen = _wcslen(toReplace); const size_t replaceWithLen = _wcslen(replaceWith); - + size_t i = str.find(toReplace); while (i != std::wstring::npos) { @@ -1967,7 +1967,7 @@ void HeapTraverser::PrintObjectHead(size_t objAddr,size_t typeID,size_t Size) (PBYTE)objAddr,m_curNID); m_curNID++; - + fprintf(m_file, "o 0x%p %d %d ", (PBYTE)objAddr,typeID,Size); @@ -2002,7 +2002,7 @@ void HeapTraverser::PrintObjectMember(size_t memberValue, bool dependentHandle) { fprintf(m_file, " 0x%p", - (PBYTE)memberValue); + (PBYTE)memberValue); } } @@ -2060,7 +2060,7 @@ void HeapTraverser::PrintSection(int Type,BOOL bOpening) const char *const pTypes[] = {"","","",""}; const char *const pTypeEnds[] = {"","","",""}; - if (m_format==FORMAT_XML) + if (m_format==FORMAT_XML) { if ((Type >= 0) && (Type < TYPE_HIGHEST)) { @@ -2070,7 +2070,7 @@ void HeapTraverser::PrintSection(int Type,BOOL bOpening) { ExtOut ("INVALID TYPE %d\n", Type); } - } + } else if (m_format==FORMAT_CLRPROFILER) { if ((Type == TYPE_START) && !bOpening) // a final newline is needed @@ -2092,19 +2092,19 @@ void HeapTraverser::FindGCRootOnStacks() ExtOut("Failed to enumerate threads in the process.\n"); return; } - + int total = 0; DacpThreadData vThread; for (int i = 0; i < numThreads; i++) { if (FAILED(vThread.Request(g_sos, threadList[i]))) continue; - + if (vThread.osThreadId) { unsigned int refCount = 0; ArrayHolder refs = NULL; - + if (FAILED(::GetGCRefs(vThread.osThreadId, &refs, &refCount, NULL, NULL))) { ExtOut("Failed to walk thread %x\n", vThread.osThreadId); @@ -2116,11 +2116,11 @@ void HeapTraverser::FindGCRootOnStacks() PrintRoot(W("stack"), TO_TADDR(refs[i].Object)); } } - + } -/* static */ void HeapTraverser::PrintOutTree(size_t methodTable, size_t ID, +/* static */ void HeapTraverser::PrintOutTree(size_t methodTable, size_t ID, LPVOID token) { HeapTraverser *pHolder = (HeapTraverser *) token; @@ -2131,9 +2131,9 @@ void HeapTraverser::FindGCRootOnStacks() /* static */ void HeapTraverser::PrintHeap(DWORD_PTR objAddr,size_t Size, DWORD_PTR methodTable, LPVOID token) -{ +{ if (!IsMTForFreeObj (methodTable)) - { + { HeapTraverser *pHolder = (HeapTraverser *) token; pHolder->m_objVisited++; size_t ID = pHolder->getID(methodTable); @@ -2154,19 +2154,19 @@ void HeapTraverser::TraceHandles() { unsigned int fetched = 0; SOSHandleData data[64]; - + ToRelease handles; HRESULT hr = g_sos->GetHandleEnum(&handles); if (FAILED(hr)) return; - + do { hr = handles->Next(_countof(data), data, &fetched); - + if (FAILED(hr)) break; - + for (unsigned int i = 0; i < fetched; ++i) PrintRoot(W("handle"), (size_t)data[i].Handle); } while (fetched == _countof(data)); @@ -2174,7 +2174,7 @@ void HeapTraverser::TraceHandles() /* static */ void HeapTraverser::GatherTypes(DWORD_PTR objAddr,size_t Size, DWORD_PTR methodTable, LPVOID token) -{ +{ if (!IsMTForFreeObj (methodTable)) { HeapTraverser *pHolder = (HeapTraverser *) token; @@ -2185,17 +2185,17 @@ void HeapTraverser::TraceHandles() void HeapTraverser::PrintRefs(size_t obj, size_t methodTable, size_t size) { DWORD_PTR dwAddr = methodTable; - + // TODO: pass info to callback having to lookup the MethodTableInfo again MethodTableInfo* info = g_special_mtCache.Lookup((DWORD_PTR)methodTable); _ASSERTE(info->IsInitialized()); // This is the second pass, so we should be initialized if (!info->bContainsPointers && !info->bCollectible) return; - + if (info->bContainsPointers) { - // Fetch the GCInfo from the other process + // Fetch the GCInfo from the other process CGCDesc *map = info->GCInfo; if (map == NULL) { @@ -2207,7 +2207,7 @@ void HeapTraverser::PrintRefs(size_t obj, size_t methodTable, size_t size) arrayOfVC = true; nEntries = -nEntries; } - + size_t nSlots = 1+nEntries*sizeof(CGCDescSeries)/sizeof(DWORD_PTR); info->GCInfoBuffer = new DWORD_PTR[nSlots]; if (info->GCInfoBuffer == NULL) @@ -2217,9 +2217,9 @@ void HeapTraverser::PrintRefs(size_t obj, size_t methodTable, size_t size) } if (FAILED(rvCache->Read(TO_CDADDR(dwAddr - nSlots*sizeof(DWORD_PTR)), - info->GCInfoBuffer, (ULONG) (nSlots*sizeof(DWORD_PTR)), NULL))) + info->GCInfoBuffer, (ULONG) (nSlots*sizeof(DWORD_PTR)), NULL))) return; - + map = info->GCInfo = (CGCDesc*)(info->GCInfoBuffer+nSlots); info->ArrayOfVC = arrayOfVC; } @@ -2240,7 +2240,7 @@ void HeapTraverser::PrintRefs(size_t obj, size_t methodTable, size_t size) } } } - + std::unordered_map>::iterator itr = mDependentHandleMap.find((TADDR)obj); if (itr != mDependentHandleMap.end()) { @@ -2289,10 +2289,10 @@ bool sos::ObjectIterator::VerifyObjectMembers(char *reason, size_t count) const BuildError(reason, count, "Object %s has a bad GCDesc.", DMLObject(objAddr)); return false; } - - CGCDesc *map = (CGCDesc *)(buffer+nSlots); - CGCDescSeries* cur = map->GetHighestSeries(); - CGCDescSeries* last = map->GetLowestSeries(); + + CGCDesc *map = (CGCDesc *)(buffer+nSlots); + CGCDescSeries* cur = map->GetHighestSeries(); + CGCDescSeries* last = map->GetLowestSeries(); const size_t bufferSize = sizeof(size_t)*128; size_t objBuffer[bufferSize/sizeof(size_t)]; @@ -2300,7 +2300,7 @@ bool sos::ObjectIterator::VerifyObjectMembers(char *reason, size_t count) const size_t bytesInBuffer = bufferSize; if (size < bytesInBuffer) bytesInBuffer = size; - + if (FAILED(g_ExtData->ReadVirtual(TO_CDADDR(dwBeginAddr), objBuffer, (ULONG) bytesInBuffer,NULL))) { @@ -2330,14 +2330,14 @@ bool sos::ObjectIterator::VerifyObjectMembers(char *reason, size_t count) const } } - if (cur >= last) - { - do - { - BYTE** parm = (BYTE**)((objAddr) + cur->GetSeriesOffset()); - BYTE** ppstop = - (BYTE**)((BYTE*)parm + cur->GetSeriesSize() + (size)); - while (parm < ppstop) + if (cur >= last) + { + do + { + BYTE** parm = (BYTE**)((objAddr) + cur->GetSeriesOffset()); + BYTE** ppstop = + (BYTE**)((BYTE*)parm + cur->GetSeriesSize() + (size)); + while (parm < ppstop) { CheckInterrupt(); size_t dwAddr1; @@ -2370,22 +2370,22 @@ bool sos::ObjectIterator::VerifyObjectMembers(char *reason, size_t count) const BOOL bPointers; DWORD_PTR dwAddrMethTable; if (FAILED(GetMTOfObject(dwAddr1, &dwAddrMethTable)) || - (GetSizeEfficient(dwAddr1, dwAddrMethTable, FALSE, s, bPointers) == FALSE)) + (GetSizeEfficient(dwAddr1, dwAddrMethTable, FALSE, s, bPointers) == FALSE)) { BuildError(reason, count, "object %s: bad member %p at %p", DMLObject(objAddr), SOS_PTR(dwAddr1), SOS_PTR(objAddr+(size_t)parm-objAddr)); return false; } - + if (IsMTForFreeObj(dwAddrMethTable)) { sos::Throw("object %s contains free object %p at %p", DMLObject(objAddr), SOS_PTR(dwAddr1), SOS_PTR(objAddr+(size_t)parm-objAddr)); } - + // verify card table - if (bCheckCard && + if (bCheckCard && NeedCard(objAddr+(size_t)parm-objAddr,dwChild)) { BuildError(reason, count, "Object %s: %s missing card_table entry for %p", @@ -2395,7 +2395,7 @@ bool sos::ObjectIterator::VerifyObjectMembers(char *reason, size_t count) const return false; } } - parm++; + parm++; } cur--; CheckInterrupt(); @@ -2446,7 +2446,7 @@ bool sos::ObjectIterator::VerifyObjectMembers(char *reason, size_t count) const BOOL bPointers; DWORD_PTR dwAddrMethTable; if (FAILED(GetMTOfObject(dwAddr1, &dwAddrMethTable)) || - (GetSizeEfficient(dwAddr1, dwAddrMethTable, FALSE, s, bPointers) == FALSE)) + (GetSizeEfficient(dwAddr1, dwAddrMethTable, FALSE, s, bPointers) == FALSE)) { BuildError(reason, count, "Object %s: Bad member %p at %p.\n", DMLObject(objAddr), SOS_PTR(dwAddr1), SOS_PTR(objAddr+(size_t)parm-objAddr)); @@ -2501,13 +2501,13 @@ bool sos::ObjectIterator::Verify(char *reason, size_t count) const BuildError(reason, count, "Object %s: Size %d is too small.", DMLObject(mCurrObj.GetAddress()), size); return false; } - + if (mCurrObj.GetAddress() + mCurrObj.GetSize() > mSegmentEnd) { BuildError(reason, count, "Object %s is too large. End of segment at %p.", DMLObject(mCurrObj), mSegmentEnd); return false; } - + BOOL bVerifyMember = TRUE; // If we requested to verify the object's members, the GC may be in a state where that's not possible. diff --git a/src/SOS/Strike/sos.cpp b/src/SOS/Strike/sos.cpp index 2a160f9d36..0f0d169bbb 100644 --- a/src/SOS/Strike/sos.cpp +++ b/src/SOS/Strike/sos.cpp @@ -29,7 +29,7 @@ namespace sos return true; else if (end2 >= beg1 && end2 <= end1) // second range ends within first range return true; - else if (beg1 >= beg2 && beg1 <= end2) // first range starts within second range + else if (beg1 >= beg2 && beg1 <= end2) // first range starts within second range return true; else if (end1 >= beg2 && end1 <= end2) // first range ends within second range return true; @@ -51,8 +51,8 @@ namespace sos if ((mAddress & ~ALIGNCONST) != mAddress) sos::Throw("Object %p is misaligned.", mAddress); } - - + + Object::Object(const Object &rhs) : mAddress(rhs.mAddress), mMT(rhs.mMT), mSize(rhs.mSize), mPointers(rhs.mPointers), mMTData(rhs.mMTData), mTypeName(rhs.mTypeName) { @@ -64,7 +64,7 @@ namespace sos { if (mMTData) delete mMTData; - + if (mTypeName) delete mTypeName; @@ -115,7 +115,7 @@ namespace sos TADDR temp; if (FAILED(MOVE(temp, mAddress))) sos::Throw("Object %s has an invalid method table.", DMLListNearObj(mAddress)); - + if (temp == NULL) sos::Throw("Object %s has an invalid method table.", DMLListNearObj(mAddress)); @@ -124,19 +124,19 @@ namespace sos return mMT; } - + TADDR Object::GetComponentMT() const { if (mMT != NULL && mMT != sos::MethodTable::GetArrayMT()) return NULL; - + DacpObjectData objData; if (FAILED(objData.Request(g_sos, TO_CDADDR(mAddress)))) sos::Throw("Failed to request object data for %s.", DMLListNearObj(mAddress)); - + if (mMT == NULL) mMT = TO_TADDR(objData.MethodTable) & ~3; - + return TO_TADDR(objData.ElementTypeHandle); } @@ -144,8 +144,8 @@ namespace sos { if (mTypeName == NULL) mTypeName = CreateMethodTableName(GetMT(), GetComponentMT()); - - + + if (mTypeName == NULL) return W(""); @@ -190,7 +190,7 @@ namespace sos info->LoaderAllocatorObjectHandle = TO_TADDR(mtcd.LoaderAllocatorObjectHandle); } } - + if (mSize == (size_t)~0) { mSize = info->BaseSize; @@ -259,11 +259,11 @@ namespace sos // Verify all fields on the object. CLRDATA_ADDRESS dwAddr = vMethodTableFields.FirstField; DacpFieldDescData vFieldDesc; - + while (numInstanceFields < vMethodTableFields.wNumInstanceFields) { CheckInterrupt(); - + if (FAILED(vFieldDesc.Request(g_sos, dwAddr))) return false; @@ -271,14 +271,14 @@ namespace sos return false; dwAddr = vFieldDesc.NextField; - + if (!vFieldDesc.bIsStatic) { - numInstanceFields++; + numInstanceFields++; TADDR dwTmp = TO_TADDR(obj + vFieldDesc.dwOffset + sizeof(BaseObject)); if (vFieldDesc.Type == ELEMENT_TYPE_CLASS) { - // Is it a valid object? + // Is it a valid object? if (FAILED(MOVE(dwTmp, dwTmp))) return false; @@ -289,9 +289,9 @@ namespace sos return false; } } - } + } } - + return true; } @@ -301,7 +301,7 @@ namespace sos MethodTable mt = addr; return _wcscmp(mt.GetName(), W("")) == 0; } - + void MethodTable::Clear() { if (mName) @@ -310,15 +310,15 @@ namespace sos mName = NULL; } } - + const WCHAR *MethodTable::GetName() const { if (mName == NULL) mName = CreateMethodTableName(mMT); - + if (mName == NULL) return W(""); - + return mName; } @@ -334,7 +334,7 @@ namespace sos { return VerifyMemberFields(TO_TADDR(objectData.MethodTable), address); } - + return true; } @@ -358,10 +358,10 @@ namespace sos { out.ThreadPtr = TO_TADDR(threadPtr); } - + return out.ThreadId != 0 && out.ThreadPtr != NULL; } - + bool Object::GetStringData(__out_ecount(size) WCHAR *buffer, size_t size) const { SOS_Assert(IsString()); @@ -370,7 +370,7 @@ namespace sos return SUCCEEDED(g_sos->GetObjectStringData(mAddress, (ULONG32)size, buffer, NULL)); } - + size_t Object::GetStringLength() const { SOS_Assert(IsString()); @@ -401,13 +401,13 @@ namespace sos { Init(); } - + RefIterator::~RefIterator() { if (mBuffer) delete [] mBuffer; } - + const RefIterator &RefIterator::operator++() { if (mDone) @@ -419,7 +419,7 @@ namespace sos mDone = true; return *this; } - + if (!mArrayOfVC) { mCurr += sizeof(TADDR); @@ -444,18 +444,18 @@ namespace sos { int i_last = i; i--; - + if (i == mCount) i = 0; - + mCurr += mCurrSeries->val_serie[i_last].skip; mStop = mCurr + mCurrSeries->val_serie[i].nptrs * sizeof(TADDR); } - + if (mCurr >= mObject + mObjSize - plug_skew) mDone = true; } - + if (mDone && mLoaderAllocatorObjectHandle != NULL) { // The iteration over all regular object references is done, but there is one more @@ -466,17 +466,17 @@ namespace sos return *this; } - + TADDR RefIterator::operator*() const { return ReadPointer(mCurr); } - + TADDR RefIterator::GetOffset() const { return mCurr - mObject; } - + void RefIterator::Init() { TADDR mt = ReadPointer(mObject); @@ -559,7 +559,7 @@ namespace sos mLoaderAllocatorObjectHandle = loaderAllocatorObjectHandle; if (mDone) { - // There are no object references, but there is still a reference for + // There are no object references, but there is still a reference for // collectible types - the LoaderAllocator for GC mCurr = mLoaderAllocatorObjectHandle; mDone = false; @@ -571,19 +571,21 @@ namespace sos const TADDR GCHeap::HeapStart = 0; const TADDR GCHeap::HeapEnd = ~0; - ObjectIterator::ObjectIterator(const DacpGcHeapDetails *heap, int numHeaps, TADDR start, TADDR stop) - : bLarge(false), mCurrObj(0), mLastObj(0), mStart(start), mEnd(stop), mSegmentEnd(0), mHeaps(heap), + ObjectIterator::ObjectIterator(const GCHeapDetails *heap, int numHeaps, TADDR start, TADDR stop) + : bLarge(false), bPinned(false), mCurrObj(0), mLastObj(0), mStart(start), mEnd(stop), mSegmentEnd(0), mHeaps(heap), mNumHeaps(numHeaps), mCurrHeap(0) { mAllocInfo.Init(); SOS_Assert(numHeaps > 0); TADDR segStart = TO_TADDR(mHeaps[0].generation_table[GetMaxGeneration()].start_segment); - if (FAILED(mSegment.Request(g_sos, segStart, mHeaps[0]))) + if (FAILED(mSegment.Request(g_sos, segStart, mHeaps[0].original_heap_details))) + { sos::Throw("Could not request segment data at %p.", segStart); + } mCurrObj = mStart < TO_TADDR(mSegment.mem) ? TO_TADDR(mSegment.mem) : mStart; - mSegmentEnd = (segStart == TO_TADDR(mHeaps[0].ephemeral_heap_segment)) ? + mSegmentEnd = (segStart == TO_TADDR(mHeaps[0].ephemeral_heap_segment)) ? TO_TADDR(mHeaps[0].alloc_allocated) : TO_TADDR(mSegment.allocated); @@ -593,35 +595,48 @@ namespace sos bool ObjectIterator::NextSegment() { if (mCurrHeap >= mNumHeaps) + { return false; + } TADDR next = TO_TADDR(mSegment.next); if (next == NULL) { - if (bLarge) + if (bPinned || (bLarge && !mHeaps[mCurrHeap].has_poh)) { mCurrHeap++; if (mCurrHeap == mNumHeaps) + { return false; + } + bPinned = false; bLarge = false; next = TO_TADDR(mHeaps[mCurrHeap].generation_table[GetMaxGeneration()].start_segment); } + else if (bLarge) + { + bLarge = false; + bPinned = true; + next = TO_TADDR(mHeaps[mCurrHeap].generation_table[GetMaxGeneration() + 2].start_segment); + } else { bLarge = true; - next = TO_TADDR(mHeaps[mCurrHeap].generation_table[GetMaxGeneration()+1].start_segment); + next = TO_TADDR(mHeaps[mCurrHeap].generation_table[GetMaxGeneration() + 1].start_segment); } } SOS_Assert(next != NULL); - if (FAILED(mSegment.Request(g_sos, next, mHeaps[mCurrHeap]))) + if (FAILED(mSegment.Request(g_sos, next, mHeaps[mCurrHeap].original_heap_details))) + { sos::Throw("Failed to request segment data at %p.", next); + } mLastObj = 0; mCurrObj = mStart < TO_TADDR(mSegment.mem) ? TO_TADDR(mSegment.mem) : mStart; - mSegmentEnd = (next == TO_TADDR(mHeaps[mCurrHeap].ephemeral_heap_segment)) ? - TO_TADDR(mHeaps[mCurrHeap].alloc_allocated) : + mSegmentEnd = (next == TO_TADDR(mHeaps[mCurrHeap].ephemeral_heap_segment)) ? + TO_TADDR(mHeaps[mCurrHeap].alloc_allocated) : TO_TADDR(mSegment.allocated); return CheckSegmentRange(); } @@ -655,7 +670,7 @@ namespace sos } - + const Object &ObjectIterator::operator*() const { AssertSanity(); @@ -724,13 +739,13 @@ namespace sos mCurrObj = mCurrObj.GetAddress() + size; if (!bLarge) - { + { // Is this the end of an allocation context? We need to know this because there can be // allocated memory at the end of an allocation context that doesn't yet contain any objects. // This happens because we actually allocate a minimum amount of memory (the allocation quantum) // whenever we need to get more memory. Typically, a single allocation request won't fill this // block, so we'll fulfill subsequent requests out of the remainder of the block until it's - // depleted. + // depleted. int i; for (i = 0; i < mAllocInfo.num; i ++) { @@ -766,32 +781,50 @@ namespace sos GCHeap::GCHeap() { if (FAILED(mHeapData.Request(g_sos))) + { sos::Throw("Failed to request GC heap data."); + } if (mHeapData.bServerMode) { mNumHeaps = mHeapData.HeapCount; DWORD dwAllocSize = 0; if (!ClrSafeInt::multiply(sizeof(CLRDATA_ADDRESS), mNumHeaps, dwAllocSize)) + { sos::Throw("Failed to get GCHeaps: Integer overflow."); + } CLRDATA_ADDRESS *heapAddrs = (CLRDATA_ADDRESS*)alloca(dwAllocSize); if (FAILED(g_sos->GetGCHeapList(mNumHeaps, heapAddrs, NULL))) + { sos::Throw("Failed to get GCHeaps."); + } - mHeaps = new DacpGcHeapDetails[mNumHeaps]; + mHeaps = new GCHeapDetails[mNumHeaps]; for (int i = 0; i < mNumHeaps; i++) - if (FAILED(mHeaps[i].Request(g_sos, heapAddrs[i]))) + { + DacpGcHeapDetails dacHeapDetails; + if (FAILED(dacHeapDetails.Request(g_sos, heapAddrs[i]))) + { sos::Throw("Failed to get GC heap details at %p.", heapAddrs[i]); + } + + mHeaps[i].Set(dacHeapDetails, heapAddrs[i]); + } } else { - mHeaps = new DacpGcHeapDetails[1]; + mHeaps = new GCHeapDetails[1]; mNumHeaps = 1; - - if (FAILED(mHeaps[0].Request(g_sos))) + + DacpGcHeapDetails dacGCDetails; + if (FAILED(dacGCDetails.Request(g_sos))) + { sos::Throw("Failed to request GC details data."); + } + + mHeaps[0].Set(dacGCDetails); } } @@ -821,7 +854,7 @@ namespace sos { Init(); } - + const SyncBlk &SyncBlk::operator=(int index) { mIndex = index; @@ -898,7 +931,7 @@ namespace sos SOS_Assert(mIndex); return TO_TADDR(mData.appDomainPtr); } - + void BuildTypeWithExtraInfo(TADDR addr, unsigned int size, __inout_ecount(size) WCHAR *buffer) { try @@ -907,9 +940,9 @@ namespace sos TADDR mtAddr = obj.GetMT(); bool isArray = sos::MethodTable::IsArrayMT(mtAddr); bool isString = obj.IsString(); - + sos::MethodTable mt(isArray ? obj.GetComponentMT() : mtAddr); - + if (isArray) { swprintf_s(buffer, size, W("%s[]"), mt.GetName()); @@ -918,7 +951,7 @@ namespace sos { WCHAR str[32]; obj.GetStringData(str, _countof(str)); - + _snwprintf_s(buffer, size, _TRUNCATE, W("%s: \"%s\""), mt.GetName(), str); } else @@ -929,10 +962,10 @@ namespace sos catch (const sos::Exception &e) { int len = MultiByteToWideChar(CP_ACP, 0, e.what(), -1, NULL, 0); - + ArrayHolder tmp = new WCHAR[len]; MultiByteToWideChar(CP_ACP, 0, e.what(), -1, (WCHAR*)tmp, len); - + swprintf_s(buffer, size, W(""), (WCHAR*)tmp); } } diff --git a/src/SOS/Strike/sos.h b/src/SOS/Strike/sos.h index b8a85660b1..458b013ed4 100644 --- a/src/SOS/Strike/sos.h +++ b/src/SOS/Strike/sos.h @@ -136,7 +136,7 @@ namespace sos * mt - The address of the MethodTable to test for. */ static bool IsZombie(TADDR mt); - + /* Returns the method table for arrays. */ inline static TADDR GetArrayMT() @@ -164,7 +164,7 @@ namespace sos { return GetFreeMT() == mt; } - + /* Returns true if the given method table is that of an Array. */ inline static bool IsArrayMT(TADDR mt) @@ -178,7 +178,7 @@ namespace sos { return GetStringMT() == mt; } - + inline static bool IsValid(TADDR mt) { DacpMethodTableData data; @@ -190,7 +190,7 @@ namespace sos : mMT(mt), mName(0) { } - + MethodTable(const MethodTable &mt) : mMT(mt.mMT), mName(mt.mName) { @@ -198,7 +198,7 @@ namespace sos // the copy instead of the original. mt.mName = NULL; } - + const MethodTable &operator=(const MethodTable &mt) { Clear(); @@ -208,10 +208,10 @@ namespace sos mMT = mt.mMT; mName = mt.mName; mt.mName = NULL; - + return *this; } - + ~MethodTable() { Clear(); @@ -252,7 +252,7 @@ namespace sos * true will make IsValid return less false positives. */ static bool IsValid(TADDR address, bool verifyFields=false); - + static int GetStringDataOffset() { #ifndef _TARGET_WIN64_ @@ -279,14 +279,14 @@ namespace sos * Exception - if addr is misaligned. */ Object(TADDR addr, TADDR mt); - + Object(const Object &rhs); inline ~Object() { if (mMTData) delete mMTData; - + if (mTypeName) delete mTypeName; } @@ -320,7 +320,7 @@ namespace sos * DataRead - we failed to read the object header. */ ULONG GetHeader() const; - + /* Gets the header for the current object, does not throw any exception. * Params: * outHeader - filled with the header if this function was successful. @@ -328,7 +328,7 @@ namespace sos * True if we successfully read the object header, false otherwise. */ bool TryGetHeader(ULONG &outHeader) const; - + /* Returns the method table of the object this represents. * Throws: * DataRead - If we failed to read the method table from the address. @@ -338,7 +338,7 @@ namespace sos * verification here.) */ TADDR GetMT() const; - + /* Returns the component method table of the object. For example, if * this object is an array, the method table will be the general array * MT. Calling this function tells you what type of objects can be @@ -453,19 +453,19 @@ namespace sos RefIterator(TADDR obj, LinearReadCache *cache = NULL); RefIterator(TADDR obj, CGCDesc *desc, bool arrayOfVC, LinearReadCache *cache = NULL); ~RefIterator(); - + /* Moves to the next reference in the object. */ const RefIterator &operator++(); - + /* Returns the address of the current reference. */ TADDR operator*() const; - + /* Gets the offset into the object where the current reference comes from. */ TADDR GetOffset() const; - + /* Returns true if there are more objects in the iteration, false otherwise. * Used as: * if (itr) @@ -480,7 +480,7 @@ namespace sos { return mLoaderAllocatorObjectHandle == mCurr; } - + private: void Init(); inline TADDR ReadPointer(TADDR addr) const @@ -494,22 +494,22 @@ namespace sos { MOVE(addr, addr); } - + return addr; } - + private: LinearReadCache *mCache; CGCDesc *mGCDesc; bool mArrayOfVC, mDone; - + TADDR *mBuffer; CGCDescSeries *mCurrSeries; - + TADDR mLoaderAllocatorObjectHandle; int i, mCount; - + TADDR mCurr, mStop, mObject; size_t mObjSize; }; @@ -612,7 +612,7 @@ namespace sos void MoveToNextObjectCarefully(); private: - ObjectIterator(const DacpGcHeapDetails *heap, int numHeaps, TADDR start, TADDR stop); + ObjectIterator(const GCHeapDetails *heap, int numHeaps, TADDR start, TADDR stop); bool VerifyObjectMembers(__out_ecount(size) char *buffer, size_t size) const; void BuildError(__out_ecount(count) char *out, size_t count, const char *format, ...) const; @@ -625,10 +625,11 @@ namespace sos private: DacpHeapSegmentData mSegment; bool bLarge; + bool bPinned; Object mCurrObj; TADDR mLastObj, mStart, mEnd, mSegmentEnd; AllocInfo mAllocInfo; - const DacpGcHeapDetails *mHeaps; + const GCHeapDetails *mHeaps; int mNumHeaps; int mCurrHeap; }; @@ -649,7 +650,7 @@ namespace sos * DataRead - if we could not read the syncblk entry for the given index. */ explicit SyncBlk(int index); - + /* Returns whether or not the current entry is a "Free" SyncBlk table entry * or not. This should be called *before* any other function here. */ @@ -736,7 +737,7 @@ namespace sos int mCurr, mTotal; SyncBlk mSyncBlk; }; - + /* An class which contains information about the GCHeap. */ class GCHeap @@ -779,7 +780,7 @@ namespace sos bool AreGCStructuresValid() const; private: - DacpGcHeapDetails *mHeaps; + GCHeapDetails *mHeaps; DacpGcHeapData mHeapData; int mNumHeaps; }; @@ -795,7 +796,7 @@ namespace sos { return Object::IsValid(TO_TADDR(addr), verifyFields); } - - + + void BuildTypeWithExtraInfo(TADDR addr, unsigned int size, __inout_ecount(size) WCHAR *buffer); } diff --git a/src/SOS/Strike/strike.cpp b/src/SOS/Strike/strike.cpp index ef0598a667..b6d338e08f 100644 --- a/src/SOS/Strike/strike.cpp +++ b/src/SOS/Strike/strike.cpp @@ -3,9 +3,9 @@ // See the LICENSE file in the project root for more information. // ==++== -// - -// +// + +// // ==--== // =========================================================================== @@ -17,45 +17,45 @@ // //************************************************************************************************ // SOS is the native debugging extension designed to support investigations into CLR (mis-) -// behavior by both users of the runtime as well as the code owners. It allows inspection of +// behavior by both users of the runtime as well as the code owners. It allows inspection of // internal structures, of user visible entities, as well as execution control. -// -// This is the main SOS file hosting the implementation of all the exposed commands. A good +// +// This is the main SOS file hosting the implementation of all the exposed commands. A good // starting point for understanding the semantics of these commands is the sosdocs.txt file. -// +// // #CrossPlatformSOS -// SOS currently supports cross platform debugging from x86 to ARM. It takes a different approach -// from the DAC: whereas for the DAC we produce one binary for each supported host-target -// architecture pair, for SOS we produce only one binary for each host architecture; this one +// SOS currently supports cross platform debugging from x86 to ARM. It takes a different approach +// from the DAC: whereas for the DAC we produce one binary for each supported host-target +// architecture pair, for SOS we produce only one binary for each host architecture; this one // binary contains code for all supported target architectures. In doing this SOS depends on two // assumptions: -// . that the debugger will load the appropriate DAC, and +// . that the debugger will load the appropriate DAC, and // . that the host and target word size is identical. // The second assumption is identical to the DAC assumption, and there will be considerable effort // required (in the EE, the DAC, and SOS) if we ever need to remove it. -// -// In an ideal world SOS would be able to retrieve all platform specific information it needs +// +// In an ideal world SOS would be able to retrieve all platform specific information it needs // either from the debugger or from DAC. However, SOS has taken some subtle and not so subtle // dependencies on the CLR and the target platform. -// To resolve this problem, SOS now abstracts the target behind the IMachine interface, and uses -// calls on IMachine to take target-specific actions. It implements X86Machine, ARMMachine, and +// To resolve this problem, SOS now abstracts the target behind the IMachine interface, and uses +// calls on IMachine to take target-specific actions. It implements X86Machine, ARMMachine, and // AMD64Machine. An instance of these exists in each appropriate host (e.g. the X86 version of SOS -// contains instances of X86Machine and ARMMachine, the ARM version contains an instance of -// ARMMachine, and the AMD64 version contains an instance of AMD64Machine). The code included in -// each version if determined by the SosTarget*** MSBuild symbols, and SOS_TARGET_*** conditional +// contains instances of X86Machine and ARMMachine, the ARM version contains an instance of +// ARMMachine, and the AMD64 version contains an instance of AMD64Machine). The code included in +// each version if determined by the SosTarget*** MSBuild symbols, and SOS_TARGET_*** conditional // compilation symbols (as specified in sos.targets). -// +// // Most of the target specific code is hosted in disasm.h/.cpp, and disasmX86.cpp, disasmARM.cpp. // Some code currently under _TARGET_*** ifdefs may need to be reviewed/revisited. -// +// // Issues: -// The one-binary-per-host decision does have some drawbacks: -// . Currently including system headers or even CLR headers will only account for the host -// target, IOW, when building the X86 version of SOS, CONTEXT will refer to the X86 CONTEXT -// structure, so we need to be careful when debugging ARM targets. The CONTEXT issue is -// partially resolved by CROSS_PLATFORM_CONTEXT (there is still a need to be very careful +// The one-binary-per-host decision does have some drawbacks: +// . Currently including system headers or even CLR headers will only account for the host +// target, IOW, when building the X86 version of SOS, CONTEXT will refer to the X86 CONTEXT +// structure, so we need to be careful when debugging ARM targets. The CONTEXT issue is +// partially resolved by CROSS_PLATFORM_CONTEXT (there is still a need to be very careful // when handling arrays of CONTEXTs - see _EFN_StackTrace for details on this). -// . For larger includes (e.g. GC info), we will need to include files in specific namespaces, +// . For larger includes (e.g. GC info), we will need to include files in specific namespaces, // with specific _TARGET_*** macros defined in order to avoid name clashes and ensure correct // system types are used. // ----------------------------------------------------------------------------------------------- @@ -67,7 +67,7 @@ #include #include #ifndef FEATURE_PAL -#include +#include #endif // !FEATURE_PAL #include @@ -226,16 +226,16 @@ DECLARE_API (MinidumpMode) ONLY_SUPPORTED_ON_WINDOWS_TARGET(); DWORD_PTR Value=0; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&Value, COHEX} }; size_t nArg; - if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) { return Status; - } + } if (nArg == 0) { // Print status of current mode @@ -264,7 +264,7 @@ DECLARE_API (MinidumpMode) /**********************************************************************\ * Routine Description: * * * -* This function is called to get the MethodDesc for a given eip * +* This function is called to get the MethodDesc for a given eip * * * \**********************************************************************/ DECLARE_API(IP2MD) @@ -274,19 +274,19 @@ DECLARE_API(IP2MD) BOOL dml = FALSE; TADDR IP = 0; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&IP, COHEX}, }; size_t nArg; - - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -301,7 +301,7 @@ DECLARE_API(IP2MD) CLRDATA_ADDRESS cdaStart = TO_CDADDR(IP); CLRDATA_ADDRESS pMD; - + if ((Status = g_sos->GetMethodDescPtrFromIP(cdaStart, &pMD)) != S_OK) { ExtOut("Failed to request MethodData, not in JIT code range\n"); @@ -320,7 +320,7 @@ DECLARE_API(IP2MD) symlines &= SYMOPT_LOAD_LINES; } - if (symlines != 0 && + if (symlines != 0 && SUCCEEDED(GetLineByOffset(TO_CDADDR(IP), &linenum, filename, _countof(filename)))) { ExtOut("Source file: %S @ %d\n", filename, linenum); @@ -368,8 +368,8 @@ GetContextStackTrace(ULONG osThreadId, PULONG pnumFrames) g_ExtSystem->SetCurrentThreadId(id); // GetContextStackTrace fills g_FrameContexts as an array of - // contexts packed as target architecture contexts. We cannot - // safely cast this as an array of CROSS_PLATFORM_CONTEXT, since + // contexts packed as target architecture contexts. We cannot + // safely cast this as an array of CROSS_PLATFORM_CONTEXT, since // sizeof(CROSS_PLATFORM_CONTEXT) != sizeof(TGT_CONTEXT) hr = debugControl4->GetContextStackTrace( NULL, @@ -392,15 +392,15 @@ GetContextStackTrace(ULONG osThreadId, PULONG pnumFrames) /**********************************************************************\ * Routine Description: * * * -* This function displays the stack trace. It looks at each DWORD * +* This function displays the stack trace. It looks at each DWORD * * on stack. If the DWORD is a return address, the symbol name or * managed function name is displayed. * * * \**********************************************************************/ void DumpStackInternal(DumpStackFlag *pDSFlag) -{ +{ ReloadSymbolWithLineInfo(); - + ULONG64 StackOffset; g_ExtRegisters->GetStackOffset (&StackOffset); if (pDSFlag->top == 0) { @@ -413,7 +413,7 @@ void DumpStackInternal(DumpStackFlag *pDSFlag) pDSFlag->top = NextOSPageAddress(pDSFlag->top); } -#ifndef FEATURE_PAL +#ifndef FEATURE_PAL if (IsWindowsTarget() && (pDSFlag->end == 0)) { // Find the current stack range NT_TIB teb; @@ -432,13 +432,13 @@ void DumpStackInternal(DumpStackFlag *pDSFlag) } } #endif // FEATURE_PAL - + if (pDSFlag->end == 0) { ExtOut("TEB information is not available so a stack size of 0xFFFF is assumed\n"); pDSFlag->end = pDSFlag->top + 0xFFFF; } - + if (pDSFlag->end < pDSFlag->top) { ExtOut("Wrong option: stack selection wrong\n"); @@ -448,7 +448,7 @@ void DumpStackInternal(DumpStackFlag *pDSFlag) DumpStackWorker(*pDSFlag); } - + DECLARE_API(DumpStack) { INIT_API_NO_RET_ON_FAILURE(); @@ -498,7 +498,7 @@ DECLARE_API(DumpStack) ExtOut("(%d)\n", id); DumpStackInternal(&DSFlag); - + return Status; } @@ -506,15 +506,15 @@ DECLARE_API(DumpStack) /**********************************************************************\ * Routine Description: * * * -* This function displays the stack trace for threads that EE knows * +* This function displays the stack trace for threads that EE knows * * from ThreadStore. * * * \**********************************************************************/ DECLARE_API (EEStack) { - INIT_API(); + INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); DumpStackFlag DSFlag; DSFlag.fEEonly = FALSE; @@ -524,16 +524,16 @@ DECLARE_API (EEStack) BOOL bShortList = FALSE; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-EE", &DSFlag.fEEonly, COBOOL, FALSE}, {"-short", &bShortList, COBOOL, FALSE}, #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE} #endif - }; + }; - if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) + if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; } @@ -548,7 +548,7 @@ DECLARE_API (EEStack) { ExtOut("Failed to request ThreadStore\n"); return Status; - } + } CLRDATA_ADDRESS CurThread = ThreadStore.firstThread; while (CurThread) @@ -556,7 +556,7 @@ DECLARE_API (EEStack) if (IsInterrupt()) break; - DacpThreadData Thread; + DacpThreadData Thread; if ((Status = Thread.Request(g_sos, CurThread)) != S_OK) { ExtOut("Failed to request Thread at %p\n", CurThread); @@ -566,27 +566,27 @@ DECLARE_API (EEStack) ULONG id=0; if (g_ExtSystem->GetThreadIdBySystemId (Thread.osThreadId, &id) != S_OK) { - CurThread = Thread.nextThread; + CurThread = Thread.nextThread; continue; } - + ExtOut("---------------------------------------------\n"); ExtOut("Thread %3d\n", id); BOOL doIt = FALSE; - + #define TS_Hijacked 0x00000080 - if (!bShortList) + if (!bShortList) { doIt = TRUE; } - else if ((Thread.lockCount > 0) || (Thread.state & TS_Hijacked)) - { + else if ((Thread.lockCount > 0) || (Thread.state & TS_Hijacked)) + { // TODO: bring back || (int)vThread.m_pFrame != -1 { doIt = TRUE; } - else + else { ULONG64 IP; g_ExtRegisters->GetInstructionOffset (&IP); @@ -599,8 +599,8 @@ DECLARE_API (EEStack) doIt = TRUE; } } - - if (doIt) + + if (doIt) { g_ExtSystem->SetCurrentThreadId(id); DSFlag.top = 0; @@ -645,7 +645,7 @@ HRESULT DumpStackObjectsRaw(size_t nArg, __in_z LPSTR exprBottom, __in_z LPSTR e } } } - + #ifndef FEATURE_PAL if (IsWindowsTarget()) { @@ -662,10 +662,10 @@ HRESULT DumpStackObjectsRaw(size_t nArg, __in_z LPSTR exprBottom, __in_z LPSTR e } } #endif - + if (StackBottom == 0) StackBottom = StackTop + 0xFFFF; - + if (StackBottom < StackTop) { ExtOut("Wrong option: stack selection wrong\n"); @@ -673,12 +673,12 @@ HRESULT DumpStackObjectsRaw(size_t nArg, __in_z LPSTR exprBottom, __in_z LPSTR e } // We can use the gc snapshot to eliminate object addresses that are - // not on the gc heap. + // not on the gc heap. if (!g_snapshot.Build()) { ExtOut("Unable to determine bounds of gc heap\n"); return E_FAIL; - } + } // Print thread ID. ULONG id = 0; @@ -686,7 +686,7 @@ HRESULT DumpStackObjectsRaw(size_t nArg, __in_z LPSTR exprBottom, __in_z LPSTR e ExtOut("OS Thread Id: 0x%x ", id); g_ExtSystem->GetCurrentThreadId (&id); ExtOut("(%d)\n", id); - + DumpStackObjectsHelper(StackTop, StackBottom, bVerify); return S_OK; } @@ -695,7 +695,7 @@ HRESULT DumpStackObjectsRaw(size_t nArg, __in_z LPSTR exprBottom, __in_z LPSTR e * Routine Description: * * * * This function is called to dump the address and name of all * -* Managed Objects on the stack. * +* Managed Objects on the stack. * * * \**********************************************************************/ DECLARE_API(DumpStackObjects) @@ -706,27 +706,27 @@ DECLARE_API(DumpStackObjects) BOOL bVerify = FALSE; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-verify", &bVerify, COBOOL, FALSE}, #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE} #endif - }; - CMDValue arg[] = + }; + CMDValue arg[] = { // vptr, type {&exprTop.data, COSTRING}, {&exprBottom.data, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } EnableDMLHolder enableDML(dml); - + return DumpStackObjectsRaw(nArg, exprBottom.data, exprTop.data, bVerify); } @@ -734,42 +734,42 @@ DECLARE_API(DumpStackObjects) * Routine Description: * * * * This function is called to dump the contents of a MethodDesc * -* for a given address * +* for a given address * * * \**********************************************************************/ DECLARE_API(DumpMD) { INIT_API(); MINIDUMP_NOT_SUPPORTED(); - + DWORD_PTR dwStartAddr = NULL; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&dwStartAddr, COHEX}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } EnableDMLHolder dmlHolder(dml); - + DumpMDInfo(dwStartAddr); - + return Status; } -BOOL GatherDynamicInfo(TADDR DynamicMethodObj, DacpObjectData *codeArray, +BOOL GatherDynamicInfo(TADDR DynamicMethodObj, DacpObjectData *codeArray, DacpObjectData *tokenArray, TADDR *ptokenArrayAddr) { BOOL bRet = FALSE; @@ -778,21 +778,21 @@ BOOL GatherDynamicInfo(TADDR DynamicMethodObj, DacpObjectData *codeArray, if (codeArray == NULL || tokenArray == NULL) return bRet; - + if (objData.Request(g_sos, TO_CDADDR(DynamicMethodObj)) != S_OK) return bRet; - + iOffset = GetObjFieldOffset(TO_CDADDR(DynamicMethodObj), objData.MethodTable, W("m_resolver")); if (iOffset <= 0) return bRet; - + TADDR resolverPtr; if (FAILED(MOVE(resolverPtr, DynamicMethodObj + iOffset))) return bRet; if (objData.Request(g_sos, TO_CDADDR(resolverPtr)) != S_OK) return bRet; - + iOffset = GetObjFieldOffset(TO_CDADDR(resolverPtr), objData.MethodTable, W("m_code")); if (iOffset <= 0) return bRet; @@ -803,10 +803,10 @@ BOOL GatherDynamicInfo(TADDR DynamicMethodObj, DacpObjectData *codeArray, if (codeArray->Request(g_sos, TO_CDADDR(codePtr)) != S_OK) return bRet; - + if (codeArray->dwComponentSize != 1) return bRet; - + // We also need the resolution table iOffset = GetObjFieldOffset (TO_CDADDR(resolverPtr), objData.MethodTable, W("m_scope")); if (iOffset <= 0) @@ -818,7 +818,7 @@ BOOL GatherDynamicInfo(TADDR DynamicMethodObj, DacpObjectData *codeArray, if (objData.Request(g_sos, TO_CDADDR(scopePtr)) != S_OK) return bRet; - + iOffset = GetObjFieldOffset (TO_CDADDR(scopePtr), objData.MethodTable, W("m_tokens")); if (iOffset <= 0) return bRet; @@ -829,7 +829,7 @@ BOOL GatherDynamicInfo(TADDR DynamicMethodObj, DacpObjectData *codeArray, if (objData.Request(g_sos, TO_CDADDR(tokensPtr)) != S_OK) return bRet; - + iOffset = GetObjFieldOffset(TO_CDADDR(tokensPtr), objData.MethodTable, W("_items")); if (iOffset <= 0) return bRet; @@ -838,7 +838,7 @@ BOOL GatherDynamicInfo(TADDR DynamicMethodObj, DacpObjectData *codeArray, MOVE (itemsPtr, tokensPtr + iOffset); *ptokenArrayAddr = itemsPtr; - + if (tokenArray->Request(g_sos, TO_CDADDR(itemsPtr)) != S_OK) return bRet; @@ -864,23 +864,23 @@ DECLARE_API(DumpIL) BOOL dml = FALSE; BOOL fILPointerDirectlySpecified = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, {"/i", &fILPointerDirectlySpecified, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&dwStartAddr, COHEX}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } - EnableDMLHolder dmlHolder(dml); + EnableDMLHolder dmlHolder(dml); if (dwStartAddr == NULL) { ExtOut("Must pass a valid expression\n"); @@ -902,7 +902,7 @@ DECLARE_API(DumpIL) { dwDynamicMethodObj = dwStartAddr; } - + if (dwDynamicMethodObj == NULL) { // We have been given a MethodDesc @@ -936,10 +936,10 @@ DECLARE_API(DumpIL) IfFailRet(DecodeILFromAddress(pImport, ilAddr)); } } - + if (dwDynamicMethodObj != NULL) { - // We have a DynamicMethod managed object, let us visit the town and paint. + // We have a DynamicMethod managed object, let us visit the town and paint. DacpObjectData codeArray; DacpObjectData tokenArray; DWORD_PTR tokenArrayAddr; @@ -948,7 +948,7 @@ DECLARE_API(DumpIL) DMLOut("Error gathering dynamic info from object at %s.\n", DMLObject(dwDynamicMethodObj)); return Status; } - + // Read the memory into a local buffer BYTE *pArray = new NOTHROW BYTE[(SIZE_T)codeArray.dwNumComponents]; if (pArray == NULL) @@ -956,7 +956,7 @@ DECLARE_API(DumpIL) ExtOut("Not enough memory to read IL\n"); return Status; } - + Status = g_ExtData->ReadVirtual(UL64_TO_CDA(codeArray.ArrayDataPtr), pArray, (ULONG)codeArray.dwNumComponents, NULL); if (Status != S_OK) { @@ -966,15 +966,15 @@ DECLARE_API(DumpIL) } // Now we have a local copy of the IL, and a managed array for token resolution. - // Visit our IL parser with this info. + // Visit our IL parser with this info. ExtOut("This is dynamic IL. Exception info is not reported at this time.\n"); ExtOut("If a token is unresolved, run \"!do \" on the addr given\n"); ExtOut("in parenthesis. You can also look at the token table yourself, by\n"); ExtOut("running \"!DumpArray %p\".\n\n", SOS_PTR(tokenArrayAddr)); DecodeDynamicIL(pArray, (ULONG)codeArray.dwNumComponents, tokenArray); - - delete [] pArray; - } + + delete [] pArray; + } return Status; } @@ -992,10 +992,10 @@ void DumpSigWorker ( ArrayHolder pSig = new NOTHROW COR_SIGNATURE[cbSigInc]; if (pSig == NULL) { - ReportOOM(); + ReportOOM(); return; } - + CQuickBytes sigString; for (;;) { @@ -1044,7 +1044,7 @@ void DumpSigWorker ( ExtOut("Out of memory\n"); return; } - + pSig = pSigNew; } @@ -1070,7 +1070,7 @@ DECLARE_API(DumpSig) StringHolder sigExpr; StringHolder moduleExpr; - CMDValue arg[] = + CMDValue arg[] = { {&sigExpr.data, COSTRING}, {&moduleExpr.data, COSTRING} @@ -1086,7 +1086,7 @@ DECLARE_API(DumpSig) return Status; } - DWORD_PTR dwSigAddr = GetExpression(sigExpr.data); + DWORD_PTR dwSigAddr = GetExpression(sigExpr.data); DWORD_PTR dwModuleAddr = GetExpression(moduleExpr.data); if (dwSigAddr == 0 || dwModuleAddr == 0) @@ -1094,7 +1094,7 @@ DECLARE_API(DumpSig) ExtOut("Invalid parameters %s %s\n", sigExpr.data, moduleExpr.data); return Status; } - + DumpSigWorker(dwSigAddr, dwModuleAddr, TRUE); return Status; } @@ -1118,7 +1118,7 @@ DECLARE_API(DumpSigElem) StringHolder sigExpr; StringHolder moduleExpr; - CMDValue arg[] = + CMDValue arg[] = { {&sigExpr.data, COSTRING}, {&moduleExpr.data, COSTRING} @@ -1135,7 +1135,7 @@ DECLARE_API(DumpSigElem) return Status; } - DWORD_PTR dwSigAddr = GetExpression(sigExpr.data); + DWORD_PTR dwSigAddr = GetExpression(sigExpr.data); DWORD_PTR dwModuleAddr = GetExpression(moduleExpr.data); if (dwSigAddr == 0 || dwModuleAddr == 0) @@ -1151,7 +1151,7 @@ DECLARE_API(DumpSigElem) /**********************************************************************\ * Routine Description: * * * -* This function is called to dump the contents of an EEClass from * +* This function is called to dump the contents of an EEClass from * * a given address * * \**********************************************************************/ @@ -1159,28 +1159,28 @@ DECLARE_API(DumpClass) { INIT_API(); MINIDUMP_NOT_SUPPORTED(); - + DWORD_PTR dwStartAddr = 0; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&dwStartAddr, COHEX} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } - if (nArg == 0) + if (nArg == 0) { ExtOut("Missing EEClass address\n"); return Status; @@ -1200,7 +1200,7 @@ DECLARE_API(DumpClass) { ExtOut("EEClass has an invalid MethodTable address\n"); return Status; - } + } sos::MethodTable mt = TO_TADDR(methodTable); ExtOut("Class Name: %S\n", mt.GetName()); @@ -1218,7 +1218,7 @@ DECLARE_API(DumpClass) { ExtOut("EEClass has an invalid MethodTable address\n"); return Status; - } + } ParentEEClass = mtdataparent.Class; } @@ -1235,8 +1235,8 @@ DECLARE_API(DumpClass) ExtOut("Abstract, "); if (IsTdImport(mtdata.dwAttrClass)) ExtOut("ComImport, "); - - ExtOut("\n"); + + ExtOut("\n"); DacpMethodTableFieldData vMethodTableFields; if (SUCCEEDED(vMethodTableFields.Request(g_sos, methodTable))) @@ -1256,7 +1256,7 @@ DECLARE_API(DumpClass) ExtOut("ContextStaticsSize: %x\n", vMethodTableFields.wContextStaticsSize); } - + if (vMethodTableFields.wNumInstanceFields + vMethodTableFields.wNumStaticFields > 0) { DisplayFields(methodTable, &mtdata, &vMethodTableFields, NULL, TRUE, FALSE); @@ -1269,7 +1269,7 @@ DECLARE_API(DumpClass) /**********************************************************************\ * Routine Description: * * * -* This function is called to dump the contents of a MethodTable * +* This function is called to dump the contents of a MethodTable * * from a given address * * * \**********************************************************************/ @@ -1277,27 +1277,27 @@ DECLARE_API(DumpMT) { DWORD_PTR dwStartAddr=0; DWORD_PTR dwOriginalAddr; - + INIT_API(); MINIDUMP_NOT_SUPPORTED(); - + BOOL bDumpMDTable = FALSE; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-MD", &bDumpMDTable, COBOOL, FALSE}, #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE} #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&dwStartAddr, COHEX} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -1313,17 +1313,17 @@ DECLARE_API(DumpMT) dwOriginalAddr = dwStartAddr; dwStartAddr = dwStartAddr&~3; - + if (!IsMethodTable(dwStartAddr)) { Print(dwOriginalAddr, " is not a MethodTable\n"); return Status; } - + DacpMethodTableData vMethTable; - vMethTable.Request(g_sos, TO_CDADDR(dwStartAddr)); + vMethTable.Request(g_sos, TO_CDADDR(dwStartAddr)); - if (vMethTable.bIsFree) + if (vMethTable.bIsFree) { Print("Free MethodTable\n"); return Status; @@ -1358,7 +1358,7 @@ DECLARE_API(DumpMT) table.WriteRow("DynamicStatics:", vMethTable.bIsDynamic ? "true" : "false"); table.WriteRow("ContainsPointers:", vMethTable.bContainsPointers ? "true" : "false"); table.WriteRow("Slots in VTable:", Decimal(vMethTable.wNumMethods)); - + table.SetColWidth(0, 29); table.WriteRow("Number of IFaces in IFaceMap:", Decimal(vMethTable.wNumInterfaces)); @@ -1397,9 +1397,9 @@ DECLARE_API(DumpMT) DacpMethodDescData tmpMethodDescData; if (tmpMethodDescData.Request(g_sos, TO_CDADDR(methodDesc)) == S_OK) { - DacpCodeHeaderData codeHeaderData; + DacpCodeHeaderData codeHeaderData; if (codeHeaderData.Request(g_sos,tmpMethodDescData.NativeCodeAddr) == S_OK) - { + { jitType = (JITTypes) codeHeaderData.JITType; } } @@ -1427,23 +1427,23 @@ DECLARE_API(DumpMT) } table.WriteColumn(2, pszJitType); - - NameForMD_s(methodDesc,g_mdName,mdNameLen); + + NameForMD_s(methodDesc,g_mdName,mdNameLen); table.WriteColumn(3, g_mdName); } } - return Status; + return Status; } extern size_t Align (size_t nbytes); HRESULT PrintVC(TADDR taMT, TADDR taObject, BOOL bPrintFields = TRUE) -{ +{ HRESULT Status; DacpMethodTableData mtabledata; if ((Status = mtabledata.Request(g_sos, TO_CDADDR(taMT)))!=S_OK) return Status; - + size_t size = mtabledata.BaseSize; if ((Status=g_sos->GetMethodTableName(TO_CDADDR(taMT), mdNameLen, g_mdName, NULL))!=S_OK) return Status; @@ -1476,15 +1476,15 @@ void PrintRuntimeTypeInfo(TADDR p_rtObject, const DacpObjectData & rtObjectData) // Get the method table int iOffset = GetObjFieldOffset(TO_CDADDR(p_rtObject), rtObjectData.MethodTable, W("m_handle")); if (iOffset > 0) - { + { TADDR mtPtr; if (SUCCEEDED(GetMTOfObject(p_rtObject + iOffset, &mtPtr))) { sos::MethodTable mt = mtPtr; ExtOut("Type Name: %S\n", mt.GetName()); DMLOut("Type MT: %s\n", DMLMethodTable(mtPtr)); - } - } + } + } } HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE) @@ -1497,7 +1497,7 @@ HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE) DacpObjectData objData; HRESULT Status; if ((Status=objData.Request(g_sos, TO_CDADDR(taObj))) != S_OK) - { + { ExtOut("Invalid object\n"); return Status; } @@ -1509,18 +1509,18 @@ HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE) ExtOut("Size: %" POINTERSIZE_TYPE "d(0x%" POINTERSIZE_TYPE "x) bytes\n", size, size); return S_OK; } - + sos::Object obj = taObj; ExtOut("Name: %S\n", obj.GetTypeName()); DMLOut("MethodTable: %s\n", DMLMethodTable(objData.MethodTable)); - + DacpMethodTableData mtabledata; if ((Status=mtabledata.Request(g_sos,objData.MethodTable)) == S_OK) { DMLOut("EEClass: %s\n", DMLClass(mtabledata.Class)); } - else + else { ExtOut("Invalid EEClass address\n"); return Status; @@ -1548,20 +1548,20 @@ HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE) // Get the method table int iOffset = GetObjFieldOffset (TO_CDADDR(taObj), objData.MethodTable, W("m_runtimeType")); if (iOffset > 0) - { + { TADDR rtPtr; if (MOVE(rtPtr, taObj + iOffset) == S_OK) { DacpObjectData rtObjectData; if ((Status=rtObjectData.Request(g_sos, TO_CDADDR(rtPtr))) != S_OK) - { + { ExtOut("Error when reading RuntimeType field\n"); return Status; } PrintRuntimeTypeInfo(rtPtr, rtObjectData); - } - } + } + } } if (objData.ObjectType==OBJ_ARRAY) @@ -1571,7 +1571,7 @@ HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE) IfDMLOut(" (Print Array)", SOS_PTR(taObj)); ExtOut("\n"); - + if (objData.ElementType == ELEMENT_TYPE_I1 || objData.ElementType == ELEMENT_TYPE_U1 || objData.ElementType == ELEMENT_TYPE_CHAR) @@ -1606,7 +1606,7 @@ HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE) else if (objData.ObjectType == OBJ_OBJECT) { ExtOut("Object\n"); - } + } if (bPrintFields) { @@ -1628,10 +1628,10 @@ HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE) sos::ThinLockInfo lockInfo; if (obj.GetThinLock(lockInfo)) { - ExtOut("ThinLock owner %x (%p), Recursive %x\n", lockInfo.ThreadId, + ExtOut("ThinLock owner %x (%p), Recursive %x\n", lockInfo.ThreadId, SOS_PTR(lockInfo.ThreadPtr), lockInfo.Recursion); } - + return S_OK; } @@ -1652,7 +1652,7 @@ BOOL IndicesInRange (DWORD * indices, DWORD * lowerBounds, DWORD * bounds, DWORD { return FALSE; } - + indices[i] = lowerBounds[i]; indices[i - 1]++; } @@ -1681,7 +1681,7 @@ size_t OffsetFromIndices (DWORD * indices, DWORD * lowerBounds, DWORD * bounds, return 0; } - for (; i >= 0; i--) + for (; i >= 0; i--) { DWORD curIndex = indices[i] - lowerBounds[i]; offset += curIndex * multiplier; @@ -1698,12 +1698,12 @@ HRESULT PrintPermissionSet (TADDR p_PermSet) DacpObjectData PermSetData; if ((Status=PermSetData.Request(g_sos, TO_CDADDR(p_PermSet))) != S_OK) - { + { ExtOut("Invalid object\n"); return Status; } - + sos::MethodTable mt = TO_TADDR(PermSetData.MethodTable); if (_wcscmp (W("System.Security.PermissionSet"), mt.GetName()) != 0 && _wcscmp(W("System.Security.NamedPermissionSet"), mt.GetName()) != 0) { @@ -1712,14 +1712,14 @@ HRESULT PrintPermissionSet (TADDR p_PermSet) } ExtOut("PermissionSet object: %p\n", SOS_PTR(p_PermSet)); - + // Print basic info // Walk the fields, printing some fields in a special way. int iOffset = GetObjFieldOffset (TO_CDADDR(p_PermSet), PermSetData.MethodTable, W("m_Unrestricted")); - - if (iOffset > 0) + + if (iOffset > 0) { BYTE unrestricted; MOVE(unrestricted, p_PermSet + iOffset); @@ -1738,7 +1738,7 @@ HRESULT PrintPermissionSet (TADDR p_PermSet) { DacpObjectData tbSetData; if ((Status=tbSetData.Request(g_sos, TO_CDADDR(tbSetPtr))) != S_OK) - { + { ExtOut("Invalid object\n"); return Status; } @@ -1753,7 +1753,7 @@ HRESULT PrintPermissionSet (TADDR p_PermSet) // Print all the permissions in the array DacpObjectData objData; if ((Status=objData.Request(g_sos, TO_CDADDR(PermsArrayPtr))) != S_OK) - { + { ExtOut("Invalid object\n"); return Status; } @@ -1774,7 +1774,7 @@ HRESULT PrintPermissionSet (TADDR p_PermSet) return PrintObj(PermObjPtr); } } - + } } @@ -1786,7 +1786,7 @@ HRESULT PrintPermissionSet (TADDR p_PermSet) /**********************************************************************\ * Routine Description: * * * -* This function is called to dump the contents of an object from a * +* This function is called to dump the contents of an object from a * * given address * * \**********************************************************************/ @@ -1795,12 +1795,12 @@ DECLARE_API(DumpArray) INIT_API(); DumpArrayFlags flags; - + MINIDUMP_NOT_SUPPORTED(); BOOL dml = FALSE; - - CMDOption option[] = + + CMDOption option[] = { // name, vptr, type, hasValue {"-start", &flags.startIndex, COSIZE_T, TRUE}, {"-length", &flags.Length, COSIZE_T, TRUE}, @@ -1810,12 +1810,12 @@ DECLARE_API(DumpArray) {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&flags.strObject, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -1832,10 +1832,10 @@ DECLARE_API(DumpArray) { ExtOut("\n"); } - + DacpObjectData objData; if ((Status=objData.Request(g_sos, TO_CDADDR(p_Object))) != S_OK) - { + { ExtOut("Invalid object\n"); return Status; } @@ -1869,7 +1869,7 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe { ExtOut("-nofields has no effect unless -details is specified\n"); } - + DWORD i; if (!isPermSetPrint) { @@ -1880,7 +1880,7 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe for (i = 1; i < objData.dwRank; i++) ExtOut(","); ExtOut("]\n"); - + DMLOut("MethodTable: %s\n", DMLMethodTable(objData.MethodTable)); { @@ -1888,13 +1888,13 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe if (SUCCEEDED(mtdata.Request(g_sos, objData.MethodTable))) { DMLOut("EEClass: %s\n", DMLClass(mtdata.Class)); - } + } } DWORD_PTR size = (DWORD_PTR)objData.Size; ExtOut("Size: %" POINTERSIZE_TYPE "d(0x%" POINTERSIZE_TYPE "x) bytes\n", size, size); - ExtOut("Array: Rank %d, Number of elements %" POINTERSIZE_TYPE "d, Type %s\n", + ExtOut("Array: Rank %d, Number of elements %" POINTERSIZE_TYPE "d, Type %s\n", objData.dwRank, (DWORD_PTR)objData.dwNumComponents, ElementTypeName(objData.ElementType)); DMLOut("Element Methodtable: %s\n", DMLMethodTable(objData.ElementTypeHandle)); } @@ -1911,14 +1911,14 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe DWORD *lowerBounds = (DWORD *)alloca(dwRankAllocSize); if (!SafeReadMemory(objData.ArrayLowerBoundsPtr, lowerBounds, dwRankAllocSize, NULL)) { - ExtOut("Failed to read lower bounds info from the array\n"); + ExtOut("Failed to read lower bounds info from the array\n"); return S_OK; } DWORD *bounds = (DWORD *)alloca(dwRankAllocSize); if (!SafeReadMemory (objData.ArrayBoundsPtr, bounds, dwRankAllocSize, NULL)) { - ExtOut("Failed to read bounds info from the array\n"); + ExtOut("Failed to read bounds info from the array\n"); return S_OK; } @@ -1927,7 +1927,7 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe { bounds[0] = _min(bounds[0], (DWORD)(flags.Length + flags.startIndex) - lowerBounds[0]); } - + DWORD *indices = (DWORD *)alloca(dwRankAllocSize); for (i = 0; i < objData.dwRank; i++) { @@ -1939,13 +1939,13 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe { indices[0] = (DWORD)flags.startIndex; } - - //Offset should be calculated by OffsetFromIndices. However because of the way - //how we grow indices, incrementing offset by one happens to match indices in every iteration + + //Offset should be calculated by OffsetFromIndices. However because of the way + //how we grow indices, incrementing offset by one happens to match indices in every iteration for (size_t offset = OffsetFromIndices (indices, lowerBounds, bounds, objData.dwRank); - IndicesInRange (indices, lowerBounds, bounds, objData.dwRank); + IndicesInRange (indices, lowerBounds, bounds, objData.dwRank); indices[objData.dwRank - 1]++, offset++) - { + { if (IsInterrupt()) { ExtOut("interrupted by user\n"); @@ -1956,11 +1956,11 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe TADDR p_Element = NULL; if (isElementValueType) { - p_Element = elementAddress; + p_Element = elementAddress; } else if (!SafeReadMemory (elementAddress, &p_Element, sizeof (p_Element), NULL)) { - ExtOut("Failed to read element at "); + ExtOut("Failed to read element at "); ExtOutIndices(indices, objData.dwRank); ExtOut("\n"); continue; @@ -1999,28 +1999,28 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe DecrementIndent(); } } - + return S_OK; } /**********************************************************************\ * Routine Description: * * * -* This function is called to dump the contents of an object from a * +* This function is called to dump the contents of an object from a * * given address * * \**********************************************************************/ -DECLARE_API(DumpObj) +DECLARE_API(DumpObj) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); BOOL dml = FALSE; BOOL bNoFields = FALSE; BOOL bRefs = FALSE; StringHolder str_Object; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-nofields", &bNoFields, COBOOL, FALSE}, {"-refs", &bRefs, COBOOL, FALSE}, @@ -2028,16 +2028,16 @@ DECLARE_API(DumpObj) {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&str_Object.data, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } - + DWORD_PTR p_Object = GetExpression(str_Object.data); EnableDMLHolder dmlHolder(dml); if (p_Object == 0) @@ -2048,7 +2048,7 @@ DECLARE_API(DumpObj) try { Status = PrintObj(p_Object, !bNoFields); - + if (SUCCEEDED(Status) && bRefs) { ExtOut("GC Refs:\n"); @@ -2204,7 +2204,7 @@ CLRDATA_ADDRESS isExceptionObj(CLRDATA_ADDRESS mtObj) { if (dmtd.Request(g_sos, walkMT) != S_OK) { - break; + break; } if (walkMT == g_special_usefulGlobals.ExceptionMethodTable) { @@ -2224,9 +2224,9 @@ CLRDATA_ADDRESS isSecurityExceptionObj(CLRDATA_ADDRESS mtObj) { if (dmtd.Request(g_sos, walkMT) != S_OK) { - break; + break; } - NameForMT_s(TO_TADDR(walkMT), g_mdName, mdNameLen); + NameForMT_s(TO_TADDR(walkMT), g_mdName, mdNameLen); if (_wcscmp(W("System.Security.SecurityException"), g_mdName) == 0) { return walkMT; @@ -2264,7 +2264,7 @@ enum StackTraceElementFlags // This struct needs to match the definition in the runtime. // See: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/clrex.h -struct StackTraceElement +struct StackTraceElement { UINT_PTR ip; UINT_PTR sp; @@ -2288,7 +2288,7 @@ class StringOutput BOOL Append(__in_z LPCWSTR pszStr) { - size_t iInputLen = _wcslen (pszStr); + size_t iInputLen = _wcslen (pszStr); size_t iCurLen = _wcslen (cs.String()); if ((iCurLen + iInputLen + 1) > cs.Size()) { @@ -2301,7 +2301,7 @@ class StringOutput wcsncat_s (cs.String(), cs.Size(), pszStr, _TRUNCATE); return TRUE; } - + size_t Length() { return _wcslen(cs.String()); @@ -2315,7 +2315,7 @@ class StringOutput static HRESULT DumpMDInfoBuffer(DWORD_PTR dwStartAddr, DWORD Flags, ULONG64 Esp, ULONG64 IPAddr, StringOutput& so); -// Using heuristics to determine if an exception object represented an async (hardware) or a +// Using heuristics to determine if an exception object represented an async (hardware) or a // managed exception // We need to use these heuristics when the System.Exception object is not the active exception // on some thread, but it's something found somewhere on the managed heap. @@ -2330,13 +2330,13 @@ static const HRESULT AsyncHResultValues[] = COR_E_FORMAT, // kFormatException COR_E_NULLREFERENCE, // kNullReferenceException E_POINTER, // kAccessViolationException - // the EE is raising the next exceptions more often than the OS will raise an async + // the EE is raising the next exceptions more often than the OS will raise an async // exception for these conditions, so in general treat these as Synchronous // COR_E_INDEXOUTOFRANGE, // kIndexOutOfRangeException // COR_E_OUTOFMEMORY, // kOutOfMemoryException // COR_E_STACKOVERFLOW, // kStackOverflowException COR_E_DATAMISALIGNED, // kDataMisalignedException - + }; BOOL IsAsyncException(CLRDATA_ADDRESS taObj, CLRDATA_ADDRESS mtObj) { @@ -2399,10 +2399,10 @@ BOOL IsAsyncException(const DacpExceptionObjectData & excData) #define SOS_STACKTRACE_SHOWEXPLICITFRAMES 0x00000002 -size_t FormatGeneratedException (DWORD_PTR dataPtr, - UINT bytes, - __out_ecount_opt(bufferLength) WCHAR *wszBuffer, - size_t bufferLength, +size_t FormatGeneratedException (DWORD_PTR dataPtr, + UINT bytes, + __out_ecount_opt(bufferLength) WCHAR *wszBuffer, + size_t bufferLength, BOOL bAsync, // hardware exception if true BOOL bNestedCase = FALSE, BOOL bLineNumbers = FALSE) @@ -2416,7 +2416,7 @@ size_t FormatGeneratedException (DWORD_PTR dataPtr, { wszBuffer[0] = L'\0'; } - + // Buffer is calculated for sprintf below (" %p %p %S\n"); WCHAR wszLineBuffer[mdNameLen + 8 + sizeof(size_t)*2 + MAX_LONGPATH + 8]; @@ -2424,7 +2424,7 @@ size_t FormatGeneratedException (DWORD_PTR dataPtr, { return 0; } - + if (bNestedCase) { // If we are computing the call stack for a nested exception, we @@ -2432,36 +2432,36 @@ size_t FormatGeneratedException (DWORD_PTR dataPtr, // will have that frame. count--; } - + for (UINT i = 0; i < count; i++) { StackTraceElement ste; MOVE (ste, dataPtr + i*sizeof(StackTraceElement)); - // ste.ip must be adjusted because of an ancient workaround in the exception + // ste.ip must be adjusted because of an ancient workaround in the exception // infrastructure. The workaround is that the exception needs to have // an ip address that will map to the line number where the exception was thrown. // (It doesn't matter that it's not a valid instruction). (see /vm/excep.cpp) // // This "counterhack" is not 100% accurate - // The biggest issue is that !PrintException must work with exception objects - // that may not be currently active; as a consequence we cannot rely on the - // state of some "current thread" to infer whether the IP values stored in - // the exception object have been adjusted or not. If we could, we may examine - // the topmost "Frame" and make the decision based on whether it's a + // The biggest issue is that !PrintException must work with exception objects + // that may not be currently active; as a consequence we cannot rely on the + // state of some "current thread" to infer whether the IP values stored in + // the exception object have been adjusted or not. If we could, we may examine + // the topmost "Frame" and make the decision based on whether it's a // FaultingExceptionFrame or not. - // 1. On IA64 the IP values are never adjusted by the EE so there's nothing + // 1. On IA64 the IP values are never adjusted by the EE so there's nothing // to adjust back. // 2. On AMD64: - // (a) if the exception was an async (hardware) exception add 1 to all + // (a) if the exception was an async (hardware) exception add 1 to all // IP values in the exception object - // (b) if the exception was a managed exception (either raised by the + // (b) if the exception was a managed exception (either raised by the // EE or thrown by managed code) do not adjust any IP values // 3. On X86: - // (a) if the exception was an async (hardware) exception add 1 to + // (a) if the exception was an async (hardware) exception add 1 to // all but the topmost IP value in the exception object - // (b) if the exception was a managed exception (either raised by - // the EE or thrown by managed code) add 1 to all IP values in + // (b) if the exception was a managed exception (either raised by + // the EE or thrown by managed code) add 1 to all IP values in // the exception object #if defined(_TARGET_AMD64_) if (bAsync) @@ -2478,15 +2478,15 @@ size_t FormatGeneratedException (DWORD_PTR dataPtr, StringOutput so; HRESULT Status = DumpMDInfoBuffer(ste.pFunc, SOS_STACKTRACE_SHOWADDRESSES|SOS_STACKTRACE_SHOWEXPLICITFRAMES, ste.sp, ste.ip, so); - // If DumpMDInfoBuffer failed (due to out of memory or missing metadata), + // If DumpMDInfoBuffer failed (due to out of memory or missing metadata), // or did not update so (when ste is an explicit frames), do not update wszBuffer if (Status == S_OK) { WCHAR filename[MAX_LONGPATH] = W(""); ULONG linenum = 0; - if (bLineNumbers && - // To get the source line number of the actual code that threw an exception, the IP needs - // to be adjusted in certain cases. + if (bLineNumbers && + // To get the source line number of the actual code that threw an exception, the IP needs + // to be adjusted in certain cases. // // The IP of the stack frame points to either: // @@ -2503,7 +2503,7 @@ size_t FormatGeneratedException (DWORD_PTR dataPtr, // When the IP needs to be adjusted it is a lot simpler to decrement IP instead of trying to figure // out the beginning of the instruction. It is enough for GetLineByOffset to return the correct line number. // - // The unmodified IP is displayed (above by DumpMDInfoBuffer) which points after the exception in most + // The unmodified IP is displayed (above by DumpMDInfoBuffer) which points after the exception in most // cases. This means that the printed IP and the printed line number often will not map to one another // and this is intentional. SUCCEEDED(GetLineByOffset(TO_CDADDR(ste.ip), &linenum, filename, _countof(filename), !bAsync || i > 0))) @@ -2561,7 +2561,7 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE) DacpObjectData objData; if ((Status=objData.Request(g_sos, taObj)) != S_OK) - { + { ExtOut("Invalid object\n"); return Status; } @@ -2575,7 +2575,7 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE) } DMLOut("Exception object: %s\n", DMLObject(taObj)); - + if (NameForMT_s(TO_TADDR(objData.MethodTable), g_mdName, mdNameLen)) { ExtOut("Exception type: %S\n", g_mdName); @@ -2640,7 +2640,7 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE) TADDR taMT; if (SUCCEEDED(GetMTOfObject(taInnerExc, &taMT))) { - NameForMT_s(taMT, g_mdName, mdNameLen); + NameForMT_s(taMT, g_mdName, mdNameLen); ExtOut("%S, ", g_mdName); if (IsDMLEnabled()) DMLOut("Use !PrintException %p to see more.\n", taInnerExc, taInnerExc); @@ -2670,7 +2670,7 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE) else { int iOffset = GetObjFieldOffset (taObj, objData.MethodTable, W("_stackTrace")); - if (iOffset > 0) + if (iOffset > 0) { MOVE(taStackTrace, taObj + iOffset); } @@ -2696,7 +2696,7 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE) DWORD cbStackSize = static_cast(stackTraceSize * sizeof(StackTraceElement)); dataPtr += sizeof(size_t) + sizeof(size_t); // skip the array header, then goes the data - + if (stackTraceSize == 0) { ExtOut("Unable to decipher generated stack trace\n"); @@ -2720,7 +2720,7 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE) { ExtOut("\n"); } - } + } else { ExtOut("\n"); @@ -2770,18 +2770,18 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE) { // We have a SecurityException Object: print out the debugString if present int iOffset = GetObjFieldOffset (taObj, objData.MethodTable, W("m_debugString")); - if (iOffset > 0) + if (iOffset > 0) { TADDR taDebugString; - MOVE (taDebugString, taObj + iOffset); - + MOVE (taDebugString, taObj + iOffset); + if (taDebugString) { ExtOut("SecurityException Message: "); StringObjectContent(taDebugString); ExtOut("\n\n"); // extra newline looks better } - } + } } return Status; @@ -2790,13 +2790,13 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE) DECLARE_API(PrintException) { INIT_API(); - + BOOL dml = FALSE; - BOOL bShowNested = FALSE; + BOOL bShowNested = FALSE; BOOL bLineNumbers = FALSE; BOOL bCCW = FALSE; StringHolder strObject; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-nested", &bShowNested, COBOOL, FALSE}, {"-lines", &bLineNumbers, COBOOL, FALSE}, @@ -2806,12 +2806,12 @@ DECLARE_API(PrintException) {"/d", &dml, COBOOL, FALSE} #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&strObject, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -2846,7 +2846,7 @@ DECLARE_API(PrintException) CLRDATA_ADDRESS threadAddr = GetCurrentManagedThread(); DacpThreadData Thread; - + if ((threadAddr == NULL) || (Thread.Request(g_sos, threadAddr) != S_OK)) { ExtOut("The current thread is unmanaged\n"); @@ -2858,11 +2858,11 @@ DECLARE_API(PrintException) &dwAddr, sizeof(dwAddr), NULL)) || (dwAddr==NULL)) { - ExtOut("There is no current managed exception on this thread\n"); - } + ExtOut("There is no current managed exception on this thread\n"); + } else - { - p_Object = dwAddr; + { + p_Object = dwAddr; } } else @@ -2901,7 +2901,7 @@ DECLARE_API(PrintException) // Are there nested exceptions? CLRDATA_ADDRESS threadAddr = GetCurrentManagedThread(); DacpThreadData Thread; - + if ((threadAddr == NULL) || (Thread.Request(g_sos, threadAddr) != S_OK)) { ExtOut("The current thread is unmanaged\n"); @@ -2915,7 +2915,7 @@ DECLARE_API(PrintException) ExtOut("There are nested exceptions on this thread. Run with -nested for details\n"); return Status; } - + CLRDATA_ADDRESS currentNested = Thread.firstNestedException; do { @@ -2940,10 +2940,10 @@ DECLARE_API(PrintException) { return Status; } - + currentNested = next; } - while(currentNested != NULL); + while(currentNested != NULL); } return Status; } @@ -2951,32 +2951,32 @@ DECLARE_API(PrintException) /**********************************************************************\ * Routine Description: * * * -* This function is called to dump the contents of an object from a * +* This function is called to dump the contents of an object from a * * given address * * \**********************************************************************/ DECLARE_API(DumpVC) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); - + MINIDUMP_NOT_SUPPORTED(); + DWORD_PTR p_MT = NULL; DWORD_PTR p_Object = NULL; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE} #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&p_MT, COHEX}, {&p_Object, COHEX}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -2987,12 +2987,12 @@ DECLARE_API(DumpVC) ExtOut("Usage: !DumpVC \n"); return Status; } - + if (!IsMethodTable(p_MT)) { ExtOut("Not a managed object\n"); return S_OK; - } + } return PrintVC(p_MT, p_Object); } @@ -3009,16 +3009,16 @@ DECLARE_API(DumpRCW) BOOL dml = FALSE; StringHolder strObject; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE} }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&strObject, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -3057,7 +3057,7 @@ DECLARE_API(DumpRCW) ExtOut("Managed ref count: %d\n", rcwData.refCount); ExtOut("IUnknown V-table pointer : %p (captured at RCW creation time)\n", SOS_PTR(rcwData.vtablePtr)); - ExtOut("Flags: %s%s%s%s%s%s%s%s\n", + ExtOut("Flags: %s%s%s%s%s%s%s%s\n", (rcwData.isDisconnected? "IsDisconnected " : ""), (rcwData.supportsIInspectable? "SupportsIInspectable " : ""), (rcwData.isAggregated? "IsAggregated " : ""), @@ -3071,15 +3071,15 @@ DECLARE_API(DumpRCW) // Jupiter data hidden by default if (rcwData.isJupiterObject) { - ExtOut("IJupiterObject: %p\n", SOS_PTR(rcwData.jupiterObject)); + ExtOut("IJupiterObject: %p\n", SOS_PTR(rcwData.jupiterObject)); } - + ExtOut("COM interface pointers:\n"); ArrayHolder pArray = new NOTHROW DacpCOMInterfacePointerData[rcwData.interfaceCount]; if (pArray == NULL) { - ReportOOM(); + ReportOOM(); return Status; } @@ -3092,14 +3092,14 @@ DECLARE_API(DumpRCW) ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s Type\n", "IP", "Context", "MT"); for (int i = 0; i < rcwData.interfaceCount; i++) { - // Ignore any NULL MethodTable interface cache. At this point only IJupiterObject - // is saved as NULL MethodTable at first slot, and we've already printed outs its + // Ignore any NULL MethodTable interface cache. At this point only IJupiterObject + // is saved as NULL MethodTable at first slot, and we've already printed outs its // value earlier. if (pArray[i].methodTable == NULL) continue; - + NameForMT_s(TO_TADDR(pArray[i].methodTable), g_mdName, mdNameLen); - + DMLOut("%p %p %s %S\n", SOS_PTR(pArray[i].interfacePtr), SOS_PTR(pArray[i].comContext), DMLMethodTable(pArray[i].methodTable), g_mdName); } } @@ -3116,16 +3116,16 @@ DECLARE_API(DumpCCW) BOOL dml = FALSE; StringHolder strObject; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE} }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&strObject, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -3154,7 +3154,7 @@ DECLARE_API(DumpCCW) if (ccwData.ccwAddress != p_CCW) ExtOut("CCW: %p\n", SOS_PTR(ccwData.ccwAddress)); - + DMLOut("Managed object: %s\n", DMLObject(ccwData.managedObject)); ExtOut("Outer IUnknown: %p\n", SOS_PTR(ccwData.outerIUnknown)); ExtOut("Ref count: %d%s\n", ccwData.refCount, ccwData.isNeutered ? " (NEUTERED)" : ""); @@ -3162,29 +3162,29 @@ DECLARE_API(DumpCCW) (ccwData.isExtendsCOMObject? "IsExtendsCOMObject " : ""), (ccwData.isAggregated? "IsAggregated " : "") ); - + // Jupiter information hidden by default if (ccwData.jupiterRefCount > 0) { - ExtOut("Jupiter ref count: %d%s%s%s%s\n", - ccwData.jupiterRefCount, + ExtOut("Jupiter ref count: %d%s%s%s%s\n", + ccwData.jupiterRefCount, (ccwData.isPegged || ccwData.isGlobalPegged) ? ", Pegged by" : "", ccwData.isPegged ? " Jupiter " : "", (ccwData.isPegged && ccwData.isGlobalPegged) ? "&" : "", ccwData.isGlobalPegged ? " CLR " : "" ); } - - ExtOut("RefCounted Handle: %p%s\n", - SOS_PTR(ccwData.handle), + + ExtOut("RefCounted Handle: %p%s\n", + SOS_PTR(ccwData.handle), (ccwData.hasStrongRef ? " (STRONG)" : " (WEAK)")); - ExtOut("COM interface pointers:\n"); + ExtOut("COM interface pointers:\n"); ArrayHolder pArray = new NOTHROW DacpCOMInterfacePointerData[ccwData.interfaceCount]; if (pArray == NULL) { - ReportOOM(); + ReportOOM(); return Status; } @@ -3205,7 +3205,7 @@ DECLARE_API(DumpCCW) { NameForMT_s(TO_TADDR(pArray[i].methodTable), g_mdName, mdNameLen); } - + DMLOut("%p %s %S\n", pArray[i].interfacePtr, DMLMethodTable(pArray[i].methodTable), g_mdName); } } @@ -3221,31 +3221,31 @@ DECLARE_API(DumpCCW) * Routine Description: * * * * This function is called to dump the contents of a PermissionSet * -* from a given address. * +* from a given address. * * * \**********************************************************************/ -/* +/* COMMAND: dumppermissionset. !DumpPermissionSet - This command allows you to examine a PermissionSet object. Note that you can - also use DumpObj such an object in greater detail. DumpPermissionSet attempts - to extract all the relevant information from a PermissionSet that you might be + This command allows you to examine a PermissionSet object. Note that you can + also use DumpObj such an object in greater detail. DumpPermissionSet attempts + to extract all the relevant information from a PermissionSet that you might be interested in when performing Code Access Security (CAS) related debugging. Here is a simple PermissionSet object: - 0:000> !DumpPermissionSet 014615f4 + 0:000> !DumpPermissionSet 014615f4 PermissionSet object: 014615f4 Unrestricted: TRUE - Note that this is an unrestricted PermissionSet object that does not contain - any individual permissions. + Note that this is an unrestricted PermissionSet object that does not contain + any individual permissions. - Here is another example of a PermissionSet object, one that is not unrestricted + Here is another example of a PermissionSet object, one that is not unrestricted and contains a single permission: - 0:003> !DumpPermissionSet 01469fa8 + 0:003> !DumpPermissionSet 01469fa8 PermissionSet object: 01469fa8 Unrestricted: FALSE Name: System.Security.Permissions.ReflectionPermission @@ -3259,8 +3259,8 @@ DECLARE_API(DumpCCW) MT Field Offset Type VT Attr Value Name 5b73125c 4001d66 4 System.Int32 0 instance 2 m_flags - Here is another example of an unrestricted PermissionSet, one that contains - several permissions. The numbers in parentheses before each Permission object + Here is another example of an unrestricted PermissionSet, one that contains + several permissions. The numbers in parentheses before each Permission object represents the index of that Permission in the PermissionSet. 0:003> !DumpPermissionSet 01467bd8 @@ -3354,12 +3354,12 @@ DECLARE_API(DumpPermissionSet) DWORD_PTR p_Object = NULL; - CMDValue arg[] = + CMDValue arg[] = { {&p_Object, COHEX} }; size_t nArg; - if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) { return Status; } @@ -3368,7 +3368,7 @@ DECLARE_API(DumpPermissionSet) ExtOut("Usage: !DumpPermissionSet \n"); return Status; } - + return PrintPermissionSet(p_Object); } @@ -3393,26 +3393,26 @@ void DisplayInvalidStructuresMessage() /**********************************************************************\ * Routine Description: * * * -* This function dumps GC heap size. * +* This function dumps GC heap size. * * * \**********************************************************************/ DECLARE_API(EEHeap) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); - + MINIDUMP_NOT_SUPPORTED(); + BOOL dml = FALSE; BOOL showgc = FALSE; BOOL showloader = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-gc", &showgc, COBOOL, FALSE}, {"-loader", &showloader, COBOOL, FALSE}, {"/d", &dml, COBOOL, FALSE}, }; - if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) + if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; } @@ -3422,7 +3422,7 @@ DECLARE_API(EEHeap) { // Loader heap. DWORD_PTR allHeapSize = 0; - DWORD_PTR wasted = 0; + DWORD_PTR wasted = 0; DacpAppDomainStoreData adsData; if ((Status=adsData.Request(g_sos))!=S_OK) { @@ -3437,12 +3437,12 @@ DECLARE_API(EEHeap) { IfFailRet(PrintDomainHeapInfo("Shared Domain", adsData.sharedDomain, &allHeapSize, &wasted)); } - + ArrayHolder pArray = new NOTHROW CLRDATA_ADDRESS[adsData.DomainCount]; if (pArray==NULL) { - ReportOOM(); + ReportOOM(); return Status; } @@ -3477,11 +3477,11 @@ DECLARE_API(EEHeap) allHeapSize += JitHeapInfo(); } - + // Module Data { int numModule; - ArrayHolder moduleList = ModuleFromName(NULL, &numModule); + ArrayHolder moduleList = ModuleFromName(NULL, &numModule); if (moduleList == NULL) { ExtOut("Failed to request module list.\n"); @@ -3507,7 +3507,7 @@ DECLARE_API(EEHeap) } if (showgc || !showloader) - { + { // GC Heap DWORD dwNHeaps = 1; @@ -3515,7 +3515,7 @@ DECLARE_API(EEHeap) { DisplayInvalidStructuresMessage(); } - + DacpGcHeapData gcheap; if (gcheap.Request(g_sos) != S_OK) { @@ -3558,12 +3558,12 @@ DECLARE_API(EEHeap) ExtOut("Failed to get GCHeaps\n"); return Status; } - + DWORD n; for (n = 0; n < dwNHeaps; n ++) { - DacpGcHeapDetails heapDetails; - if (heapDetails.Request(g_sos, heapAddrs[n]) != S_OK) + DacpGcHeapDetails dacHeapDetails; + if (dacHeapDetails.Request(g_sos, heapAddrs[n]) != S_OK) { ExtOut("Error requesting details\n"); return Status; @@ -3571,6 +3571,7 @@ DECLARE_API(EEHeap) ExtOut("------------------------------\n"); ExtOut("Heap %d (%p)\n", n, SOS_PTR(heapAddrs[n])); DWORD_PTR heapSize = 0; + GCHeapDetails heapDetails(dacHeapDetails, heapAddrs[n]); GCHeapInfo (heapDetails, heapSize); totalSize += heapSize; ExtOut("Heap Size: " WIN86_8SPACES); @@ -3616,17 +3617,17 @@ DECLARE_API(TraverseHeap) BOOL bVerify = FALSE; StringHolder Filename; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-xml", &bXmlFormat, COBOOL, FALSE}, {"-verify", &bVerify, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&Filename.data, COSTRING}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -3650,11 +3651,11 @@ DECLARE_API(TraverseHeap) } if (!bVerify) - ExtOut("Assuming a uncorrupted GC heap. If this is a crash dump consider -verify option\n"); + ExtOut("Assuming a uncorrupted GC heap. If this is a crash dump consider -verify option\n"); HeapTraverser traverser(bVerify != FALSE); - ExtOut("Writing %s format to file %s\n", bXmlFormat ? "Xml" : "CLRProfiler", Filename.data); + ExtOut("Writing %s format to file %s\n", bXmlFormat ? "Xml" : "CLRProfiler", Filename.data); ExtOut("Gathering types...\n"); // TODO: there may be a canonical list of methodtables in the runtime that we can @@ -3678,9 +3679,9 @@ DECLARE_API(TraverseHeap) return Status; } - fclose(file); + fclose(file); ExtOut("\nfile %s saved\n", Filename.data); - + return Status; } @@ -3735,7 +3736,7 @@ void PrintRuntimeTypes(DWORD_PTR objAddr,size_t Size,DWORD_PTR methodTable,LPVOI { ExtOut(" %" POINTERSIZE "s", "?"); } - + NameForMT_s(mtPtr, g_mdName, mdNameLen); DMLOut(" %s %S\n", DMLMethodTable(mtPtr), g_mdName); } @@ -3746,12 +3747,12 @@ void PrintRuntimeTypes(DWORD_PTR objAddr,size_t Size,DWORD_PTR methodTable,LPVOI DECLARE_API(DumpRuntimeTypes) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, }; @@ -3822,7 +3823,7 @@ class DumpHeapImpl ArrayHolder type = NULL; TADDR minTemp = 0; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-mt", &mMT, COHEX, TRUE}, // dump objects with a given MethodTable {"-type", &type, COSTRING, TRUE}, // list objects of specified type @@ -3840,7 +3841,7 @@ class DumpHeapImpl #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&mStart, COHEX}, {&mStop, COHEX} @@ -3860,7 +3861,7 @@ class DumpHeapImpl { sos::Throw("Cannot specify both -mt and -type"); } - + if (mLive && mDead) { sos::Throw("Cannot specify both -live and -dead."); @@ -3870,7 +3871,7 @@ class DumpHeapImpl { sos::Throw("wrong argument"); } - + // If the user gave us a type, convert it to unicode and clean up "type". if (type && !mStrings) { @@ -3889,12 +3890,12 @@ class DumpHeapImpl void Run() { // enable Debugger Markup Language - EnableDMLHolder dmlholder(mDML); + EnableDMLHolder dmlholder(mDML); sos::GCHeap gcheap; if (!gcheap.AreGCStructuresValid()) DisplayInvalidStructuresMessage(); - + if (IsMiniDumpFile()) { ExtOut("In a minidump without full memory, most gc heap structures will not be valid.\n"); @@ -3936,7 +3937,7 @@ class DumpHeapImpl { if (!sos::IsObject(itr->GetObject(), true)) { - ExtOut("SyncBlock %d corrupted, points to invalid object %p\n", + ExtOut("SyncBlock %d corrupted, points to invalid object %p\n", itr->GetIndex(), SOS_PTR(itr->GetObject())); succeeded = false; } @@ -3960,7 +3961,7 @@ class DumpHeapImpl ULONG index = header & MASK_SYNCBLOCKINDEX; valid = (ULONG)itr->GetIndex() == index; } - + if (!valid) { ExtOut("Object header for %p should have a SyncBlock index of %d.\n", @@ -3988,7 +3989,7 @@ class DumpHeapImpl return false; } } - + return true; } @@ -4067,7 +4068,7 @@ class DumpHeapImpl { stats.Add((DWORD_PTR)itr->GetMT(), (DWORD)itr->GetSize()); if (!mStat) - DMLOut("%s %s %8d%s\n", DMLObject(itr->GetAddress()), DMLDumpHeapMT(itr->GetMT()), itr->GetSize(), + DMLOut("%s %s %8d%s\n", DMLObject(itr->GetAddress()), DMLDumpHeapMT(itr->GetMT()), itr->GetSize(), itr->IsFree() ? " Free":" "); } } @@ -4087,30 +4088,30 @@ class DumpHeapImpl { str[0] = 0; } - + StringSetEntry(__in_ecount(64) WCHAR tmp[64], size_t _size) : count(1), size(_size) { memcpy(str, tmp, sizeof(str)); } - + void Add(size_t _size) const { count++; size += _size; } - + mutable size_t count; mutable size_t size; WCHAR str[64]; - + bool operator<(const StringSetEntry &rhs) const { return _wcscmp(str, rhs.str) < 0; } }; - + static bool StringSetCompare(const StringSetEntry &a1, const StringSetEntry &a2) { return a1.size < a2.size; @@ -4130,7 +4131,7 @@ class DumpHeapImpl const int offset = sos::Object::GetStringDataOffset(); typedef std::set Set; Set set; // A set keyed off of the string's text - + StringSetEntry tmp; // Temp string used to keep track of the set ULONG fetched = 0; @@ -4139,12 +4140,12 @@ class DumpHeapImpl { if (IsInterrupt()) break; - + if (itr->IsString() && IsCorrectSize(*itr) && IsCorrectLiveness(*itr)) { CLRDATA_ADDRESS addr = itr->GetAddress(); size_t size = itr->GetSize(); - + if (!mStat) out.WriteRow(ObjectPtr(addr), Pointer(itr->GetMT()), Decimal(size)); @@ -4184,7 +4185,7 @@ class DumpHeapImpl { if (IsInterrupt()) break; - + Flatten(vitr->str, (unsigned int)_wcslen(vitr->str)); out.WriteRow(Decimal(vitr->size), Decimal(vitr->count), vitr->str); } @@ -4213,7 +4214,7 @@ class DumpHeapImpl if (!Verify(itr)) return; - sos::ThinLockInfo lockInfo; + sos::ThinLockInfo lockInfo; if (IsCorrectType(*itr) && itr->GetThinLock(lockInfo)) { DMLOut("%s %s %8d", DMLObject(itr->GetAddress()), DMLDumpHeapMT(itr->GetMT()), itr->GetSize()); @@ -4282,7 +4283,7 @@ class DumpHeapImpl { ExtOut("Fragmented blocks larger than 0.5 MB:\n"); ExtOut("%" POINTERSIZE "s %8s %16s\n", "Addr", "Size", "Followed by"); - + for (FragmentationList::const_iterator itr = mFrag.begin(); itr != mFrag.end(); ++itr) { sos::MethodTable mt = itr->GetNextMT(); @@ -4569,7 +4570,7 @@ DECLARE_API(DumpAsync) type = new WCHAR[ansiTypeLen]; MultiByteToWideChar(CP_ACP, 0, ansiType, -1, type, (int)ansiTypeLen); } - + EnableDMLHolder dmlHolder(dml); BOOL hasTypeFilter = mt != NULL || ansiType != NULL || addr != NULL; @@ -4591,7 +4592,7 @@ DECLARE_API(DumpAsync) for (sos::ObjectIterator itr = gcheap.WalkHeap(); !IsInterrupt() && itr != NULL; ++itr) { // Skip objects too small to be state machines or tasks, avoiding some compiler-generated caching data structures. - if (itr->GetSize() <= 24) + if (itr->GetSize() <= 24) { continue; } @@ -4909,8 +4910,8 @@ DECLARE_API(DumpAsync) /**********************************************************************\ * Routine Description: * * * -* This function dumps all objects on GC heap. It also displays * -* statistics of objects. If GC heap is corrupted, it will stop at +* This function dumps all objects on GC heap. It also displays * +* statistics of objects. If GC heap is corrupted, it will stop at * the bad place. (May not work if GC is in progress.) * * * \**********************************************************************/ @@ -4940,7 +4941,7 @@ DECLARE_API(DumpHeap) } DECLARE_API(VerifyHeap) -{ +{ INIT_API(); MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); @@ -4950,7 +4951,7 @@ DECLARE_API(VerifyHeap) ExtOut("Unable to build snapshot of the garbage collector state\n"); return E_FAIL; } - + try { bool succeeded = true; @@ -5010,20 +5011,20 @@ enum oom_reason oom_unproductive_full_gc = 6 }; -static const char *const str_oom[] = +static const char *const str_oom[] = { - "There was no managed OOM due to allocations on the GC heap", // oom_no_failure + "There was no managed OOM due to allocations on the GC heap", // oom_no_failure "This is likely to be a bug in GC", // oom_budget "Didn't have enough memory to commit", // oom_cant_commit - "This is likely to be a bug in GC", // oom_cant_reserve - "Didn't have enough memory to allocate an LOH segment", // oom_loh - "Low on memory during GC", // oom_low_mem + "This is likely to be a bug in GC", // oom_cant_reserve + "Didn't have enough memory to allocate an LOH segment", // oom_loh + "Low on memory during GC", // oom_low_mem "Could not do a full GC" // oom_unproductive_full_gc }; -static const char *const str_fgm[] = +static const char *const str_fgm[] = { - "There was no failure to allocate memory", // fgm_no_failure + "There was no failure to allocate memory", // fgm_no_failure "Failed to reserve memory", // fgm_reserve_segment "Didn't have enough memory to commit beginning of the segment", // fgm_commit_segment_beg "Didn't have enough memory to commit the new ephemeral segment", // fgm_commit_eph_segment @@ -5033,7 +5034,7 @@ static const char *const str_fgm[] = void PrintOOMInfo(DacpOomData* oomData) { - ExtOut("Managed OOM occurred after GC #%d (Requested to allocate %d bytes)\n", + ExtOut("Managed OOM occurred after GC #%d (Requested to allocate %d bytes)\n", oomData->gc_index, oomData->alloc_size); if ((oomData->reason == oom_budget) || @@ -5050,11 +5051,11 @@ void PrintOOMInfo(DacpOomData* oomData) // Now print out the more detailed memory info if any. if (oomData->fgm != fgm_no_failure) { - ExtOut("Detail: %s: %s (%d bytes)", - (oomData->loh_p ? "LOH" : "SOH"), + ExtOut("Detail: %s: %s (%d bytes)", + (oomData->loh_p ? "LOH" : "SOH"), str_fgm[oomData->fgm], oomData->size); - + if ((oomData->fgm == fgm_commit_segment_beg) || (oomData->fgm == fgm_commit_eph_segment) || (oomData->fgm == fgm_grow_table) || @@ -5076,9 +5077,9 @@ void PrintOOMInfo(DacpOomData* oomData) } DECLARE_API(AnalyzeOOM) -{ - INIT_API(); - MINIDUMP_NOT_SUPPORTED(); +{ + INIT_API(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); #ifndef FEATURE_PAL @@ -5106,7 +5107,7 @@ DECLARE_API(AnalyzeOOM) } } else - { + { DWORD dwNHeaps = GetGcHeapCount(); DWORD dwAllocSize; if (!ClrSafeInt::multiply(sizeof(CLRDATA_ADDRESS), dwNHeaps, dwAllocSize)) @@ -5121,7 +5122,7 @@ DECLARE_API(AnalyzeOOM) ExtOut("Failed to get GCHeaps\n"); return Status; } - + for (DWORD n = 0; n < dwNHeaps; n ++) { if (oomData.Request(g_sos, heapAddrs[n]) != S_OK) @@ -5155,7 +5156,7 @@ DECLARE_API(AnalyzeOOM) DECLARE_API(VerifyObj) { - INIT_API(); + INIT_API(); MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); @@ -5166,11 +5167,11 @@ DECLARE_API(VerifyObj) BOOL bValid = FALSE; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&taddrObj, COHEX} }; @@ -5197,7 +5198,7 @@ DECLARE_API(VerifyObj) goto Exit; } { - DacpGcHeapDetails *pheapDetails = g_snapshot.GetHeap(taddrObj); + GCHeapDetails *pheapDetails = g_snapshot.GetHeap(taddrObj); bValid = VerifyObject(*pheapDetails, taddrObj, taddrMT, objSize, TRUE); } @@ -5210,7 +5211,7 @@ DECLARE_API(VerifyObj) return Status; } -void LNODisplayOutput(LPCWSTR tag, TADDR pMT, TADDR currentObj, size_t size) +void LNODisplayOutput(LPCWSTR tag, TADDR pMT, TADDR currentObj, size_t size) { sos::Object obj(currentObj, pMT); DMLOut("%S %s %12d (0x%x)\t%S\n", tag, DMLObject(currentObj), size, size, obj.GetTypeName()); @@ -5219,29 +5220,29 @@ void LNODisplayOutput(LPCWSTR tag, TADDR pMT, TADDR currentObj, size_t size) DECLARE_API(ListNearObj) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); #if !defined(FEATURE_PAL) TADDR taddrArg = 0; TADDR taddrObj = 0; - // we may want to provide a more exact version of searching for the - // previous object in the heap, using the brick table, instead of + // we may want to provide a more exact version of searching for the + // previous object in the heap, using the brick table, instead of // looking for what may be valid method tables... //BOOL bExact; - //CMDOption option[] = + //CMDOption option[] = //{ // // name, vptr, type, hasValue // {"-exact", &bExact, COBOOL, FALSE} //}; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&taddrArg, COHEX} @@ -5258,12 +5259,12 @@ DECLARE_API(ListNearObj) if (!g_snapshot.Build()) { ExtOut("Unable to build snapshot of the garbage collector state\n"); - return Status; + return Status; } taddrObj = Align(taddrArg); - DacpGcHeapDetails *heap = g_snapshot.GetHeap(taddrArg); + GCHeapDetails *heap = g_snapshot.GetHeap(taddrArg); if (heap == NULL) { ExtOut("Address %p does not lie in the managed heap\n", SOS_PTR(taddrObj)); @@ -5276,7 +5277,7 @@ DECLARE_API(ListNearObj) int gen; if (!GCObjInHeap(taddrObj, *heap, trngSeg, gen, allocCtx, bLarge)) { - ExtOut("Failed to find the segment of the managed heap where the object %p resides\n", + ExtOut("Failed to find the segment of the managed heap where the object %p resides\n", SOS_PTR(taddrObj)); return Status; } @@ -5312,13 +5313,13 @@ DECLARE_API(ListNearObj) // remember this as one of the possible "good" objects preceeding taddrObj candidate.push_back(taddrCur); - std::vector::iterator it = + std::vector::iterator it = std::find(candidate.begin(), candidate.end(), taddrCur+curSize); if (it != candidate.end()) { // We found a chain of two objects preceeding taddrObj. We'll // trust this is a good indication that the two objects are valid. - // What is not valid is possibly the object following the second + // What is not valid is possibly the object following the second // one... taddrCur = *it; GetMTOfObject(taddrCur, &curMT); @@ -5340,15 +5341,15 @@ DECLARE_API(ListNearObj) } taddrNxt = taddrObj; - if (taddrArg == taddrObj) + if (taddrArg == taddrObj) { taddrNxt += sizeof(TADDR); } // ===== Now look at taddrObj - if (taddrObj == taddrArg) + if (taddrObj == taddrArg) { - // only look at taddrObj if it's the same as what user passed in, meaning it's aligned. + // only look at taddrObj if it's the same as what user passed in, meaning it's aligned. if (SUCCEEDED(GetMTOfObject(taddrObj, &objMT)) && GetSizeEfficient(taddrObj, objMT, bLarge, objSize, bContainsPointers)) { @@ -5367,7 +5368,7 @@ DECLARE_API(ListNearObj) } // ===== And finally move on to elements following taddrObj - + for (; taddrNxt < trngSeg.end; taddrNxt += sizeof(TADDR)) { if (SUCCEEDED(GetMTOfObject(taddrNxt, &nxtMT)) && @@ -5393,8 +5394,8 @@ DECLARE_API(ListNearObj) ExtOut("After: couldn't find any object between %#p and %#p\n", SOS_PTR(taddrArg), SOS_PTR(trngSeg.end)); - if (bCur && bNxt && - (((taddrCur+curSize == taddrObj) && (taddrObj+objSize == taddrNxt)) || (taddrCur+curSize == taddrNxt))) + if (bCur && bNxt && + (((taddrCur + curSize == taddrObj) && (taddrObj + objSize == taddrNxt)) || (taddrCur + curSize == taddrNxt))) { ExtOut("Heap local consistency confirmed.\n"); } @@ -5403,7 +5404,7 @@ DECLARE_API(ListNearObj) ExtOut("Heap local consistency not confirmed.\n"); } - return Status; + return Status; #else @@ -5417,7 +5418,7 @@ DECLARE_API(ListNearObj) DECLARE_API(GCHeapStat) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); #ifndef FEATURE_PAL @@ -5431,49 +5432,57 @@ DECLARE_API(GCHeapStat) {"-iu", &bIncUnreachable, COBOOL, FALSE}, {"/d", &dml, COBOOL, FALSE} }; - - if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) + + if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; } EnableDMLHolder dmlHolder(dml); - ExtOut("%-8s %12s %12s %12s %12s\n", "Heap", "Gen0", "Gen1", "Gen2", "LOH"); + ExtOut("%-8s %12s %12s %12s %12s %12s\n", "Heap", "Gen0", "Gen1", "Gen2", "LOH", "POH"); if (!IsServerBuild()) { float tempf; - DacpGcHeapDetails heapDetails; - if (heapDetails.Request(g_sos) != S_OK) + DacpGcHeapDetails dacHeapDetails; + if (dacHeapDetails.Request(g_sos) != S_OK) { ExtErr("Error requesting gc heap details\n"); return Status; } HeapUsageStat hpUsage; + GCHeapDetails heapDetails(dacHeapDetails); if (GCHeapUsageStats(heapDetails, bIncUnreachable, &hpUsage)) { - ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", 0, - hpUsage.genUsage[0].allocd, hpUsage.genUsage[1].allocd, - hpUsage.genUsage[2].allocd, hpUsage.genUsage[3].allocd); - ExtOut("\nFree space: Percentage\n"); - ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u ", 0, - hpUsage.genUsage[0].freed, hpUsage.genUsage[1].freed, - hpUsage.genUsage[2].freed, hpUsage.genUsage[3].freed); - tempf = ((float)(hpUsage.genUsage[0].freed+hpUsage.genUsage[1].freed+hpUsage.genUsage[2].freed)) / - (hpUsage.genUsage[0].allocd+hpUsage.genUsage[1].allocd+hpUsage.genUsage[2].allocd); - ExtOut("SOH:%3d%% LOH:%3d%%\n", (int)(100 * tempf), - (int)(100*((float)hpUsage.genUsage[3].freed) / (hpUsage.genUsage[3].allocd))); + ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", 0, + hpUsage.genUsage[0].allocd, hpUsage.genUsage[1].allocd, + hpUsage.genUsage[2].allocd, hpUsage.genUsage[3].allocd, + hpUsage.genUsage[4].allocd); + ExtOut("\nFree space: Percentage\n"); + ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u ", 0, + hpUsage.genUsage[0].freed, hpUsage.genUsage[1].freed, + hpUsage.genUsage[2].freed, hpUsage.genUsage[3].freed, + hpUsage.genUsage[4].freed); + tempf = ((float)(hpUsage.genUsage[0].freed + hpUsage.genUsage[1].freed + hpUsage.genUsage[2].freed)) / + (hpUsage.genUsage[0].allocd + hpUsage.genUsage[1].allocd + hpUsage.genUsage[2].allocd); + int pohFreeUsage = heapDetails.has_poh ? (int)(100*((float)hpUsage.genUsage[4].freed) / (hpUsage.genUsage[4].allocd)) : 0; + ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%%", + (int)(100*((float)hpUsage.genUsage[3].freed) / (hpUsage.genUsage[3].allocd)), "%%", + pohFreeUsage, "%%"); + if (bIncUnreachable) { - ExtOut("\nUnrooted objects: Percentage\n"); - ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u ", 0, - hpUsage.genUsage[0].unrooted, hpUsage.genUsage[1].unrooted, - hpUsage.genUsage[2].unrooted, hpUsage.genUsage[3].unrooted); - tempf = ((float)(hpUsage.genUsage[0].unrooted+hpUsage.genUsage[1].unrooted+hpUsage.genUsage[2].unrooted)) / - (hpUsage.genUsage[0].allocd+hpUsage.genUsage[1].allocd+hpUsage.genUsage[2].allocd); - ExtOut("SOH:%3d%% LOH:%3d%%\n", (int)(100 * tempf), - (int)(100*((float)hpUsage.genUsage[3].unrooted) / (hpUsage.genUsage[3].allocd))); + ExtOut("\nUnrooted objects: Percentage\n"); + ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u ", 0, + hpUsage.genUsage[0].unrooted, hpUsage.genUsage[1].unrooted, + hpUsage.genUsage[2].unrooted, hpUsage.genUsage[3].unrooted); + tempf = ((float)(hpUsage.genUsage[0].unrooted+hpUsage.genUsage[1].unrooted+hpUsage.genUsage[2].unrooted)) / + (hpUsage.genUsage[0].allocd+hpUsage.genUsage[1].allocd+hpUsage.genUsage[2].allocd); + int pohUnrootedUsage = heapDetails.has_poh ? (int)(100*((float)hpUsage.genUsage[4].unrooted) / (hpUsage.genUsage[4].allocd)) : 0; + ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%%", + (int)(100*((float)hpUsage.genUsage[3].unrooted) / (hpUsage.genUsage[3].allocd)), "%%", + pohUnrootedUsage, "%%"); } } } @@ -5510,26 +5519,28 @@ DECLARE_API(GCHeapStat) } // aggregate stats across heaps / generation - GenUsageStat genUsageStat[4] = {0, 0, 0, 0}; - + GenUsageStat genUsageStat[5] = {0, 0, 0, 0, 0}; + bool hasPoh = false; for (DWORD n = 0; n < dwNHeaps; n ++) { - DacpGcHeapDetails heapDetails; - if (heapDetails.Request(g_sos, heapAddrs[n]) != S_OK) + DacpGcHeapDetails dacHeapDetails; + if (dacHeapDetails.Request(g_sos, heapAddrs[n]) != S_OK) { ExtErr("Error requesting gc heap details\n"); return Status; } + GCHeapDetails heapDetails(dacHeapDetails, heapAddrs[n]); + hasPoh = heapDetails.has_poh; if (GCHeapUsageStats(heapDetails, bIncUnreachable, &hpUsage[n])) { - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 5; ++i) { genUsageStat[i].allocd += hpUsage[n].genUsage[i].allocd; genUsageStat[i].freed += hpUsage[n].genUsage[i].freed; if (bIncUnreachable) { - genUsageStat[i].unrooted += hpUsage[n].genUsage[i].unrooted; + genUsageStat[i].unrooted += hpUsage[n].genUsage[i].unrooted; } } } @@ -5537,54 +5548,63 @@ DECLARE_API(GCHeapStat) for (DWORD n = 0; n < dwNHeaps; n ++) { - ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", n, - hpUsage[n].genUsage[0].allocd, hpUsage[n].genUsage[1].allocd, - hpUsage[n].genUsage[2].allocd, hpUsage[n].genUsage[3].allocd); + ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", n, + hpUsage[n].genUsage[0].allocd, hpUsage[n].genUsage[1].allocd, + hpUsage[n].genUsage[2].allocd, hpUsage[n].genUsage[3].allocd, + hpUsage[n].genUsage[4].allocd); } - ExtOut("Total %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", - genUsageStat[0].allocd, genUsageStat[1].allocd, - genUsageStat[2].allocd, genUsageStat[3].allocd); + ExtOut("Total %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", + genUsageStat[0].allocd, genUsageStat[1].allocd, + genUsageStat[2].allocd, genUsageStat[3].allocd, + genUsageStat[4].allocd); - ExtOut("\nFree space: Percentage\n"); + ExtOut("\nFree space: Percentage\n"); for (DWORD n = 0; n < dwNHeaps; n ++) { - ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u ", n, - hpUsage[n].genUsage[0].freed, hpUsage[n].genUsage[1].freed, - hpUsage[n].genUsage[2].freed, hpUsage[n].genUsage[3].freed); + ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u ", n, + hpUsage[n].genUsage[0].freed, hpUsage[n].genUsage[1].freed, + hpUsage[n].genUsage[2].freed, hpUsage[n].genUsage[3].freed, + hpUsage[n].genUsage[4].freed); - tempf = ((float)(hpUsage[n].genUsage[0].freed+hpUsage[n].genUsage[1].freed+hpUsage[n].genUsage[2].freed)) / - (hpUsage[n].genUsage[0].allocd+hpUsage[n].genUsage[1].allocd+hpUsage[n].genUsage[2].allocd); - ExtOut("SOH:%3d%% LOH:%3d%%\n", (int)(100 * tempf), - (int)(100*((float)hpUsage[n].genUsage[3].freed) / (hpUsage[n].genUsage[3].allocd)) - ); + tempf = ((float)(hpUsage[n].genUsage[0].freed + hpUsage[n].genUsage[1].freed + hpUsage[n].genUsage[2].freed)) / + (hpUsage[n].genUsage[0].allocd + hpUsage[n].genUsage[1].allocd + hpUsage[n].genUsage[2].allocd); + int pohFreeUsage = hasPoh ? (int)(100*((float)hpUsage[n].genUsage[4].freed) / (hpUsage[n].genUsage[4].allocd)) : 0; + ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%%", + (int)(100*((float)hpUsage[n].genUsage[3].freed) / (hpUsage[n].genUsage[3].allocd)), "%%", + pohFreeUsage, "%%"); } - ExtOut("Total %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", - genUsageStat[0].freed, genUsageStat[1].freed, - genUsageStat[2].freed, genUsageStat[3].freed); + ExtOut("Total %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", + genUsageStat[0].freed, genUsageStat[1].freed, + genUsageStat[2].freed, genUsageStat[3].freed, + genUsageStat[4].freed); if (bIncUnreachable) { ExtOut("\nUnrooted objects: Percentage\n"); for (DWORD n = 0; n < dwNHeaps; n ++) { - ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u ", n, - hpUsage[n].genUsage[0].unrooted, hpUsage[n].genUsage[1].unrooted, - hpUsage[n].genUsage[2].unrooted, hpUsage[n].genUsage[3].unrooted); + ExtOut("Heap%-4d %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u ", n, + hpUsage[n].genUsage[0].unrooted, hpUsage[n].genUsage[1].unrooted, + hpUsage[n].genUsage[2].unrooted, hpUsage[n].genUsage[3].unrooted, + hpUsage[n].genUsage[4].unrooted); - tempf = ((float)(hpUsage[n].genUsage[0].unrooted+hpUsage[n].genUsage[1].unrooted+hpUsage[n].genUsage[2].unrooted)) / - (hpUsage[n].genUsage[0].allocd+hpUsage[n].genUsage[1].allocd+hpUsage[n].genUsage[2].allocd); - ExtOut("SOH:%3d%% LOH:%3d%%\n", (int)(100 * tempf), - (int)(100*((float)hpUsage[n].genUsage[3].unrooted) / (hpUsage[n].genUsage[3].allocd))); + tempf = ((float)(hpUsage[n].genUsage[0].unrooted + hpUsage[n].genUsage[1].unrooted + hpUsage[n].genUsage[2].unrooted)) / + (hpUsage[n].genUsage[0].allocd + hpUsage[n].genUsage[1].allocd + hpUsage[n].genUsage[2].allocd); + int pohUnrootedUsage = hasPoh ? (int)(100*((float)hpUsage[n].genUsage[4].unrooted) / (hpUsage[n].genUsage[4].allocd)) : 0; + ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%%", + (int)(100*((float)hpUsage[n].genUsage[3].unrooted) / (hpUsage[n].genUsage[3].allocd)), "%%", + pohUnrootedUsage, "%%"); } - ExtOut("Total %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", - genUsageStat[0].unrooted, genUsageStat[1].unrooted, - genUsageStat[2].unrooted, genUsageStat[3].unrooted); + ExtOut("Total %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n", + genUsageStat[0].unrooted, genUsageStat[1].unrooted, + genUsageStat[2].unrooted, genUsageStat[3].unrooted, + genUsageStat[4].unrooted); } } return Status; - + #else _ASSERTE(false); @@ -5598,30 +5618,30 @@ DECLARE_API(GCHeapStat) /**********************************************************************\ * Routine Description: * * * -* This function dumps what is in the syncblock cache. By default * +* This function dumps what is in the syncblock cache. By default * * it dumps all active syncblocks. Using -all to dump all syncblocks * * \**********************************************************************/ DECLARE_API(SyncBlk) { - INIT_API(); - MINIDUMP_NOT_SUPPORTED(); - + INIT_API(); + MINIDUMP_NOT_SUPPORTED(); + BOOL bDumpAll = FALSE; size_t nbAsked = 0; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-all", &bDumpAll, COBOOL, FALSE}, {"/d", &dml, COBOOL, FALSE} }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&nbAsked, COSIZE_T} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -5635,7 +5655,7 @@ DECLARE_API(SyncBlk) } DWORD dwCount = syncBlockData.SyncBlockCount; - + ExtOut("Index" WIN64_8SPACES " SyncBlock MonitorHeld Recursion Owning Thread Info" WIN64_8SPACES " SyncBlock Owner\n"); ULONG freeCount = 0; ULONG CCWCount = 0; @@ -5645,8 +5665,8 @@ DECLARE_API(SyncBlk) { if (IsInterrupt()) return Status; - - if (nbAsked && nb != nbAsked) + + if (nbAsked && nb != nbAsked) { continue; } @@ -5664,8 +5684,8 @@ DECLARE_API(SyncBlk) { ExtOut("%5d ", nb); if (!syncBlockData.bFree || nb != nbAsked) - { - ExtOut("%p ", syncBlockData.SyncBlockPointer); + { + ExtOut("%p ", syncBlockData.SyncBlockPointer); ExtOut("%11d ", syncBlockData.MonitorHeld); ExtOut("%9d ", syncBlockData.Recursion); ExtOut("%p ", syncBlockData.HoldingThread); @@ -5710,17 +5730,17 @@ DECLARE_API(SyncBlk) } } } - - if (syncBlockData.bFree) + + if (syncBlockData.bFree) { freeCount ++; if (bPrint) { ExtOut(" Free"); } } - else + else { -#ifdef FEATURE_COMINTEROP +#ifdef FEATURE_COMINTEROP if (syncBlockData.COMFlags) { switch (syncBlockData.COMFlags) { case SYNCBLOCKDATA_COMFLAGS_CCW: @@ -5734,10 +5754,10 @@ DECLARE_API(SyncBlk) break; } } -#endif // FEATURE_COMINTEROP +#endif // FEATURE_COMINTEROP } - if (syncBlockData.MonitorHeld > 1) + if (syncBlockData.MonitorHeld > 1) { // TODO: implement this /* @@ -5745,7 +5765,7 @@ DECLARE_API(SyncBlk) DWORD_PTR pHead = (DWORD_PTR)vSyncBlock.m_Link.m_pNext; DWORD_PTR pNext = pHead; Thread vThread; - + while (1) { if (IsInterrupt()) @@ -5767,14 +5787,14 @@ DECLARE_API(SyncBlk) pNext = (DWORD_PTR)vWaitEventLink.m_LinkSB.m_pNext; if (pNext == 0) break; - } + } */ } - + if (bPrint) ExtOut("\n"); } - + ExtOut("-----------------------------\n"); ExtOut("Total %d\n", dwCount); #ifdef FEATURE_COMINTEROP @@ -5783,7 +5803,7 @@ DECLARE_API(SyncBlk) ExtOut("ComClassFactory %d\n", CFCount); #endif ExtOut("Free %d\n", freeCount); - + return Status; } @@ -5808,7 +5828,7 @@ void VisitRcw(CLRDATA_ADDRESS RCW,CLRDATA_ADDRESS Context,CLRDATA_ADDRESS Thread ExtOut("RuntimeCallableWrappers (RCW) to be cleaned:\n"); ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s Apartment\n", "RCW", "CONTEXT", "THREAD"); - } + } LPCSTR szThreadApartment; if (bIsFreeThreaded) { @@ -5824,11 +5844,11 @@ void VisitRcw(CLRDATA_ADDRESS RCW,CLRDATA_ADDRESS Context,CLRDATA_ADDRESS Thread { szThreadApartment = "(STA)"; pArgs->STACount++; - } - + } + ExtOut("%" POINTERSIZE "p %" POINTERSIZE "p %" POINTERSIZE "p %9s\n", - SOS_PTR(RCW), - SOS_PTR(Context), + SOS_PTR(RCW), + SOS_PTR(Context), SOS_PTR(Thread), szThreadApartment); } @@ -5837,13 +5857,13 @@ void VisitRcw(CLRDATA_ADDRESS RCW,CLRDATA_ADDRESS Context,CLRDATA_ADDRESS Thread DECLARE_API(RCWCleanupList) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); DWORD_PTR p_CleanupList = GetExpression(args); VisitRcwArgs travArgs; - ZeroMemory(&travArgs,sizeof(VisitRcwArgs)); + ZeroMemory(&travArgs,sizeof(VisitRcwArgs)); travArgs.bDetail = TRUE; // We need to detect when !RCWCleanupList is called with an expression which evaluates to 0 @@ -5852,7 +5872,7 @@ DECLARE_API(RCWCleanupList) if (p_CleanupList || strlen(args) == 0) { HRESULT hr = g_sos->TraverseRCWCleanupList(p_CleanupList, (VISITRCWFORCLEANUP)VisitRcw, &travArgs); - + if (SUCCEEDED(hr)) { ExtOut("Free-Threaded Interfaces to be released: %d\n", travArgs.FTMCount); @@ -5868,7 +5888,7 @@ DECLARE_API(RCWCleanupList) { ExtOut("Invalid parameter %s\n", args); } - + return Status; } #endif // FEATURE_COMINTEROP @@ -5877,21 +5897,21 @@ DECLARE_API(RCWCleanupList) * Routine Description: * * * * This function is called to dump the contents of the finalizer * -* queue. * +* queue. * * * \**********************************************************************/ DECLARE_API(FinalizeQueue) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); - + MINIDUMP_NOT_SUPPORTED(); + BOOL bDetail = FALSE; BOOL bAllReady = FALSE; BOOL bShort = FALSE; BOOL dml = FALSE; TADDR taddrMT = 0; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-detail", &bDetail, COBOOL, FALSE}, {"-allReady", &bAllReady, COBOOL, FALSE}, @@ -5900,7 +5920,7 @@ DECLARE_API(FinalizeQueue) {"-mt", &taddrMT, COHEX, TRUE}, }; - if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) + if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; } @@ -5919,10 +5939,10 @@ DECLARE_API(FinalizeQueue) { ExtOut("SyncBlocks to be cleaned by the finalizer thread:\n"); ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", - "SyncBlock", "RCW", "CCW", "ComClassFactory"); + "SyncBlock", "RCW", "CCW", "ComClassFactory"); } - - ExtOut("%" POINTERSIZE "p %" POINTERSIZE "p %" POINTERSIZE "p %" POINTERSIZE "p\n", + + ExtOut("%" POINTERSIZE "p %" POINTERSIZE "p %" POINTERSIZE "p %" POINTERSIZE "p\n", (ULONG64) dsbcd.SyncBlockPointer, (ULONG64) dsbcd.blockRCW, (ULONG64) dsbcd.blockCCW, @@ -5941,13 +5961,13 @@ DECLARE_API(FinalizeQueue) #ifdef FEATURE_COMINTEROP VisitRcwArgs travArgs; - ZeroMemory(&travArgs,sizeof(VisitRcwArgs)); + ZeroMemory(&travArgs,sizeof(VisitRcwArgs)); travArgs.bDetail = bDetail; g_sos->TraverseRCWCleanupList(0, (VISITRCWFORCLEANUP) VisitRcw, &travArgs); ExtOut("Free-Threaded Interfaces to be released: %d\n", travArgs.FTMCount); ExtOut("MTA Interfaces to be released: %d\n", travArgs.MTACount); - ExtOut("STA Interfaces to be released: %d\n", travArgs.STACount); -#endif // FEATURE_COMINTEROP + ExtOut("STA Interfaces to be released: %d\n", travArgs.STACount); +#endif // FEATURE_COMINTEROP // noRCW: ExtOut("----------------------------------\n"); @@ -5970,7 +5990,7 @@ DECLARE_API(FinalizeQueue) GatherOneHeapFinalization(heapDetails, &hpStat, bAllReady, bShort); } else - { + { DWORD dwAllocSize; if (!ClrSafeInt::multiply(sizeof(CLRDATA_ADDRESS), dwNHeaps, dwAllocSize)) { @@ -5984,7 +6004,7 @@ DECLARE_API(FinalizeQueue) ExtOut("Failed to get GCHeaps\n"); return Status; } - + for (DWORD n = 0; n < dwNHeaps; n ++) { DacpGcHeapDetails heapDetails; @@ -5996,10 +6016,11 @@ DECLARE_API(FinalizeQueue) ExtOut("------------------------------\n"); ExtOut("Heap %d\n", n); + GatherOneHeapFinalization(heapDetails, &hpStat, bAllReady, bShort); - } + } } - + if (!bShort) { if (bAllReady) @@ -6041,21 +6062,21 @@ void ModuleMapTraverse(UINT index, CLRDATA_ADDRESS methodTable, LPVOID token) * Routine Description: * * * * This function is called to dump the contents of a Module * -* for a given address * +* for a given address * * * \**********************************************************************/ DECLARE_API(DumpModule) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); - - + MINIDUMP_NOT_SUPPORTED(); + + DWORD_PTR p_ModuleAddr = NULL; BOOL bMethodTables = FALSE; BOOL bProfilerModified = FALSE; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-mt", &bMethodTables, COBOOL, FALSE}, #ifndef FEATURE_PAL @@ -6063,13 +6084,13 @@ DECLARE_API(DumpModule) #endif {"-prof", &bProfilerModified, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&p_ModuleAddr, COHEX} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -6087,7 +6108,7 @@ DECLARE_API(DumpModule) return Status; } - + WCHAR FileName[MAX_LONGPATH]; FileNameForModule (&module, FileName); ExtOut("Name: %S\n", FileName[0] ? FileName : W("Unknown Module")); @@ -6139,24 +6160,24 @@ DECLARE_API(DumpModule) { ExtOut("\nTypes defined in this module\n\n"); ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %s\n", "MT", "TypeDef", "Name"); - + ExtOut("------------------------------------------------------------------------------\n"); - g_sos->TraverseModuleMap(TYPEDEFTOMETHODTABLE, TO_CDADDR(p_ModuleAddr), ModuleMapTraverse, (LPVOID)mdTypeDefNil); + g_sos->TraverseModuleMap(TYPEDEFTOMETHODTABLE, TO_CDADDR(p_ModuleAddr), ModuleMapTraverse, (LPVOID)mdTypeDefNil); ExtOut("\nTypes referenced in this module\n\n"); ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %s\n", "MT", "TypeRef", "Name"); - + ExtOut("------------------------------------------------------------------------------\n"); - g_sos->TraverseModuleMap(TYPEREFTOMETHODTABLE, TO_CDADDR(p_ModuleAddr), ModuleMapTraverse, (LPVOID)mdTypeDefNil); + g_sos->TraverseModuleMap(TYPEREFTOMETHODTABLE, TO_CDADDR(p_ModuleAddr), ModuleMapTraverse, (LPVOID)mdTypeDefNil); } - + if (bProfilerModified) { CLRDATA_ADDRESS methodDescs[kcMaxMethodDescsForProfiler]; int cMethodDescs; ReleaseHolder sos7; - if (SUCCEEDED(g_sos->QueryInterface(__uuidof(ISOSDacInterface7), &sos7)) && + if (SUCCEEDED(g_sos->QueryInterface(__uuidof(ISOSDacInterface7), &sos7)) && SUCCEEDED(sos7->GetMethodsWithProfilerModifiedIL(TO_CDADDR(p_ModuleAddr), methodDescs, kcMaxMethodDescsForProfiler, @@ -6216,30 +6237,30 @@ DECLARE_API(DumpModule) * Routine Description: * * * * This function is called to dump the contents of a Domain * -* for a given address * +* for a given address * * * \**********************************************************************/ DECLARE_API(DumpDomain) { INIT_API(); MINIDUMP_NOT_SUPPORTED(); - + DWORD_PTR p_DomainAddr = 0; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&p_DomainAddr, COHEX}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -6252,7 +6273,7 @@ DECLARE_API(DumpDomain) ExtOut("Unable to get AppDomain information\n"); return Status; } - + if (p_DomainAddr) { DacpAppDomainData appDomain1; @@ -6280,7 +6301,7 @@ DECLARE_API(DumpDomain) DomainInfo(&appDomain1); return Status; } - + ExtOut("--------------------------------------\n"); DMLOut("System Domain: %s\n", DMLDomain(adsData.systemDomain)); DacpAppDomainData appDomain; @@ -6290,7 +6311,7 @@ DECLARE_API(DumpDomain) return Status; } DomainInfo(&appDomain); - + if (adsData.sharedDomain != NULL) { ExtOut("--------------------------------------\n"); @@ -6339,30 +6360,30 @@ DECLARE_API(DumpDomain) * Routine Description: * * * * This function is called to dump the contents of a Assembly * -* for a given address * +* for a given address * * * \**********************************************************************/ DECLARE_API(DumpAssembly) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); - + MINIDUMP_NOT_SUPPORTED(); + DWORD_PTR p_AssemblyAddr = 0; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&p_AssemblyAddr, COHEX}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -6374,7 +6395,7 @@ DECLARE_API(DumpAssembly) ExtOut("Invalid Assembly %s\n", args); return Status; } - + DacpAssemblyData Assembly; if ((Status=Assembly.Request(g_sos, TO_CDADDR(p_AssemblyAddr)))!=S_OK) { @@ -6428,7 +6449,7 @@ String GetHostingCapabilities(DWORD hostConfig) HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly) { HRESULT Status; - + DacpThreadStoreData ThreadStore; if ((Status = ThreadStore.Request(g_sos)) != S_OK) { @@ -6461,7 +6482,7 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly) const bool hosted = (ThreadStore.fHostConfig & CLRTASKHOSTED) != 0; table.ReInit(hosted ? 12 : 11, POINTERSIZE_HEX); - table.SetWidths(10, 4, 4, 4, _max(9, POINTERSIZE_HEX), + table.SetWidths(10, 4, 4, 4, _max(9, POINTERSIZE_HEX), 8, 11, 1+POINTERSIZE_HEX*2, POINTERSIZE_HEX, 5, 3, POINTERSIZE_HEX); @@ -6472,12 +6493,12 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly) table.WriteColumn(8, "Lock"); table.WriteRow("DBG", "ID", "OSID", "ThreadOBJ", "State", "GC Mode", "GC Alloc Context", "Domain", "Count", "Apt"); - + if (hosted) table.WriteColumn("Fiber"); table.WriteColumn("Exception"); - + DacpThreadData Thread; CLRDATA_ADDRESS CurThread = ThreadStore.firstThread; while (CurThread) @@ -6494,8 +6515,8 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly) BOOL bSwitchedOutFiber = Thread.osThreadId == SWITCHED_OUT_FIBER_OSID; if (!IsKernelDebugger()) { - ULONG id = 0; - + ULONG id = 0; + if (bSwitchedOutFiber) { table.WriteColumn(0, "<<<< "); @@ -6534,11 +6555,11 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly) else table.WriteColumn(7, AppDomainPtr(domain)); } - + table.WriteColumn(8, Decimal(Thread.lockCount)); // Apartment state -#ifndef FEATURE_PAL +#ifndef FEATURE_PAL DWORD_PTR OleTlsDataAddr; if (IsWindowsTarget() && !bSwitchedOutFiber && SafeReadMemory(Thread.teb + offsetof(TEB, ReservedForOle), @@ -6570,7 +6591,7 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly) if (hosted) table.WriteColumn(10, Thread.fiberData); - + WString lastCol; if (CurThread == ThreadStore.finalizerThread) lastCol += W("(Finalizer) "); @@ -6579,13 +6600,13 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly) const int TS_TPWorkerThread = 0x01000000; // is this a threadpool worker thread? const int TS_CompletionPortThread = 0x08000000; // is this is a completion port thread? - + if (Thread.state & TS_TPWorkerThread) lastCol += W("(Threadpool Worker) "); else if (Thread.state & TS_CompletionPortThread) lastCol += W("(Threadpool Completion Port) "); - - + + TADDR taLTOH; if (Thread.lastThrownObjectHandle && SafeReadMemory(TO_TADDR(Thread.lastThrownObjectHandle), &taLTOH, sizeof(taLTOH), NULL) && taLTOH) @@ -6618,7 +6639,7 @@ HRESULT PrintSpecialThreads() DWORD dwCLRTLSDataIndex = 0; HRESULT Status = g_sos->GetTLSIndex(&dwCLRTLSDataIndex); - + if (!SUCCEEDED (Status)) { Print("Failed to retrieve Tls Data index\n"); @@ -6648,35 +6669,35 @@ HRESULT PrintSpecialThreads() for (ULONG ulThread = 0; ulThread < ulTotalThreads; ulThread++) { ULONG Id = 0; - ULONG SysId = 0; + ULONG SysId = 0; HRESULT threadStatus = g_ExtSystem->GetThreadIdsByIndex(ulThread, 1, &Id, &SysId); if (!SUCCEEDED (threadStatus)) { - PrintLn("Failed to get thread ID for thread ", Decimal(ulThread)); + PrintLn("Failed to get thread ID for thread ", Decimal(ulThread)); continue; - } + } threadStatus = g_ExtSystem->SetCurrentThreadId(Id); if (!SUCCEEDED (threadStatus)) { - PrintLn("Failed to switch to thread ", ThreadID(SysId)); + PrintLn("Failed to switch to thread ", ThreadID(SysId)); continue; - } + } - CLRDATA_ADDRESS cdaTeb = 0; + CLRDATA_ADDRESS cdaTeb = 0; threadStatus = g_ExtSystem->GetCurrentThreadTeb(&cdaTeb); if (!SUCCEEDED (threadStatus)) { - PrintLn("Failed to get Teb for Thread ", ThreadID(SysId)); + PrintLn("Failed to get Teb for Thread ", ThreadID(SysId)); continue; - } + } TADDR CLRTLSDataAddr = 0; TADDR tlsArrayAddr = NULL; if (!SafeReadMemory (TO_TADDR(cdaTeb) + WINNT_OFFSETOF__TEB__ThreadLocalStoragePointer , &tlsArrayAddr, sizeof (void**), NULL)) { - PrintLn("Failed to get Tls expansion slots for thread ", ThreadID(SysId)); + PrintLn("Failed to get Tls expansion slots for thread ", ThreadID(SysId)); continue; } @@ -6688,7 +6709,7 @@ HRESULT PrintSpecialThreads() TADDR moduleTlsDataAddr = 0; if (!SafeReadMemory (tlsArrayAddr + sizeof (void*) * (dwCLRTLSDataIndex & 0xFFFF), &moduleTlsDataAddr, sizeof (void**), NULL)) { - PrintLn("Failed to get Tls expansion slots for thread ", ThreadID(SysId)); + PrintLn("Failed to get Tls expansion slots for thread ", ThreadID(SysId)); continue; } @@ -6697,7 +6718,7 @@ HRESULT PrintSpecialThreads() TADDR CLRTLSData = NULL; if (!SafeReadMemory (CLRTLSDataAddr, &CLRTLSData, sizeof (TADDR), NULL)) { - PrintLn("Failed to get CLR Tls data for thread ", ThreadID(SysId)); + PrintLn("Failed to get CLR Tls data for thread ", ThreadID(SysId)); continue; } @@ -6709,10 +6730,10 @@ HRESULT PrintSpecialThreads() size_t ThreadType = 0; if (!SafeReadMemory (CLRTLSData + sizeof (TADDR) * TlsIdx_ThreadType, &ThreadType, sizeof (size_t), NULL)) { - PrintLn("Failed to get thread type info not found for thread ", ThreadID(SysId)); + PrintLn("Failed to get thread type info not found for thread ", ThreadID(SysId)); continue; } - + if (ThreadType == 0) { continue; @@ -6785,9 +6806,9 @@ HRESULT PrintSpecialThreads() Status = g_ExtSystem->SetCurrentThreadId (ulOriginalThreadID); if (!SUCCEEDED (Status)) { - ExtOut("Failed to switch to original thread\n"); + ExtOut("Failed to switch to original thread\n"); return Status; - } + } return Status; } @@ -6796,7 +6817,7 @@ HRESULT PrintSpecialThreads() HRESULT SwitchToExceptionThread() { HRESULT Status; - + DacpThreadStoreData ThreadStore; if ((Status = ThreadStore.Request(g_sos)) != S_OK) { @@ -6816,7 +6837,7 @@ HRESULT SwitchToExceptionThread() PrintLn("Failed to request Thread at ", Pointer(CurThread)); return Status; } - + TADDR taLTOH; if (Thread.lastThrownObjectHandle != NULL) { @@ -6901,7 +6922,7 @@ DECLARE_API(ThreadState) count++; } } - + // If we did not find any thread states, print out a message to let the user // know that the function is working correctly. if (count == 0) @@ -6919,7 +6940,7 @@ DECLARE_API(Threads) BOOL bSwitchToManagedExceptionThread = FALSE; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-special", &bPrintSpecialThreads, COBOOL, FALSE}, {"-live", &bPrintLiveThreadsOnly, COBOOL, FALSE}, @@ -6928,7 +6949,7 @@ DECLARE_API(Threads) {"/d", &dml, COBOOL, FALSE}, #endif }; - if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) + if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; } @@ -6937,7 +6958,7 @@ DECLARE_API(Threads) { return SwitchToExceptionThread(); } - + // We need to support minidumps for this command. BOOL bMiniDump = IsMiniDumpFile(); @@ -6977,7 +6998,7 @@ DECLARE_API(Threads) { ExtOut("%s\n", e.what()); } - + return Status; } @@ -6998,7 +7019,7 @@ DECLARE_API(WatsonBuckets) { ExtOut("Not supported on mini dumps.\n"); } - + // Get the current managed thread. CLRDATA_ADDRESS threadAddr = GetCurrentManagedThread(); DacpThreadData Thread; @@ -7008,7 +7029,7 @@ DECLARE_API(WatsonBuckets) ExtOut("The current thread is unmanaged\n"); return Status; } - + // Get the definition of GenericModeBlock. #include GenericModeBlock gmb; @@ -7029,7 +7050,7 @@ DECLARE_API(WatsonBuckets) ExtOut("b7: %S\n", gmb.wzP7); ExtOut("b8: %S\n", gmb.wzP8); ExtOut("b9: %S\n", gmb.wzP9); - + return Status; } // WatsonBuckets() #endif // FEATURE_PAL @@ -7040,7 +7061,7 @@ struct PendingBreakpoint WCHAR szFunctionName[mdNameLen]; WCHAR szFilename[MAX_LONGPATH]; DWORD lineNumber; - TADDR pModule; + TADDR pModule; DWORD ilOffset; mdMethodDef methodToken; void SetModule(TADDR module) @@ -7054,7 +7075,7 @@ struct PendingBreakpoint } PendingBreakpoint *pNext; - PendingBreakpoint() : lineNumber(0), ilOffset(0), methodToken(0), pNext(NULL) + PendingBreakpoint() : lineNumber(0), ilOffset(0), methodToken(0), pNext(NULL) { szModuleName[0] = L'\0'; szFunctionName[0] = L'\0'; @@ -7074,7 +7095,7 @@ void IssueDebuggerBPCommand ( CLRDATA_ADDRESS addr ) addr &= ~THUMB_CODE; #else addr |= THUMB_CODE; // lldb expects thumb code bit set -#endif +#endif // if we overflowed our cache consider all new BPs unique... BOOL bUnique = curLimit >= MaxBPsCached; @@ -7100,7 +7121,7 @@ void IssueDebuggerBPCommand ( CLRDATA_ADDRESS addr ) if (g_sos->GetMethodDescPtrFromIP(addr, &pMD) != S_OK || g_sos->GetMethodDescName(pMD, 1024, wszNameBuffer, NULL) != S_OK) { - wcscpy_s(wszNameBuffer, _countof(wszNameBuffer), W("UNKNOWN")); + wcscpy_s(wszNameBuffer, _countof(wszNameBuffer), W("UNKNOWN")); } #ifndef FEATURE_PAL @@ -7209,7 +7230,7 @@ class Breakpoints pSymReader = NULL; // Get tokens for any modules that match. If there was a change, - // update notifications. + // update notifications. pCur = m_breakpoints; while(pCur) { @@ -7266,9 +7287,9 @@ class Breakpoints } pCur = pNext; - } + } } - + void ListBreakpoints() { PendingBreakpoint *pCur = m_breakpoints; @@ -7388,7 +7409,7 @@ class Breakpoints HRESULT Status = S_OK; char szName[mdNameLen]; int numModule; - + ToRelease module; IfFailRet(g_sos->GetModule(mod, &module)); @@ -7433,7 +7454,7 @@ class Breakpoints BOOL bFoundCode = FALSE; BOOL bNeedDefer = FALSE; CLRDATA_ENUM h1; - + if (pMeth->StartEnumInstances (NULL, &h1) == S_OK) { IXCLRDataMethodInstance *inst = NULL; @@ -7457,7 +7478,7 @@ class Breakpoints } } } - + if (!foundByIlOffset && ilOffset == 0) { CLRDATA_ADDRESS addr = 0; @@ -7488,13 +7509,13 @@ class Breakpoints return bNeedDefer; } -private: +private: BOOL IsIn(__in_z LPWSTR szModule, __in_z LPWSTR szName, TADDR mod) { PendingBreakpoint *pCur = m_breakpoints; while(pCur) { - if (pCur->ModuleMatches(mod) && + if (pCur->ModuleMatches(mod) && _wcsicmp(pCur->szModuleName, szModule) == 0 && _wcscmp(pCur->szFunctionName, szName) == 0) { @@ -7510,7 +7531,7 @@ class Breakpoints PendingBreakpoint *pCur = m_breakpoints; while(pCur) { - if (pCur->ModuleMatches(mod) && + if (pCur->ModuleMatches(mod) && _wcsicmp(pCur->szFilename, szFilename) == 0 && pCur->lineNumber == lineNumber) { @@ -7526,7 +7547,7 @@ class Breakpoints PendingBreakpoint *pCur = m_breakpoints; while(pCur) { - if (pCur->ModuleMatches(mod) && + if (pCur->ModuleMatches(mod) && pCur->methodToken == token && pCur->ilOffset == ilOffset) { @@ -7637,7 +7658,7 @@ class CNotification : public IXCLRDataExceptionNotification5 int m_count; int m_dbgStatus; public: - CNotification() + CNotification() : m_count(0) , m_dbgStatus(DEBUG_STATUS_NO_CHANGE) {} @@ -7678,7 +7699,7 @@ class CNotification : public IXCLRDataExceptionNotification5 } return m_count; } - + /* * New code was generated or discarded for a method.: */ @@ -7730,7 +7751,7 @@ class CNotification : public IXCLRDataExceptionNotification5 ULONG32 len = mdNameLen; LPWSTR szModuleName = (LPWSTR)alloca(mdNameLen * sizeof(WCHAR)); if (method->GetName(0, mdNameLen, &len, g_mdName) == S_OK) - { + { ToRelease pMod; HRESULT hr = method->GetTokenAndScope(NULL, &pMod); if (SUCCEEDED(hr)) @@ -7739,7 +7760,7 @@ class CNotification : public IXCLRDataExceptionNotification5 if (pMod->GetName(mdNameLen, &len, szModuleName) == S_OK) { ExtOut("JITTED %S!%S\n", szModuleName, g_mdName); - + DacpGetModuleAddress dgma; if (SUCCEEDED(dgma.Request(pMod))) { @@ -7796,7 +7817,7 @@ class CNotification : public IXCLRDataExceptionNotification5 ExtOut("SOS: warning, optimizations for this module could not be suppressed hr=0x%x\n", hr); } } - + m_dbgStatus = DEBUG_STATUS_GO_HANDLED; return S_OK; } @@ -7816,9 +7837,9 @@ class CNotification : public IXCLRDataExceptionNotification5 /* * The given type was loaded or unloaded. */ - STDMETHODIMP OnTypeLoaded(IXCLRDataTypeInstance* typeInst) + STDMETHODIMP OnTypeLoaded(IXCLRDataTypeInstance* typeInst) { return E_NOTIMPL; } - STDMETHODIMP OnTypeUnloaded(IXCLRDataTypeInstance* typeInst) + STDMETHODIMP OnTypeUnloaded(IXCLRDataTypeInstance* typeInst) { return E_NOTIMPL; } STDMETHODIMP OnAppDomainLoaded(IXCLRDataAppDomain* domain) @@ -7920,7 +7941,7 @@ BOOL CheckCLRNotificationEvent(DEBUG_LAST_EVENT_INFO_EXCEPTION* pdle) return FALSE; } - // The new DAC based interface doesn't exists so ask the debugger for the last exception + // The new DAC based interface doesn't exists so ask the debugger for the last exception // information. NOTE: this function doesn't work on xplat version when the coreclr symbols // have been stripped. @@ -8016,8 +8037,8 @@ void EnableModuleLoadUnloadCallbacks() DECLARE_API(SOSHandleCLRN) { - INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + INIT_API(); + MINIDUMP_NOT_SUPPORTED(); return HandleCLRNotificationEvent(); } @@ -8050,7 +8071,7 @@ DECLARE_API(bpmd) INIT_API_NOEE(); MINIDUMP_NOT_SUPPORTED(); char buffer[1024]; - + if (IsDumpFile()) { ExtOut(SOSPrefix "bpmd is not supported on a dump file.\n"); @@ -8070,9 +8091,9 @@ DECLARE_API(bpmd) DWORD_PTR pMD = NULL; BOOL fNoFutureModule = FALSE; BOOL fList = FALSE; - size_t clearItem = 0; + size_t clearItem = 0; BOOL fClearAll = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-md", &pMD, COHEX, TRUE}, {"-nofuturemodule", &fNoFutureModule, COBOOL, FALSE}, @@ -8080,14 +8101,14 @@ DECLARE_API(bpmd) {"-clear", &clearItem, COSIZE_T, TRUE}, {"-clearall", &fClearAll, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&DllName.data, COSTRING}, {&TypeName.data, COSTRING}, {&Offset, COSIZE_T}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -8188,8 +8209,8 @@ DECLARE_API(bpmd) // Do we already have this breakpoint? // Or, before setting it, is the module perhaps already loaded and code // is available? If so, don't add to our pending list, just go ahead and - // set the real breakpoint. - + // set the real breakpoint. + LPWSTR ModuleName = (LPWSTR)alloca(mdNameLen * sizeof(WCHAR)); LPWSTR FunctionName = (LPWSTR)alloca(mdNameLen * sizeof(WCHAR)); LPWSTR Filename = (LPWSTR)alloca(MAX_LONGPATH * sizeof(WCHAR)); @@ -8277,10 +8298,10 @@ DECLARE_API(bpmd) { ULONG32 nameLen = 0; pMethodDef->GetName(0, mdNameLen, &nameLen, FunctionName); - + // get the size of the required buffer int buffSize = WideCharToMultiByte(CP_ACP, 0, FunctionName, -1, TypeName.data, 0, NULL, NULL); - + TypeName.data = new NOTHROW char[buffSize]; if (TypeName.data != NULL) { @@ -8337,7 +8358,7 @@ DECLARE_API(bpmd) bNeedNotificationExceptions = TRUE; EnableModuleLoadUnloadCallbacks(); } - else + else { #ifdef FEATURE_PAL Status = g_ExtServices2->SetRuntimeLoadedCallback(HandleRuntimeLoadedNotification); @@ -8360,7 +8381,7 @@ DECLARE_API(bpmd) ExtOut("%p is not a valid MethodDesc\n", SOS_PTR(pMD)); return Status; } - + if (MethodDescData.bHasNativeCode) { IssueDebuggerBPCommand((size_t) MethodDescData.NativeCodeAddr); @@ -8372,12 +8393,12 @@ DECLARE_API(bpmd) // fix in the next release. Until then, you have a cumbersome user experience. ExtOut("This DynamicMethodDesc is not yet JITTED. Placing memory breakpoint at %p\n", MethodDescData.AddressOfNativeCodeSlot); - + sprintf_s(buffer, _countof(buffer), #ifdef _TARGET_WIN64_ "ba w8" #else - "ba w4" + "ba w4" #endif // _TARGET_WIN64_ " /1 %p \"bp poi(%p); g\"", @@ -8388,8 +8409,8 @@ DECLARE_API(bpmd) if (FAILED(Status)) { ExtOut("Unable to set breakpoint with IDebugControl::Execute: %x\n",Status); - ExtOut("Attempted to run: %s\n", buffer); - } + ExtOut("Attempted to run: %s\n", buffer); + } #else ExtErr("This DynamicMethodDesc is not yet JITTED %p\n", MethodDescData.AddressOfNativeCodeSlot); #endif // FEATURE_PAL @@ -8408,7 +8429,7 @@ DECLARE_API(bpmd) // We didn't find code, add a breakpoint. g_bpoints.ResolvePendingNonModuleBoundBreakpoint(ModuleName, FunctionName, TO_TADDR(MethodDescData.ModulePtr), 0); g_bpoints.Update(TO_TADDR(MethodDescData.ModulePtr), FALSE); - bNeedNotificationExceptions = TRUE; + bNeedNotificationExceptions = TRUE; } } @@ -8443,30 +8464,30 @@ DECLARE_API(ThreadPool) { BOOL doHCDump = FALSE, doWorkItemDump = FALSE, dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-ti", &doHCDump, COBOOL, FALSE}, {"-wi", &doWorkItemDump, COBOOL, FALSE}, #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif - }; + }; - if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) + if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; } EnableDMLHolder dmlHolder(dml); - ExtOut ("CPU utilization: %d%%\n", threadpool.cpuUtilization); + ExtOut ("CPU utilization: %d %s\n", threadpool.cpuUtilization, "%%"); ExtOut ("Worker Thread:"); ExtOut (" Total: %d", threadpool.NumWorkingWorkerThreads + threadpool.NumIdleWorkerThreads + threadpool.NumRetiredWorkerThreads); ExtOut (" Running: %d", threadpool.NumWorkingWorkerThreads); ExtOut (" Idle: %d", threadpool.NumIdleWorkerThreads); - ExtOut (" MaxLimit: %d", threadpool.MaxLimitTotalWorkerThreads); - ExtOut (" MinLimit: %d", threadpool.MinLimitTotalWorkerThreads); - ExtOut ("\n"); + ExtOut (" MaxLimit: %d", threadpool.MaxLimitTotalWorkerThreads); + ExtOut (" MinLimit: %d", threadpool.MinLimitTotalWorkerThreads); + ExtOut ("\n"); int numWorkRequests = 0; CLRDATA_ADDRESS workRequestPtr = threadpool.FirstUnmanagedWorkRequest; @@ -8482,7 +8503,7 @@ DECLARE_API(ThreadPool) workRequestPtr = workRequestData.NextWorkRequest; } - ExtOut ("Work Request in Queue: %d\n", numWorkRequests); + ExtOut ("Work Request in Queue: %d\n", numWorkRequests); workRequestPtr = threadpool.FirstUnmanagedWorkRequest; while (workRequestPtr) { @@ -8673,9 +8694,9 @@ DECLARE_API(ThreadPool) ExtOut ("\nThread Injection History\n"); if (threadpool.HillClimbingLogSize > 0) { - static char const * const TransitionNames[] = + static char const * const TransitionNames[] = { - "Warmup", + "Warmup", "Initializing", "RandomMove", "ClimbingMove", @@ -8690,7 +8711,7 @@ DECLARE_API(ThreadPool) DacpHillClimbingLogEntry entry; // get the most recent entry first, so we can calculate time offsets - + int index = (threadpool.HillClimbingLogFirstIndex + threadpool.HillClimbingLogSize-1) % HillClimbingLogCapacity; CLRDATA_ADDRESS entryPtr = threadpool.HillClimbingLog + (index * sizeof(HillClimbingLogEntry)); if ((Status = entry.Request(g_sos,entryPtr))!=S_OK) @@ -8720,18 +8741,18 @@ DECLARE_API(ThreadPool) } } } - + ExtOut ("--------------------------------------\n"); ExtOut ("Number of Timers: %d\n", threadpool.NumTimers); ExtOut ("--------------------------------------\n"); - + ExtOut ("Completion Port Thread:"); - ExtOut ("Total: %d", threadpool.NumCPThreads); - ExtOut (" Free: %d", threadpool.NumFreeCPThreads); - ExtOut (" MaxFree: %d", threadpool.MaxFreeCPThreads); + ExtOut ("Total: %d", threadpool.NumCPThreads); + ExtOut (" Free: %d", threadpool.NumFreeCPThreads); + ExtOut (" MaxFree: %d", threadpool.MaxFreeCPThreads); ExtOut (" CurrentLimit: %d", threadpool.CurrentLimitTotalCPThreads); ExtOut (" MaxLimit: %d", threadpool.MaxLimitTotalCPThreads); - ExtOut (" MinLimit: %d", threadpool.MinLimitTotalCPThreads); + ExtOut (" MinLimit: %d", threadpool.MinLimitTotalCPThreads); ExtOut ("\n"); } else @@ -8744,43 +8765,43 @@ DECLARE_API(ThreadPool) DECLARE_API(FindAppDomain) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); DWORD_PTR p_Object = NULL; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&p_Object, COHEX}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } EnableDMLHolder dmlHolder(dml); - + if ((p_Object == 0) || !sos::IsObject(p_Object)) { ExtOut("%p is not a valid object\n", SOS_PTR(p_Object)); return Status; } - + DacpAppDomainStoreData adstore; if (adstore.Request(g_sos) != S_OK) { ExtOut("Error getting AppDomain information\n"); return Status; - } + } CLRDATA_ADDRESS appDomain = GetAppDomain (TO_CDADDR(p_Object)); @@ -8790,7 +8811,7 @@ DECLARE_API(FindAppDomain) if (appDomain == adstore.sharedDomain) { ExtOut("Name: Shared Domain\n"); - ExtOut("ID: (shared domain)\n"); + ExtOut("ID: (shared domain)\n"); } else if (appDomain == adstore.systemDomain) { @@ -8823,7 +8844,7 @@ DECLARE_API(FindAppDomain) ExtOut("Note that the Thread could have transitioned between\n"); ExtOut("multiple AppDomains.\n"); } - + return Status; } @@ -8833,14 +8854,14 @@ DECLARE_API(FindAppDomain) * Routine Description: * * * * This function is called to get the COM state (e.g. APT,contexe * -* activity. * +* activity. * * * \**********************************************************************/ #ifdef FEATURE_COMINTEROP DECLARE_API(COMState) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); ULONG numThread; @@ -8900,7 +8921,7 @@ DECLARE_API(COMState) } else ExtOut(" %8x", 0); - + DWORD dwTIDCaller; if (SafeReadMemory(OleTlsDataAddr+offsetof(SOleTlsData,dwTIDCaller), &dwTIDCaller, @@ -8909,7 +8930,7 @@ DECLARE_API(COMState) } else ExtOut(" %8x", 0); - + size_t Context; if (SafeReadMemory(OleTlsDataAddr+offsetof(SOleTlsData,pCurrentCtx), &Context, @@ -8921,7 +8942,7 @@ DECLARE_API(COMState) } else - ExtOut(" Ukn"); + ExtOut(" Ukn"); } else ExtOut(" Ukn"); @@ -8938,7 +8959,7 @@ DECLARE_API(COMState) BOOL traverseEh(UINT clauseIndex,UINT totalClauses,DACEHInfo *pEHInfo,LPVOID token) { size_t methodStart = (size_t) token; - + if (IsInterrupt()) { return FALSE; @@ -8971,7 +8992,7 @@ BOOL traverseEh(UINT clauseIndex,UINT totalClauses,DACEHInfo *pEHInfo,LPVOID tok ExtOut("[%08x, %08x]", (ULONG)addrStart, (ULONG)addrEnd); #endif - ExtOut(" [%x, %x]\n", + ExtOut(" [%x, %x]\n", (UINT32) pEHInfo->tryStartOffset, (UINT32) pEHInfo->tryEndOffset); @@ -8988,10 +9009,10 @@ BOOL traverseEh(UINT clauseIndex,UINT totalClauses,DACEHInfo *pEHInfo,LPVOID tok ExtOut("[%08x, %08x]", (ULONG)addrStart, (ULONG)addrEnd); #endif - ExtOut(" [%x, %x]\n", + ExtOut(" [%x, %x]\n", (UINT32) pEHInfo->handlerStartOffset, (UINT32) pEHInfo->handlerEndOffset); - + if (pEHInfo->clauseType == EHFilter) { ExtOut("Filter: "); @@ -9007,32 +9028,32 @@ BOOL traverseEh(UINT clauseIndex,UINT totalClauses,DACEHInfo *pEHInfo,LPVOID tok ExtOut(" [%x]\n", (UINT32) pEHInfo->filterOffset); } - - ExtOut("\n"); + + ExtOut("\n"); return TRUE; } DECLARE_API(EHInfo) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); DWORD_PTR dwStartAddr = NULL; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&dwStartAddr, COHEX}, }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg) || (0 == nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg) || (0 == nArg)) { return Status; } @@ -9040,7 +9061,7 @@ DECLARE_API(EHInfo) EnableDMLHolder dmlHolder(dml); DWORD_PTR tmpAddr = dwStartAddr; - if (!IsMethodDesc(dwStartAddr)) + if (!IsMethodDesc(dwStartAddr)) { JITTypes jitType; DWORD_PTR methodDesc; @@ -9067,8 +9088,8 @@ DECLARE_API(EHInfo) { ExtOut("Unable to get codeHeader information\n"); return Status; - } - + } + DMLOut("MethodDesc: %s\n", DMLMethodDesc(MD.MethodDescPtr)); DumpMDInfo(TO_TADDR(MD.MethodDescPtr)); @@ -9083,7 +9104,7 @@ DECLARE_API(EHInfo) { ExtOut("Failed to perform EHInfo traverse\n"); } - + return Status; } @@ -9091,7 +9112,7 @@ DECLARE_API(EHInfo) * Routine Description: * * * * This function is called to dump the GC encoding of a managed * -* function. * +* function. * * * \**********************************************************************/ DECLARE_API(GCInfo) @@ -9104,11 +9125,11 @@ DECLARE_API(GCInfo) TADDR taGCInfoAddr; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&taStartAddr, COHEX}, }; @@ -9121,7 +9142,7 @@ DECLARE_API(GCInfo) EnableDMLHolder dmlHolder(dml); TADDR tmpAddr = taStartAddr; - if (!IsMethodDesc(taStartAddr)) + if (!IsMethodDesc(taStartAddr)) { JITTypes jitType; TADDR methodDesc; @@ -9202,7 +9223,7 @@ DECLARE_API(GCInfo) ExtOut("Could not allocate memory to read the gc info.\n"); return E_OUTOFMEMORY; } - + memset(table, 0, tableSize); // We avoid using move here, because we do not want to return if (!SafeReadMemory(taGCInfoAddr, table, tableSize, NULL)) @@ -9288,7 +9309,7 @@ BOOL gatherEh(UINT clauseIndex,UINT totalClauses,DACEHInfo *pEHInfo,LPVOID token { return FALSE; } - + if (pInfo->m_pInfos == NULL) { // First time, initialize structure @@ -9296,7 +9317,7 @@ BOOL gatherEh(UINT clauseIndex,UINT totalClauses,DACEHInfo *pEHInfo,LPVOID token pInfo->m_pInfos = new NOTHROW DACEHInfo[totalClauses]; if (pInfo->m_pInfos == NULL) { - ReportOOM(); + ReportOOM(); return FALSE; } } @@ -9341,7 +9362,7 @@ GetILAddressResult GetILAddress(const DacpMethodDescData& MethodDescData) // This is not a dynamic method, print the IL for it. // Get the module - DacpModuleData dmd; + DacpModuleData dmd; if (dmd.Request(g_sos, MethodDescData.ModulePtr) != S_OK) { ExtOut("Unable to get module\n"); @@ -9356,14 +9377,14 @@ GetILAddressResult GetILAddress(const DacpMethodDescData& MethodDescData) } if (ilAddr == NULL) - { + { ULONG pRva; DWORD dwFlags; if (pImport->GetRVA(MethodDescData.MDToken, &pRva, &dwFlags) != S_OK) { ExtOut("error in import\n"); return error; - } + } CLRDATA_ADDRESS ilAddrClr; if (g_sos->GetILForModule(MethodDescData.ModulePtr, pRva, &ilAddrClr) != S_OK) @@ -9388,13 +9409,13 @@ GetILAddressResult GetILAddress(const DacpMethodDescData& MethodDescData) * Routine Description: * * * * This function is called to unassembly a managed function. * -* It tries to print symbolic info for function call, contants... * +* It tries to print symbolic info for function call, contants... * * * \**********************************************************************/ DECLARE_API(u) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); DWORD_PTR dwStartAddr = NULL; @@ -9407,7 +9428,7 @@ DECLARE_API(u) BOOL dml = FALSE; size_t nArg; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-gcinfo", &fWithGCInfo, COBOOL, FALSE}, {"-ehinfo", &fWithEHInfo, COBOOL, FALSE}, @@ -9419,7 +9440,7 @@ DECLARE_API(u) {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&dwStartAddr, COHEX}, }; @@ -9623,13 +9644,13 @@ DECLARE_API(u) pInfo = new NOTHROW SOSEHInfo; if (pInfo == NULL) { - ReportOOM(); + ReportOOM(); } else if (g_sos->TraverseEHInfo(codeHeaderData.MethodStart, gatherEh, (LPVOID)pInfo) != S_OK) { ExtOut("Failed to gather EHInfo data\n"); delete pInfo; - pInfo = NULL; + pInfo = NULL; } } @@ -9661,7 +9682,7 @@ DECLARE_API(u) displayILFun); ExtOut("Cold region:\n"); - + // Displaying gcinfo for a cold region requires knowing the size of // the hot region preceeding. g_gcEncodingInfo.hotSizeToAdd = codeHeaderData.HotRegionSize; @@ -9670,7 +9691,7 @@ DECLARE_API(u) (DWORD_PTR) codeHeaderData.ColdRegionStart, ((DWORD_PTR)codeHeaderData.ColdRegionStart) + codeHeaderData.ColdRegionSize, dwStartAddr, - ((DWORD_PTR) MethodDescData.GCStressCodeCopy) + codeHeaderData.HotRegionSize, + ((DWORD_PTR) MethodDescData.GCStressCodeCopy) + codeHeaderData.HotRegionSize, fWithGCInfo ? &g_gcEncodingInfo : NULL, pInfo, bSuppressLines, @@ -9689,7 +9710,7 @@ DECLARE_API(u) { g_gcEncodingInfo.Deinitialize(); } - + return Status; } @@ -9928,10 +9949,10 @@ HRESULT GetIntermediateLangMap(BOOL bIL, const DacpCodeHeaderData& codeHeaderDat * * \**********************************************************************/ DECLARE_API(DumpLog) -{ +{ INIT_API_NO_RET_ON_FAILURE(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); _ASSERTE(g_pRuntime != nullptr); @@ -9941,21 +9962,21 @@ DECLARE_API(DumpLog) ExtErr("DumpLog not supported on desktop runtime\n"); return E_FAIL; } - + const char* fileName = "StressLog.txt"; CLRDATA_ADDRESS StressLogAddress = NULL; - + StringHolder sFileName, sLogAddr; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-addr", &sLogAddr.data, COSTRING, TRUE} }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&sFileName.data, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -10003,8 +10024,8 @@ DECLARE_API(DumpLog) ExtOut("Attempting to dump Stress log to file '%s'\n", fileName); - - + + Status = StressLog::Dump(StressLogAddress, fileName, g_ExtData); if (Status == S_OK) @@ -10022,7 +10043,7 @@ DECLARE_API(DumpLog) DECLARE_API (DumpGCLog) { INIT_API_NODAC(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); const char* fileName = "GCLog.txt"; @@ -10032,7 +10053,7 @@ DECLARE_API (DumpGCLog) if (*args != 0) fileName = args; - + DWORD_PTR dwAddr = GetValueFromExpression("SVR::gc_log_buffer"); moveN (dwAddr, dwAddr); @@ -10046,13 +10067,13 @@ DECLARE_API (DumpGCLog) return E_FAIL; } } - + ExtOut("Dumping GC log at %08x\n", dwAddr); g_bDacBroken = FALSE; - + ExtOut("Attempting to dump GC log to file '%s'\n", fileName); - + Status = E_FAIL; HANDLE hGCLog = CreateFileA( @@ -10122,8 +10143,8 @@ DECLARE_API (DumpGCLog) DECLARE_API (DumpGCConfigLog) { INIT_API(); -#ifdef GC_CONFIG_DRIVEN - MINIDUMP_NOT_SUPPORTED(); +#ifdef GC_CONFIG_DRIVEN + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); const char* fileName = "GCConfigLog.txt"; @@ -10133,7 +10154,7 @@ DECLARE_API (DumpGCConfigLog) if (*args != 0) fileName = args; - + if (!InitializeHeapData ()) { ExtOut("GC Heap not initialized yet.\n"); @@ -10142,10 +10163,10 @@ DECLARE_API (DumpGCConfigLog) BOOL fIsServerGC = IsServerBuild(); - DWORD_PTR dwAddr = 0; + DWORD_PTR dwAddr = 0; DWORD_PTR dwAddrOffset = 0; - - if (fIsServerGC) + + if (fIsServerGC) { dwAddr = GetValueFromExpression("SVR::gc_config_log_buffer"); dwAddrOffset = GetValueFromExpression("SVR::gc_config_log_buffer_offset"); @@ -10164,15 +10185,15 @@ DECLARE_API (DumpGCConfigLog) ExtOut("Can't get either WKS or SVR GC's config log buffer"); return E_FAIL; } - + ExtOut("Dumping GC log at %08x\n", dwAddr); g_bDacBroken = FALSE; - + ExtOut("Attempting to dump GC log to file '%s'\n", fileName); - + Status = E_FAIL; - + HANDLE hGCLog = CreateFileA( fileName, GENERIC_WRITE, @@ -10247,7 +10268,7 @@ static const char * const str_interesting_data_points[] = "post short padded", // 7 }; -static const char * const str_heap_compact_reasons[] = +static const char * const str_heap_compact_reasons[] = { "low on ephemeral space", "high fragmentation", @@ -10255,7 +10276,7 @@ static const char * const str_heap_compact_reasons[] = "user specfied compact LOH", "last GC before OOM", "induced compacting GC", - "fragmented gen0 (ephemeral GC)", + "fragmented gen0 (ephemeral GC)", "high memory load (ephemeral GC)", "high memory load and frag", "very high memory load and frag", @@ -10270,14 +10291,14 @@ static BOOL gc_heap_compact_reason_mandatory_p[] = TRUE, //compact_loh_forced = 3, TRUE, //compact_last_gc = 4 TRUE, //compact_induced_compacting = 5, - FALSE, //compact_fragmented_gen0 = 6, - FALSE, //compact_high_mem_load = 7, - TRUE, //compact_high_mem_frag = 8, + FALSE, //compact_fragmented_gen0 = 6, + FALSE, //compact_high_mem_load = 7, + TRUE, //compact_high_mem_frag = 8, TRUE, //compact_vhigh_mem_frag = 9, TRUE //compact_no_gc_mode = 10 }; -static const char * const str_heap_expand_mechanisms[] = +static const char * const str_heap_expand_mechanisms[] = { "reused seg with normal fit", "reused seg with best fit", @@ -10287,7 +10308,7 @@ static const char * const str_heap_expand_mechanisms[] = "expand in next full GC" }; -static const char * const str_bit_mechanisms[] = +static const char * const str_bit_mechanisms[] = { "using mark list", "demotion" @@ -10295,7 +10316,7 @@ static const char * const str_bit_mechanisms[] = static const char * const str_gc_global_mechanisms[] = { - "concurrent GCs", + "concurrent GCs", "compacting GCs", "promoting GCs", "GCs that did demotion", @@ -10340,7 +10361,7 @@ DECLARE_API(DumpGCData) INIT_API(); #ifdef GC_CONFIG_DRIVEN - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); if (!InitializeHeapData ()) @@ -10365,11 +10386,11 @@ DECLARE_API(DumpGCData) ExtOut("Error requesting interesting GC info\n"); return E_FAIL; } - + PrintInterestingGCInfo(&interestingInfo); } else - { + { DWORD dwNHeaps = GetGcHeapCount(); DWORD dwAllocSize; if (!ClrSafeInt::multiply(sizeof(CLRDATA_ADDRESS), dwNHeaps, dwAllocSize)) @@ -10384,7 +10405,7 @@ DECLARE_API(DumpGCData) ExtOut("Failed to get GCHeaps\n"); return Status; } - + for (DWORD n = 0; n < dwNHeaps; n ++) { if (interestingInfo.Request(g_sos, heapAddrs[n]) != S_OK) @@ -10409,7 +10430,7 @@ DECLARE_API(DumpGCData) /**********************************************************************\ * Routine Description: * * * -* This function is called to dump the build number and type of the * +* This function is called to dump the build number and type of the * * runtime and SOS. * * * \**********************************************************************/ @@ -10510,7 +10531,7 @@ DECLARE_API(SOSStatus) BOOL bDesktop = FALSE; BOOL bNetCore = FALSE; BOOL bReset = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"-desktop", &bDesktop, COBOOL, FALSE}, @@ -10521,7 +10542,7 @@ DECLARE_API(SOSStatus) if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; - } + } #ifndef FEATURE_PAL if (bNetCore || bDesktop) { @@ -10574,14 +10595,14 @@ DECLARE_API(SOSStatus) /**********************************************************************\ * Routine Description: * * * -* This function is called to print the environment setting for * +* This function is called to print the environment setting for * * the current process. * * * \**********************************************************************/ DECLARE_API (ProcInfo) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); if (IsDumpFile()) @@ -10591,7 +10612,7 @@ DECLARE_API (ProcInfo) } #define INFO_ENV 0x00000001 -#define INFO_TIME 0x00000002 +#define INFO_TIME 0x00000002 #define INFO_MEM 0x00000004 #define INFO_ALL 0xFFFFFFFF @@ -10655,7 +10676,7 @@ DECLARE_API (ProcInfo) addr = value + Offset_Environment; g_ExtData->ReadVirtual(UL64_TO_CDA(addr), &value, sizeof(PVOID), NULL); - static WCHAR buffer[DT_OS_PAGE_SIZE/2]; + static WCHAR buffer[DT_OS_PAGE_SIZE/2]; ULONG readBytes = DT_OS_PAGE_SIZE; ULONG64 Page; if ((g_ExtData->ReadDebuggerData( DEBUG_DATA_MmPageSize, &Page, sizeof(Page), NULL)) == S_OK @@ -10665,7 +10686,7 @@ DECLARE_API (ProcInfo) if (readBytes > uPageSize) { readBytes = uPageSize; } - } + } addr = value; while (1) { if (IsInterrupt()) @@ -10694,7 +10715,7 @@ DECLARE_API (ProcInfo) } } } - + HANDLE hProcess = INVALID_HANDLE_VALUE; if (fProcInfo & (INFO_TIME | INFO_MEM)) { ULONG64 handle; @@ -10704,7 +10725,7 @@ DECLARE_API (ProcInfo) } hProcess = (HANDLE)handle; } - + if (!IsDumpFile() && fProcInfo & INFO_TIME) { FILETIME CreationTime; FILETIME ExitTime; @@ -10738,15 +10759,15 @@ DECLARE_API (ProcInfo) SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond, SystemTime.wMilliseconds/10); } - + DWORD nDay = 0; DWORD nHour = 0; DWORD nMin = 0; DWORD nSec = 0; DWORD nHundred = 0; - + ULONG64 totalTime; - + totalTime = KernelTime.dwLowDateTime + (((ULONG64)KernelTime.dwHighDateTime) << 32); nDay = (DWORD)(totalTime/(24*3600*10000000ui64)); totalTime %= 24*3600*10000000ui64; @@ -10759,13 +10780,13 @@ DECLARE_API (ProcInfo) nHundred = (DWORD)(totalTime/100000); ExtOut("Kernel CPU time : %d days %02d:%02d:%02d.%02d\n", nDay, nHour, nMin, nSec, nHundred); - + DWORD sDay = nDay; DWORD sHour = nHour; DWORD sMin = nMin; DWORD sSec = nSec; DWORD sHundred = nHundred; - + totalTime = UserTime.dwLowDateTime + (((ULONG64)UserTime.dwHighDateTime) << 32); nDay = (DWORD)(totalTime/(24*3600*10000000ui64)); totalTime %= 24*3600*10000000ui64; @@ -10778,7 +10799,7 @@ DECLARE_API (ProcInfo) nHundred = (DWORD)(totalTime/100000); ExtOut("User CPU time : %d days %02d:%02d:%02d.%02d\n", nDay, nHour, nMin, nSec, nHundred); - + sDay += nDay; sHour += nHour; sMin += nMin; @@ -10829,9 +10850,9 @@ DECLARE_API (ProcInfo) ExtOut("Process Memory\n"); ExtOut("WorkingSetSize: %8d KB PeakWorkingSetSize: %8d KB\n", memory.WorkingSetSize/1024, memory.PeakWorkingSetSize/1024); - ExtOut("VirtualSize: %8d KB PeakVirtualSize: %8d KB\n", + ExtOut("VirtualSize: %8d KB PeakVirtualSize: %8d KB\n", memory.VirtualSize/1024, memory.PeakVirtualSize/1024); - ExtOut("PagefileUsage: %8d KB PeakPagefileUsage: %8d KB\n", + ExtOut("PagefileUsage: %8d KB PeakPagefileUsage: %8d KB\n", memory.PagefileUsage/1024, memory.PeakPagefileUsage/1024); } @@ -10854,35 +10875,35 @@ DECLARE_API (ProcInfo) /**********************************************************************\ * Routine Description: * * * -* This function is called to find the address of EE data for a * +* This function is called to find the address of EE data for a * * metadata token. * * * \**********************************************************************/ DECLARE_API(Token2EE) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); StringHolder DllName; ULONG64 token = 0; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&DllName.data, COSTRING}, {&token, COHEX} }; size_t nArg; - if (!GetCMDOption(args,option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args,option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -10905,7 +10926,7 @@ DECLARE_API(Token2EE) { moduleList = ModuleFromName(DllName.data, &numModule); } - + if (moduleList == NULL) { ExtOut("Failed to request module list.\n"); @@ -10920,7 +10941,7 @@ DECLARE_API(Token2EE) if (i > 0) { ExtOut("--------------------------------------\n"); - } + } DWORD_PTR dwAddr = moduleList[i]; WCHAR FileName[MAX_LONGPATH]; @@ -10936,21 +10957,21 @@ DECLARE_API(Token2EE) { pszFilename++; // skip past the last "\" character } - + DMLOut("Module: %s\n", DMLModule(dwAddr)); ExtOut("Assembly: %S\n", pszFilename); - + GetInfoFromModule(dwAddr, (ULONG)token); } } - + return Status; } /**********************************************************************\ * Routine Description: * * * -* This function is called to find the address of EE data for a * +* This function is called to find the address of EE data for a * * metadata token. * * * \**********************************************************************/ @@ -10959,24 +10980,24 @@ DECLARE_API(Name2EE) INIT_API(); MINIDUMP_NOT_SUPPORTED(); - StringHolder DllName, TypeName; + StringHolder DllName, TypeName; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue #ifndef FEATURE_PAL {"/d", &dml, COBOOL, FALSE}, #endif }; - - CMDValue arg[] = + + CMDValue arg[] = { // vptr, type {&DllName.data, COSTRING}, {&TypeName.data, COSTRING} }; size_t nArg; - - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -11013,17 +11034,17 @@ DECLARE_API(Name2EE) } } } - + if (nArg != 2) { ExtOut("Usage: " SOSPrefix "name2ee module_name item_name\n"); - ExtOut(" or " SOSPrefix "name2ee module_name!item_name\n"); + ExtOut(" or " SOSPrefix "name2ee module_name!item_name\n"); ExtOut(" use * for module_name to search all loaded modules\n"); ExtOut("Examples: " SOSPrefix "name2ee mscorlib.dll System.String.ToString\n"); ExtOut(" " SOSPrefix "name2ee *!System.String\n"); return Status; } - + int numModule; ArrayHolder moduleList = NULL; if (strcmp(DllName.data, "*") == 0) @@ -11034,7 +11055,7 @@ DECLARE_API(Name2EE) { moduleList = ModuleFromName(DllName.data, &numModule); } - + if (moduleList == NULL) { @@ -11051,7 +11072,7 @@ DECLARE_API(Name2EE) { ExtOut("--------------------------------------\n"); } - + DWORD_PTR dwAddr = moduleList[i]; WCHAR FileName[MAX_LONGPATH]; FileNameForModule (dwAddr, FileName); @@ -11066,13 +11087,13 @@ DECLARE_API(Name2EE) { pszFilename++; // skip past the last "\" character } - + DMLOut("Module: %s\n", DMLModule(dwAddr)); ExtOut("Assembly: %S\n", pszFilename); GetInfoFromName(dwAddr, TypeName.data); } } - + return Status; } @@ -11080,7 +11101,7 @@ DECLARE_API(Name2EE) DECLARE_API(PathTo) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); DWORD_PTR root = NULL; @@ -11088,11 +11109,11 @@ DECLARE_API(PathTo) BOOL dml = FALSE; size_t nArg; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&root, COHEX}, {&target, COHEX}, @@ -11100,20 +11121,20 @@ DECLARE_API(PathTo) if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; - } - + } + if (root == 0 || target == 0) { ExtOut("Invalid argument %s\n", args); return Status; } - + GCRootImpl gcroot; bool result = gcroot.PrintPathToObject(root, target); - + if (!result) ExtOut("Did not find a path from %p to %p.\n", SOS_PTR(root), SOS_PTR(target)); - + return Status; } @@ -11121,14 +11142,14 @@ DECLARE_API(PathTo) /**********************************************************************\ * Routine Description: * * * -* This function finds all roots (on stack or in handles) for a * +* This function finds all roots (on stack or in handles) for a * * given object. * * * \**********************************************************************/ DECLARE_API(GCRoot) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); BOOL bNoStacks = FALSE; DWORD_PTR obj = NULL; @@ -11136,7 +11157,7 @@ DECLARE_API(GCRoot) BOOL all = FALSE; size_t nArg; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-nostacks", &bNoStacks, COBOOL, FALSE}, {"-all", &all, COBOOL, FALSE}, @@ -11144,7 +11165,7 @@ DECLARE_API(GCRoot) {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&obj, COHEX} @@ -11152,20 +11173,20 @@ DECLARE_API(GCRoot) if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; - } + } if (obj == 0) { ExtOut("Invalid argument %s\n", args); return Status; } - EnableDMLHolder dmlHolder(dml); + EnableDMLHolder dmlHolder(dml); GCRootImpl gcroot; int i = gcroot.PrintRootsForObject(obj, all == TRUE, bNoStacks == TRUE); - + if (IsInterrupt()) ExtOut("Interrupted, data may be incomplete.\n"); - + if (all) ExtOut("Found %d roots.\n", i); else @@ -11185,13 +11206,13 @@ DECLARE_API(GCWhere) TADDR taddrObj = 0; size_t nArg; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-brick", &bGetBrick, COBOOL, FALSE}, {"-card", &bGetCard, COBOOL, FALSE}, {"/d", &dml, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&taddrObj, COHEX} }; @@ -11201,7 +11222,7 @@ DECLARE_API(GCWhere) } EnableDMLHolder dmlHolder(dml); - // Obtain allocation context for each managed thread. + // Obtain allocation context for each managed thread. AllocInfo allocInfo; allocInfo.Init(); @@ -11214,7 +11235,7 @@ DECLARE_API(GCWhere) size_t size = 0; if (sos::IsObject(taddrObj)) { - TADDR taddrMT; + TADDR taddrMT; BOOL bContainsPointers; if(FAILED(GetMTOfObject(taddrObj, &taddrMT)) || !GetSizeEfficient(taddrObj, taddrMT, FALSE, size, bContainsPointers)) @@ -11264,16 +11285,17 @@ DECLARE_API(GCWhere) ExtOut("Failed to get GCHeaps\n"); return Status; } - + for (DWORD n = 0; n < dwNHeaps; n ++) { - DacpGcHeapDetails heapDetails; - if (heapDetails.Request(g_sos, heapAddrs[n]) != S_OK) + DacpGcHeapDetails dacHeapDetails; + if (dacHeapDetails.Request(g_sos, heapAddrs[n]) != S_OK) { ExtOut("Error requesting details\n"); return Status; } + GCHeapDetails heapDetails(dacHeapDetails, heapAddrs[n]); if (GCObjInHeap(taddrObj, heapDetails, trngSeg, gen, allocCtx, bLarge)) { ExtOut("Address " WIN64_8SPACES " Gen Heap segment " WIN64_8SPACES " begin " WIN64_8SPACES " allocated" WIN64_8SPACES " size\n"); @@ -11307,19 +11329,19 @@ DECLARE_API(FindRoots) ExtOut("!FindRoots is not supported on a dump file.\n"); return Status; } - + LONG_PTR gen = -100; // initialized outside the legal range: [-1, 2] StringHolder sgen; TADDR taObj = NULL; BOOL dml = FALSE; size_t nArg; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-gen", &sgen.data, COSTRING, TRUE}, {"/d", &dml, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&taObj, COHEX} }; @@ -11397,7 +11419,7 @@ DECLARE_API(FindRoots) GCRootImpl gcroot; int roots = gcroot.FindRoots(CNotification::GetCondemnedGen(), taObj); - + ExtOut("Found %d roots.\n", roots); } @@ -11410,7 +11432,7 @@ DECLARE_API(FindRoots) class GCHandleStatsForDomains { public: - GCHandleStatsForDomains() + GCHandleStatsForDomains() : m_singleDomainMode(FALSE), m_numDomains(0), m_pStatistics(NULL), m_pDomainPointers(NULL), m_sharedDomainIndex(-1), m_systemDomainIndex(-1) { } @@ -11424,14 +11446,14 @@ class GCHandleStatsForDomains else delete [] m_pStatistics; } - + if (m_pDomainPointers) delete [] m_pDomainPointers; } - + BOOL Init(BOOL singleDomainMode) { - m_singleDomainMode = singleDomainMode; + m_singleDomainMode = singleDomainMode; if (m_singleDomainMode) { m_numDomains = 1; @@ -11461,16 +11483,16 @@ class GCHandleStatsForDomains m_sharedDomainIndex = i - 1; // The m_sharedDomainIndex is set to -1 if there is no shared domain m_systemDomainIndex = i; - + if (g_sos->GetAppDomainList(adsData.DomainCount, pArray+numSpecialDomains, NULL) != S_OK) return FALSE; - + m_pDomainPointers = pArray.Detach(); m_pStatistics = new NOTHROW GCHandleStatistics[m_numDomains]; if (m_pStatistics == NULL) return FALSE; } - + return TRUE; } @@ -11487,24 +11509,24 @@ class GCHandleStatsForDomains if (m_pDomainPointers[i] == appDomainPtr) return m_pStatistics + i; } - + return NULL; } - - + + GCHandleStatistics *GetStatistics(int appDomainIndex) const { SOS_Assert(appDomainIndex >= 0); SOS_Assert(appDomainIndex < m_numDomains); - + return m_singleDomainMode ? m_pStatistics : m_pStatistics + appDomainIndex; } - + int GetNumDomains() const { return m_numDomains; } - + CLRDATA_ADDRESS GetDomain(int index) const { SOS_Assert(index >= 0); @@ -11538,17 +11560,17 @@ class GCHandlesImpl : mPerDomain(FALSE), mStat(FALSE), mDML(FALSE), mType((int)~0) { ArrayHolder type = NULL; - CMDOption option[] = + CMDOption option[] = { {"-perdomain", &mPerDomain, COBOOL, FALSE}, {"-stat", &mStat, COBOOL, FALSE}, {"-type", &type, COSTRING, TRUE}, {"/d", &mDML, COBOOL, FALSE}, }; - + if (!GetCMDOption(args,option,_countof(option),NULL,0,NULL)) sos::Throw("Failed to parse command line arguments."); - + if (type != NULL) if (_stricmp(type, "Pinned") == 0) mType = HNDTYPE_PINNED; @@ -11573,32 +11595,32 @@ class GCHandlesImpl else sos::Throw("Unknown handle type '%s'.", type.GetPtr()); } - + void Run() { EnableDMLHolder dmlHolder(mDML); - + mOut.ReInit(6, POINTERSIZE_HEX, AlignRight); mOut.SetWidths(5, POINTERSIZE_HEX, 11, POINTERSIZE_HEX, 8, POINTERSIZE_HEX); mOut.SetColAlignment(1, AlignLeft); - + if (mHandleStat.Init(!mPerDomain) == FALSE) sos::Throw("Error getting per-appdomain handle information"); - + if (!mStat) mOut.WriteRow("Handle", "Type", "Object", "Size", "Data", "Type"); - + WalkHandles(); - + for (int i=0; (i < mHandleStat.GetNumDomains()) && !IsInterrupt(); i++) { GCHandleStatistics *pStats = mHandleStat.GetStatistics(i); if (mPerDomain) { - Print( "------------------------------------------------------------------------------\n"); + Print( "------------------------------------------------------------------------------\n"); Print("GC Handle Statistics for AppDomain ", AppDomainPtr(mHandleStat.GetDomain(i))); - + if (i == mHandleStat.GetSharedDomainIndex()) Print(" (Shared Domain)\n"); else if (i == mHandleStat.GetSystemDomainIndex()) @@ -11610,7 +11632,7 @@ class GCHandlesImpl if (!mStat) Print("\n"); PrintGCStat(&pStats->hs); - + // Don't print handle stats if the user has filtered by type. All handles will be the same // type, and the total count will be displayed by PrintGCStat. if (mType == (unsigned int)~0) @@ -11632,14 +11654,14 @@ class GCHandlesImpl else sos::Throw("Failed to walk the handle table."); } - + // GCC can't handle stacks which are too large. #ifndef FEATURE_PAL SOSHandleData data[256]; #else SOSHandleData data[4]; #endif - + unsigned int fetched = 0; HRESULT hr = S_OK; do @@ -11649,27 +11671,27 @@ class GCHandlesImpl ExtOut("Error %x while walking the handle table.\n", hr); break; } - + WalkHandles(data, fetched); } while (_countof(data) == fetched); } - + void WalkHandles(SOSHandleData data[], unsigned int count) { for (unsigned int i = 0; i < count; ++i) { sos::CheckInterrupt(); - + if (mType != (unsigned int)~0 && mType != data[i].Type) continue; - + GCHandleStatistics *pStats = mHandleStat.LookupStatistics(data[i].AppDomain); TADDR objAddr = 0; TADDR mtAddr = 0; size_t size = 0; const WCHAR *mtName = 0; const char *type = 0; - + if (FAILED(MOVE(objAddr, data[i].Handle))) { objAddr = 0; @@ -11694,7 +11716,7 @@ class GCHandlesImpl pStats->hs.Add(obj.GetMT(), (DWORD)size); } } - + switch(data[i].Type) { case HNDTYPE_PINNED: @@ -11704,7 +11726,7 @@ class GCHandlesImpl case HNDTYPE_REFCOUNTED: type = "RefCounted"; if (pStats) pStats->refCntHandleCount++; - break; + break; case HNDTYPE_STRONG: type = "Strong"; if (pStats) pStats->strongHandleCount++; @@ -11743,13 +11765,13 @@ class GCHandlesImpl pStats->unknownHandleCount++; break; } - + if (type && !mStat) { sos::MethodTable mt = mtAddr; if (mtName == 0) mtName = mt.GetName(); - + if (data[i].Type == HNDTYPE_REFCOUNTED) mOut.WriteRow(data[i].Handle, type, ObjectPtr(objAddr), Decimal(size), Decimal(data[i].RefCount), mtName); else if (data[i].Type == HNDTYPE_DEPENDENT) @@ -11761,18 +11783,18 @@ class GCHandlesImpl } } } - + inline void PrintHandleRow(const char *text, int count) { if (count) mOut.WriteRow(text, Decimal(count)); } - + void PrintGCHandleStats(GCHandleStatistics *pStats) { Print("Handles:\n"); mOut.ReInit(2, 21, AlignLeft, 4); - + PrintHandleRow("Strong Handles:", pStats->strongHandleCount); PrintHandleRow("Pinned Handles:", pStats->pinnedHandleCount); PrintHandleRow("Async Pinned Handles:", pStats->asyncPinnedHandleCount); @@ -11785,7 +11807,7 @@ class GCHandlesImpl PrintHandleRow("Dependent Handles:", pStats->dependentCount); PrintHandleRow("Other Handles:", pStats->unknownHandleCount); } - + private: BOOL mPerDomain, mStat, mDML; unsigned int mType; @@ -11802,7 +11824,7 @@ class GCHandlesImpl DECLARE_API(GCHandles) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); try @@ -11917,21 +11939,21 @@ DECLARE_API(TraceToCode) #ifndef FEATURE_PAL DECLARE_API(GetCodeTypeFlags) { - INIT_API(); + INIT_API(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); _ASSERTE(g_pRuntime != nullptr); - + char buffer[100+mdNameLen]; size_t ip; StringHolder PReg; - + CMDValue arg[] = { // vptr, type {&ip, COSIZE_T}, {&PReg.data, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) { return Status; } @@ -11945,7 +11967,7 @@ DECLARE_API(GetCodeTypeFlags) ExtOut("Pseudo-register number must be between 0 and 19\n"); return Status; } - } + } sprintf_s(buffer,_countof (buffer), "r$t%d=0", @@ -11955,7 +11977,7 @@ DECLARE_API(GetCodeTypeFlags) { ExtOut("Error initialized register $t%d to zero\n", preg); return Status; - } + } ULONG64 base = 0; CLRDATA_ADDRESS cdaStart = TO_CDADDR(ip); @@ -12006,7 +12028,7 @@ DECLARE_API(GetCodeTypeFlags) { ExtOut("Error setting register $t%d\n", preg); return Status; - } + } return Status; } @@ -12015,14 +12037,14 @@ DECLARE_API(GetCodeTypeFlags) DECLARE_API(StopOnException) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); - + MINIDUMP_NOT_SUPPORTED(); + char buffer[100+mdNameLen]; BOOL fDerived = FALSE; - BOOL fCreate1 = FALSE; - BOOL fCreate2 = FALSE; + BOOL fCreate1 = FALSE; + BOOL fCreate2 = FALSE; CMDOption option[] = { // name, vptr, type, hasValue @@ -12032,14 +12054,14 @@ DECLARE_API(StopOnException) }; StringHolder TypeName,PReg; - + CMDValue arg[] = { // vptr, type {&TypeName.data, COSTRING}, {&PReg.data, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -12051,7 +12073,7 @@ DECLARE_API(StopOnException) if (nArg < 1 || nArg > 2) { ExtOut("usage: StopOnException [-derived] [-create | -create2] \n"); - ExtOut(" []\n"); + ExtOut(" []\n"); ExtOut("ex: StopOnException -create System.OutOfMemoryException 1\n"); return Status; } @@ -12065,7 +12087,7 @@ DECLARE_API(StopOnException) ExtOut("Pseudo-register number must be between 0 and 19\n"); return Status; } - } + } sprintf_s(buffer,_countof (buffer), "r$t%d=0", @@ -12075,10 +12097,10 @@ DECLARE_API(StopOnException) { ExtOut("Error initialized register $t%d to zero\n", preg); return Status; - } - + } + if (fCreate1 || fCreate2) - { + { sprintf_s(buffer,_countof (buffer), "sxe %s \"!soe %s %s %d;.if(@$t%d==0) {g} .else {.echo '%s hit'}\" %x", fCreate1 ? "-c" : "-c2", @@ -12089,23 +12111,23 @@ DECLARE_API(StopOnException) TypeName.data, EXCEPTION_COMPLUS ); - - Status = g_ExtControl->Execute(DEBUG_EXECUTE_NOT_LOGGED, buffer, 0); + + Status = g_ExtControl->Execute(DEBUG_EXECUTE_NOT_LOGGED, buffer, 0); if (FAILED(Status)) { ExtOut("Error setting breakpoint: %s\n", buffer); return Status; - } + } ExtOut("Breakpoint set\n"); return Status; - } + } // Find the last thrown exception on this thread. // Does it match? If so, set the register. CLRDATA_ADDRESS threadAddr = GetCurrentManagedThread(); DacpThreadData Thread; - + if ((threadAddr == NULL) || (Thread.Request(g_sos, threadAddr) != S_OK)) { ExtOut("The current thread is unmanaged\n"); @@ -12120,15 +12142,15 @@ DECLARE_API(StopOnException) ExtOut("There is no current managed exception on this thread\n"); return Status; } - + if (taLTOH) { LPWSTR typeNameWide = (LPWSTR)alloca(mdNameLen * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP,0,TypeName.data,-1,typeNameWide,mdNameLen); - + TADDR taMT; if (SafeReadMemory(taLTOH, &taMT, sizeof(taMT), NULL)) - { + { NameForMT_s (taMT, g_mdName, mdNameLen); if ((_wcscmp(g_mdName,typeNameWide) == 0) || (fDerived && IsDerivedFrom(taMT, typeNameWide))) @@ -12151,30 +12173,30 @@ DECLARE_API(StopOnException) /**********************************************************************\ * Routine Description: * * * -* This function finds the size of an object or all roots. * +* This function finds the size of an object or all roots. * * * \**********************************************************************/ DECLARE_API(ObjSize) { #ifndef FEATURE_PAL INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); BOOL dml = FALSE; - StringHolder str_Object; + StringHolder str_Object; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&str_Object.data, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg)) { return Status; } @@ -12213,7 +12235,7 @@ DECLARE_API(ObjSize) DECLARE_API(GCHandleLeaks) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); ExtOut("-------------------------------------------------------------------------------\n"); @@ -12221,23 +12243,23 @@ DECLARE_API(GCHandleLeaks) ExtOut("Strong and Pinned GCHandles are reported at this time. You can safely abort the\n"); ExtOut("memory scan with Control-C or Control-Break. \n"); ExtOut("-------------------------------------------------------------------------------\n"); - + static DWORD_PTR array[2000]; UINT i; BOOL dml = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"/d", &dml, COBOOL, FALSE}, }; - if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) + if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; } EnableDMLHolder dmlHolder(dml); - + UINT iFinal = FindAllPinnedAndStrong(array,sizeof(array)/sizeof(DWORD_PTR)); ExtOut("Found %d handles:\n",iFinal); for (i=1;i<=iFinal;i++) @@ -12260,7 +12282,7 @@ DECLARE_API(GCHandleLeaks) { // Try to find stress log symbols DWORD_PTR dwAddr = GetValueFromExpression("StressLog::theLog"); - StressLogAddress = dwAddr; + StressLogAddress = dwAddr; g_bDacBroken = TRUE; } else @@ -12280,22 +12302,22 @@ DECLARE_API(GCHandleLeaks) { ExtOut("Failed to read whole or part of stress log, some references may come from stress log\n"); } - - + + while (!bAbort) { NTSTATUS status; MEMORY_BASIC_INFORMATION64 memInfo; status = g_ExtData2->QueryVirtual(UL64_TO_CDA(memCur), &memInfo); - - if( !NT_SUCCESS(status) ) - { + + if( !NT_SUCCESS(status) ) + { break; } if (memInfo.State == MEM_COMMIT) - { + { for (ULONG64 memIter = memCur; memIter < (memCur + memInfo.RegionSize); memIter+=sizeof(buffer)) { if (IsInterrupt()) @@ -12309,19 +12331,19 @@ DECLARE_API(GCHandleLeaks) { ExtOut("Searching %p...\n", SOS_PTR(memIter)); } - + ULONG size = 0; HRESULT ret; ret = g_ExtData->ReadVirtual(UL64_TO_CDA(memIter), buffer, sizeof(buffer), &size); if (ret == S_OK) { for (UINT x=0;x<1024;x++) - { + { DWORD_PTR value = buffer[x]; // We don't care about the low bit. Also, the GCHandle class turns on the // low bit for pinned handles, so without the statement below, we wouldn't // notice pinned handles. - value = value & ~1; + value = value & ~1; for (i=0;i 0) { - ExtOut("------------------------------------------------------------------------------\n"); + ExtOut("------------------------------------------------------------------------------\n"); ExtOut("Some handles were not found. If the number of not-found handles grows over the\n"); ExtOut("lifetime of your application, you may have a GCHandle leak. This will cause \n"); ExtOut("the GC Heap to grow larger as objects are being kept alive, referenced only \n"); @@ -12373,7 +12395,7 @@ DECLARE_API(GCHandleLeaks) ExtOut("may be some noise in this output, as an unmanaged application may be storing \n"); ExtOut("the handle in a non-standard way, perhaps with some bits flipped. The memory \n"); ExtOut("scan wouldn't be able to find those. \n"); - ExtOut("------------------------------------------------------------------------------\n"); + ExtOut("------------------------------------------------------------------------------\n"); ExtOut("Didn't find %d handles:\n", numNotFound); int numPrinted=0; @@ -12386,24 +12408,24 @@ DECLARE_API(GCHandleLeaks) if ((numPrinted % 4) == 0) ExtOut("\n"); } - } + } ExtOut("\n"); } else - { - ExtOut("------------------------------------------------------------------------------\n"); + { + ExtOut("------------------------------------------------------------------------------\n"); ExtOut("All handles found"); if (bAbort) ExtOut(" even though you aborted.\n"); else - ExtOut(".\n"); + ExtOut(".\n"); ExtOut("A leak may still exist because in a general scan of process memory SOS can't \n"); ExtOut("differentiate between garbage and valid structures, so you may have false \n"); ExtOut("positives. If you still suspect a leak, use this function over time to \n"); ExtOut("identify a possible trend. \n"); - ExtOut("------------------------------------------------------------------------------\n"); + ExtOut("------------------------------------------------------------------------------\n"); } - + return Status; } #endif // FEATURE_PAL @@ -12492,7 +12514,7 @@ class ClrStackImplWithICorDebug { ULONG numTypes = 0; ToRelease pCurrentTypeParam; - + while(SUCCEEDED(pTypeEnum->Next(1, &pCurrentTypeParam, &numTypes))) { if(numTypes == 0) break; @@ -12589,7 +12611,7 @@ class ClrStackImplWithICorDebug break; case ELEMENT_TYPE_U2: swprintf_s(typeName, typeNameLen, W("unsigned short\0")); - break; + break; case ELEMENT_TYPE_I4: swprintf_s(typeName, typeNameLen, W("int\0")); break; @@ -12633,7 +12655,7 @@ class ClrStackImplWithICorDebug switch(corElemType) { - case ELEMENT_TYPE_SZARRAY: + case ELEMENT_TYPE_SZARRAY: wcsncat_s(typeName, typeNameLen, W("[]\0"), typeNameLen); return S_OK; case ELEMENT_TYPE_ARRAY: @@ -12643,16 +12665,16 @@ class ClrStackImplWithICorDebug wcsncat_s(typeName, typeNameLen, W("["), typeNameLen); for(ULONG32 i = 0; i < rank - 1; i++) { - // + // wcsncat_s(typeName, typeNameLen, W(","), typeNameLen); } wcsncat_s(typeName, typeNameLen, W("]\0"), typeNameLen); } return S_OK; - case ELEMENT_TYPE_BYREF: + case ELEMENT_TYPE_BYREF: wcsncat_s(typeName, typeNameLen, W("&\0"), typeNameLen); return S_OK; - case ELEMENT_TYPE_PTR: + case ELEMENT_TYPE_PTR: wcsncat_s(typeName, typeNameLen, W("*\0"), typeNameLen); return S_OK; default: @@ -12831,7 +12853,7 @@ class ClrStackImplWithICorDebug quickString.String())); ExtOut(" = \"%S\"\n", quickString.String()); - + return S_OK; } @@ -13007,7 +13029,7 @@ class ClrStackImplWithICorDebug case ELEMENT_TYPE_U2: ExtOut(" = %hu\n", *(unsigned short*) &(rgbValue[0])); break; - + case ELEMENT_TYPE_I: ExtOut(" = %d\n", *(int*) &(rgbValue[0])); break; @@ -13047,7 +13069,7 @@ class ClrStackImplWithICorDebug // TODO: The following corElementTypes are not yet implemented here. Array // might be interesting to add, though the others may be of rather limited use: // ELEMENT_TYPE_ARRAY = 0x14, // MDARRAY ... ... - // + // // ELEMENT_TYPE_GENERICINST = 0x15, // GENERICINST ... } @@ -13076,7 +13098,7 @@ class ClrStackImplWithICorDebug if(i == 0 && (methAttr & mdStatic) == 0) swprintf_s(paramName, mdNameLen, W("this\0")); - else + else { int idx = ((methAttr & mdStatic) == 0)? i : (i + 1); if(SUCCEEDED(pMD->GetParamForMethodIndex(methodDef, idx, ¶mDef))) @@ -13292,7 +13314,7 @@ class ClrStackImplWithICorDebug DMLOut(" |- %S %s", typeName, DMLManagedVar(currentExpansion, currentFrame, mdName)); PrintValue(pFieldVal, pILFrame, pMD, indent, varToExpand, currentExpansion, currentExpansionSize, currentFrame); } - else if(!(fieldAttr & fdLiteral)) + else if(!(fieldAttr & fdLiteral)) ExtOut(" |- < unknown type > %S\n", mdName); } } @@ -13338,7 +13360,7 @@ class ClrStackImplWithICorDebug InternalFrameManager internalFrameManager; IfFailRet(internalFrameManager.Init(pThread3)); - + #if defined(_AMD64_) || defined(_ARM64_) ExtOut("%-16s %-16s %s\n", "Child SP", "IP", "Call Site"); #elif defined(_X86_) || defined(_ARM_) @@ -13363,7 +13385,7 @@ class ClrStackImplWithICorDebug ExtOut("\n"); break; } - + // This is a workaround for a problem in the MacOS DAC/DBI PAL. The PAL exception // handling is unnecessarily enabled for DLLs and is not properly passing what I // think is recoverable stack fault on to the OS. Instead it is causing a fault @@ -13371,7 +13393,7 @@ class ClrStackImplWithICorDebug ArrayHolder context = new CROSS_PLATFORM_CONTEXT[1]; ULONG32 cbContextActual; if ((Status = pStackWalk->GetContext( - DT_CONTEXT_FULL, + DT_CONTEXT_FULL, sizeof(CROSS_PLATFORM_CONTEXT), &cbContextActual, (BYTE *)context.GetPtr())) != S_OK) @@ -13395,7 +13417,7 @@ class ClrStackImplWithICorDebug continue; } - // TODO: What about internal frames preceding the above native stack frame? + // TODO: What about internal frames preceding the above native stack frame? // Should I just exclude the above native stack frame from the output? // TODO: Compare caller frame (instead of current frame) against internal frame, // to deal with issues of current frame's current SP being closer to leaf than @@ -13442,7 +13464,7 @@ class ClrStackImplWithICorDebug if (FAILED(Status)) { // We're on a JITted frame, but there's no Function for it. So it must - // be... + // be... ExtOut("[IL Stub or LCG]\n"); continue; } @@ -13499,7 +13521,7 @@ class ClrStackImplWithICorDebug WString BuildRegisterOutput(const SOSStackRefData &ref, bool printObj) { WString res; - + if (ref.HasRegisterInformation) { WCHAR reg[32]; @@ -13508,7 +13530,7 @@ WString BuildRegisterOutput(const SOSStackRefData &ref, bool printObj) res = reg; else res = W(""); - + if (ref.Offset) { int offset = ref.Offset; @@ -13521,16 +13543,16 @@ WString BuildRegisterOutput(const SOSStackRefData &ref, bool printObj) res += W("-"); offset = -offset; } - + res += Hex(offset); } - + res += W(": "); } - + if (ref.Address) res += WString(Pointer(ref.Address)); - + if (printObj) { if (ref.Address) @@ -13543,27 +13565,27 @@ WString BuildRegisterOutput(const SOSStackRefData &ref, bool printObj) { res += W(" (pinned)"); } - + if (ref.Flags & SOSRefInterior) { res += W(" (interior)"); } - + return res; } void PrintRef(const SOSStackRefData &ref, TableOutput &out) { WString res = BuildRegisterOutput(ref); - + if (ref.Object && (ref.Flags & SOSRefInterior) == 0) { WCHAR type[128]; sos::BuildTypeWithExtraInfo(TO_TADDR(ref.Object), _countof(type), type); - + res += WString(W(" - ")) + type; } - + out.WriteColumn(2, res); } @@ -13581,12 +13603,12 @@ class ClrStackImpl { symlines &= SYMOPT_LOAD_LINES; } - + if (symlines == 0) bSuppressLines = TRUE; - + ToRelease pStackWalk; - + HRESULT hr = CreateStackWalk(osID, &pStackWalk); if (FAILED(hr) || pStackWalk == NULL) { @@ -13608,13 +13630,13 @@ class ClrStackImpl currentNativeFrame = &g_Frames[0]; } #endif // DEBUG_STACK_CONTEXT - + unsigned int refCount = 0, errCount = 0; ArrayHolder pRefs = NULL; ArrayHolder pErrs = NULL; if (bGC && FAILED(GetGCRefs(osID, &pRefs, &refCount, &pErrs, &errCount))) refCount = 0; - + TableOutput out(3, POINTERSIZE_HEX, AlignRight); out.WriteRow("Child SP", "IP", "Call Site"); @@ -13662,7 +13684,7 @@ class ClrStackImpl // This is a clr!Frame. out.WriteColumn(2, GetFrameFromAddress(TO_TADDR(FrameData.frameAddr), pStackWalk, bFull)); - // Print out gc references for the Frame. + // Print out gc references for the Frame. for (unsigned int i = 0; i < refCount; ++i) if (pRefs[i].Source == sp) PrintRef(pRefs[i], out); @@ -13674,8 +13696,8 @@ class ClrStackImpl } else { - // To get the source line number of the actual code that threw an exception, the IP needs - // to be adjusted in certain cases. + // To get the source line number of the actual code that threw an exception, the IP needs + // to be adjusted in certain cases. // // The IP of stack frame points to either: // @@ -13690,7 +13712,7 @@ class ClrStackImpl // or #2 by either being non-leaf node stack frame (#4) or the present of an internal stack frame (#3). bool bAdjustIPForLineNumber = frameNumber > 0 || internalFrames > 0; frameNumber++; - + // The unmodified IP is displayed which points after the exception in most cases. This means that the // printed IP and the printed line number often will not map to one another and this is intentional. out.WriteColumn(1, InstructionPtr(ip)); @@ -13739,8 +13761,7 @@ class ClrStackImpl } #endif // DEBUG_STACK_CONTEXT } - - static HRESULT PrintManagedFrameContext(IXCLRDataStackWalk* pStackWalk) + static HRESULT PrintManagedFrameContext(IXCLRDataStackWalk *pStackWalk) { CROSS_PLATFORM_CONTEXT context; HRESULT hr = pStackWalk->GetContext(DT_CONTEXT_FULL, g_targetMachine->GetContextSize(), NULL, (BYTE*)&context); @@ -13839,13 +13860,13 @@ class ClrStackImpl // First find the info for the Frame object, if the current frame has an associated clr!Frame. *ip = GetIP(context); *sp = GetSP(context); - + if (IsDbgTargetArm()) *ip = *ip & ~THUMB_CODE; - + return S_OK; } - + static void PrintNativeStackFrame(TableOutput out, PDEBUG_STACK_FRAME frame, BOOL bSuppressLines) { char filename[MAX_LONGPATH + 1]; @@ -13894,12 +13915,12 @@ class ClrStackImpl { ULONG id = 0; ULONG osid = 0; - + g_ExtSystem->GetCurrentThreadSystemId(&osid); ExtOut("OS Thread Id: 0x%x ", osid); g_ExtSystem->GetCurrentThreadId(&id); ExtOut("(%d)\n", id); - + PrintThread(osid, bParams, bLocals, bSuppressLines, bGC, bNative, bDisplayRegVals); } @@ -13935,7 +13956,7 @@ class ClrStackImpl } } -private: +private: static HRESULT CreateStackWalk(ULONG osID, IXCLRDataStackWalk **ppStackwalk) { HRESULT hr = S_OK; @@ -13969,27 +13990,27 @@ class ClrStackImpl ULONG32 argCount = 0; ULONG32 localCount = 0; HRESULT hr = S_OK; - + hr = pStackWalk->GetFrame(&pFrame); - + // Print arguments if (SUCCEEDED(hr) && bArgs) hr = pFrame->GetNumArguments(&argCount); - + if (SUCCEEDED(hr) && bArgs) hr = ShowArgs(argCount, pFrame, pVal); - + // Print locals if (SUCCEEDED(hr) && bLocals) hr = pFrame->GetNumLocalVariables(&localCount); - + if (SUCCEEDED(hr) && bLocals) ShowLocals(localCount, pFrame, pVal); - + ExtOut("\n"); } - - + + /* Displays the arguments to a function * Params: @@ -14004,46 +14025,46 @@ class ClrStackImpl ULONG64 outVar = 0; ULONG32 tmp; HRESULT hr = S_OK; - + ArrayHolder argName = new NOTHROW WCHAR[mdNameLen]; if (!argName) { ReportOOM(); return E_FAIL; } - + for (ULONG32 i=0; i < argy; i++) - { + { if (i == 0) - { + { ExtOut(" PARAMETERS:\n"); } - + hr = pFramey->GetArgumentByIndex(i, &pVal, mdNameLen, &tmp, argName); - + if (FAILED(hr)) return hr; ExtOut(" "); - + if (argName[0] != L'\0') { ExtOut("%S ", argName.GetPtr()); } - + // At times we cannot print the value of a parameter (most - // common case being a non-primitive value type). In these - // cases we need to print the location of the parameter, + // common case being a non-primitive value type). In these + // cases we need to print the location of the parameter, // so that we can later examine it (e.g. using !dumpvc) { bool result = SUCCEEDED(pVal->GetNumLocations(&tmp)) && tmp == 1; if (result) result = SUCCEEDED(pVal->GetLocationByIndex(0, &tmp, &addr)); - + if (result) { if (tmp == CLRDATA_VLOC_REGISTER) @@ -14060,9 +14081,9 @@ class ClrStackImpl if (argName[0] != L'\0' || fPrintedLocation) { - ExtOut("= "); + ExtOut("= "); } - + if (HRESULT_CODE(pVal->GetBytes(0,&tmp,NULL)) == ERROR_BUFFER_OVERFLOW) { ArrayHolder pByte = new NOTHROW BYTE[tmp + 1]; @@ -14071,9 +14092,9 @@ class ClrStackImpl ReportOOM(); return E_FAIL; } - + hr = pVal->GetBytes(tmp, &tmp, pByte); - + if (FAILED(hr)) { ExtOut("\n"); @@ -14094,16 +14115,16 @@ class ClrStackImpl else ExtOut("0x%p\n", SOS_PTR(outVar)); } - + } else { ExtOut("\n"); } - + pVal->Release(); } - + return S_OK; } @@ -14117,13 +14138,13 @@ class ClrStackImpl static HRESULT ShowLocals(ULONG32 localy, IXCLRDataFrame *pFramey, IXCLRDataValue *pVal) { for (ULONG32 i=0; i < localy; i++) - { + { if (i == 0) ExtOut(" LOCALS:\n"); - + HRESULT hr; ExtOut(" "); - + // local names don't work in Whidbey. hr = pFramey->GetLocalVariableByIndex(i, &pVal, mdNameLen, NULL, g_mdName); if (FAILED(hr)) @@ -14151,11 +14172,11 @@ class ClrStackImpl // Can I get a name for the item? - ExtOut("= "); + ExtOut("= "); } ULONG32 dwSize = 0; hr = pVal->GetBytes(0, &dwSize, NULL); - + if (HRESULT_CODE(hr) == ERROR_BUFFER_OVERFLOW) { ArrayHolder pByte = new NOTHROW BYTE[dwSize + 1]; @@ -14193,10 +14214,10 @@ class ClrStackImpl { ExtOut("\n"); } - + pVal->Release(); } - + return S_OK; } @@ -14223,7 +14244,7 @@ DECLARE_API(Watch) BOOL clear = FALSE; size_t nArg = 0; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-add", &addExpression.data, COSTRING, TRUE}, {"-a", &aExpression.data, COSTRING, TRUE}, @@ -14238,7 +14259,7 @@ DECLARE_API(Watch) {"-rename", &renameOldName.data, COSTRING, TRUE}, }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&expression.data, COSTRING} }; @@ -14335,7 +14356,7 @@ DECLARE_API(ClrStack) { INIT_API(); - BOOL bAll = FALSE; + BOOL bAll = FALSE; BOOL bParams = FALSE; BOOL bLocals = FALSE; BOOL bSuppressLines = FALSE; @@ -14344,7 +14365,7 @@ DECLARE_API(ClrStack) BOOL dml = FALSE; BOOL bFull = FALSE; BOOL bDisplayRegVals = FALSE; - BOOL bAllThreads = FALSE; + BOOL bAllThreads = FALSE; DWORD frameToDumpVariablesFor = -1; StringHolder cvariableName; ArrayHolder wvariableName = new NOTHROW WCHAR[mdNameLen]; @@ -14357,7 +14378,7 @@ DECLARE_API(ClrStack) memset(wvariableName, 0, sizeof(wvariableName)); size_t nArg = 0; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-a", &bAll, COBOOL, FALSE}, {"-all", &bAllThreads, COBOOL, FALSE}, @@ -14372,7 +14393,7 @@ DECLARE_API(ClrStack) {"/d", &dml, COBOOL, FALSE}, #endif }; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&cvariableName.data, COSTRING}, {&frameToDumpVariablesFor, COSIZE_T}, @@ -14386,7 +14407,7 @@ DECLARE_API(ClrStack) if (bAll || bParams || bLocals) { // No parameter or local supports for minidump case! - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); } if (bAll) @@ -14410,21 +14431,21 @@ DECLARE_API(ClrStack) } if(cvariableName.data != NULL && strlen(cvariableName.data) > 0) swprintf_s(wvariableName, mdNameLen, W("%S\0"), cvariableName.data); - + if(_wcslen(wvariableName) > 0) bParams = bLocals = TRUE; EnableDMLHolder dmlHolder(TRUE); return ClrStackImplWithICorDebug::ClrStackFromPublicInterface(bParams, bLocals, FALSE, wvariableName, frameToDumpVariablesFor); } - + if (bAllThreads) { ClrStackImpl::PrintAllThreads(bParams, bLocals, bSuppressLines, bGC, bFull, bDisplayRegVals); } else { ClrStackImpl::PrintCurrentThread(bParams, bLocals, bSuppressLines, bGC, bFull, bDisplayRegVals); } - + return S_OK; } @@ -14435,17 +14456,17 @@ BOOL IsMemoryInfoAvailable() ULONG Class; ULONG Qualifier; g_ExtControl->GetDebuggeeType(&Class,&Qualifier); - if (Qualifier == DEBUG_DUMP_SMALL) + if (Qualifier == DEBUG_DUMP_SMALL) { g_ExtControl->GetDumpFormatFlags(&Qualifier); - if ((Qualifier & DEBUG_FORMAT_USER_SMALL_FULL_MEMORY) == 0) + if ((Qualifier & DEBUG_FORMAT_USER_SMALL_FULL_MEMORY) == 0) { if ((Qualifier & DEBUG_FORMAT_USER_SMALL_FULL_MEMORY_INFO) == 0) { return FALSE; - } + } } - } + } return TRUE; } @@ -14475,7 +14496,7 @@ DECLARE_API(SOSFlush) #ifdef FEATURE_PAL FlushMetadataRegions(); #endif - + return Status; } @@ -14500,26 +14521,26 @@ DECLARE_API( VMStat ) /**********************************************************************\ * Routine Description: * * * -* This function saves a dll to a file. * +* This function saves a dll to a file. * * * \**********************************************************************/ DECLARE_API(SaveModule) { INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); StringHolder Location; DWORD_PTR moduleAddr = NULL; BOOL bIsImage; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&moduleAddr, COHEX}, {&Location.data, COSTRING} }; size_t nArg; - if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) { return Status; } @@ -14534,7 +14555,7 @@ DECLARE_API(SaveModule) } char* ptr = Location.data; - + DWORD_PTR dllBase = 0; ULONG64 base; if (g_ExtSymbols->GetModuleByOffset(TO_CDADDR(moduleAddr),0,NULL,&base) == S_OK) @@ -14542,7 +14563,7 @@ DECLARE_API(SaveModule) dllBase = TO_TADDR(base); } else if (IsModule(moduleAddr)) - { + { DacpModuleData module; module.Request(g_sos, TO_CDADDR(moduleAddr)); dllBase = TO_TADDR(module.ilBase); @@ -14577,7 +14598,7 @@ DECLARE_API(SaveModule) return S_FALSE; DWORD_PTR sectionAddr = dllBase + DosHeader.e_lfanew + offsetof(IMAGE_NT_HEADERS,OptionalHeader) - + Header.FileHeader.SizeOfOptionalHeader; + + Header.FileHeader.SizeOfOptionalHeader; IMAGE_SECTION_HEADER section; struct MemLocation @@ -14646,7 +14667,7 @@ DECLARE_API(SaveModule) char *buffer = (char *)_alloca(pageSize); DWORD nRead; DWORD nWrite; - + // NT PE Headers TADDR dwAddr = dllBase; TADDR dwEnd = dllBase + Header.OptionalHeader.SizeOfHeaders; @@ -14678,7 +14699,7 @@ DECLARE_API(SaveModule) nRead = pageSize; if (dwEnd - dwAddr + 1 < pageSize) nRead = (ULONG)(dwEnd - dwAddr + 1); - + if (g_ExtData->ReadVirtual(TO_CDADDR(dwAddr), buffer, nRead, &nRead) == S_OK) { WriteFile(hFile,buffer,nRead,&nWrite,NULL); @@ -14704,7 +14725,7 @@ DECLARE_API(dbgout) BOOL bOff = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-off", &bOff, COBOOL, FALSE}, }; @@ -14712,14 +14733,14 @@ DECLARE_API(dbgout) if (!GetCMDOption(args, option, _countof(option), NULL, 0, NULL)) { return Status; - } + } Output::SetDebugOutputEnabled(!bOff); ExtOut("Debug output logging %s\n", Output::IsDebugOutputEnabled() ? "enabled" : "disabled"); return Status; } -static HRESULT DumpMDInfoBuffer(DWORD_PTR dwStartAddr, DWORD Flags, ULONG64 Esp, +static HRESULT DumpMDInfoBuffer(DWORD_PTR dwStartAddr, DWORD Flags, ULONG64 Esp, ULONG64 IPAddr, StringOutput& so) { #define DOAPPEND(str) \ @@ -14766,7 +14787,7 @@ static HRESULT DumpMDInfoBuffer(DWORD_PTR dwStartAddr, DWORD Flags, ULONG64 Esp, ULONG Index; ULONG64 base; if (g_ExtSymbols->GetModuleByOffset(UL64_TO_CDA(addrInModule), 0, &Index, &base) == S_OK) - { + { ArrayHolder szModuleName = new char[MAX_LONGPATH+1]; if (g_ExtSymbols->GetModuleNames(Index, base, NULL, 0, NULL, szModuleName, MAX_LONGPATH, NULL, NULL, 0, NULL) == S_OK) { @@ -14791,7 +14812,7 @@ static HRESULT DumpMDInfoBuffer(DWORD_PTR dwStartAddr, DWORD Flags, ULONG64 Esp, } } - // Under certain circumstances DacpMethodDescData::GetMethodDescName() + // Under certain circumstances DacpMethodDescData::GetMethodDescName() // returns a module qualified method name HRESULT hr = g_sos->GetMethodDescName(dwStartAddr, MAX_LONGPATH, wszNameBuffer, NULL); @@ -14811,7 +14832,7 @@ static HRESULT DumpMDInfoBuffer(DWORD_PTR dwStartAddr, DWORD Flags, ULONG64 Esp, DOAPPEND(W("!")); if (hr == S_OK) { - // the module name we retrieved above from debugger will take + // the module name we retrieved above from debugger will take // precedence over the name possibly returned by GetMethodDescName() DOAPPEND(pwszMethNameBegin != NULL ? (pwszMethNameBegin+1) : (WCHAR *)wszNameBuffer); } @@ -14868,7 +14889,7 @@ HRESULT CALLBACK ImplementEFNStackTrace( LPVOID pTransitionContexts, size_t *puiTransitionContextCount, size_t uiSizeOfContext, - DWORD Flags) + DWORD Flags) { #define DOAPPEND(str) if (!so.Append((str))) { \ @@ -14876,7 +14897,7 @@ HRESULT CALLBACK ImplementEFNStackTrace( goto Exit; \ } - HRESULT Status = E_FAIL; + HRESULT Status = E_FAIL; StringOutput so; size_t transitionContextCount = 0; @@ -14940,7 +14961,7 @@ HRESULT CALLBACK ImplementEFNStackTrace( for (ULONG i = 0; i < numFrames; i++) { - PDEBUG_STACK_FRAME pCur = g_Frames + i; + PDEBUG_STACK_FRAME pCur = g_Frames + i; CLRDATA_ADDRESS pMD; if (g_sos->GetMethodDescPtrFromIP(pCur->InstructionOffset, &pMD) == S_OK) @@ -14955,7 +14976,7 @@ HRESULT CALLBACK ImplementEFNStackTrace( if (puiTransitionContextCount) { // below we cast the i-th AMD64_CONTEXT to CROSS_PLATFORM_CONTEXT - AppendContext (pTransitionContexts, *puiTransitionContextCount, + AppendContext (pTransitionContexts, *puiTransitionContextCount, &transitionContextCount, uiSizeOfContext, (CROSS_PLATFORM_CONTEXT*)(&(g_FrameContexts[i]))); } else @@ -14976,7 +14997,7 @@ HRESULT CALLBACK ImplementEFNStackTrace( } // for S_FALSE do not append anything - } + } else { if (!bInNative) @@ -14988,7 +15009,7 @@ HRESULT CALLBACK ImplementEFNStackTrace( // For each transition, we need to store the context information if (puiTransitionContextCount) { - AppendContext (pTransitionContexts, *puiTransitionContextCount, + AppendContext (pTransitionContexts, *puiTransitionContextCount, &transitionContextCount, uiSizeOfContext, (CROSS_PLATFORM_CONTEXT*)(&(g_FrameContexts[i]))); } else @@ -15040,19 +15061,19 @@ HRESULT CALLBACK ImplementEFNStackTrace( // For each transition, we need to store the context information if (puiTransitionContextCount) { - AppendContext (pTransitionContexts, *puiTransitionContextCount, + AppendContext (pTransitionContexts, *puiTransitionContextCount, &transitionContextCount, uiSizeOfContext, &context); } else { transitionContextCount++; - } + } } // we may have a method, try to get the methoddesc if (g_sos->GetMethodDescPtrFromIP(GetIP(context), &pMD)==S_OK) { - Status = DumpMDInfoBuffer((DWORD_PTR) pMD, Flags, + Status = DumpMDInfoBuffer((DWORD_PTR) pMD, Flags, GetSP(context), GetIP(context), so); if (FAILED(Status)) { @@ -15073,7 +15094,7 @@ HRESULT CALLBACK ImplementEFNStackTrace( DWORD_PTR vtAddr; MOVE(vtAddr, TO_TADDR(FrameData.frameAddr)); if (g_sos->GetFrameName(TO_CDADDR(vtAddr), 1024, wszNameBuffer, NULL) == S_OK) - ExtDbgOut("[%ls: %08x] ", wszNameBuffer, FrameData.frameAddr); + ExtDbgOut("[%ls: %08x] ", wszNameBuffer, FrameData.frameAddr); else ExtDbgOut("[Frame: %08x] ", FrameData.frameAddr); } @@ -15087,13 +15108,13 @@ HRESULT CALLBACK ImplementEFNStackTrace( // For each transition, we need to store the context information if (puiTransitionContextCount) { - AppendContext (pTransitionContexts, *puiTransitionContextCount, + AppendContext (pTransitionContexts, *puiTransitionContextCount, &transitionContextCount, uiSizeOfContext, &context); } else { transitionContextCount++; - } + } } } @@ -15107,9 +15128,9 @@ HRESULT CALLBACK ImplementEFNStackTrace( ExtDbgOut ( "\n" ); #endif - } + } while ((frameCount++) < MAX_STACK_FRAMES && pStackWalk->Next()==S_OK); - + Status = S_OK; Exit: @@ -15151,19 +15172,19 @@ HRESULT CALLBACK ImplementEFNStackTraceTry( LPVOID pTransitionContexts, size_t *puiTransitionContextCount, size_t uiSizeOfContext, - DWORD Flags) + DWORD Flags) { HRESULT Status = E_FAIL; PAL_TRY_NAKED { - Status = ImplementEFNStackTrace(client, wszTextOut, puiTextLength, + Status = ImplementEFNStackTrace(client, wszTextOut, puiTextLength, pTransitionContexts, puiTransitionContextCount, uiSizeOfContext, Flags); } PAL_EXCEPT_NAKED (EXCEPTION_EXECUTE_HANDLER) { - } + } PAL_ENDTRY_NAKED return Status; @@ -15177,11 +15198,11 @@ HRESULT CALLBACK _EFN_StackTrace( __out_bcount_opt(uiSizeOfContext*(*puiTransitionContextCount)) LPVOID pTransitionContexts, size_t *puiTransitionContextCount, size_t uiSizeOfContext, - DWORD Flags) + DWORD Flags) { - INIT_API(); + INIT_API(); - Status = ImplementEFNStackTraceTry(client, wszTextOut, puiTextLength, + Status = ImplementEFNStackTraceTry(client, wszTextOut, puiTextLength, pTransitionContexts, puiTransitionContextCount, uiSizeOfContext, Flags); @@ -15193,7 +15214,7 @@ BOOL FormatFromRemoteString(DWORD_PTR strObjPointer, __out_ecount(cchString) PWS BOOL bRet = FALSE; wszBuffer[0] = L'\0'; - + DacpObjectData objData; if (objData.Request(g_sos, TO_CDADDR(strObjPointer))!=S_OK) { @@ -15206,7 +15227,7 @@ BOOL FormatFromRemoteString(DWORD_PTR strObjPointer, __out_ecount(cchString) PWS { return bRet; } - + DWORD dwBufLength = 0; if (!ClrSafeInt::addition(stInfo.m_StringLength, 1, dwBufLength)) { @@ -15219,7 +15240,7 @@ BOOL FormatFromRemoteString(DWORD_PTR strObjPointer, __out_ecount(cchString) PWS { return bRet; } - + if (g_sos->GetObjectStringData(TO_CDADDR(strObjPointer), stInfo.m_StringLength+1, pwszBuf, NULL)!=S_OK) { delete [] pwszBuf; @@ -15263,9 +15284,9 @@ BOOL FormatFromRemoteString(DWORD_PTR strObjPointer, __out_ecount(cchString) PWS // Note that we don't add a newline because we have this embedded in wszLineBuffer swprintf_s(wszLineBuffer, _countof(wszLineBuffer), W(" %p %p %s"), (void*)(size_t)-1, (void*)(size_t)-1, pwszPointer); Length += (UINT)_wcslen(wszLineBuffer); - + if (wszBuffer) - { + { wcsncat_s(wszBuffer, cchString, wszLineBuffer, _TRUNCATE); } @@ -15273,8 +15294,8 @@ BOOL FormatFromRemoteString(DWORD_PTR strObjPointer, __out_ecount(cchString) PWS // Move to the next line. pwszPointer = nextPos; } - - delete [] pwszBuf; + + delete [] pwszBuf; // Return TRUE only if the stack string had any information that was successfully parsed. // (Length > 0) is a good indicator of that. @@ -15282,14 +15303,14 @@ BOOL FormatFromRemoteString(DWORD_PTR strObjPointer, __out_ecount(cchString) PWS return bRet; } -HRESULT AppendExceptionInfo(CLRDATA_ADDRESS cdaObj, +HRESULT AppendExceptionInfo(CLRDATA_ADDRESS cdaObj, __out_ecount(cchString) PWSTR wszStackString, ULONG cchString, BOOL bNestedCase) // If bNestedCase is TRUE, the last frame of the computed stack is left off -{ +{ DacpObjectData objData; if (objData.Request(g_sos, cdaObj) != S_OK) - { + { return E_FAIL; } @@ -15304,7 +15325,7 @@ HRESULT AppendExceptionInfo(CLRDATA_ADDRESS cdaObj, DacpExceptionObjectData excData; BOOL bGotExcData = SUCCEEDED(excData.Request(g_sos, cdaObj)); - int iOffset; + int iOffset; // Is there a _remoteStackTraceString? We'll want to prepend that data. // We only have string data, so IP/SP info has to be set to -1. DWORD_PTR strPointer; @@ -15315,7 +15336,7 @@ HRESULT AppendExceptionInfo(CLRDATA_ADDRESS cdaObj, else { iOffset = GetObjFieldOffset (cdaObj, objData.MethodTable, W("_remoteStackTraceString")); - MOVE (strPointer, TO_TADDR(cdaObj) + iOffset); + MOVE (strPointer, TO_TADDR(cdaObj) + iOffset); } if (strPointer) { @@ -15324,7 +15345,7 @@ HRESULT AppendExceptionInfo(CLRDATA_ADDRESS cdaObj, { return E_OUTOFMEMORY; } - + if (FormatFromRemoteString(strPointer, pwszBuffer, cchString)) { // Prepend this stuff to the string for the user @@ -15332,7 +15353,7 @@ HRESULT AppendExceptionInfo(CLRDATA_ADDRESS cdaObj, } delete[] pwszBuffer; } - + BOOL bAsync = bGotExcData ? IsAsyncException(excData) : IsAsyncException(cdaObj, objData.MethodTable); @@ -15366,9 +15387,9 @@ HRESULT AppendExceptionInfo(CLRDATA_ADDRESS cdaObj, DWORD cbStackSize = static_cast(stackTraceSize * sizeof(StackTraceElement)); dataPtr += sizeof(size_t) + sizeof(size_t); // skip the array header, then goes the data - + if (stackTraceSize != 0) - { + { size_t iLength = FormatGeneratedException (dataPtr, cbStackSize, NULL, 0, bAsync, bNestedCase); WCHAR *pwszBuffer = new NOTHROW WCHAR[iLength + 1]; if (pwszBuffer) @@ -15383,12 +15404,12 @@ HRESULT AppendExceptionInfo(CLRDATA_ADDRESS cdaObj, } } } - } + } return S_OK; } HRESULT ImplementEFNGetManagedExcepStack( - CLRDATA_ADDRESS cdaStackObj, + CLRDATA_ADDRESS cdaStackObj, __out_ecount(cchString) PWSTR wszStackString, ULONG cchString) { @@ -15404,38 +15425,38 @@ HRESULT ImplementEFNGetManagedExcepStack( BOOL bCanUseThreadContext = TRUE; ZeroMemory(&Thread, sizeof(DacpThreadData)); - + if ((threadAddr == NULL) || (Thread.Request(g_sos, threadAddr) != S_OK)) { // The current thread is unmanaged bCanUseThreadContext = FALSE; } - if (cdaStackObj == NULL) + if (cdaStackObj == NULL) { if (!bCanUseThreadContext) { return E_INVALIDARG; } - + TADDR taLTOH = NULL; if ((!SafeReadMemory(TO_TADDR(Thread.lastThrownObjectHandle), &taLTOH, sizeof(taLTOH), NULL)) || (taLTOH==NULL)) { return Status; - } + } else - { + { cdaStackObj = TO_CDADDR(taLTOH); } } // Put the stack trace header on AddExceptionHeader(wszStackString, cchString); - + // First is there a nested exception? - if (bCanUseThreadContext && Thread.firstNestedException) + if (bCanUseThreadContext && Thread.firstNestedException) { CLRDATA_ADDRESS obj = 0, next = 0; CLRDATA_ADDRESS currentNested = Thread.firstNestedException; @@ -15448,13 +15469,13 @@ HRESULT ImplementEFNGetManagedExcepStack( { break; } - + Status = AppendExceptionInfo(obj, wszStackString, cchString, TRUE); currentNested = next; } - while(currentNested != NULL); + while(currentNested != NULL); } - + Status = AppendExceptionInfo(cdaStackObj, wszStackString, cchString, FALSE); return Status; @@ -15470,12 +15491,12 @@ DECLARE_API(VerifyStackTrace) ONLY_SUPPORTED_ON_WINDOWS_TARGET(); BOOL bVerifyManagedExcepStack = FALSE; - CMDOption option[] = + CMDOption option[] = { // name, vptr, type, hasValue {"-ManagedExcepStack", &bVerifyManagedExcepStack, COBOOL, FALSE}, }; - - if (!GetCMDOption(args, option, _countof(option), NULL,0,NULL)) + + if (!GetCMDOption(args, option, _countof(option), NULL,0,NULL)) { return Status; } @@ -15497,11 +15518,11 @@ DECLARE_API(VerifyStackTrace) &taLTOH, sizeof(taLTOH), NULL)) || (taLTOH == NULL)) { - ExtOut("There is no current managed exception on this thread\n"); + ExtOut("There is no current managed exception on this thread\n"); return Status; - } + } else - { + { taExc = taLTOH; } @@ -15551,7 +15572,7 @@ DECLARE_API(VerifyStackTrace) return Status; } - // For the transition contexts buffer the callers are expected to allocate + // For the transition contexts buffer the callers are expected to allocate // contextLength * sizeof(TARGET_CONTEXT), and not // contextLength * sizeof(CROSS_PLATFORM_CONTEXT). See sos_stacktrace.h for // details. @@ -15586,17 +15607,17 @@ DECLARE_API(VerifyStackTrace) if (IsDbgTargetX86()) { ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", - "Ebp", "Esp", "Eip"); + "Ebp", "Esp", "Eip"); } else if (IsDbgTargetAmd64()) { ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", - "Rbp", "Rsp", "Rip"); + "Rbp", "Rsp", "Rip"); } else if (IsDbgTargetArm()) { ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", - "FP", "SP", "PC"); + "FP", "SP", "PC"); } else { @@ -15641,14 +15662,14 @@ DECLARE_API(VerifyStackTrace) ExtOut("Simple Context information:\n"); if (IsDbgTargetX86()) ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", - "Ebp", "Esp", "Eip"); + "Ebp", "Esp", "Eip"); else if (IsDbgTargetAmd64()) ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", - "Rbp", "Rsp", "Rip"); + "Rbp", "Rsp", "Rip"); else if (IsDbgTargetArm()) ExtOut("%" POINTERSIZE "s %" POINTERSIZE "s %" POINTERSIZE "s\n", - "FP", "SP", "PC"); - else + "FP", "SP", "PC"); + else { ExtOut("Unsupported platform"); delete[] wszBuffer; @@ -15671,17 +15692,17 @@ DECLARE_API(VerifyStackTrace) // This is an internal-only Apollo extension to save breakpoint/watch state DECLARE_API(SaveState) { - INIT_API_NOEE(); - MINIDUMP_NOT_SUPPORTED(); + INIT_API_NOEE(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); StringHolder filePath; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&filePath.data, COSTRING}, }; size_t nArg; - if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) { return E_FAIL; } @@ -15711,17 +15732,17 @@ DECLARE_API(SaveState) DECLARE_API(SuppressJitOptimization) { - INIT_API_NOEE(); - MINIDUMP_NOT_SUPPORTED(); + INIT_API_NOEE(); + MINIDUMP_NOT_SUPPORTED(); ONLY_SUPPORTED_ON_WINDOWS_TARGET(); StringHolder onOff; - CMDValue arg[] = + CMDValue arg[] = { // vptr, type {&onOff.data, COSTRING}, }; size_t nArg; - if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) + if (!GetCMDOption(args, NULL, 0, arg, _countof(arg), &nArg)) { return E_FAIL; } @@ -15846,8 +15867,8 @@ HRESULT SetNGENCompilerFlags(DWORD flags) DECLARE_API(StopOnCatch) { - INIT_API(); - MINIDUMP_NOT_SUPPORTED(); + INIT_API(); + MINIDUMP_NOT_SUPPORTED(); g_stopOnNextCatch = TRUE; ULONG32 flags = 0; @@ -15870,9 +15891,9 @@ DECLARE_API(ExposeDML) } // According to kksharma the Windows debuggers always sign-extend -// arguments when calling externally, therefore StackObjAddr +// arguments when calling externally, therefore StackObjAddr // conforms to CLRDATA_ADDRESS contract. -HRESULT CALLBACK +HRESULT CALLBACK _EFN_GetManagedExcepStack( PDEBUG_CLIENT client, ULONG64 StackObjAddr, @@ -15915,11 +15936,11 @@ _EFN_GetManagedExcepStackW( return ImplementEFNGetManagedExcepStack(StackObjAddr, wszStackString, cchString); } - + // According to kksharma the Windows debuggers always sign-extend -// arguments when calling externally, therefore objAddr +// arguments when calling externally, therefore objAddr // conforms to CLRDATA_ADDRESS contract. -HRESULT CALLBACK +HRESULT CALLBACK _EFN_GetManagedObjectName( PDEBUG_CLIENT client, ULONG64 objAddr, @@ -15945,9 +15966,9 @@ _EFN_GetManagedObjectName( } // According to kksharma the Windows debuggers always sign-extend -// arguments when calling externally, therefore objAddr +// arguments when calling externally, therefore objAddr // conforms to CLRDATA_ADDRESS contract. -HRESULT CALLBACK +HRESULT CALLBACK _EFN_GetManagedObjectFieldInfo( PDEBUG_CLIENT client, ULONG64 objAddr, @@ -15959,7 +15980,7 @@ _EFN_GetManagedObjectFieldInfo( INIT_API(); DacpObjectData objData; LPWSTR fieldName = (LPWSTR)alloca(mdNameLen * sizeof(WCHAR)); - + if (szFieldName == NULL || *szFieldName == '\0' || objAddr == NULL) { @@ -15971,12 +15992,12 @@ _EFN_GetManagedObjectFieldInfo( // One of these needs to be valid return E_FAIL; } - + if (FAILED(objData.Request(g_sos, objAddr))) - { + { return E_FAIL; } - + MultiByteToWideChar(CP_ACP,0,szFieldName,-1,fieldName,mdNameLen); int iOffset = GetObjFieldOffset (objAddr, objData.MethodTable, fieldName); @@ -16058,9 +16079,9 @@ _EFN_GetManagedThread( if ((Status = thread.Request(g_sos, curThread)) != S_OK) { return Status; - } + } if (thread.osThreadId == osThreadId) - { + { *pManagedThread = (ULONG64)curThread; return S_OK; } @@ -16085,13 +16106,13 @@ DECLARE_API(SetHostRuntime) {&hostRuntimeDirectory.data, COSTRING}, }; size_t narg; - if (!GetCMDOption(args, nullptr, 0, arg, _countof(arg), &narg)) + if (!GetCMDOption(args, nullptr, 0, arg, _countof(arg), &narg)) { return E_FAIL; } if (narg > 0) { - if (IsHostingInitialized()) + if (IsHostingInitialized()) { ExtErr("Runtime hosting already initialized %s\n", g_hostRuntimeDirectory); return E_FAIL; @@ -16258,7 +16279,7 @@ void PrintHelp (__in_z LPCSTR pszCmdName) HGLOBAL hResource = NULL; HRSRC hResInfo = FindResource (g_hInstance, TEXT ("DOCUMENTATION"), TEXT ("TEXT")); if (hResInfo) hResource = LoadResource (g_hInstance, hResInfo); - if (hResource) pText = (LPSTR) LockResource (hResource); + if (hResource) pText = (LPSTR) LockResource (hResource); if (pText == NULL) { ExtErr("Error loading documentation resource\n"); @@ -16275,7 +16296,7 @@ void PrintHelp (__in_z LPCSTR pszCmdName) char lpFilename[MAX_LONGPATH + 12]; // + 12 to make enough room for strcat function. strcpy_s(lpFilename, _countof(lpFilename), szSOSModulePath); strcat_s(lpFilename, _countof(lpFilename), "sosdocsunix.txt"); - + HANDLE hSosDocFile = CreateFileA(lpFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hSosDocFile == INVALID_HANDLE_VALUE) { ExtErr("Error finding documentation file\n"); @@ -16284,7 +16305,7 @@ void PrintHelp (__in_z LPCSTR pszCmdName) HANDLE hMappedSosDocFile = CreateFileMappingA(hSosDocFile, NULL, PAGE_READONLY, 0, 0, NULL); CloseHandle(hSosDocFile); - if (hMappedSosDocFile == NULL) { + if (hMappedSosDocFile == NULL) { ExtErr("Error mapping documentation file\n"); return; } @@ -16302,7 +16323,7 @@ void PrintHelp (__in_z LPCSTR pszCmdName) // Find our line in the text file char searchString[MAX_LONGPATH]; sprintf_s(searchString, _countof(searchString), "COMMAND: %s.", pszCmdName); - + LPSTR pStart = strstr(pText, searchString); LPSTR pEnd = NULL; if (!pStart) @@ -16347,7 +16368,7 @@ void PrintHelp (__in_z LPCSTR pszCmdName) /**********************************************************************\ * Routine Description: * * * -* This function displays the commands available in strike and the * +* This function displays the commands available in strike and the * * arguments passed into each. * * \**********************************************************************/ @@ -16356,7 +16377,7 @@ DECLARE_API(Help) INIT_API_EXT(); StringHolder commandName; - CMDValue arg[] = + CMDValue arg[] = { {&commandName.data, COSTRING} }; @@ -16369,7 +16390,7 @@ DECLARE_API(Help) ExtOut("-------------------------------------------------------------------------------\n"); if (nArg == 1) - { + { // Convert commandName to lower-case LPSTR curChar = commandName.data; while (*curChar != '\0') @@ -16385,13 +16406,13 @@ DECLARE_API(Help) curChar = commandName.data; if (*curChar == '!') curChar++; - + PrintHelp (curChar); } else { PrintHelp ("contents"); } - + return S_OK; } diff --git a/src/SOS/Strike/util.h b/src/SOS/Strike/util.h index 7f37859a63..7e6f8e0c0d 100644 --- a/src/SOS/Strike/util.h +++ b/src/SOS/Strike/util.h @@ -3,9 +3,9 @@ // See the LICENSE file in the project root for more information. // ==++== -// - -// +// + +// // ==--== #ifndef __util_h__ #define __util_h__ @@ -39,6 +39,7 @@ inline void RestoreSOToleranceState() {} #include "static_assert.h" #include #include "hostcoreclr.h" +#include "holder.h" typedef LPCSTR LPCUTF8; typedef LPSTR LPUTF8; @@ -47,7 +48,7 @@ typedef LPSTR LPUTF8; #define NOTHROW #else #define NOTHROW (std::nothrow) -#endif +#endif DECLARE_HANDLE(OBJECTHANDLE); @@ -116,7 +117,7 @@ DECLARE_HANDLE(OBJECTHANDLE); #endif -#if defined(_PREFAST_) || defined(_PREFIX_) +#if defined(_PREFAST_) || defined(_PREFIX_) #define COMPILER_ASSUME_MSG(_condition, _message) if (!(_condition)) __UNREACHABLE(); #else @@ -183,7 +184,7 @@ typedef struct tagLockEntry tagLockEntry *pPrev; // prev entry DWORD dwULockID; DWORD dwLLockID; // owning lock - WORD wReaderLevel; // reader nesting level + WORD wReaderLevel; // reader nesting level } LockEntry; #define MAX_CLASSNAME_LENGTH 1024 @@ -268,7 +269,7 @@ class CachedString { return mIndex == -2; } - + // allocate a string of the specified size. this will Clear() any // previously allocated string. call IsOOM() to check for failure. void Allocate(int size); @@ -298,7 +299,7 @@ class CachedString // -1 - mPtr points to a pointer we have new'ed // -2 - We hit an oom trying to allocate either mCount or mPtr int mIndex; - + // contains the size of current string int mSize; @@ -306,6 +307,211 @@ class CachedString static StaticData cache; }; +class GCHeapDetails +{ +private: + void GetGenerationTableSize(CLRDATA_ADDRESS svrHeapAddr, unsigned int *count) + { + HRESULT hr = S_OK; + bool success = false; + ReleaseHolder sos8; + 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; + } + } + + // Fill the target array with either the details from heap or if this is a newer runtime that supports + // the pinned object heap (or potentially future GC generations), get that data too. This abstraction is + // necessary because the original GC heap APIs are hardcoded to 4 generations. + void FillGenerationTable(CLRDATA_ADDRESS svrHeapAddr, const DacpGcHeapDetails &heap, unsigned int count, DacpGenerationData *data) + { + HRESULT hr = S_OK; + bool success = false; + unsigned int generationCount; + ReleaseHolder sos8; + if (SUCCEEDED(hr = g_sos->QueryInterface(__uuidof(ISOSDacInterface8), &sos8))) + { + if (svrHeapAddr == NULL) + { + 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)) + && hr != S_FALSE) + { + success = true; + // Nothing else to do, data is already populated + } + } + + _ASSERTE(generationCount == count || !success); + } + + if (!success) + { + // This would mean that there are additional, unaccounted for, generations + _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); + } + } + + // Fill the target array with either the details from heap or if this is a newer runtime that supports + // the pinned object heap (or potentially future GC generations), get that data too. This abstraction is + // necessary because the original GC heap APIs are hardcoded to 4 generations. + void FillFinalizationPointers(CLRDATA_ADDRESS svrHeapAddr, const DacpGcHeapDetails &heap, unsigned int count, CLRDATA_ADDRESS *data) + { + HRESULT hr = S_OK; + bool success = false; + unsigned int fillPointersCount; + ReleaseHolder sos8; + if (SUCCEEDED(hr = g_sos->QueryInterface(__uuidof(ISOSDacInterface8), &sos8))) + { + if (svrHeapAddr == NULL) + { + 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)) + && hr != S_FALSE) + { + success = true; + // Nothing else to do, data is already populated + } + } + + _ASSERTE(fillPointersCount == count); + } + + if (!success) + { + // This would mean that there are additional, unaccounted for, generations + _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 + 2)); + } + } + +public: + GCHeapDetails() + { + generation_table = NULL; + finalization_fill_pointers = NULL; + } + + GCHeapDetails(const DacpGcHeapDetails &dacGCDetails, CLRDATA_ADDRESS svrHeapAddr = NULL) + { + generation_table = NULL; + finalization_fill_pointers = NULL; + + Set(dacGCDetails, svrHeapAddr); + } + + ~GCHeapDetails() + { + if (generation_table != NULL) + { + delete[] generation_table; + generation_table = NULL; + } + + if (finalization_fill_pointers != NULL) + { + delete[] finalization_fill_pointers; + finalization_fill_pointers = NULL; + } + } + + // Due to the raw pointers, we are not a POD and have to be careful about lifetime + GCHeapDetails(const GCHeapDetails& other) = delete; + GCHeapDetails(GCHeapDetails&& other) = delete; + GCHeapDetails& operator=(const GCHeapDetails& other) = delete; + GCHeapDetails& operator=(GCHeapDetails&& other) = delete; + + void Set(const DacpGcHeapDetails dacGCDetails, CLRDATA_ADDRESS svrHeapAddr = NULL) + { + original_heap_details = dacGCDetails; + + GetGenerationTableSize(svrHeapAddr, &num_generations); + // Either we're pre POH and have 4, or post and have 5. If there's a different + // number it's either a bug or we need to update SOS. + _ASSERTE(num_generations == 4 || num_generations == 5); + has_poh = num_generations > 4; + + if (generation_table != NULL) + { + delete[] generation_table; + } + generation_table = new DacpGenerationData[num_generations]; + FillGenerationTable(svrHeapAddr, dacGCDetails, num_generations, generation_table); + + if (finalization_fill_pointers != NULL) + { + delete[] finalization_fill_pointers; + } + + unsigned int num_fill_pointers = num_generations + 2; + finalization_fill_pointers = new CLRDATA_ADDRESS[num_fill_pointers]; + FillFinalizationPointers(svrHeapAddr, dacGCDetails, num_fill_pointers, finalization_fill_pointers); + + heapAddr = svrHeapAddr; + alloc_allocated = dacGCDetails.alloc_allocated; + mark_array = dacGCDetails.mark_array; + current_c_gc_state = dacGCDetails.current_c_gc_state; + next_sweep_obj = dacGCDetails.next_sweep_obj; + saved_sweep_ephemeral_seg = dacGCDetails.saved_sweep_ephemeral_seg; + saved_sweep_ephemeral_start = dacGCDetails.saved_sweep_ephemeral_start; + background_saved_lowest_address = dacGCDetails.background_saved_lowest_address; + background_saved_highest_address = dacGCDetails.background_saved_highest_address; + ephemeral_heap_segment = dacGCDetails.ephemeral_heap_segment; + lowest_address = dacGCDetails.lowest_address; + highest_address = dacGCDetails.highest_address; + card_table = dacGCDetails.card_table; + } + + DacpGcHeapDetails original_heap_details; + bool has_poh; + CLRDATA_ADDRESS heapAddr; // Only filled in in server mode, otherwise NULL + CLRDATA_ADDRESS alloc_allocated; + + CLRDATA_ADDRESS mark_array; + CLRDATA_ADDRESS current_c_gc_state; + CLRDATA_ADDRESS next_sweep_obj; + CLRDATA_ADDRESS saved_sweep_ephemeral_seg; + CLRDATA_ADDRESS saved_sweep_ephemeral_start; + CLRDATA_ADDRESS background_saved_lowest_address; + CLRDATA_ADDRESS background_saved_highest_address; + + // There are num_generations entries in generation_table and num_generations + 3 entries + // in finalization_fill_pointers + unsigned int num_generations; + DacpGenerationData *generation_table; + CLRDATA_ADDRESS ephemeral_heap_segment; + CLRDATA_ADDRESS *finalization_fill_pointers; + CLRDATA_ADDRESS lowest_address; + CLRDATA_ADDRESS highest_address; + CLRDATA_ADDRESS card_table; + +}; + // Things in this namespace should not be directly accessed/called outside of // the output-related functions. namespace Output @@ -315,22 +521,22 @@ namespace Output extern unsigned int g_DMLEnable; extern bool g_bDbgOutput; extern bool g_bDMLExposed; - + inline bool IsOutputSuppressed() { return g_bSuppressOutput > 0; } - + inline void ResetIndent() { g_Indent = 0; } - + inline void SetDebugOutputEnabled(bool enabled) { g_bDbgOutput = enabled; } - + inline bool IsDebugOutputEnabled() { return g_bDbgOutput; } inline void SetDMLExposed(bool exposed) { g_bDMLExposed = exposed; } - + inline bool IsDMLExposed() { return g_bDMLExposed; } @@ -372,7 +578,7 @@ namespace Output * * \**********************************************************************/ CachedString BuildVCValue(CLRDATA_ADDRESS mt, CLRDATA_ADDRESS addr, FormatType type, bool fill = true); - + /**********************************************************************\ * This function builds a DML string for an object. If DML is enabled, * @@ -484,7 +690,7 @@ class BaseString : mStr(0), mSize(0), mLength(0) { const size_t size = 64; - + mStr = new T[size]; mSize = size; mStr[0] = 0; @@ -548,7 +754,7 @@ class BaseString { return mStr; } - + const T *c_str() const { return mStr; @@ -566,11 +772,11 @@ class BaseString const size_t size = len1 + len2 + 1 + ((len1 + len2) >> 1); mStr = new T[size]; mSize = size; - + CopyFrom(str1, len1); CopyFrom(str2, len2); } - + void Clear() { mLength = 0; @@ -616,7 +822,7 @@ class BaseString { newStr[0] = 0; } - + mStr = newStr; mSize = size; } @@ -705,7 +911,7 @@ namespace Output { const int len = GetDMLWidth(mDml); char *buffer = (char*)alloca(len); - + BuildDML(buffer, len, (CLRDATA_ADDRESS)mValue, mFormat, mDml); DMLOut(buffer); } @@ -754,7 +960,7 @@ namespace Output { const int len = GetDMLColWidth(mDml, width); char *buffer = (char*)alloca(len); - + BuildDMLCol(buffer, len, (CLRDATA_ADDRESS)mValue, mFormat, mDml, leftAlign, width); DMLOut(buffer); } @@ -792,7 +998,7 @@ namespace Output } } } - + /* Converts this object into a Wide char string. This allows you to write the following code: * WString foo = L"bar " + ObjectPtr(obj); * Where ObjectPtr is a subclass/typedef of this Format class. @@ -801,15 +1007,15 @@ namespace Output { String str = *this; const char *cstr = (const char *)str; - + int len = MultiByteToWideChar(CP_ACP, 0, cstr, -1, NULL, 0); WCHAR *buffer = (WCHAR *)alloca(len*sizeof(WCHAR)); - + MultiByteToWideChar(CP_ACP, 0, cstr, -1, buffer, len); - + return WString(buffer); } - + /* Converts this object into a String object. This allows you to write the following code: * String foo = "bar " + ObjectPtr(obj); * Where ObjectPtr is a subclass/typedef of this Format class. @@ -820,7 +1026,7 @@ namespace Output { const int len = GetDMLColWidth(mDml, 0); char *buffer = (char*)alloca(len); - + BuildDMLCol(buffer, len, (CLRDATA_ADDRESS)mValue, mFormat, mDml, false, 0); return buffer; } @@ -845,7 +1051,7 @@ namespace Output sprintf_s(buffer, _countof(buffer), format, (__int32)mValue); ConvertToLower(buffer, _countof(buffer)); } - + return buffer; } } @@ -890,38 +1096,38 @@ namespace Output { BuildDMLCol(result, len, value, format, dmlType, true, 0); } - + static int GetDMLWidth(Output::FormatType dmlType) { return GetDMLColWidth(dmlType, 0); } - + static void BuildDMLCol(__out_ecount(len) char *result, int len, CLRDATA_ADDRESS value, Formats::Format format, Output::FormatType dmlType, bool leftAlign, int width) { char hex[64]; int count = GetHex(value, hex, _countof(hex), format != Formats::Hex); int i = 0; - + if (!leftAlign) { for (; i < width - count; ++i) result[i] = ' '; - + result[i] = 0; } - + int written = sprintf_s(result+i, len - i, DMLFormats[dmlType], hex, hex); - + SOS_Assert(written != -1); if (written != -1) { for (i = i + written; i < width; ++i) result[i] = ' '; - + result[i] = 0; } } - + static int GetDMLColWidth(Output::FormatType dmlType, int width) { return 1 + 4*sizeof(int*) + (int)strlen(DMLFormats[dmlType]) + width; @@ -965,7 +1171,7 @@ namespace Output precision = width; const char *format = align == AlignLeft ? "%-*.*s" : "%*.*s"; - + if (IsDMLEnabled()) DMLOut(format, width, precision, mValue); else @@ -991,7 +1197,7 @@ namespace Output : mValue(rhs.mValue) { } - + void Output() const { if (IsDMLEnabled()) @@ -1143,7 +1349,7 @@ class TableOutput */ void ReInit(int numColumns, int defaultColumnWidth, Alignment alignmentDefault = AlignLeft, int indent = 0, int padding = 1); - /* Sets the amount of whitespace to prefix at the start of the row (in characters). + /* Sets the amount of whitespace to prefix at the start of the row (in characters). */ void SetIndent(int indent) { @@ -1180,7 +1386,7 @@ class TableOutput */ void SetColAlignment(int col, Alignment align); - + /* The WriteRow family of functions allows you to write an entire row of the table at once. * The common use case for the TableOutput class is to individually output each column after * calculating what the value should contain. However, this would be tedious if you already @@ -1214,7 +1420,7 @@ class TableOutput WriteColumn(3, t3); } - + template void WriteRow(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) { @@ -1224,7 +1430,7 @@ class TableOutput WriteColumn(3, t3); WriteColumn(4, t4); } - + template void WriteRow(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) { @@ -1279,7 +1485,7 @@ class TableOutput if (col == 0) OutputIndent(); - + bool lastCol = col == mColumns - 1; if (!lastCol) @@ -1294,7 +1500,7 @@ class TableOutput else mCurrCol = col+1; } - + template void WriteColumn(int col, T t) { @@ -1320,7 +1526,7 @@ class TableOutput { WriteColumn(col, Output::Format(str)); } - + inline void WriteColumn(int col, __in_z char *str) { WriteColumn(col, Output::Format(str)); @@ -1335,7 +1541,7 @@ class TableOutput SOS_Assert(strstr(fmt, "%S") == NULL); char result[128]; - + va_list list; va_start(list, fmt); vsprintf_s(result, _countof(result), fmt, list); @@ -1343,11 +1549,11 @@ class TableOutput WriteColumn(col, result); } - + void WriteColumnFormat(int col, const WCHAR *fmt, ...) { WCHAR result[128]; - + va_list list; va_start(list, fmt); vswprintf_s(result, _countof(result), fmt, list); @@ -1380,7 +1586,7 @@ class TableOutput int *mWidths; Alignment *mAlignments; }; - + #ifndef FEATURE_PAL HRESULT GetClrModuleImages(__in IXCLRDataModule* module, __in CLRDataModuleExtentType desiredType, __out PULONG64 pBase, __out PULONG64 pSize); #endif @@ -1399,11 +1605,11 @@ int GetObjFieldOffset(CLRDATA_ADDRESS cdaObj, CLRDATA_ADDRESS cdaMT, __in_z LPCW int GetValueFieldOffset(CLRDATA_ADDRESS cdaMT, __in_z LPCWSTR wszFieldName, DacpFieldDescData* pDacpFieldDescData); BOOL IsValidToken(DWORD_PTR ModuleAddr, mdTypeDef mb); -void NameForToken_s(DacpModuleData *pModule, mdTypeDef mb, __out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName, +void NameForToken_s(DacpModuleData *pModule, mdTypeDef mb, __out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName, bool bClassName=true); -void NameForToken_s(DWORD_PTR ModuleAddr, mdTypeDef mb, __out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName, +void NameForToken_s(DWORD_PTR ModuleAddr, mdTypeDef mb, __out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName, bool bClassName=true); -HRESULT NameForToken_s(mdTypeDef mb, IMetaDataImport *pImport, __out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName, +HRESULT NameForToken_s(mdTypeDef mb, IMetaDataImport *pImport, __out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName, bool bClassName); void vmmap(); @@ -1445,7 +1651,7 @@ DllsName( inline BOOL IsElementValueType (CorElementType cet) { - return (cet >= ELEMENT_TYPE_BOOLEAN && cet <= ELEMENT_TYPE_R8) + return (cet >= ELEMENT_TYPE_BOOLEAN && cet <= ELEMENT_TYPE_R8) || cet == ELEMENT_TYPE_VALUETYPE || cet == ELEMENT_TYPE_I || cet == ELEMENT_TYPE_U; } @@ -1473,11 +1679,11 @@ class ToRelease ToRelease() : m_ptr(NULL) {} - + ToRelease(T* ptr) : m_ptr(ptr) {} - + ~ToRelease() { Release(); @@ -1516,7 +1722,7 @@ class ToRelease m_ptr = NULL; return pT; } - + void Release() { if (m_ptr != NULL) @@ -1527,7 +1733,7 @@ class ToRelease } private: - T* m_ptr; + T* m_ptr; }; BOOL InitializeHeapData(); @@ -1603,11 +1809,11 @@ struct GenUsageStat struct HeapUsageStat { - GenUsageStat genUsage[4]; // gen0, 1, 2, LOH + GenUsageStat genUsage[5]; // gen0, 1, 2, LOH, POH }; extern DacpUsefulGlobalsData g_special_usefulGlobals; -BOOL GCHeapUsageStats(const DacpGcHeapDetails& heap, BOOL bIncUnreachable, HeapUsageStat *hpUsage); +BOOL GCHeapUsageStats(const GCHeapDetails& heap, BOOL bIncUnreachable, HeapUsageStat *hpUsage); class HeapStat { @@ -1705,8 +1911,8 @@ class MethodTableCache void Clear (); private: - int CompareData(DWORD_PTR n1, DWORD_PTR n2); - void ReverseLeftMost (Node *root); + int CompareData(DWORD_PTR n1, DWORD_PTR n2); + void ReverseLeftMost (Node *root); }; extern MethodTableCache g_special_mtCache; @@ -1718,7 +1924,7 @@ struct DumpArrayFlags BOOL bDetail; LPSTR strObject; BOOL bNoFieldsForElement; - + DumpArrayFlags () : startIndex(0), Length((DWORD_PTR)-1), bDetail(FALSE), strObject (0), bNoFieldsForElement(FALSE) {} @@ -1748,7 +1954,7 @@ struct DumpArrayFlags HRESULT GetMTOfObject(TADDR obj, TADDR *mt); -struct needed_alloc_context +struct needed_alloc_context { BYTE* alloc_ptr; // starting point for next allocation BYTE* alloc_limit; // ending point for allocation region/quantum @@ -1769,16 +1975,16 @@ struct AllocInfo GetAllocContextPtrs(this); } ~AllocInfo() - { - if (array != NULL) - delete[] array; + { + if (array != NULL) + delete[] array; } }; struct GCHandleStatistics { HeapStat hs; - + DWORD strongHandleCount; DWORD pinnedHandleCount; DWORD asyncPinnedHandleCount; @@ -1806,7 +2012,7 @@ struct SegmentLookup DacpHeapSegmentData *m_segments; int m_iSegmentsSize; int m_iSegmentCount; - + SegmentLookup(); ~SegmentLookup(); @@ -1819,11 +2025,11 @@ class GCHeapSnapshot { private: BOOL m_isBuilt; - DacpGcHeapDetails *m_heapDetails; + GCHeapDetails *m_heapDetails; DacpGcHeapData m_gcheap; SegmentLookup m_segments; - BOOL AddSegments(DacpGcHeapDetails& details); + BOOL AddSegments(const GCHeapDetails& details); public: GCHeapSnapshot(); @@ -1832,16 +2038,16 @@ class GCHeapSnapshot BOOL IsBuilt() { return m_isBuilt; } DacpGcHeapData *GetHeapData() { return &m_gcheap; } - - int GetHeapCount() { return m_gcheap.HeapCount; } - - DacpGcHeapDetails *GetHeap(CLRDATA_ADDRESS objectPointer); + + int GetHeapCount() { return m_gcheap.HeapCount; } + + GCHeapDetails *GetHeap(CLRDATA_ADDRESS objectPointer); int GetGeneration(CLRDATA_ADDRESS objectPointer); - + }; extern GCHeapSnapshot g_snapshot; - + BOOL IsSameModuleName (const char *str1, const char *str2); BOOL IsModule (DWORD_PTR moduleAddr); BOOL IsMethodDesc (DWORD_PTR value); @@ -1875,7 +2081,7 @@ HRESULT GetModuleFromAddress(___in CLRDATA_ADDRESS peAddress, ___out IXCLRDataMo void GetInfoFromName(DWORD_PTR ModuleAddr, const char* name, mdTypeDef* retMdTypeDef=NULL); void GetInfoFromModule (DWORD_PTR ModuleAddr, ULONG token, DWORD_PTR *ret=NULL); - + typedef void (*VISITGCHEAPFUNC)(DWORD_PTR objAddr,size_t Size,DWORD_PTR methodTable,LPVOID token); BOOL GCHeapsTraverse(VISITGCHEAPFUNC pFunc, LPVOID token, BOOL verify=true); @@ -1911,13 +2117,13 @@ void GatherOneHeapFinalization(DacpGcHeapDetails& heapDetails, HeapStat *stat, B CLRDATA_ADDRESS GetAppDomainForMT(CLRDATA_ADDRESS mtPtr); CLRDATA_ADDRESS GetAppDomain(CLRDATA_ADDRESS objPtr); -void GCHeapInfo(const DacpGcHeapDetails &heap, DWORD_PTR &total_size); -BOOL GCObjInHeap(TADDR taddrObj, const DacpGcHeapDetails &heap, +void GCHeapInfo(const GCHeapDetails &heap, DWORD_PTR &total_size); +BOOL GCObjInHeap(TADDR taddrObj, const GCHeapDetails &heap, TADDR_SEGINFO& trngSeg, int& gen, TADDR_RANGE& allocCtx, BOOL &bLarge); -BOOL VerifyObject(const DacpGcHeapDetails &heap, const DacpHeapSegmentData &seg, DWORD_PTR objAddr, DWORD_PTR MTAddr, size_t objSize, +BOOL VerifyObject(const GCHeapDetails &heap, const DacpHeapSegmentData &seg, DWORD_PTR objAddr, DWORD_PTR MTAddr, size_t objSize, BOOL bVerifyMember); -BOOL VerifyObject(const DacpGcHeapDetails &heap, DWORD_PTR objAddr, DWORD_PTR MTAddr, size_t objSize, +BOOL VerifyObject(const GCHeapDetails &heap, DWORD_PTR objAddr, DWORD_PTR MTAddr, size_t objSize, BOOL bVerifyMember); BOOL IsMTForFreeObj(DWORD_PTR pMT); @@ -1961,7 +2167,7 @@ size_t NextOSPageAddress (size_t addr); // This version of objectsize reduces the lookup of methodtables in the DAC. // It uses g_special_mtCache for it's work. -BOOL GetSizeEfficient(DWORD_PTR dwAddrCurrObj, +BOOL GetSizeEfficient(DWORD_PTR dwAddrCurrObj, DWORD_PTR dwAddrMethTable, BOOL bLarge, size_t& s, BOOL& bContainsPointers); BOOL GetCollectibleDataEfficient(DWORD_PTR dwAddrMethTable, BOOL& bCollectible, TADDR& loaderAllocatorObjectHandle); @@ -1974,7 +2180,7 @@ void CharArrayContent(TADDR pos, ULONG num, bool widechar); void StringObjectContent (size_t obj, BOOL fLiteral=FALSE, const int length=-1); // length=-1: dump everything in the string object. UINT FindAllPinnedAndStrong (DWORD_PTR handlearray[],UINT arraySize); -void PrintNotReachableInRange(TADDR rngStart, TADDR rngEnd, BOOL bExcludeReadyForFinalization, +void PrintNotReachableInRange(TADDR rngStart, TADDR rngEnd, BOOL bExcludeReadyForFinalization, HeapStat* stat, BOOL bShort); const char *EHTypeName(EHClauseType et); @@ -2012,7 +2218,7 @@ extern IMetaDataImport* MDImportForModule (DWORD_PTR pModule); // 520 bytes, so use accordinly. // //***************************************************************************** -template +template class CQuickBytesBase { public: @@ -2041,7 +2247,7 @@ class CQuickBytesBase } else { - if (pbBuff) + if (pbBuff) delete[] (BYTE*)pbBuff; pbBuff = new BYTE[iItems]; cbTotal = pbBuff ? iItems : 0; @@ -2071,7 +2277,7 @@ class CQuickBytesBase pbBuffNew = new BYTE[iItems + INCREMENT]; if (!pbBuffNew) return E_OUTOFMEMORY; - if (pbBuff) + if (pbBuff) { memcpy(pbBuffNew, pbBuff, cbTotal); delete[] (BYTE*)pbBuff; @@ -2085,7 +2291,7 @@ class CQuickBytesBase iSize = iItems; pbBuff = pbBuffNew; return NOERROR; - + } operator PVOID() @@ -2125,12 +2331,12 @@ class CQuickBytes : public CQuickBytesNoDtor } }; -template +template class CQuickBytesNoDtorSpecifySize : public CQuickBytesBase { }; -template +template class CQuickBytesSpecifySize : public CQuickBytesNoDtorSpecifySize { public: @@ -2144,7 +2350,7 @@ class CQuickBytesSpecifySize : public CQuickBytesNoDtorSpecifySize +class CQuickString : public CQuickBytesBase { public: CQuickString() { } @@ -2153,7 +2359,7 @@ class CQuickString : public CQuickBytesBase { Destroy(); } - + void *Alloc(SIZE_T iItems) { return CQuickBytesBase::Alloc(iItems*sizeof(WCHAR)); @@ -2209,7 +2415,7 @@ int _ui64toa_s( unsigned __int64 inValue, char* outBuffer, size_t inDestBufferS struct MemRange { - MemRange (ULONG64 s = NULL, size_t l = 0, MemRange * n = NULL) + MemRange (ULONG64 s = NULL, size_t l = 0, MemRange * n = NULL) : start(s), len (l), next (n) {} @@ -2217,7 +2423,7 @@ struct MemRange { return addr >= start && addr < start + len; } - + ULONG64 start; size_t len; MemRange * next; @@ -2235,7 +2441,7 @@ class StressLogMem { list = new MemRange (s, l, list); } - + public: StressLogMem () : list (NULL) {} @@ -2256,7 +2462,7 @@ class PEOffsetMemoryReader : IDiaReadExeAtOffsetCallback HRESULT __stdcall QueryInterface(REFIID riid, VOID** ppInterface); ULONG __stdcall AddRef(); ULONG __stdcall Release(); - + // IDiaReadExeAtOffsetCallback implementation HRESULT __stdcall ReadExecutableAt(DWORDLONG fileOffset, DWORD cbData, DWORD* pcbData, BYTE data[]); @@ -2277,7 +2483,7 @@ class PERvaMemoryReader : IDiaReadExeAtRVACallback HRESULT __stdcall QueryInterface(REFIID riid, VOID** ppInterface); ULONG __stdcall AddRef(); ULONG __stdcall Release(); - + // IDiaReadExeAtOffsetCallback implementation HRESULT __stdcall ReadExecutableAtRVA(DWORD relativeVirtualAddress, DWORD cbData, DWORD* pcbData, BYTE data[]); @@ -2513,7 +2719,7 @@ typedef DECLSPEC_ALIGN(8) struct { #define ARM64_MAX_BREAKPOINTS 8 #define ARM64_MAX_WATCHPOINTS 2 typedef struct { - + DWORD ContextFlags; DWORD Cpsr; // NZVF + DAIF + CurrentEL + SPSel union { @@ -2631,7 +2837,7 @@ class LinearReadCache // If MoveToPage succeeds, we MUST be on the right page. _ASSERTE(addr >= mCurrPageStart); - + // However, the amount of data requested may fall off of the page. In that case, // fall back to MisalignedRead. TADDR offset = addr - mCurrPageStart; @@ -2654,7 +2860,7 @@ class LinearReadCache { if (size <= mCurrPageSize) return; - + // Total bytes to read, don't overflow buffer. unsigned int total = size + mCurrPageSize; if (total + mCurrPageSize > mPageSize) @@ -2676,7 +2882,7 @@ class LinearReadCache MoveToPage(start, size); } } - + void ClearStats() { #ifdef _DEBUG @@ -2685,7 +2891,7 @@ class LinearReadCache mMisaligned = 0; #endif } - + void PrintStats(const char *func) { #ifdef _DEBUG @@ -2723,7 +2929,7 @@ class LinearReadCache TADDR mCurrPageStart; ULONG mPageSize, mCurrPageSize; BYTE *mPage; - + int mMisses, mReads, mMisaligned; }; @@ -2750,10 +2956,10 @@ class HeapTraverser size_t m_objVisited; // for UI updates bool m_verify; LinearReadCache mCache; - + std::unordered_map> mDependentHandleMap; - -public: + +public: HeapTraverser(bool verify); ~HeapTraverser(); @@ -2762,11 +2968,11 @@ class HeapTraverser BOOL Initialize(); BOOL CreateReport (FILE *fp, int format); -private: +private: // First all types are added to a tree void insert(size_t mTable); - size_t getID(size_t mTable); - + size_t getID(size_t mTable); + // Functions for writing to the output file. void PrintType(size_t ID,LPCWSTR name); @@ -2778,13 +2984,13 @@ class HeapTraverser void PrintRootHead(); void PrintRoot(LPCWSTR kind,size_t Value); void PrintRootTail(); - + void PrintSection(int Type,BOOL bOpening); // Root and object member helper functions void FindGCRootOnStacks(); void PrintRefs(size_t obj, size_t methodTable, size_t size); - + // Callback functions used during traversals static void GatherTypes(DWORD_PTR objAddr,size_t Size,DWORD_PTR methodTable, LPVOID token); static void PrintHeap(DWORD_PTR objAddr,size_t Size,DWORD_PTR methodTable, LPVOID token); @@ -2810,15 +3016,15 @@ class GCRootImpl bool Collectible; size_t BaseSize; size_t ComponentSize; - + const WCHAR *GetTypeName() { if (!TypeName) TypeName = CreateMethodTableName(MethodTable); - + if (!TypeName) return W(""); - + return TypeName; } @@ -2848,13 +3054,13 @@ class GCRootImpl bool FilledRefs; bool FromDependentHandle; RootNode *GCRefs; - - + + const WCHAR *GetTypeName() { if (!MTInfo) return W(""); - + return MTInfo->GetTypeName(); } @@ -2880,11 +3086,11 @@ class GCRootImpl FromDependentHandle = false; GCRefs = 0; } - + void Remove(RootNode *&list) { RootNode *curr_next = Next; - + // We've already considered this object, remove it. if (Prev == NULL) { @@ -2951,7 +3157,7 @@ class GCRootImpl RootNode *FilterRoots(RootNode *&list); RootNode *FindPathToTarget(TADDR root); RootNode *GetGCRefs(RootNode *path, RootNode *node); - + void InitDependentHandleMap(); //Reporting: @@ -2976,20 +3182,20 @@ class GCRootImpl void DeleteNode(RootNode *node); private: - + bool mAll, // Print all roots or just unique roots? mSize; // Print rooting information or total size info? std::list mCleanupList; // A list of RootNode's we've newed up. This is only used to delete all of them later. std::list mRootNewList; // A list of unused RootNodes that are free to use instead of having to "new" up more. - + std::unordered_map mMTs; // The MethodTable cache which maps from MT -> MethodTable data (size, gcdesc, string typename) std::unordered_map mTargets; // The objects that we are searching for. std::unordered_set mConsidered; // A hashtable of objects we've already visited. std::unordered_map mSizes; // A mapping from object address to total size of data the object roots. - + std::unordered_map> mDependentHandleMap; - + LinearReadCache mCache; // A linear cache which stops us from having to read from the target process more than 1-2 times per object. }; diff --git a/src/inc/sospriv.idl b/src/inc/sospriv.idl index 89a7d84693..e29ef5692f 100644 --- a/src/inc/sospriv.idl +++ b/src/inc/sospriv.idl @@ -44,7 +44,7 @@ typedef unsigned int size_t; typedef int ModuleMapType; typedef int VCSHeapType; cpp_quote("#endif") - + cpp_quote("typedef enum { TYPEDEFTOMETHODTABLE, TYPEREFTOMETHODTABLE } ModuleMapType;") cpp_quote("typedef enum {IndcellHeap, LookupHeap, ResolveHeap, DispatchHeap, CacheEntryHeap} VCSHeapType;") @@ -52,7 +52,7 @@ cpp_quote("typedef enum {IndcellHeap, LookupHeap, ResolveHeap, DispatchHeap, Cac typedef void (*MODULEMAPTRAVERSE)(UINT index, CLRDATA_ADDRESS methodTable,LPVOID token); typedef void (*VISITHEAP)(CLRDATA_ADDRESS blockData,size_t blockSize,BOOL blockIsCurrentBlock); -typedef BOOL (*VISITRCWFORCLEANUP)(CLRDATA_ADDRESS RCW,CLRDATA_ADDRESS Context,CLRDATA_ADDRESS Thread, +typedef BOOL (*VISITRCWFORCLEANUP)(CLRDATA_ADDRESS RCW,CLRDATA_ADDRESS Context,CLRDATA_ADDRESS Thread, BOOL bIsFreeThreaded, LPVOID token); typedef BOOL (*DUMPEHINFO)(UINT clauseIndex,UINT totalClauses, struct DACEHInfo *pEHInfo,LPVOID token); @@ -66,7 +66,7 @@ typedef struct _SOSHandleData CLRDATA_ADDRESS Secondary; unsigned int Type; BOOL StrongReference; - + // For RefCounted Handles unsigned int RefCount; unsigned int JupiterRefCount; @@ -123,7 +123,7 @@ typedef struct _SOS_StackRefData CLRDATA_ADDRESS Address; CLRDATA_ADDRESS Object; unsigned int Flags; - + SOSStackSourceType SourceType; CLRDATA_ADDRESS Source; CLRDATA_ADDRESS StackPointer; @@ -163,8 +163,8 @@ interface ISOSStackRefEnum : ISOSEnum HRESULT Next([in] unsigned int count, [out, size_is(count), length_is(*pFetched)] SOSStackRefData ref[], [out] unsigned int *pFetched); - - + + /* Reports all frames which we could not enumerate gc references for. */ HRESULT EnumerateErrors([out] ISOSStackRefErrorEnum **ppEnum); @@ -180,31 +180,31 @@ interface ISOSDacInterface : IUnknown { // ThreadStore HRESULT GetThreadStoreData(struct DacpThreadStoreData *data); - + // AppDomains HRESULT GetAppDomainStoreData(struct DacpAppDomainStoreData *data); HRESULT GetAppDomainList(unsigned int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded); HRESULT GetAppDomainData(CLRDATA_ADDRESS addr, struct DacpAppDomainData *data); HRESULT GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, WCHAR *name, unsigned int *pNeeded); HRESULT GetDomainFromContext(CLRDATA_ADDRESS context, CLRDATA_ADDRESS *domain); - + // Assemblies HRESULT GetAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], int *pNeeded); HRESULT GetAssemblyData(CLRDATA_ADDRESS baseDomainPtr, CLRDATA_ADDRESS assembly, struct DacpAssemblyData *data); HRESULT GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded); - + // Modules HRESULT GetModule(CLRDATA_ADDRESS addr, IXCLRDataModule **mod); HRESULT GetModuleData(CLRDATA_ADDRESS moduleAddr, struct DacpModuleData *data); HRESULT TraverseModuleMap(ModuleMapType mmt, CLRDATA_ADDRESS moduleAddr, MODULEMAPTRAVERSE pCallback, LPVOID token); HRESULT GetAssemblyModuleList(CLRDATA_ADDRESS assembly, unsigned int count, CLRDATA_ADDRESS modules[], unsigned int *pNeeded); HRESULT GetILForModule(CLRDATA_ADDRESS moduleAddr, DWORD rva, CLRDATA_ADDRESS *il); - + // Threads HRESULT GetThreadData(CLRDATA_ADDRESS thread, struct DacpThreadData *data); HRESULT GetThreadFromThinlockID(UINT thinLockId, CLRDATA_ADDRESS *pThread); HRESULT GetStackLimits(CLRDATA_ADDRESS threadPtr, CLRDATA_ADDRESS *lower, CLRDATA_ADDRESS *upper, CLRDATA_ADDRESS *fp); - + // MethodDescs HRESULT GetMethodDescData(CLRDATA_ADDRESS methodDesc, CLRDATA_ADDRESS ip, struct DacpMethodDescData *data, ULONG cRevertedRejitVersions, struct DacpReJitData * rgRevertedRejitData, ULONG * pcNeededRevertedRejitData); HRESULT GetMethodDescPtrFromIP(CLRDATA_ADDRESS ip, CLRDATA_ADDRESS * ppMD); @@ -228,7 +228,7 @@ interface ISOSDacInterface : IUnknown HRESULT GetObjectData(CLRDATA_ADDRESS objAddr, struct DacpObjectData *data); HRESULT GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, WCHAR *stringData, unsigned int *pNeeded); HRESULT GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, WCHAR *className, unsigned int *pNeeded); - + // MethodTable HRESULT GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, WCHAR *mtName, unsigned int *pNeeded); HRESULT GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData *data); @@ -238,7 +238,7 @@ interface ISOSDacInterface : IUnknown // EEClass HRESULT GetMethodTableForEEClass(CLRDATA_ADDRESS eeClass, CLRDATA_ADDRESS *value); - + // FieldDesc HRESULT GetFieldDescData(CLRDATA_ADDRESS fieldDesc, struct DacpFieldDescData *data); @@ -260,7 +260,7 @@ interface ISOSDacInterface : IUnknown HRESULT GetOOMStaticData(struct DacpOomData *data); HRESULT GetHeapAnalyzeData(CLRDATA_ADDRESS addr, struct DacpGcHeapAnalyzeData *data); HRESULT GetHeapAnalyzeStaticData(struct DacpGcHeapAnalyzeData *data); - + // DomainLocal HRESULT GetDomainLocalModuleData(CLRDATA_ADDRESS addr, struct DacpDomainLocalModuleData *data); HRESULT GetDomainLocalModuleDataFromAppDomain(CLRDATA_ADDRESS appDomainAddr, int moduleID, struct DacpDomainLocalModuleData *data); @@ -281,7 +281,7 @@ interface ISOSDacInterface : IUnknown // EH HRESULT TraverseEHInfo(CLRDATA_ADDRESS ip, DUMPEHINFO pCallback, LPVOID token); HRESULT GetNestedExceptionData(CLRDATA_ADDRESS exception, CLRDATA_ADDRESS *exceptionObject, CLRDATA_ADDRESS *nextNestedException); - + // StressLog HRESULT GetStressLogAddress(CLRDATA_ADDRESS *stressLog); @@ -302,9 +302,9 @@ interface ISOSDacInterface : IUnknown HRESULT GetCCWData(CLRDATA_ADDRESS ccw, struct DacpCCWData *data); HRESULT GetCCWInterfaces(CLRDATA_ADDRESS ccw, unsigned int count, struct DacpCOMInterfacePointerData *interfaces, unsigned int *pNeeded); HRESULT TraverseRCWCleanupList(CLRDATA_ADDRESS cleanupListPtr, VISITRCWFORCLEANUP pCallback, LPVOID token); - + // GC Reference Functions - + /* GetStackReferences * Enumerates all references on a given callstack. */ @@ -313,7 +313,7 @@ interface ISOSDacInterface : IUnknown HRESULT GetThreadAllocData(CLRDATA_ADDRESS thread, struct DacpAllocData *data); HRESULT GetHeapAllocData(unsigned int count, struct DacpGenerationAllocData *data, unsigned int *pNeeded); - + // For BindingDisplay plugin HRESULT GetFailedAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded); HRESULT GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count, WCHAR *paths, unsigned int *pNeeded); @@ -390,3 +390,21 @@ interface ISOSDacInterface7 : IUnknown HRESULT GetProfilerModifiedILInformation(CLRDATA_ADDRESS methodDesc, struct DacpProfilerILData *pILData); HRESULT GetMethodsWithProfilerModifiedIL(CLRDATA_ADDRESS mod, CLRDATA_ADDRESS *methodDescs, int cMethodDescs, int *pcMethodDescs); }; + +[ + object, + local, + uuid(c12f35a9-e55c-4520-a894-b3dc5165dfce) +] +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); + + // SVR + HRESULT GetGenerationTableSvr(CLRDATA_ADDRESS heapAddr, unsigned int cGenerations, struct DacpGenerationData *pGenerationData, unsigned int *pNeeded); + HRESULT GetFinalizationFillPointersSvr(CLRDATA_ADDRESS heapAddr, unsigned int cFillPointers, CLRDATA_ADDRESS *pFinalizationFillPointers, unsigned int *pNeeded); +} diff --git a/src/pal/prebuilt/inc/sospriv.h b/src/pal/prebuilt/inc/sospriv.h index 2f03eb0134..21040e2ebe 100644 --- a/src/pal/prebuilt/inc/sospriv.h +++ b/src/pal/prebuilt/inc/sospriv.h @@ -6,11 +6,11 @@ /* 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: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622 +/* 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 - VC __declspec() decoration level: + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ @@ -43,7 +43,7 @@ #pragma once #endif -/* Forward Declarations */ +/* Forward Declarations */ #ifndef __ISOSEnum_FWD_DEFINED__ #define __ISOSEnum_FWD_DEFINED__ @@ -122,17 +122,24 @@ typedef interface ISOSDacInterface7 ISOSDacInterface7; #endif /* __ISOSDacInterface7_FWD_DEFINED__ */ +#ifndef __ISOSDacInterface8_FWD_DEFINED__ +#define __ISOSDacInterface8_FWD_DEFINED__ +typedef interface ISOSDacInterface8 ISOSDacInterface8; + +#endif /* __ISOSDacInterface8_FWD_DEFINED__ */ + + /* header files for imported files */ #include "unknwn.h" #include "xclrdata.h" #ifdef __cplusplus extern "C"{ -#endif +#endif /* interface __MIDL_itf_sospriv_0000_0000 */ -/* [local] */ +/* [local] */ @@ -176,24 +183,24 @@ typedef int VCSHeapType; #endif typedef enum { TYPEDEFTOMETHODTABLE, TYPEREFTOMETHODTABLE } ModuleMapType; typedef enum {IndcellHeap, LookupHeap, ResolveHeap, DispatchHeap, CacheEntryHeap} VCSHeapType; -typedef void ( *MODULEMAPTRAVERSE )( +typedef void ( *MODULEMAPTRAVERSE )( UINT index, CLRDATA_ADDRESS methodTable, LPVOID token); -typedef void ( *VISITHEAP )( +typedef void ( *VISITHEAP )( CLRDATA_ADDRESS blockData, size_t blockSize, BOOL blockIsCurrentBlock); -typedef BOOL ( *VISITRCWFORCLEANUP )( +typedef BOOL ( *VISITRCWFORCLEANUP )( CLRDATA_ADDRESS RCW, CLRDATA_ADDRESS Context, CLRDATA_ADDRESS Thread, BOOL bIsFreeThreaded, LPVOID token); -typedef BOOL ( *DUMPEHINFO )( +typedef BOOL ( *DUMPEHINFO )( UINT clauseIndex, UINT totalClauses, struct DACEHInfo *pEHInfo, @@ -223,57 +230,57 @@ extern RPC_IF_HANDLE __MIDL_itf_sospriv_0000_0000_v0_0_s_ifspec; #define __ISOSEnum_INTERFACE_DEFINED__ /* interface ISOSEnum */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("286CA186-E763-4F61-9760-487D43AE4341") ISOSEnum : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE Skip( + virtual HRESULT STDMETHODCALLTYPE Skip( /* [in] */ unsigned int count) = 0; - + virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCount( + + virtual HRESULT STDMETHODCALLTYPE GetCount( /* [out] */ unsigned int *pCount) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ISOSEnum * This, /* [in] */ unsigned int count); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ISOSEnum * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ISOSEnum * This, /* [out] */ unsigned int *pCount); - + END_INTERFACE } ISOSEnumVtbl; @@ -282,29 +289,29 @@ EXTERN_C const IID IID_ISOSEnum; CONST_VTBL struct ISOSEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSEnum_Skip(This,count) \ - ( (This)->lpVtbl -> Skip(This,count) ) + ( (This)->lpVtbl -> Skip(This,count) ) #define ISOSEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ISOSEnum_GetCount(This,pCount) \ - ( (This)->lpVtbl -> GetCount(This,pCount) ) + ( (This)->lpVtbl -> GetCount(This,pCount) ) #endif /* COBJMACROS */ @@ -321,60 +328,60 @@ EXTERN_C const IID IID_ISOSEnum; #define __ISOSHandleEnum_INTERFACE_DEFINED__ /* interface ISOSHandleEnum */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSHandleEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("3E269830-4A2B-4301-8EE2-D6805B29B2FA") ISOSHandleEnum : public ISOSEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ unsigned int count, /* [length_is][size_is][out] */ SOSHandleData handles[ ], /* [out] */ unsigned int *pNeeded) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSHandleEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSHandleEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSHandleEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSHandleEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ISOSHandleEnum * This, /* [in] */ unsigned int count); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ISOSHandleEnum * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ISOSHandleEnum * This, /* [out] */ unsigned int *pCount); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ISOSHandleEnum * This, /* [in] */ unsigned int count, /* [length_is][size_is][out] */ SOSHandleData handles[ ], /* [out] */ unsigned int *pNeeded); - + END_INTERFACE } ISOSHandleEnumVtbl; @@ -383,33 +390,33 @@ EXTERN_C const IID IID_ISOSHandleEnum; CONST_VTBL struct ISOSHandleEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSHandleEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSHandleEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSHandleEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSHandleEnum_Skip(This,count) \ - ( (This)->lpVtbl -> Skip(This,count) ) + ( (This)->lpVtbl -> Skip(This,count) ) #define ISOSHandleEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ISOSHandleEnum_GetCount(This,pCount) \ - ( (This)->lpVtbl -> GetCount(This,pCount) ) + ( (This)->lpVtbl -> GetCount(This,pCount) ) #define ISOSHandleEnum_Next(This,count,handles,pNeeded) \ - ( (This)->lpVtbl -> Next(This,count,handles,pNeeded) ) + ( (This)->lpVtbl -> Next(This,count,handles,pNeeded) ) #endif /* COBJMACROS */ @@ -423,18 +430,18 @@ EXTERN_C const IID IID_ISOSHandleEnum; /* interface __MIDL_itf_sospriv_0000_0002 */ -/* [local] */ +/* [local] */ #ifndef _SOS_StackReference_ #define _SOS_StackReference_ -typedef +typedef enum SOSStackSourceType { SOS_StackSourceIP = 0, - SOS_StackSourceFrame = ( SOS_StackSourceIP + 1 ) + SOS_StackSourceFrame = ( SOS_StackSourceIP + 1 ) } SOSStackSourceType; -typedef +typedef enum SOSRefFlags { SOSRefInterior = 1, @@ -471,60 +478,60 @@ extern RPC_IF_HANDLE __MIDL_itf_sospriv_0000_0002_v0_0_s_ifspec; #define __ISOSStackRefErrorEnum_INTERFACE_DEFINED__ /* interface ISOSStackRefErrorEnum */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSStackRefErrorEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("774F4E1B-FB7B-491B-976D-A8130FE355E9") ISOSStackRefErrorEnum : public ISOSEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ unsigned int count, /* [length_is][size_is][out] */ SOSStackRefError ref[ ], /* [out] */ unsigned int *pFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSStackRefErrorEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSStackRefErrorEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSStackRefErrorEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSStackRefErrorEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ISOSStackRefErrorEnum * This, /* [in] */ unsigned int count); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ISOSStackRefErrorEnum * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ISOSStackRefErrorEnum * This, /* [out] */ unsigned int *pCount); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ISOSStackRefErrorEnum * This, /* [in] */ unsigned int count, /* [length_is][size_is][out] */ SOSStackRefError ref[ ], /* [out] */ unsigned int *pFetched); - + END_INTERFACE } ISOSStackRefErrorEnumVtbl; @@ -533,33 +540,33 @@ EXTERN_C const IID IID_ISOSStackRefErrorEnum; CONST_VTBL struct ISOSStackRefErrorEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSStackRefErrorEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSStackRefErrorEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSStackRefErrorEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSStackRefErrorEnum_Skip(This,count) \ - ( (This)->lpVtbl -> Skip(This,count) ) + ( (This)->lpVtbl -> Skip(This,count) ) #define ISOSStackRefErrorEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ISOSStackRefErrorEnum_GetCount(This,pCount) \ - ( (This)->lpVtbl -> GetCount(This,pCount) ) + ( (This)->lpVtbl -> GetCount(This,pCount) ) #define ISOSStackRefErrorEnum_Next(This,count,ref,pFetched) \ - ( (This)->lpVtbl -> Next(This,count,ref,pFetched) ) + ( (This)->lpVtbl -> Next(This,count,ref,pFetched) ) #endif /* COBJMACROS */ @@ -576,67 +583,67 @@ EXTERN_C const IID IID_ISOSStackRefErrorEnum; #define __ISOSStackRefEnum_INTERFACE_DEFINED__ /* interface ISOSStackRefEnum */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSStackRefEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("8FA642BD-9F10-4799-9AA3-512AE78C77EE") ISOSStackRefEnum : public ISOSEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ unsigned int count, /* [length_is][size_is][out] */ SOSStackRefData ref[ ], /* [out] */ unsigned int *pFetched) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateErrors( + + virtual HRESULT STDMETHODCALLTYPE EnumerateErrors( /* [out] */ ISOSStackRefErrorEnum **ppEnum) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSStackRefEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSStackRefEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSStackRefEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSStackRefEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ISOSStackRefEnum * This, /* [in] */ unsigned int count); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ISOSStackRefEnum * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ISOSStackRefEnum * This, /* [out] */ unsigned int *pCount); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ISOSStackRefEnum * This, /* [in] */ unsigned int count, /* [length_is][size_is][out] */ SOSStackRefData ref[ ], /* [out] */ unsigned int *pFetched); - - HRESULT ( STDMETHODCALLTYPE *EnumerateErrors )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateErrors )( ISOSStackRefEnum * This, /* [out] */ ISOSStackRefErrorEnum **ppEnum); - + END_INTERFACE } ISOSStackRefEnumVtbl; @@ -645,36 +652,36 @@ EXTERN_C const IID IID_ISOSStackRefEnum; CONST_VTBL struct ISOSStackRefEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSStackRefEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSStackRefEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSStackRefEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSStackRefEnum_Skip(This,count) \ - ( (This)->lpVtbl -> Skip(This,count) ) + ( (This)->lpVtbl -> Skip(This,count) ) #define ISOSStackRefEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ISOSStackRefEnum_GetCount(This,pCount) \ - ( (This)->lpVtbl -> GetCount(This,pCount) ) + ( (This)->lpVtbl -> GetCount(This,pCount) ) #define ISOSStackRefEnum_Next(This,count,ref,pFetched) \ - ( (This)->lpVtbl -> Next(This,count,ref,pFetched) ) + ( (This)->lpVtbl -> Next(This,count,ref,pFetched) ) #define ISOSStackRefEnum_EnumerateErrors(This,ppEnum) \ - ( (This)->lpVtbl -> EnumerateErrors(This,ppEnum) ) + ( (This)->lpVtbl -> EnumerateErrors(This,ppEnum) ) #endif /* COBJMACROS */ @@ -691,546 +698,546 @@ EXTERN_C const IID IID_ISOSStackRefEnum; #define __ISOSDacInterface_INTERFACE_DEFINED__ /* interface ISOSDacInterface */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSDacInterface; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("436f00f2-b42a-4b9f-870c-e73db66ae930") ISOSDacInterface : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetThreadStoreData( + virtual HRESULT STDMETHODCALLTYPE GetThreadStoreData( struct DacpThreadStoreData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppDomainStoreData( + + virtual HRESULT STDMETHODCALLTYPE GetAppDomainStoreData( struct DacpAppDomainStoreData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppDomainList( + + virtual HRESULT STDMETHODCALLTYPE GetAppDomainList( unsigned int count, CLRDATA_ADDRESS values[ ], unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppDomainData( + + virtual HRESULT STDMETHODCALLTYPE GetAppDomainData( CLRDATA_ADDRESS addr, struct DacpAppDomainData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppDomainName( + + virtual HRESULT STDMETHODCALLTYPE GetAppDomainName( CLRDATA_ADDRESS addr, unsigned int count, WCHAR *name, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDomainFromContext( + + virtual HRESULT STDMETHODCALLTYPE GetDomainFromContext( CLRDATA_ADDRESS context, CLRDATA_ADDRESS *domain) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyList( + + virtual HRESULT STDMETHODCALLTYPE GetAssemblyList( CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[ ], int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyData( + + virtual HRESULT STDMETHODCALLTYPE GetAssemblyData( CLRDATA_ADDRESS baseDomainPtr, CLRDATA_ADDRESS assembly, struct DacpAssemblyData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyName( + + virtual HRESULT STDMETHODCALLTYPE GetAssemblyName( CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModule( + + virtual HRESULT STDMETHODCALLTYPE GetModule( CLRDATA_ADDRESS addr, IXCLRDataModule **mod) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModuleData( + + virtual HRESULT STDMETHODCALLTYPE GetModuleData( CLRDATA_ADDRESS moduleAddr, struct DacpModuleData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE TraverseModuleMap( + + virtual HRESULT STDMETHODCALLTYPE TraverseModuleMap( ModuleMapType mmt, CLRDATA_ADDRESS moduleAddr, MODULEMAPTRAVERSE pCallback, LPVOID token) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyModuleList( + + virtual HRESULT STDMETHODCALLTYPE GetAssemblyModuleList( CLRDATA_ADDRESS assembly, unsigned int count, CLRDATA_ADDRESS modules[ ], unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetILForModule( + + virtual HRESULT STDMETHODCALLTYPE GetILForModule( CLRDATA_ADDRESS moduleAddr, DWORD rva, CLRDATA_ADDRESS *il) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThreadData( + + virtual HRESULT STDMETHODCALLTYPE GetThreadData( CLRDATA_ADDRESS thread, struct DacpThreadData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThreadFromThinlockID( + + virtual HRESULT STDMETHODCALLTYPE GetThreadFromThinlockID( UINT thinLockId, CLRDATA_ADDRESS *pThread) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStackLimits( + + virtual HRESULT STDMETHODCALLTYPE GetStackLimits( CLRDATA_ADDRESS threadPtr, CLRDATA_ADDRESS *lower, CLRDATA_ADDRESS *upper, CLRDATA_ADDRESS *fp) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodDescData( + + virtual HRESULT STDMETHODCALLTYPE GetMethodDescData( CLRDATA_ADDRESS methodDesc, CLRDATA_ADDRESS ip, struct DacpMethodDescData *data, ULONG cRevertedRejitVersions, struct DacpReJitData *rgRevertedRejitData, ULONG *pcNeededRevertedRejitData) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromIP( + + virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromIP( CLRDATA_ADDRESS ip, CLRDATA_ADDRESS *ppMD) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodDescName( + + virtual HRESULT STDMETHODCALLTYPE GetMethodDescName( CLRDATA_ADDRESS methodDesc, unsigned int count, WCHAR *name, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromFrame( + + virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromFrame( CLRDATA_ADDRESS frameAddr, CLRDATA_ADDRESS *ppMD) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodDescFromToken( + + virtual HRESULT STDMETHODCALLTYPE GetMethodDescFromToken( CLRDATA_ADDRESS moduleAddr, mdToken token, CLRDATA_ADDRESS *methodDesc) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodDescTransparencyData( + + virtual HRESULT STDMETHODCALLTYPE GetMethodDescTransparencyData( CLRDATA_ADDRESS methodDesc, struct DacpMethodDescTransparencyData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCodeHeaderData( + + virtual HRESULT STDMETHODCALLTYPE GetCodeHeaderData( CLRDATA_ADDRESS ip, struct DacpCodeHeaderData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetJitManagerList( + + virtual HRESULT STDMETHODCALLTYPE GetJitManagerList( unsigned int count, struct DacpJitManagerInfo *managers, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetJitHelperFunctionName( + + virtual HRESULT STDMETHODCALLTYPE GetJitHelperFunctionName( CLRDATA_ADDRESS ip, unsigned int count, char *name, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetJumpThunkTarget( + + virtual HRESULT STDMETHODCALLTYPE GetJumpThunkTarget( T_CONTEXT *ctx, CLRDATA_ADDRESS *targetIP, CLRDATA_ADDRESS *targetMD) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThreadpoolData( + + virtual HRESULT STDMETHODCALLTYPE GetThreadpoolData( struct DacpThreadpoolData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetWorkRequestData( + + virtual HRESULT STDMETHODCALLTYPE GetWorkRequestData( CLRDATA_ADDRESS addrWorkRequest, struct DacpWorkRequestData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHillClimbingLogEntry( + + virtual HRESULT STDMETHODCALLTYPE GetHillClimbingLogEntry( CLRDATA_ADDRESS addr, struct DacpHillClimbingLogEntry *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetObjectData( + + virtual HRESULT STDMETHODCALLTYPE GetObjectData( CLRDATA_ADDRESS objAddr, struct DacpObjectData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetObjectStringData( + + virtual HRESULT STDMETHODCALLTYPE GetObjectStringData( CLRDATA_ADDRESS obj, unsigned int count, WCHAR *stringData, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetObjectClassName( + + virtual HRESULT STDMETHODCALLTYPE GetObjectClassName( CLRDATA_ADDRESS obj, unsigned int count, WCHAR *className, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodTableName( + + virtual HRESULT STDMETHODCALLTYPE GetMethodTableName( CLRDATA_ADDRESS mt, unsigned int count, WCHAR *mtName, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodTableData( + + virtual HRESULT STDMETHODCALLTYPE GetMethodTableData( CLRDATA_ADDRESS mt, struct DacpMethodTableData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodTableSlot( + + virtual HRESULT STDMETHODCALLTYPE GetMethodTableSlot( CLRDATA_ADDRESS mt, unsigned int slot, CLRDATA_ADDRESS *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodTableFieldData( + + virtual HRESULT STDMETHODCALLTYPE GetMethodTableFieldData( CLRDATA_ADDRESS mt, struct DacpMethodTableFieldData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodTableTransparencyData( + + virtual HRESULT STDMETHODCALLTYPE GetMethodTableTransparencyData( CLRDATA_ADDRESS mt, struct DacpMethodTableTransparencyData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodTableForEEClass( + + virtual HRESULT STDMETHODCALLTYPE GetMethodTableForEEClass( CLRDATA_ADDRESS eeClass, CLRDATA_ADDRESS *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFieldDescData( + + virtual HRESULT STDMETHODCALLTYPE GetFieldDescData( CLRDATA_ADDRESS fieldDesc, struct DacpFieldDescData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameName( + + virtual HRESULT STDMETHODCALLTYPE GetFrameName( CLRDATA_ADDRESS vtable, unsigned int count, WCHAR *frameName, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPEFileBase( + + virtual HRESULT STDMETHODCALLTYPE GetPEFileBase( CLRDATA_ADDRESS addr, CLRDATA_ADDRESS *base) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPEFileName( + + virtual HRESULT STDMETHODCALLTYPE GetPEFileName( CLRDATA_ADDRESS addr, unsigned int count, WCHAR *fileName, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGCHeapData( + + virtual HRESULT STDMETHODCALLTYPE GetGCHeapData( struct DacpGcHeapData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGCHeapList( + + virtual HRESULT STDMETHODCALLTYPE GetGCHeapList( unsigned int count, CLRDATA_ADDRESS heaps[ ], unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGCHeapDetails( + + virtual HRESULT STDMETHODCALLTYPE GetGCHeapDetails( CLRDATA_ADDRESS heap, struct DacpGcHeapDetails *details) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGCHeapStaticData( + + virtual HRESULT STDMETHODCALLTYPE GetGCHeapStaticData( struct DacpGcHeapDetails *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHeapSegmentData( + + virtual HRESULT STDMETHODCALLTYPE GetHeapSegmentData( CLRDATA_ADDRESS seg, struct DacpHeapSegmentData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetOOMData( + + virtual HRESULT STDMETHODCALLTYPE GetOOMData( CLRDATA_ADDRESS oomAddr, struct DacpOomData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetOOMStaticData( + + virtual HRESULT STDMETHODCALLTYPE GetOOMStaticData( struct DacpOomData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHeapAnalyzeData( + + virtual HRESULT STDMETHODCALLTYPE GetHeapAnalyzeData( CLRDATA_ADDRESS addr, struct DacpGcHeapAnalyzeData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHeapAnalyzeStaticData( + + virtual HRESULT STDMETHODCALLTYPE GetHeapAnalyzeStaticData( struct DacpGcHeapAnalyzeData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDomainLocalModuleData( + + virtual HRESULT STDMETHODCALLTYPE GetDomainLocalModuleData( CLRDATA_ADDRESS addr, struct DacpDomainLocalModuleData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDomainLocalModuleDataFromAppDomain( + + virtual HRESULT STDMETHODCALLTYPE GetDomainLocalModuleDataFromAppDomain( CLRDATA_ADDRESS appDomainAddr, int moduleID, struct DacpDomainLocalModuleData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDomainLocalModuleDataFromModule( + + virtual HRESULT STDMETHODCALLTYPE GetDomainLocalModuleDataFromModule( CLRDATA_ADDRESS moduleAddr, struct DacpDomainLocalModuleData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThreadLocalModuleData( + + virtual HRESULT STDMETHODCALLTYPE GetThreadLocalModuleData( CLRDATA_ADDRESS thread, unsigned int index, struct DacpThreadLocalModuleData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSyncBlockData( + + virtual HRESULT STDMETHODCALLTYPE GetSyncBlockData( unsigned int number, struct DacpSyncBlockData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSyncBlockCleanupData( + + virtual HRESULT STDMETHODCALLTYPE GetSyncBlockCleanupData( CLRDATA_ADDRESS addr, struct DacpSyncBlockCleanupData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHandleEnum( + + virtual HRESULT STDMETHODCALLTYPE GetHandleEnum( ISOSHandleEnum **ppHandleEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHandleEnumForTypes( + + virtual HRESULT STDMETHODCALLTYPE GetHandleEnumForTypes( unsigned int types[ ], unsigned int count, ISOSHandleEnum **ppHandleEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHandleEnumForGC( + + virtual HRESULT STDMETHODCALLTYPE GetHandleEnumForGC( unsigned int gen, ISOSHandleEnum **ppHandleEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE TraverseEHInfo( + + virtual HRESULT STDMETHODCALLTYPE TraverseEHInfo( CLRDATA_ADDRESS ip, DUMPEHINFO pCallback, LPVOID token) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNestedExceptionData( + + virtual HRESULT STDMETHODCALLTYPE GetNestedExceptionData( CLRDATA_ADDRESS exception, CLRDATA_ADDRESS *exceptionObject, CLRDATA_ADDRESS *nextNestedException) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStressLogAddress( + + virtual HRESULT STDMETHODCALLTYPE GetStressLogAddress( CLRDATA_ADDRESS *stressLog) = 0; - - virtual HRESULT STDMETHODCALLTYPE TraverseLoaderHeap( + + virtual HRESULT STDMETHODCALLTYPE TraverseLoaderHeap( CLRDATA_ADDRESS loaderHeapAddr, VISITHEAP pCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCodeHeapList( + + virtual HRESULT STDMETHODCALLTYPE GetCodeHeapList( CLRDATA_ADDRESS jitManager, unsigned int count, struct DacpJitCodeHeapInfo *codeHeaps, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE TraverseVirtCallStubHeap( + + virtual HRESULT STDMETHODCALLTYPE TraverseVirtCallStubHeap( CLRDATA_ADDRESS pAppDomain, VCSHeapType heaptype, VISITHEAP pCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUsefulGlobals( + + virtual HRESULT STDMETHODCALLTYPE GetUsefulGlobals( struct DacpUsefulGlobalsData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetClrWatsonBuckets( + + virtual HRESULT STDMETHODCALLTYPE GetClrWatsonBuckets( CLRDATA_ADDRESS thread, void *pGenericModeBlock) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTLSIndex( + + virtual HRESULT STDMETHODCALLTYPE GetTLSIndex( ULONG *pIndex) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDacModuleHandle( + + virtual HRESULT STDMETHODCALLTYPE GetDacModuleHandle( HMODULE *phModule) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRCWData( + + virtual HRESULT STDMETHODCALLTYPE GetRCWData( CLRDATA_ADDRESS addr, struct DacpRCWData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRCWInterfaces( + + virtual HRESULT STDMETHODCALLTYPE GetRCWInterfaces( CLRDATA_ADDRESS rcw, unsigned int count, struct DacpCOMInterfacePointerData *interfaces, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCCWData( + + virtual HRESULT STDMETHODCALLTYPE GetCCWData( CLRDATA_ADDRESS ccw, struct DacpCCWData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCCWInterfaces( + + virtual HRESULT STDMETHODCALLTYPE GetCCWInterfaces( CLRDATA_ADDRESS ccw, unsigned int count, struct DacpCOMInterfacePointerData *interfaces, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE TraverseRCWCleanupList( + + virtual HRESULT STDMETHODCALLTYPE TraverseRCWCleanupList( CLRDATA_ADDRESS cleanupListPtr, VISITRCWFORCLEANUP pCallback, LPVOID token) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStackReferences( + + virtual HRESULT STDMETHODCALLTYPE GetStackReferences( /* [in] */ DWORD osThreadID, /* [out] */ ISOSStackRefEnum **ppEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRegisterName( + + virtual HRESULT STDMETHODCALLTYPE GetRegisterName( /* [in] */ int regName, /* [in] */ unsigned int count, /* [out] */ WCHAR *buffer, /* [out] */ unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThreadAllocData( + + virtual HRESULT STDMETHODCALLTYPE GetThreadAllocData( CLRDATA_ADDRESS thread, struct DacpAllocData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHeapAllocData( + + virtual HRESULT STDMETHODCALLTYPE GetHeapAllocData( unsigned int count, struct DacpGenerationAllocData *data, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyList( + + virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyList( CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[ ], unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPrivateBinPaths( + + virtual HRESULT STDMETHODCALLTYPE GetPrivateBinPaths( CLRDATA_ADDRESS appDomain, int count, WCHAR *paths, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyLocation( + + virtual HRESULT STDMETHODCALLTYPE GetAssemblyLocation( CLRDATA_ADDRESS assembly, int count, WCHAR *location, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppDomainConfigFile( + + virtual HRESULT STDMETHODCALLTYPE GetAppDomainConfigFile( CLRDATA_ADDRESS appDomain, int count, WCHAR *configFile, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetApplicationBase( + + virtual HRESULT STDMETHODCALLTYPE GetApplicationBase( CLRDATA_ADDRESS appDomain, int count, WCHAR *base, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyData( + + virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyData( CLRDATA_ADDRESS assembly, unsigned int *pContext, HRESULT *pResult) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyLocation( + + virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyLocation( CLRDATA_ADDRESS assesmbly, unsigned int count, WCHAR *location, unsigned int *pNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyDisplayName( + + virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyDisplayName( CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSDacInterfaceVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSDacInterface * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSDacInterface * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSDacInterface * This); - - HRESULT ( STDMETHODCALLTYPE *GetThreadStoreData )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadStoreData )( ISOSDacInterface * This, struct DacpThreadStoreData *data); - - HRESULT ( STDMETHODCALLTYPE *GetAppDomainStoreData )( + + HRESULT ( STDMETHODCALLTYPE *GetAppDomainStoreData )( ISOSDacInterface * This, struct DacpAppDomainStoreData *data); - - HRESULT ( STDMETHODCALLTYPE *GetAppDomainList )( + + HRESULT ( STDMETHODCALLTYPE *GetAppDomainList )( ISOSDacInterface * This, unsigned int count, CLRDATA_ADDRESS values[ ], unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetAppDomainData )( + + HRESULT ( STDMETHODCALLTYPE *GetAppDomainData )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, struct DacpAppDomainData *data); - - HRESULT ( STDMETHODCALLTYPE *GetAppDomainName )( + + HRESULT ( STDMETHODCALLTYPE *GetAppDomainName )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, unsigned int count, WCHAR *name, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetDomainFromContext )( + + HRESULT ( STDMETHODCALLTYPE *GetDomainFromContext )( ISOSDacInterface * This, CLRDATA_ADDRESS context, CLRDATA_ADDRESS *domain); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyList )( + + HRESULT ( STDMETHODCALLTYPE *GetAssemblyList )( ISOSDacInterface * This, CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[ ], int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyData )( + + HRESULT ( STDMETHODCALLTYPE *GetAssemblyData )( ISOSDacInterface * This, CLRDATA_ADDRESS baseDomainPtr, CLRDATA_ADDRESS assembly, struct DacpAssemblyData *data); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyName )( + + HRESULT ( STDMETHODCALLTYPE *GetAssemblyName )( ISOSDacInterface * This, CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetModule )( + + HRESULT ( STDMETHODCALLTYPE *GetModule )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, IXCLRDataModule **mod); - - HRESULT ( STDMETHODCALLTYPE *GetModuleData )( + + HRESULT ( STDMETHODCALLTYPE *GetModuleData )( ISOSDacInterface * This, CLRDATA_ADDRESS moduleAddr, struct DacpModuleData *data); - - HRESULT ( STDMETHODCALLTYPE *TraverseModuleMap )( + + HRESULT ( STDMETHODCALLTYPE *TraverseModuleMap )( ISOSDacInterface * This, ModuleMapType mmt, CLRDATA_ADDRESS moduleAddr, MODULEMAPTRAVERSE pCallback, LPVOID token); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyModuleList )( + + HRESULT ( STDMETHODCALLTYPE *GetAssemblyModuleList )( ISOSDacInterface * This, CLRDATA_ADDRESS assembly, unsigned int count, CLRDATA_ADDRESS modules[ ], unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetILForModule )( + + HRESULT ( STDMETHODCALLTYPE *GetILForModule )( ISOSDacInterface * This, CLRDATA_ADDRESS moduleAddr, DWORD rva, CLRDATA_ADDRESS *il); - - HRESULT ( STDMETHODCALLTYPE *GetThreadData )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadData )( ISOSDacInterface * This, CLRDATA_ADDRESS thread, struct DacpThreadData *data); - - HRESULT ( STDMETHODCALLTYPE *GetThreadFromThinlockID )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadFromThinlockID )( ISOSDacInterface * This, UINT thinLockId, CLRDATA_ADDRESS *pThread); - - HRESULT ( STDMETHODCALLTYPE *GetStackLimits )( + + HRESULT ( STDMETHODCALLTYPE *GetStackLimits )( ISOSDacInterface * This, CLRDATA_ADDRESS threadPtr, CLRDATA_ADDRESS *lower, CLRDATA_ADDRESS *upper, CLRDATA_ADDRESS *fp); - - HRESULT ( STDMETHODCALLTYPE *GetMethodDescData )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodDescData )( ISOSDacInterface * This, CLRDATA_ADDRESS methodDesc, CLRDATA_ADDRESS ip, @@ -1238,397 +1245,397 @@ EXTERN_C const IID IID_ISOSDacInterface; ULONG cRevertedRejitVersions, struct DacpReJitData *rgRevertedRejitData, ULONG *pcNeededRevertedRejitData); - - HRESULT ( STDMETHODCALLTYPE *GetMethodDescPtrFromIP )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodDescPtrFromIP )( ISOSDacInterface * This, CLRDATA_ADDRESS ip, CLRDATA_ADDRESS *ppMD); - - HRESULT ( STDMETHODCALLTYPE *GetMethodDescName )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodDescName )( ISOSDacInterface * This, CLRDATA_ADDRESS methodDesc, unsigned int count, WCHAR *name, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetMethodDescPtrFromFrame )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodDescPtrFromFrame )( ISOSDacInterface * This, CLRDATA_ADDRESS frameAddr, CLRDATA_ADDRESS *ppMD); - - HRESULT ( STDMETHODCALLTYPE *GetMethodDescFromToken )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodDescFromToken )( ISOSDacInterface * This, CLRDATA_ADDRESS moduleAddr, mdToken token, CLRDATA_ADDRESS *methodDesc); - - HRESULT ( STDMETHODCALLTYPE *GetMethodDescTransparencyData )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodDescTransparencyData )( ISOSDacInterface * This, CLRDATA_ADDRESS methodDesc, struct DacpMethodDescTransparencyData *data); - - HRESULT ( STDMETHODCALLTYPE *GetCodeHeaderData )( + + HRESULT ( STDMETHODCALLTYPE *GetCodeHeaderData )( ISOSDacInterface * This, CLRDATA_ADDRESS ip, struct DacpCodeHeaderData *data); - - HRESULT ( STDMETHODCALLTYPE *GetJitManagerList )( + + HRESULT ( STDMETHODCALLTYPE *GetJitManagerList )( ISOSDacInterface * This, unsigned int count, struct DacpJitManagerInfo *managers, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetJitHelperFunctionName )( + + HRESULT ( STDMETHODCALLTYPE *GetJitHelperFunctionName )( ISOSDacInterface * This, CLRDATA_ADDRESS ip, unsigned int count, - char *name, + unsigned char *name, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetJumpThunkTarget )( + + HRESULT ( STDMETHODCALLTYPE *GetJumpThunkTarget )( ISOSDacInterface * This, T_CONTEXT *ctx, CLRDATA_ADDRESS *targetIP, CLRDATA_ADDRESS *targetMD); - - HRESULT ( STDMETHODCALLTYPE *GetThreadpoolData )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadpoolData )( ISOSDacInterface * This, struct DacpThreadpoolData *data); - - HRESULT ( STDMETHODCALLTYPE *GetWorkRequestData )( + + HRESULT ( STDMETHODCALLTYPE *GetWorkRequestData )( ISOSDacInterface * This, CLRDATA_ADDRESS addrWorkRequest, struct DacpWorkRequestData *data); - - HRESULT ( STDMETHODCALLTYPE *GetHillClimbingLogEntry )( + + HRESULT ( STDMETHODCALLTYPE *GetHillClimbingLogEntry )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, struct DacpHillClimbingLogEntry *data); - - HRESULT ( STDMETHODCALLTYPE *GetObjectData )( + + HRESULT ( STDMETHODCALLTYPE *GetObjectData )( ISOSDacInterface * This, CLRDATA_ADDRESS objAddr, struct DacpObjectData *data); - - HRESULT ( STDMETHODCALLTYPE *GetObjectStringData )( + + HRESULT ( STDMETHODCALLTYPE *GetObjectStringData )( ISOSDacInterface * This, CLRDATA_ADDRESS obj, unsigned int count, WCHAR *stringData, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetObjectClassName )( + + HRESULT ( STDMETHODCALLTYPE *GetObjectClassName )( ISOSDacInterface * This, CLRDATA_ADDRESS obj, unsigned int count, WCHAR *className, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetMethodTableName )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodTableName )( ISOSDacInterface * This, CLRDATA_ADDRESS mt, unsigned int count, WCHAR *mtName, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetMethodTableData )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodTableData )( ISOSDacInterface * This, CLRDATA_ADDRESS mt, struct DacpMethodTableData *data); - - HRESULT ( STDMETHODCALLTYPE *GetMethodTableSlot )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodTableSlot )( ISOSDacInterface * This, CLRDATA_ADDRESS mt, unsigned int slot, CLRDATA_ADDRESS *value); - - HRESULT ( STDMETHODCALLTYPE *GetMethodTableFieldData )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodTableFieldData )( ISOSDacInterface * This, CLRDATA_ADDRESS mt, struct DacpMethodTableFieldData *data); - - HRESULT ( STDMETHODCALLTYPE *GetMethodTableTransparencyData )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodTableTransparencyData )( ISOSDacInterface * This, CLRDATA_ADDRESS mt, struct DacpMethodTableTransparencyData *data); - - HRESULT ( STDMETHODCALLTYPE *GetMethodTableForEEClass )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodTableForEEClass )( ISOSDacInterface * This, CLRDATA_ADDRESS eeClass, CLRDATA_ADDRESS *value); - - HRESULT ( STDMETHODCALLTYPE *GetFieldDescData )( + + HRESULT ( STDMETHODCALLTYPE *GetFieldDescData )( ISOSDacInterface * This, CLRDATA_ADDRESS fieldDesc, struct DacpFieldDescData *data); - - HRESULT ( STDMETHODCALLTYPE *GetFrameName )( + + HRESULT ( STDMETHODCALLTYPE *GetFrameName )( ISOSDacInterface * This, CLRDATA_ADDRESS vtable, unsigned int count, WCHAR *frameName, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetPEFileBase )( + + HRESULT ( STDMETHODCALLTYPE *GetPEFileBase )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, CLRDATA_ADDRESS *base); - - HRESULT ( STDMETHODCALLTYPE *GetPEFileName )( + + HRESULT ( STDMETHODCALLTYPE *GetPEFileName )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, unsigned int count, WCHAR *fileName, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetGCHeapData )( + + HRESULT ( STDMETHODCALLTYPE *GetGCHeapData )( ISOSDacInterface * This, struct DacpGcHeapData *data); - - HRESULT ( STDMETHODCALLTYPE *GetGCHeapList )( + + HRESULT ( STDMETHODCALLTYPE *GetGCHeapList )( ISOSDacInterface * This, unsigned int count, CLRDATA_ADDRESS heaps[ ], unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetGCHeapDetails )( + + HRESULT ( STDMETHODCALLTYPE *GetGCHeapDetails )( ISOSDacInterface * This, CLRDATA_ADDRESS heap, struct DacpGcHeapDetails *details); - - HRESULT ( STDMETHODCALLTYPE *GetGCHeapStaticData )( + + HRESULT ( STDMETHODCALLTYPE *GetGCHeapStaticData )( ISOSDacInterface * This, struct DacpGcHeapDetails *data); - - HRESULT ( STDMETHODCALLTYPE *GetHeapSegmentData )( + + HRESULT ( STDMETHODCALLTYPE *GetHeapSegmentData )( ISOSDacInterface * This, CLRDATA_ADDRESS seg, struct DacpHeapSegmentData *data); - - HRESULT ( STDMETHODCALLTYPE *GetOOMData )( + + HRESULT ( STDMETHODCALLTYPE *GetOOMData )( ISOSDacInterface * This, CLRDATA_ADDRESS oomAddr, struct DacpOomData *data); - - HRESULT ( STDMETHODCALLTYPE *GetOOMStaticData )( + + HRESULT ( STDMETHODCALLTYPE *GetOOMStaticData )( ISOSDacInterface * This, struct DacpOomData *data); - - HRESULT ( STDMETHODCALLTYPE *GetHeapAnalyzeData )( + + HRESULT ( STDMETHODCALLTYPE *GetHeapAnalyzeData )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, struct DacpGcHeapAnalyzeData *data); - - HRESULT ( STDMETHODCALLTYPE *GetHeapAnalyzeStaticData )( + + HRESULT ( STDMETHODCALLTYPE *GetHeapAnalyzeStaticData )( ISOSDacInterface * This, struct DacpGcHeapAnalyzeData *data); - - HRESULT ( STDMETHODCALLTYPE *GetDomainLocalModuleData )( + + HRESULT ( STDMETHODCALLTYPE *GetDomainLocalModuleData )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, struct DacpDomainLocalModuleData *data); - - HRESULT ( STDMETHODCALLTYPE *GetDomainLocalModuleDataFromAppDomain )( + + HRESULT ( STDMETHODCALLTYPE *GetDomainLocalModuleDataFromAppDomain )( ISOSDacInterface * This, CLRDATA_ADDRESS appDomainAddr, int moduleID, struct DacpDomainLocalModuleData *data); - - HRESULT ( STDMETHODCALLTYPE *GetDomainLocalModuleDataFromModule )( + + HRESULT ( STDMETHODCALLTYPE *GetDomainLocalModuleDataFromModule )( ISOSDacInterface * This, CLRDATA_ADDRESS moduleAddr, struct DacpDomainLocalModuleData *data); - - HRESULT ( STDMETHODCALLTYPE *GetThreadLocalModuleData )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadLocalModuleData )( ISOSDacInterface * This, CLRDATA_ADDRESS thread, unsigned int index, struct DacpThreadLocalModuleData *data); - - HRESULT ( STDMETHODCALLTYPE *GetSyncBlockData )( + + HRESULT ( STDMETHODCALLTYPE *GetSyncBlockData )( ISOSDacInterface * This, unsigned int number, struct DacpSyncBlockData *data); - - HRESULT ( STDMETHODCALLTYPE *GetSyncBlockCleanupData )( + + HRESULT ( STDMETHODCALLTYPE *GetSyncBlockCleanupData )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, struct DacpSyncBlockCleanupData *data); - - HRESULT ( STDMETHODCALLTYPE *GetHandleEnum )( + + HRESULT ( STDMETHODCALLTYPE *GetHandleEnum )( ISOSDacInterface * This, ISOSHandleEnum **ppHandleEnum); - - HRESULT ( STDMETHODCALLTYPE *GetHandleEnumForTypes )( + + HRESULT ( STDMETHODCALLTYPE *GetHandleEnumForTypes )( ISOSDacInterface * This, unsigned int types[ ], unsigned int count, ISOSHandleEnum **ppHandleEnum); - - HRESULT ( STDMETHODCALLTYPE *GetHandleEnumForGC )( + + HRESULT ( STDMETHODCALLTYPE *GetHandleEnumForGC )( ISOSDacInterface * This, unsigned int gen, ISOSHandleEnum **ppHandleEnum); - - HRESULT ( STDMETHODCALLTYPE *TraverseEHInfo )( + + HRESULT ( STDMETHODCALLTYPE *TraverseEHInfo )( ISOSDacInterface * This, CLRDATA_ADDRESS ip, DUMPEHINFO pCallback, LPVOID token); - - HRESULT ( STDMETHODCALLTYPE *GetNestedExceptionData )( + + HRESULT ( STDMETHODCALLTYPE *GetNestedExceptionData )( ISOSDacInterface * This, CLRDATA_ADDRESS exception, CLRDATA_ADDRESS *exceptionObject, CLRDATA_ADDRESS *nextNestedException); - - HRESULT ( STDMETHODCALLTYPE *GetStressLogAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetStressLogAddress )( ISOSDacInterface * This, CLRDATA_ADDRESS *stressLog); - - HRESULT ( STDMETHODCALLTYPE *TraverseLoaderHeap )( + + HRESULT ( STDMETHODCALLTYPE *TraverseLoaderHeap )( ISOSDacInterface * This, CLRDATA_ADDRESS loaderHeapAddr, VISITHEAP pCallback); - - HRESULT ( STDMETHODCALLTYPE *GetCodeHeapList )( + + HRESULT ( STDMETHODCALLTYPE *GetCodeHeapList )( ISOSDacInterface * This, CLRDATA_ADDRESS jitManager, unsigned int count, struct DacpJitCodeHeapInfo *codeHeaps, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *TraverseVirtCallStubHeap )( + + HRESULT ( STDMETHODCALLTYPE *TraverseVirtCallStubHeap )( ISOSDacInterface * This, CLRDATA_ADDRESS pAppDomain, VCSHeapType heaptype, VISITHEAP pCallback); - - HRESULT ( STDMETHODCALLTYPE *GetUsefulGlobals )( + + HRESULT ( STDMETHODCALLTYPE *GetUsefulGlobals )( ISOSDacInterface * This, struct DacpUsefulGlobalsData *data); - - HRESULT ( STDMETHODCALLTYPE *GetClrWatsonBuckets )( + + HRESULT ( STDMETHODCALLTYPE *GetClrWatsonBuckets )( ISOSDacInterface * This, CLRDATA_ADDRESS thread, void *pGenericModeBlock); - - HRESULT ( STDMETHODCALLTYPE *GetTLSIndex )( + + HRESULT ( STDMETHODCALLTYPE *GetTLSIndex )( ISOSDacInterface * This, ULONG *pIndex); - - HRESULT ( STDMETHODCALLTYPE *GetDacModuleHandle )( + + HRESULT ( STDMETHODCALLTYPE *GetDacModuleHandle )( ISOSDacInterface * This, HMODULE *phModule); - - HRESULT ( STDMETHODCALLTYPE *GetRCWData )( + + HRESULT ( STDMETHODCALLTYPE *GetRCWData )( ISOSDacInterface * This, CLRDATA_ADDRESS addr, struct DacpRCWData *data); - - HRESULT ( STDMETHODCALLTYPE *GetRCWInterfaces )( + + HRESULT ( STDMETHODCALLTYPE *GetRCWInterfaces )( ISOSDacInterface * This, CLRDATA_ADDRESS rcw, unsigned int count, struct DacpCOMInterfacePointerData *interfaces, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetCCWData )( + + HRESULT ( STDMETHODCALLTYPE *GetCCWData )( ISOSDacInterface * This, CLRDATA_ADDRESS ccw, struct DacpCCWData *data); - - HRESULT ( STDMETHODCALLTYPE *GetCCWInterfaces )( + + HRESULT ( STDMETHODCALLTYPE *GetCCWInterfaces )( ISOSDacInterface * This, CLRDATA_ADDRESS ccw, unsigned int count, struct DacpCOMInterfacePointerData *interfaces, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *TraverseRCWCleanupList )( + + HRESULT ( STDMETHODCALLTYPE *TraverseRCWCleanupList )( ISOSDacInterface * This, CLRDATA_ADDRESS cleanupListPtr, VISITRCWFORCLEANUP pCallback, LPVOID token); - - HRESULT ( STDMETHODCALLTYPE *GetStackReferences )( + + HRESULT ( STDMETHODCALLTYPE *GetStackReferences )( ISOSDacInterface * This, /* [in] */ DWORD osThreadID, /* [out] */ ISOSStackRefEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetRegisterName )( + + HRESULT ( STDMETHODCALLTYPE *GetRegisterName )( ISOSDacInterface * This, /* [in] */ int regName, /* [in] */ unsigned int count, /* [out] */ WCHAR *buffer, /* [out] */ unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetThreadAllocData )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadAllocData )( ISOSDacInterface * This, CLRDATA_ADDRESS thread, struct DacpAllocData *data); - - HRESULT ( STDMETHODCALLTYPE *GetHeapAllocData )( + + HRESULT ( STDMETHODCALLTYPE *GetHeapAllocData )( ISOSDacInterface * This, unsigned int count, struct DacpGenerationAllocData *data, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyList )( + + HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyList )( ISOSDacInterface * This, CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[ ], unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateBinPaths )( + + HRESULT ( STDMETHODCALLTYPE *GetPrivateBinPaths )( ISOSDacInterface * This, CLRDATA_ADDRESS appDomain, int count, WCHAR *paths, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyLocation )( + + HRESULT ( STDMETHODCALLTYPE *GetAssemblyLocation )( ISOSDacInterface * This, CLRDATA_ADDRESS assembly, int count, WCHAR *location, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetAppDomainConfigFile )( + + HRESULT ( STDMETHODCALLTYPE *GetAppDomainConfigFile )( ISOSDacInterface * This, CLRDATA_ADDRESS appDomain, int count, WCHAR *configFile, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetApplicationBase )( + + HRESULT ( STDMETHODCALLTYPE *GetApplicationBase )( ISOSDacInterface * This, CLRDATA_ADDRESS appDomain, int count, WCHAR *base, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyData )( + + HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyData )( ISOSDacInterface * This, CLRDATA_ADDRESS assembly, unsigned int *pContext, HRESULT *pResult); - - HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyLocation )( + + HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyLocation )( ISOSDacInterface * This, CLRDATA_ADDRESS assesmbly, unsigned int count, WCHAR *location, unsigned int *pNeeded); - - HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyDisplayName )( + + HRESULT ( STDMETHODCALLTYPE *GetFailedAssemblyDisplayName )( ISOSDacInterface * This, CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded); - + END_INTERFACE } ISOSDacInterfaceVtbl; @@ -1637,284 +1644,284 @@ EXTERN_C const IID IID_ISOSDacInterface; CONST_VTBL struct ISOSDacInterfaceVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSDacInterface_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSDacInterface_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSDacInterface_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSDacInterface_GetThreadStoreData(This,data) \ - ( (This)->lpVtbl -> GetThreadStoreData(This,data) ) + ( (This)->lpVtbl -> GetThreadStoreData(This,data) ) #define ISOSDacInterface_GetAppDomainStoreData(This,data) \ - ( (This)->lpVtbl -> GetAppDomainStoreData(This,data) ) + ( (This)->lpVtbl -> GetAppDomainStoreData(This,data) ) #define ISOSDacInterface_GetAppDomainList(This,count,values,pNeeded) \ - ( (This)->lpVtbl -> GetAppDomainList(This,count,values,pNeeded) ) + ( (This)->lpVtbl -> GetAppDomainList(This,count,values,pNeeded) ) #define ISOSDacInterface_GetAppDomainData(This,addr,data) \ - ( (This)->lpVtbl -> GetAppDomainData(This,addr,data) ) + ( (This)->lpVtbl -> GetAppDomainData(This,addr,data) ) #define ISOSDacInterface_GetAppDomainName(This,addr,count,name,pNeeded) \ - ( (This)->lpVtbl -> GetAppDomainName(This,addr,count,name,pNeeded) ) + ( (This)->lpVtbl -> GetAppDomainName(This,addr,count,name,pNeeded) ) #define ISOSDacInterface_GetDomainFromContext(This,context,domain) \ - ( (This)->lpVtbl -> GetDomainFromContext(This,context,domain) ) + ( (This)->lpVtbl -> GetDomainFromContext(This,context,domain) ) #define ISOSDacInterface_GetAssemblyList(This,appDomain,count,values,pNeeded) \ - ( (This)->lpVtbl -> GetAssemblyList(This,appDomain,count,values,pNeeded) ) + ( (This)->lpVtbl -> GetAssemblyList(This,appDomain,count,values,pNeeded) ) #define ISOSDacInterface_GetAssemblyData(This,baseDomainPtr,assembly,data) \ - ( (This)->lpVtbl -> GetAssemblyData(This,baseDomainPtr,assembly,data) ) + ( (This)->lpVtbl -> GetAssemblyData(This,baseDomainPtr,assembly,data) ) #define ISOSDacInterface_GetAssemblyName(This,assembly,count,name,pNeeded) \ - ( (This)->lpVtbl -> GetAssemblyName(This,assembly,count,name,pNeeded) ) + ( (This)->lpVtbl -> GetAssemblyName(This,assembly,count,name,pNeeded) ) #define ISOSDacInterface_GetModule(This,addr,mod) \ - ( (This)->lpVtbl -> GetModule(This,addr,mod) ) + ( (This)->lpVtbl -> GetModule(This,addr,mod) ) #define ISOSDacInterface_GetModuleData(This,moduleAddr,data) \ - ( (This)->lpVtbl -> GetModuleData(This,moduleAddr,data) ) + ( (This)->lpVtbl -> GetModuleData(This,moduleAddr,data) ) #define ISOSDacInterface_TraverseModuleMap(This,mmt,moduleAddr,pCallback,token) \ - ( (This)->lpVtbl -> TraverseModuleMap(This,mmt,moduleAddr,pCallback,token) ) + ( (This)->lpVtbl -> TraverseModuleMap(This,mmt,moduleAddr,pCallback,token) ) #define ISOSDacInterface_GetAssemblyModuleList(This,assembly,count,modules,pNeeded) \ - ( (This)->lpVtbl -> GetAssemblyModuleList(This,assembly,count,modules,pNeeded) ) + ( (This)->lpVtbl -> GetAssemblyModuleList(This,assembly,count,modules,pNeeded) ) #define ISOSDacInterface_GetILForModule(This,moduleAddr,rva,il) \ - ( (This)->lpVtbl -> GetILForModule(This,moduleAddr,rva,il) ) + ( (This)->lpVtbl -> GetILForModule(This,moduleAddr,rva,il) ) #define ISOSDacInterface_GetThreadData(This,thread,data) \ - ( (This)->lpVtbl -> GetThreadData(This,thread,data) ) + ( (This)->lpVtbl -> GetThreadData(This,thread,data) ) #define ISOSDacInterface_GetThreadFromThinlockID(This,thinLockId,pThread) \ - ( (This)->lpVtbl -> GetThreadFromThinlockID(This,thinLockId,pThread) ) + ( (This)->lpVtbl -> GetThreadFromThinlockID(This,thinLockId,pThread) ) #define ISOSDacInterface_GetStackLimits(This,threadPtr,lower,upper,fp) \ - ( (This)->lpVtbl -> GetStackLimits(This,threadPtr,lower,upper,fp) ) + ( (This)->lpVtbl -> GetStackLimits(This,threadPtr,lower,upper,fp) ) #define ISOSDacInterface_GetMethodDescData(This,methodDesc,ip,data,cRevertedRejitVersions,rgRevertedRejitData,pcNeededRevertedRejitData) \ - ( (This)->lpVtbl -> GetMethodDescData(This,methodDesc,ip,data,cRevertedRejitVersions,rgRevertedRejitData,pcNeededRevertedRejitData) ) + ( (This)->lpVtbl -> GetMethodDescData(This,methodDesc,ip,data,cRevertedRejitVersions,rgRevertedRejitData,pcNeededRevertedRejitData) ) #define ISOSDacInterface_GetMethodDescPtrFromIP(This,ip,ppMD) \ - ( (This)->lpVtbl -> GetMethodDescPtrFromIP(This,ip,ppMD) ) + ( (This)->lpVtbl -> GetMethodDescPtrFromIP(This,ip,ppMD) ) #define ISOSDacInterface_GetMethodDescName(This,methodDesc,count,name,pNeeded) \ - ( (This)->lpVtbl -> GetMethodDescName(This,methodDesc,count,name,pNeeded) ) + ( (This)->lpVtbl -> GetMethodDescName(This,methodDesc,count,name,pNeeded) ) #define ISOSDacInterface_GetMethodDescPtrFromFrame(This,frameAddr,ppMD) \ - ( (This)->lpVtbl -> GetMethodDescPtrFromFrame(This,frameAddr,ppMD) ) + ( (This)->lpVtbl -> GetMethodDescPtrFromFrame(This,frameAddr,ppMD) ) #define ISOSDacInterface_GetMethodDescFromToken(This,moduleAddr,token,methodDesc) \ - ( (This)->lpVtbl -> GetMethodDescFromToken(This,moduleAddr,token,methodDesc) ) + ( (This)->lpVtbl -> GetMethodDescFromToken(This,moduleAddr,token,methodDesc) ) #define ISOSDacInterface_GetMethodDescTransparencyData(This,methodDesc,data) \ - ( (This)->lpVtbl -> GetMethodDescTransparencyData(This,methodDesc,data) ) + ( (This)->lpVtbl -> GetMethodDescTransparencyData(This,methodDesc,data) ) #define ISOSDacInterface_GetCodeHeaderData(This,ip,data) \ - ( (This)->lpVtbl -> GetCodeHeaderData(This,ip,data) ) + ( (This)->lpVtbl -> GetCodeHeaderData(This,ip,data) ) #define ISOSDacInterface_GetJitManagerList(This,count,managers,pNeeded) \ - ( (This)->lpVtbl -> GetJitManagerList(This,count,managers,pNeeded) ) + ( (This)->lpVtbl -> GetJitManagerList(This,count,managers,pNeeded) ) #define ISOSDacInterface_GetJitHelperFunctionName(This,ip,count,name,pNeeded) \ - ( (This)->lpVtbl -> GetJitHelperFunctionName(This,ip,count,name,pNeeded) ) + ( (This)->lpVtbl -> GetJitHelperFunctionName(This,ip,count,name,pNeeded) ) #define ISOSDacInterface_GetJumpThunkTarget(This,ctx,targetIP,targetMD) \ - ( (This)->lpVtbl -> GetJumpThunkTarget(This,ctx,targetIP,targetMD) ) + ( (This)->lpVtbl -> GetJumpThunkTarget(This,ctx,targetIP,targetMD) ) #define ISOSDacInterface_GetThreadpoolData(This,data) \ - ( (This)->lpVtbl -> GetThreadpoolData(This,data) ) + ( (This)->lpVtbl -> GetThreadpoolData(This,data) ) #define ISOSDacInterface_GetWorkRequestData(This,addrWorkRequest,data) \ - ( (This)->lpVtbl -> GetWorkRequestData(This,addrWorkRequest,data) ) + ( (This)->lpVtbl -> GetWorkRequestData(This,addrWorkRequest,data) ) #define ISOSDacInterface_GetHillClimbingLogEntry(This,addr,data) \ - ( (This)->lpVtbl -> GetHillClimbingLogEntry(This,addr,data) ) + ( (This)->lpVtbl -> GetHillClimbingLogEntry(This,addr,data) ) #define ISOSDacInterface_GetObjectData(This,objAddr,data) \ - ( (This)->lpVtbl -> GetObjectData(This,objAddr,data) ) + ( (This)->lpVtbl -> GetObjectData(This,objAddr,data) ) #define ISOSDacInterface_GetObjectStringData(This,obj,count,stringData,pNeeded) \ - ( (This)->lpVtbl -> GetObjectStringData(This,obj,count,stringData,pNeeded) ) + ( (This)->lpVtbl -> GetObjectStringData(This,obj,count,stringData,pNeeded) ) #define ISOSDacInterface_GetObjectClassName(This,obj,count,className,pNeeded) \ - ( (This)->lpVtbl -> GetObjectClassName(This,obj,count,className,pNeeded) ) + ( (This)->lpVtbl -> GetObjectClassName(This,obj,count,className,pNeeded) ) #define ISOSDacInterface_GetMethodTableName(This,mt,count,mtName,pNeeded) \ - ( (This)->lpVtbl -> GetMethodTableName(This,mt,count,mtName,pNeeded) ) + ( (This)->lpVtbl -> GetMethodTableName(This,mt,count,mtName,pNeeded) ) #define ISOSDacInterface_GetMethodTableData(This,mt,data) \ - ( (This)->lpVtbl -> GetMethodTableData(This,mt,data) ) + ( (This)->lpVtbl -> GetMethodTableData(This,mt,data) ) #define ISOSDacInterface_GetMethodTableSlot(This,mt,slot,value) \ - ( (This)->lpVtbl -> GetMethodTableSlot(This,mt,slot,value) ) + ( (This)->lpVtbl -> GetMethodTableSlot(This,mt,slot,value) ) #define ISOSDacInterface_GetMethodTableFieldData(This,mt,data) \ - ( (This)->lpVtbl -> GetMethodTableFieldData(This,mt,data) ) + ( (This)->lpVtbl -> GetMethodTableFieldData(This,mt,data) ) #define ISOSDacInterface_GetMethodTableTransparencyData(This,mt,data) \ - ( (This)->lpVtbl -> GetMethodTableTransparencyData(This,mt,data) ) + ( (This)->lpVtbl -> GetMethodTableTransparencyData(This,mt,data) ) #define ISOSDacInterface_GetMethodTableForEEClass(This,eeClass,value) \ - ( (This)->lpVtbl -> GetMethodTableForEEClass(This,eeClass,value) ) + ( (This)->lpVtbl -> GetMethodTableForEEClass(This,eeClass,value) ) #define ISOSDacInterface_GetFieldDescData(This,fieldDesc,data) \ - ( (This)->lpVtbl -> GetFieldDescData(This,fieldDesc,data) ) + ( (This)->lpVtbl -> GetFieldDescData(This,fieldDesc,data) ) #define ISOSDacInterface_GetFrameName(This,vtable,count,frameName,pNeeded) \ - ( (This)->lpVtbl -> GetFrameName(This,vtable,count,frameName,pNeeded) ) + ( (This)->lpVtbl -> GetFrameName(This,vtable,count,frameName,pNeeded) ) #define ISOSDacInterface_GetPEFileBase(This,addr,base) \ - ( (This)->lpVtbl -> GetPEFileBase(This,addr,base) ) + ( (This)->lpVtbl -> GetPEFileBase(This,addr,base) ) #define ISOSDacInterface_GetPEFileName(This,addr,count,fileName,pNeeded) \ - ( (This)->lpVtbl -> GetPEFileName(This,addr,count,fileName,pNeeded) ) + ( (This)->lpVtbl -> GetPEFileName(This,addr,count,fileName,pNeeded) ) #define ISOSDacInterface_GetGCHeapData(This,data) \ - ( (This)->lpVtbl -> GetGCHeapData(This,data) ) + ( (This)->lpVtbl -> GetGCHeapData(This,data) ) #define ISOSDacInterface_GetGCHeapList(This,count,heaps,pNeeded) \ - ( (This)->lpVtbl -> GetGCHeapList(This,count,heaps,pNeeded) ) + ( (This)->lpVtbl -> GetGCHeapList(This,count,heaps,pNeeded) ) #define ISOSDacInterface_GetGCHeapDetails(This,heap,details) \ - ( (This)->lpVtbl -> GetGCHeapDetails(This,heap,details) ) + ( (This)->lpVtbl -> GetGCHeapDetails(This,heap,details) ) #define ISOSDacInterface_GetGCHeapStaticData(This,data) \ - ( (This)->lpVtbl -> GetGCHeapStaticData(This,data) ) + ( (This)->lpVtbl -> GetGCHeapStaticData(This,data) ) #define ISOSDacInterface_GetHeapSegmentData(This,seg,data) \ - ( (This)->lpVtbl -> GetHeapSegmentData(This,seg,data) ) + ( (This)->lpVtbl -> GetHeapSegmentData(This,seg,data) ) #define ISOSDacInterface_GetOOMData(This,oomAddr,data) \ - ( (This)->lpVtbl -> GetOOMData(This,oomAddr,data) ) + ( (This)->lpVtbl -> GetOOMData(This,oomAddr,data) ) #define ISOSDacInterface_GetOOMStaticData(This,data) \ - ( (This)->lpVtbl -> GetOOMStaticData(This,data) ) + ( (This)->lpVtbl -> GetOOMStaticData(This,data) ) #define ISOSDacInterface_GetHeapAnalyzeData(This,addr,data) \ - ( (This)->lpVtbl -> GetHeapAnalyzeData(This,addr,data) ) + ( (This)->lpVtbl -> GetHeapAnalyzeData(This,addr,data) ) #define ISOSDacInterface_GetHeapAnalyzeStaticData(This,data) \ - ( (This)->lpVtbl -> GetHeapAnalyzeStaticData(This,data) ) + ( (This)->lpVtbl -> GetHeapAnalyzeStaticData(This,data) ) #define ISOSDacInterface_GetDomainLocalModuleData(This,addr,data) \ - ( (This)->lpVtbl -> GetDomainLocalModuleData(This,addr,data) ) + ( (This)->lpVtbl -> GetDomainLocalModuleData(This,addr,data) ) #define ISOSDacInterface_GetDomainLocalModuleDataFromAppDomain(This,appDomainAddr,moduleID,data) \ - ( (This)->lpVtbl -> GetDomainLocalModuleDataFromAppDomain(This,appDomainAddr,moduleID,data) ) + ( (This)->lpVtbl -> GetDomainLocalModuleDataFromAppDomain(This,appDomainAddr,moduleID,data) ) #define ISOSDacInterface_GetDomainLocalModuleDataFromModule(This,moduleAddr,data) \ - ( (This)->lpVtbl -> GetDomainLocalModuleDataFromModule(This,moduleAddr,data) ) + ( (This)->lpVtbl -> GetDomainLocalModuleDataFromModule(This,moduleAddr,data) ) #define ISOSDacInterface_GetThreadLocalModuleData(This,thread,index,data) \ - ( (This)->lpVtbl -> GetThreadLocalModuleData(This,thread,index,data) ) + ( (This)->lpVtbl -> GetThreadLocalModuleData(This,thread,index,data) ) #define ISOSDacInterface_GetSyncBlockData(This,number,data) \ - ( (This)->lpVtbl -> GetSyncBlockData(This,number,data) ) + ( (This)->lpVtbl -> GetSyncBlockData(This,number,data) ) #define ISOSDacInterface_GetSyncBlockCleanupData(This,addr,data) \ - ( (This)->lpVtbl -> GetSyncBlockCleanupData(This,addr,data) ) + ( (This)->lpVtbl -> GetSyncBlockCleanupData(This,addr,data) ) #define ISOSDacInterface_GetHandleEnum(This,ppHandleEnum) \ - ( (This)->lpVtbl -> GetHandleEnum(This,ppHandleEnum) ) + ( (This)->lpVtbl -> GetHandleEnum(This,ppHandleEnum) ) #define ISOSDacInterface_GetHandleEnumForTypes(This,types,count,ppHandleEnum) \ - ( (This)->lpVtbl -> GetHandleEnumForTypes(This,types,count,ppHandleEnum) ) + ( (This)->lpVtbl -> GetHandleEnumForTypes(This,types,count,ppHandleEnum) ) #define ISOSDacInterface_GetHandleEnumForGC(This,gen,ppHandleEnum) \ - ( (This)->lpVtbl -> GetHandleEnumForGC(This,gen,ppHandleEnum) ) + ( (This)->lpVtbl -> GetHandleEnumForGC(This,gen,ppHandleEnum) ) #define ISOSDacInterface_TraverseEHInfo(This,ip,pCallback,token) \ - ( (This)->lpVtbl -> TraverseEHInfo(This,ip,pCallback,token) ) + ( (This)->lpVtbl -> TraverseEHInfo(This,ip,pCallback,token) ) #define ISOSDacInterface_GetNestedExceptionData(This,exception,exceptionObject,nextNestedException) \ - ( (This)->lpVtbl -> GetNestedExceptionData(This,exception,exceptionObject,nextNestedException) ) + ( (This)->lpVtbl -> GetNestedExceptionData(This,exception,exceptionObject,nextNestedException) ) #define ISOSDacInterface_GetStressLogAddress(This,stressLog) \ - ( (This)->lpVtbl -> GetStressLogAddress(This,stressLog) ) + ( (This)->lpVtbl -> GetStressLogAddress(This,stressLog) ) #define ISOSDacInterface_TraverseLoaderHeap(This,loaderHeapAddr,pCallback) \ - ( (This)->lpVtbl -> TraverseLoaderHeap(This,loaderHeapAddr,pCallback) ) + ( (This)->lpVtbl -> TraverseLoaderHeap(This,loaderHeapAddr,pCallback) ) #define ISOSDacInterface_GetCodeHeapList(This,jitManager,count,codeHeaps,pNeeded) \ - ( (This)->lpVtbl -> GetCodeHeapList(This,jitManager,count,codeHeaps,pNeeded) ) + ( (This)->lpVtbl -> GetCodeHeapList(This,jitManager,count,codeHeaps,pNeeded) ) #define ISOSDacInterface_TraverseVirtCallStubHeap(This,pAppDomain,heaptype,pCallback) \ - ( (This)->lpVtbl -> TraverseVirtCallStubHeap(This,pAppDomain,heaptype,pCallback) ) + ( (This)->lpVtbl -> TraverseVirtCallStubHeap(This,pAppDomain,heaptype,pCallback) ) #define ISOSDacInterface_GetUsefulGlobals(This,data) \ - ( (This)->lpVtbl -> GetUsefulGlobals(This,data) ) + ( (This)->lpVtbl -> GetUsefulGlobals(This,data) ) #define ISOSDacInterface_GetClrWatsonBuckets(This,thread,pGenericModeBlock) \ - ( (This)->lpVtbl -> GetClrWatsonBuckets(This,thread,pGenericModeBlock) ) + ( (This)->lpVtbl -> GetClrWatsonBuckets(This,thread,pGenericModeBlock) ) #define ISOSDacInterface_GetTLSIndex(This,pIndex) \ - ( (This)->lpVtbl -> GetTLSIndex(This,pIndex) ) + ( (This)->lpVtbl -> GetTLSIndex(This,pIndex) ) #define ISOSDacInterface_GetDacModuleHandle(This,phModule) \ - ( (This)->lpVtbl -> GetDacModuleHandle(This,phModule) ) + ( (This)->lpVtbl -> GetDacModuleHandle(This,phModule) ) #define ISOSDacInterface_GetRCWData(This,addr,data) \ - ( (This)->lpVtbl -> GetRCWData(This,addr,data) ) + ( (This)->lpVtbl -> GetRCWData(This,addr,data) ) #define ISOSDacInterface_GetRCWInterfaces(This,rcw,count,interfaces,pNeeded) \ - ( (This)->lpVtbl -> GetRCWInterfaces(This,rcw,count,interfaces,pNeeded) ) + ( (This)->lpVtbl -> GetRCWInterfaces(This,rcw,count,interfaces,pNeeded) ) #define ISOSDacInterface_GetCCWData(This,ccw,data) \ - ( (This)->lpVtbl -> GetCCWData(This,ccw,data) ) + ( (This)->lpVtbl -> GetCCWData(This,ccw,data) ) #define ISOSDacInterface_GetCCWInterfaces(This,ccw,count,interfaces,pNeeded) \ - ( (This)->lpVtbl -> GetCCWInterfaces(This,ccw,count,interfaces,pNeeded) ) + ( (This)->lpVtbl -> GetCCWInterfaces(This,ccw,count,interfaces,pNeeded) ) #define ISOSDacInterface_TraverseRCWCleanupList(This,cleanupListPtr,pCallback,token) \ - ( (This)->lpVtbl -> TraverseRCWCleanupList(This,cleanupListPtr,pCallback,token) ) + ( (This)->lpVtbl -> TraverseRCWCleanupList(This,cleanupListPtr,pCallback,token) ) #define ISOSDacInterface_GetStackReferences(This,osThreadID,ppEnum) \ - ( (This)->lpVtbl -> GetStackReferences(This,osThreadID,ppEnum) ) + ( (This)->lpVtbl -> GetStackReferences(This,osThreadID,ppEnum) ) #define ISOSDacInterface_GetRegisterName(This,regName,count,buffer,pNeeded) \ - ( (This)->lpVtbl -> GetRegisterName(This,regName,count,buffer,pNeeded) ) + ( (This)->lpVtbl -> GetRegisterName(This,regName,count,buffer,pNeeded) ) #define ISOSDacInterface_GetThreadAllocData(This,thread,data) \ - ( (This)->lpVtbl -> GetThreadAllocData(This,thread,data) ) + ( (This)->lpVtbl -> GetThreadAllocData(This,thread,data) ) #define ISOSDacInterface_GetHeapAllocData(This,count,data,pNeeded) \ - ( (This)->lpVtbl -> GetHeapAllocData(This,count,data,pNeeded) ) + ( (This)->lpVtbl -> GetHeapAllocData(This,count,data,pNeeded) ) #define ISOSDacInterface_GetFailedAssemblyList(This,appDomain,count,values,pNeeded) \ - ( (This)->lpVtbl -> GetFailedAssemblyList(This,appDomain,count,values,pNeeded) ) + ( (This)->lpVtbl -> GetFailedAssemblyList(This,appDomain,count,values,pNeeded) ) #define ISOSDacInterface_GetPrivateBinPaths(This,appDomain,count,paths,pNeeded) \ - ( (This)->lpVtbl -> GetPrivateBinPaths(This,appDomain,count,paths,pNeeded) ) + ( (This)->lpVtbl -> GetPrivateBinPaths(This,appDomain,count,paths,pNeeded) ) #define ISOSDacInterface_GetAssemblyLocation(This,assembly,count,location,pNeeded) \ - ( (This)->lpVtbl -> GetAssemblyLocation(This,assembly,count,location,pNeeded) ) + ( (This)->lpVtbl -> GetAssemblyLocation(This,assembly,count,location,pNeeded) ) #define ISOSDacInterface_GetAppDomainConfigFile(This,appDomain,count,configFile,pNeeded) \ - ( (This)->lpVtbl -> GetAppDomainConfigFile(This,appDomain,count,configFile,pNeeded) ) + ( (This)->lpVtbl -> GetAppDomainConfigFile(This,appDomain,count,configFile,pNeeded) ) #define ISOSDacInterface_GetApplicationBase(This,appDomain,count,base,pNeeded) \ - ( (This)->lpVtbl -> GetApplicationBase(This,appDomain,count,base,pNeeded) ) + ( (This)->lpVtbl -> GetApplicationBase(This,appDomain,count,base,pNeeded) ) #define ISOSDacInterface_GetFailedAssemblyData(This,assembly,pContext,pResult) \ - ( (This)->lpVtbl -> GetFailedAssemblyData(This,assembly,pContext,pResult) ) + ( (This)->lpVtbl -> GetFailedAssemblyData(This,assembly,pContext,pResult) ) #define ISOSDacInterface_GetFailedAssemblyLocation(This,assesmbly,count,location,pNeeded) \ - ( (This)->lpVtbl -> GetFailedAssemblyLocation(This,assesmbly,count,location,pNeeded) ) + ( (This)->lpVtbl -> GetFailedAssemblyLocation(This,assesmbly,count,location,pNeeded) ) #define ISOSDacInterface_GetFailedAssemblyDisplayName(This,assembly,count,name,pNeeded) \ - ( (This)->lpVtbl -> GetFailedAssemblyDisplayName(This,assembly,count,name,pNeeded) ) + ( (This)->lpVtbl -> GetFailedAssemblyDisplayName(This,assembly,count,name,pNeeded) ) #endif /* COBJMACROS */ @@ -1931,56 +1938,56 @@ EXTERN_C const IID IID_ISOSDacInterface; #define __ISOSDacInterface2_INTERFACE_DEFINED__ /* interface ISOSDacInterface2 */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSDacInterface2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("A16026EC-96F4-40BA-87FB-5575986FB7AF") ISOSDacInterface2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetObjectExceptionData( + virtual HRESULT STDMETHODCALLTYPE GetObjectExceptionData( CLRDATA_ADDRESS objAddr, struct DacpExceptionObjectData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsRCWDCOMProxy( + + virtual HRESULT STDMETHODCALLTYPE IsRCWDCOMProxy( CLRDATA_ADDRESS rcwAddr, BOOL *isDCOMProxy) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSDacInterface2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSDacInterface2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSDacInterface2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSDacInterface2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetObjectExceptionData )( + + HRESULT ( STDMETHODCALLTYPE *GetObjectExceptionData )( ISOSDacInterface2 * This, CLRDATA_ADDRESS objAddr, struct DacpExceptionObjectData *data); - - HRESULT ( STDMETHODCALLTYPE *IsRCWDCOMProxy )( + + HRESULT ( STDMETHODCALLTYPE *IsRCWDCOMProxy )( ISOSDacInterface2 * This, CLRDATA_ADDRESS rcwAddr, BOOL *isDCOMProxy); - + END_INTERFACE } ISOSDacInterface2Vtbl; @@ -1989,26 +1996,26 @@ EXTERN_C const IID IID_ISOSDacInterface2; CONST_VTBL struct ISOSDacInterface2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSDacInterface2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSDacInterface2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSDacInterface2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSDacInterface2_GetObjectExceptionData(This,objAddr,data) \ - ( (This)->lpVtbl -> GetObjectExceptionData(This,objAddr,data) ) + ( (This)->lpVtbl -> GetObjectExceptionData(This,objAddr,data) ) #define ISOSDacInterface2_IsRCWDCOMProxy(This,rcwAddr,isDCOMProxy) \ - ( (This)->lpVtbl -> IsRCWDCOMProxy(This,rcwAddr,isDCOMProxy) ) + ( (This)->lpVtbl -> IsRCWDCOMProxy(This,rcwAddr,isDCOMProxy) ) #endif /* COBJMACROS */ @@ -2025,61 +2032,61 @@ EXTERN_C const IID IID_ISOSDacInterface2; #define __ISOSDacInterface3_INTERFACE_DEFINED__ /* interface ISOSDacInterface3 */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSDacInterface3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("B08C5CDC-FD8A-49C5-AB38-5FEEF35235B4") ISOSDacInterface3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetGCInterestingInfoData( + virtual HRESULT STDMETHODCALLTYPE GetGCInterestingInfoData( CLRDATA_ADDRESS interestingInfoAddr, struct DacpGCInterestingInfoData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGCInterestingInfoStaticData( + + virtual HRESULT STDMETHODCALLTYPE GetGCInterestingInfoStaticData( struct DacpGCInterestingInfoData *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGCGlobalMechanisms( + + virtual HRESULT STDMETHODCALLTYPE GetGCGlobalMechanisms( size_t *globalMechanisms) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSDacInterface3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSDacInterface3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSDacInterface3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSDacInterface3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetGCInterestingInfoData )( + + HRESULT ( STDMETHODCALLTYPE *GetGCInterestingInfoData )( ISOSDacInterface3 * This, CLRDATA_ADDRESS interestingInfoAddr, struct DacpGCInterestingInfoData *data); - - HRESULT ( STDMETHODCALLTYPE *GetGCInterestingInfoStaticData )( + + HRESULT ( STDMETHODCALLTYPE *GetGCInterestingInfoStaticData )( ISOSDacInterface3 * This, struct DacpGCInterestingInfoData *data); - - HRESULT ( STDMETHODCALLTYPE *GetGCGlobalMechanisms )( + + HRESULT ( STDMETHODCALLTYPE *GetGCGlobalMechanisms )( ISOSDacInterface3 * This, size_t *globalMechanisms); - + END_INTERFACE } ISOSDacInterface3Vtbl; @@ -2088,29 +2095,29 @@ EXTERN_C const IID IID_ISOSDacInterface3; CONST_VTBL struct ISOSDacInterface3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSDacInterface3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSDacInterface3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSDacInterface3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSDacInterface3_GetGCInterestingInfoData(This,interestingInfoAddr,data) \ - ( (This)->lpVtbl -> GetGCInterestingInfoData(This,interestingInfoAddr,data) ) + ( (This)->lpVtbl -> GetGCInterestingInfoData(This,interestingInfoAddr,data) ) #define ISOSDacInterface3_GetGCInterestingInfoStaticData(This,data) \ - ( (This)->lpVtbl -> GetGCInterestingInfoStaticData(This,data) ) + ( (This)->lpVtbl -> GetGCInterestingInfoStaticData(This,data) ) #define ISOSDacInterface3_GetGCGlobalMechanisms(This,globalMechanisms) \ - ( (This)->lpVtbl -> GetGCGlobalMechanisms(This,globalMechanisms) ) + ( (This)->lpVtbl -> GetGCGlobalMechanisms(This,globalMechanisms) ) #endif /* COBJMACROS */ @@ -2127,49 +2134,49 @@ EXTERN_C const IID IID_ISOSDacInterface3; #define __ISOSDacInterface4_INTERFACE_DEFINED__ /* interface ISOSDacInterface4 */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSDacInterface4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("74B9D34C-A612-4B07-93DD-5462178FCE11") ISOSDacInterface4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetClrNotification( + virtual HRESULT STDMETHODCALLTYPE GetClrNotification( CLRDATA_ADDRESS arguments[ ], int count, int *pNeeded) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSDacInterface4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSDacInterface4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSDacInterface4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSDacInterface4 * This); - - HRESULT ( STDMETHODCALLTYPE *GetClrNotification )( + + HRESULT ( STDMETHODCALLTYPE *GetClrNotification )( ISOSDacInterface4 * This, CLRDATA_ADDRESS arguments[ ], int count, int *pNeeded); - + END_INTERFACE } ISOSDacInterface4Vtbl; @@ -2178,23 +2185,23 @@ EXTERN_C const IID IID_ISOSDacInterface4; CONST_VTBL struct ISOSDacInterface4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSDacInterface4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSDacInterface4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSDacInterface4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSDacInterface4_GetClrNotification(This,arguments,count,pNeeded) \ - ( (This)->lpVtbl -> GetClrNotification(This,arguments,count,pNeeded) ) + ( (This)->lpVtbl -> GetClrNotification(This,arguments,count,pNeeded) ) #endif /* COBJMACROS */ @@ -2211,53 +2218,53 @@ EXTERN_C const IID IID_ISOSDacInterface4; #define __ISOSDacInterface5_INTERFACE_DEFINED__ /* interface ISOSDacInterface5 */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSDacInterface5; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("127d6abe-6c86-4e48-8e7b-220781c58101") ISOSDacInterface5 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetTieredVersions( + virtual HRESULT STDMETHODCALLTYPE GetTieredVersions( CLRDATA_ADDRESS methodDesc, int rejitId, struct DacpTieredVersionData *nativeCodeAddrs, int cNativeCodeAddrs, int *pcNativeCodeAddrs) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSDacInterface5Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSDacInterface5 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSDacInterface5 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSDacInterface5 * This); - - HRESULT ( STDMETHODCALLTYPE *GetTieredVersions )( + + HRESULT ( STDMETHODCALLTYPE *GetTieredVersions )( ISOSDacInterface5 * This, CLRDATA_ADDRESS methodDesc, int rejitId, struct DacpTieredVersionData *nativeCodeAddrs, int cNativeCodeAddrs, int *pcNativeCodeAddrs); - + END_INTERFACE } ISOSDacInterface5Vtbl; @@ -2266,23 +2273,23 @@ EXTERN_C const IID IID_ISOSDacInterface5; CONST_VTBL struct ISOSDacInterface5Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSDacInterface5_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSDacInterface5_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSDacInterface5_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSDacInterface5_GetTieredVersions(This,methodDesc,rejitId,nativeCodeAddrs,cNativeCodeAddrs,pcNativeCodeAddrs) \ - ( (This)->lpVtbl -> GetTieredVersions(This,methodDesc,rejitId,nativeCodeAddrs,cNativeCodeAddrs,pcNativeCodeAddrs) ) + ( (This)->lpVtbl -> GetTieredVersions(This,methodDesc,rejitId,nativeCodeAddrs,cNativeCodeAddrs,pcNativeCodeAddrs) ) #endif /* COBJMACROS */ @@ -2299,47 +2306,47 @@ EXTERN_C const IID IID_ISOSDacInterface5; #define __ISOSDacInterface6_INTERFACE_DEFINED__ /* interface ISOSDacInterface6 */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSDacInterface6; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("11206399-4B66-4EDB-98EA-85654E59AD45") ISOSDacInterface6 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetMethodTableCollectibleData( + virtual HRESULT STDMETHODCALLTYPE GetMethodTableCollectibleData( CLRDATA_ADDRESS mt, struct DacpMethodTableCollectibleData *data) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSDacInterface6Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSDacInterface6 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSDacInterface6 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSDacInterface6 * This); - - HRESULT ( STDMETHODCALLTYPE *GetMethodTableCollectibleData )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodTableCollectibleData )( ISOSDacInterface6 * This, CLRDATA_ADDRESS mt, struct DacpMethodTableCollectibleData *data); - + END_INTERFACE } ISOSDacInterface6Vtbl; @@ -2348,23 +2355,23 @@ EXTERN_C const IID IID_ISOSDacInterface6; CONST_VTBL struct ISOSDacInterface6Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSDacInterface6_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSDacInterface6_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSDacInterface6_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSDacInterface6_GetMethodTableCollectibleData(This,mt,data) \ - ( (This)->lpVtbl -> GetMethodTableCollectibleData(This,mt,data) ) + ( (This)->lpVtbl -> GetMethodTableCollectibleData(This,mt,data) ) #endif /* COBJMACROS */ @@ -2381,80 +2388,80 @@ EXTERN_C const IID IID_ISOSDacInterface6; #define __ISOSDacInterface7_INTERFACE_DEFINED__ /* interface ISOSDacInterface7 */ -/* [uuid][local][object] */ +/* [uuid][local][object] */ EXTERN_C const IID IID_ISOSDacInterface7; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("c1020dde-fe98-4536-a53b-f35a74c327eb") ISOSDacInterface7 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetPendingReJITID( + virtual HRESULT STDMETHODCALLTYPE GetPendingReJITID( CLRDATA_ADDRESS methodDesc, int *pRejitId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReJITInformation( + + virtual HRESULT STDMETHODCALLTYPE GetReJITInformation( CLRDATA_ADDRESS methodDesc, int rejitId, struct DacpReJitData2 *pRejitData) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetProfilerModifiedILInformation( + + virtual HRESULT STDMETHODCALLTYPE GetProfilerModifiedILInformation( CLRDATA_ADDRESS methodDesc, struct DacpProfilerILData *pILData) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodsWithProfilerModifiedIL( + + virtual HRESULT STDMETHODCALLTYPE GetMethodsWithProfilerModifiedIL( CLRDATA_ADDRESS mod, CLRDATA_ADDRESS *methodDescs, int cMethodDescs, int *pcMethodDescs) = 0; - + }; - - + + #else /* C style interface */ typedef struct ISOSDacInterface7Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISOSDacInterface7 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ISOSDacInterface7 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ISOSDacInterface7 * This); - - HRESULT ( STDMETHODCALLTYPE *GetPendingReJITID )( + + HRESULT ( STDMETHODCALLTYPE *GetPendingReJITID )( ISOSDacInterface7 * This, CLRDATA_ADDRESS methodDesc, int *pRejitId); - - HRESULT ( STDMETHODCALLTYPE *GetReJITInformation )( + + HRESULT ( STDMETHODCALLTYPE *GetReJITInformation )( ISOSDacInterface7 * This, CLRDATA_ADDRESS methodDesc, int rejitId, struct DacpReJitData2 *pRejitData); - - HRESULT ( STDMETHODCALLTYPE *GetProfilerModifiedILInformation )( + + HRESULT ( STDMETHODCALLTYPE *GetProfilerModifiedILInformation )( ISOSDacInterface7 * This, CLRDATA_ADDRESS methodDesc, struct DacpProfilerILData *pILData); - - HRESULT ( STDMETHODCALLTYPE *GetMethodsWithProfilerModifiedIL )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodsWithProfilerModifiedIL )( ISOSDacInterface7 * This, CLRDATA_ADDRESS mod, CLRDATA_ADDRESS *methodDescs, int cMethodDescs, int *pcMethodDescs); - + END_INTERFACE } ISOSDacInterface7Vtbl; @@ -2463,32 +2470,32 @@ EXTERN_C const IID IID_ISOSDacInterface7; CONST_VTBL struct ISOSDacInterface7Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ISOSDacInterface7_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISOSDacInterface7_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ISOSDacInterface7_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ISOSDacInterface7_GetPendingReJITID(This,methodDesc,pRejitId) \ - ( (This)->lpVtbl -> GetPendingReJITID(This,methodDesc,pRejitId) ) + ( (This)->lpVtbl -> GetPendingReJITID(This,methodDesc,pRejitId) ) #define ISOSDacInterface7_GetReJITInformation(This,methodDesc,rejitId,pRejitData) \ - ( (This)->lpVtbl -> GetReJITInformation(This,methodDesc,rejitId,pRejitData) ) + ( (This)->lpVtbl -> GetReJITInformation(This,methodDesc,rejitId,pRejitData) ) #define ISOSDacInterface7_GetProfilerModifiedILInformation(This,methodDesc,pILData) \ - ( (This)->lpVtbl -> GetProfilerModifiedILInformation(This,methodDesc,pILData) ) + ( (This)->lpVtbl -> GetProfilerModifiedILInformation(This,methodDesc,pILData) ) #define ISOSDacInterface7_GetMethodsWithProfilerModifiedIL(This,mod,methodDescs,cMethodDescs,pcMethodDescs) \ - ( (This)->lpVtbl -> GetMethodsWithProfilerModifiedIL(This,mod,methodDescs,cMethodDescs,pcMethodDescs) ) + ( (This)->lpVtbl -> GetMethodsWithProfilerModifiedIL(This,mod,methodDescs,cMethodDescs,pcMethodDescs) ) #endif /* COBJMACROS */ @@ -2501,6 +2508,146 @@ EXTERN_C const IID IID_ISOSDacInterface7; #endif /* __ISOSDacInterface7_INTERFACE_DEFINED__ */ +#ifndef __ISOSDacInterface8_INTERFACE_DEFINED__ +#define __ISOSDacInterface8_INTERFACE_DEFINED__ + +/* interface ISOSDacInterface8 */ +/* [uuid][local][object] */ + + +EXTERN_C const IID IID_ISOSDacInterface8; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c12f35a9-e55c-4520-a894-b3dc5165dfce") + ISOSDacInterface8 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetNumberGenerations( + unsigned int *pGenerations) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGenerationTable( + unsigned int cGenerations, + struct DacpGenerationData *pGenerationData, + unsigned int *pNeeded) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFinalizationFillPointers( + unsigned int cFillPointers, + CLRDATA_ADDRESS *pFinalizationFillPointers, + unsigned int *pNeeded) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGenerationTableSvr( + CLRDATA_ADDRESS heapAddr, + unsigned int cGenerations, + struct DacpGenerationData *pGenerationData, + unsigned int *pNeeded) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFinalizationFillPointersSvr( + CLRDATA_ADDRESS heapAddr, + unsigned int cFillPointers, + CLRDATA_ADDRESS *pFinalizationFillPointers, + unsigned int *pNeeded) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ISOSDacInterface8Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISOSDacInterface8 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISOSDacInterface8 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISOSDacInterface8 * This); + + HRESULT ( STDMETHODCALLTYPE *GetNumberGenerations )( + ISOSDacInterface8 * This, + unsigned int *pGenerations); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationTable )( + ISOSDacInterface8 * This, + unsigned int cGenerations, + struct DacpGenerationData *pGenerationData, + unsigned int *pNeeded); + + HRESULT ( STDMETHODCALLTYPE *GetFinalizationFillPointers )( + ISOSDacInterface8 * This, + unsigned int cFillPointers, + CLRDATA_ADDRESS *pFinalizationFillPointers, + unsigned int *pNeeded); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationTableSvr )( + ISOSDacInterface8 * This, + CLRDATA_ADDRESS heapAddr, + unsigned int cGenerations, + struct DacpGenerationData *pGenerationData, + unsigned int *pNeeded); + + HRESULT ( STDMETHODCALLTYPE *GetFinalizationFillPointersSvr )( + ISOSDacInterface8 * This, + CLRDATA_ADDRESS heapAddr, + unsigned int cFillPointers, + CLRDATA_ADDRESS *pFinalizationFillPointers, + unsigned int *pNeeded); + + END_INTERFACE + } ISOSDacInterface8Vtbl; + + interface ISOSDacInterface8 + { + CONST_VTBL struct ISOSDacInterface8Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISOSDacInterface8_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISOSDacInterface8_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISOSDacInterface8_Release(This) \ + ( (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) ) + +#define ISOSDacInterface8_GetFinalizationFillPointers(This,cFillPointers,pFinalizationFillPointers,pNeeded) \ + ( (This)->lpVtbl -> GetFinalizationFillPointers(This,cFillPointers,pFinalizationFillPointers,pNeeded) ) + +#define ISOSDacInterface8_GetGenerationTableSvr(This,heapAddr,cGenerations,pGenerationData,pNeeded) \ + ( (This)->lpVtbl -> GetGenerationTableSvr(This,heapAddr,cGenerations,pGenerationData,pNeeded) ) + +#define ISOSDacInterface8_GetFinalizationFillPointersSvr(This,heapAddr,cFillPointers,pFinalizationFillPointers,pNeeded) \ + ( (This)->lpVtbl -> GetFinalizationFillPointersSvr(This,heapAddr,cFillPointers,pFinalizationFillPointers,pNeeded) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISOSDacInterface8_INTERFACE_DEFINED__ */ + + /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */