From: Mike McLaughlin Date: Sat, 8 Dec 2018 21:30:40 +0000 (-0800) Subject: Update from coreclr SOS. (#98) X-Git-Tag: submit/tizen/20190813.035844~68 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26931d8ac53a6d6b2533f4ec42fea0cfaacfa348;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Update from coreclr SOS. (#98) Update from coreclr SOS. Fix test script. --- diff --git a/src/SOS/SOS.UnitTests/Scripts/GCTests.script b/src/SOS/SOS.UnitTests/Scripts/GCTests.script index 10898248c..b4d620655 100644 --- a/src/SOS/SOS.UnitTests/Scripts/GCTests.script +++ b/src/SOS/SOS.UnitTests/Scripts/GCTests.script @@ -76,8 +76,8 @@ ENDIF:WINDOWS SOSCOMMAND:EEHeap VERIFY:\s*Loader Heap:\s+ VERIFY:\s+System Domain:\s+\s+ -VERIFY:\s+LowFrequencyHeap:\s+.*bytes\.\s+ -VERIFY:\s+HighFrequencyHeap:\s+.*bytes\.\s+ +VERIFY:\s+LowFrequencyHeap:\s+.*bytes.*\s+ +VERIFY:\s+HighFrequencyHeap:\s+.*bytes.*\s+ VERIFY:\s+Total size:\s+Size:\s+0x\s+\(|lu\)\s+bytes\.\s+ VERIFY:\s+Jit code heap:\s+ VERIFY:\s+LoaderCodeHeap:\s+.*bytes\.\s+ diff --git a/src/SOS/Strike/strike.cpp b/src/SOS/Strike/strike.cpp index a08443ab5..04fb66f96 100644 --- a/src/SOS/Strike/strike.cpp +++ b/src/SOS/Strike/strike.cpp @@ -3383,7 +3383,10 @@ DECLARE_API(EEHeap) // The first one is the system domain. ExtOut("Loader Heap:\n"); IfFailRet(PrintDomainHeapInfo("System Domain", adsData.systemDomain, &allHeapSize, &wasted)); - IfFailRet(PrintDomainHeapInfo("Shared Domain", adsData.sharedDomain, &allHeapSize, &wasted)); + if (adsData.sharedDomain != NULL) + { + IfFailRet(PrintDomainHeapInfo("Shared Domain", adsData.sharedDomain, &allHeapSize, &wasted)); + } ArrayHolder pArray = new NOTHROW CLRDATA_ADDRESS[adsData.DomainCount]; @@ -6083,14 +6086,17 @@ DECLARE_API(DumpDomain) } DomainInfo(&appDomain); - ExtOut("--------------------------------------\n"); - DMLOut("Shared Domain: %s\n", DMLDomain(adsData.sharedDomain)); - if ((Status=appDomain.Request(g_sos, adsData.sharedDomain))!=S_OK) + if (adsData.sharedDomain != NULL) { - ExtOut("Unable to get shared domain info\n"); - return Status; + ExtOut("--------------------------------------\n"); + DMLOut("Shared Domain: %s\n", DMLDomain(adsData.sharedDomain)); + if ((Status=appDomain.Request(g_sos, adsData.sharedDomain))!=S_OK) + { + ExtOut("Unable to get shared domain info\n"); + return Status; + } + DomainInfo(&appDomain); } - DomainInfo(&appDomain); ArrayHolder pArray = new NOTHROW CLRDATA_ADDRESS[adsData.DomainCount]; if (pArray==NULL) @@ -10731,11 +10737,8 @@ DECLARE_API(FindRoots) class GCHandleStatsForDomains { public: - const static int SHARED_DOMAIN_INDEX = 0; - const static int SYSTEM_DOMAIN_INDEX = 1; - GCHandleStatsForDomains() - : m_singleDomainMode(FALSE), m_numDomains(0), m_pStatistics(NULL), m_pDomainPointers(NULL) + : m_singleDomainMode(FALSE), m_numDomains(0), m_pStatistics(NULL), m_pDomainPointers(NULL), m_sharedDomainIndex(-1), m_systemDomainIndex(-1) { } @@ -10769,19 +10772,28 @@ public: if (adsData.Request(g_sos) != S_OK) return FALSE; - m_numDomains = adsData.DomainCount + 2; - ArrayHolder pArray = new NOTHROW CLRDATA_ADDRESS[adsData.DomainCount + 2]; + LONG numSpecialDomains = (adsData.sharedDomain != NULL) ? 2 : 1; + m_numDomains = adsData.DomainCount + numSpecialDomains; + ArrayHolder pArray = new NOTHROW CLRDATA_ADDRESS[m_numDomains]; if (pArray == NULL) return FALSE; - pArray[SHARED_DOMAIN_INDEX] = adsData.sharedDomain; - pArray[SYSTEM_DOMAIN_INDEX] = adsData.systemDomain; + int i = 0; + if (adsData.sharedDomain != NULL) + { + pArray[i++] = adsData.sharedDomain; + } + + pArray[i] = adsData.systemDomain; + + 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+2, NULL) != S_OK) + if (g_sos->GetAppDomainList(adsData.DomainCount, pArray+numSpecialDomains, NULL) != S_OK) return FALSE; m_pDomainPointers = pArray.Detach(); - m_pStatistics = new NOTHROW GCHandleStatistics[adsData.DomainCount + 2]; + m_pStatistics = new NOTHROW GCHandleStatistics[m_numDomains]; if (m_pStatistics == NULL) return FALSE; } @@ -10826,12 +10838,24 @@ public: SOS_Assert(index < m_numDomains); return m_pDomainPointers[index]; } - + + int GetSharedDomainIndex() + { + return m_sharedDomainIndex; + } + + int GetSystemDomainIndex() + { + return m_systemDomainIndex; + } + private: BOOL m_singleDomainMode; int m_numDomains; GCHandleStatistics *m_pStatistics; CLRDATA_ADDRESS *m_pDomainPointers; + int m_sharedDomainIndex; + int m_systemDomainIndex; }; class GCHandlesImpl @@ -10902,9 +10926,9 @@ public: Print( "------------------------------------------------------------------------------\n"); Print("GC Handle Statistics for AppDomain ", AppDomainPtr(mHandleStat.GetDomain(i))); - if (i == GCHandleStatsForDomains::SHARED_DOMAIN_INDEX) + if (i == mHandleStat.GetSharedDomainIndex()) Print(" (Shared Domain)\n"); - else if (i == GCHandleStatsForDomains::SYSTEM_DOMAIN_INDEX) + else if (i == mHandleStat.GetSystemDomainIndex()) Print(" (System Domain)\n"); else Print("\n"); diff --git a/src/SOS/Strike/util.cpp b/src/SOS/Strike/util.cpp index 1ae4e3f15..93fff4924 100644 --- a/src/SOS/Strike/util.cpp +++ b/src/SOS/Strike/util.cpp @@ -914,16 +914,6 @@ void GetStaticFieldPTR(DWORD_PTR* pOutPtr, DacpDomainLocalModuleData* pDLMD, Dac } else { - if (pFlags && pMTD->bIsShared) - { - BYTE flags; - DWORD_PTR pTargetFlags = (DWORD_PTR) pDLMD->pClassData + RidFromToken(pMTD->cl) - 1; - move_xp (flags, pTargetFlags); - - *pFlags = flags; - } - - *pOutPtr = dwTmp; } return; @@ -1051,7 +1041,7 @@ void DisplaySharedStatic(ULONG64 dwModuleDomainID, DacpMethodTableData* pMT, Dac ExtOut(" <<\n"); } -void DisplayThreadStatic (DacpModuleData* pModule, DacpMethodTableData* pMT, DacpFieldDescData *pFD, BOOL fIsShared) +void DisplayThreadStatic(DacpModuleData* pModule, DacpMethodTableData* pMT, DacpFieldDescData *pFD) { SIZE_T dwModuleIndex = (SIZE_T)pModule->dwModuleIndex; SIZE_T dwModuleDomainID = (SIZE_T)pModule->dwModuleID; @@ -1074,31 +1064,6 @@ void DisplayThreadStatic (DacpModuleData* pModule, DacpMethodTableData* pMT, Dac { CLRDATA_ADDRESS appDomainAddr = vThread.domain; - // Get the DLM (we need this to check the ClassInit flags). - // It's annoying that we have to issue one request for - // domain-neutral modules and domain-specific modules. - DacpDomainLocalModuleData vDomainLocalModule; - if (fIsShared) - { - if (g_sos->GetDomainLocalModuleDataFromAppDomain(appDomainAddr, (int)dwModuleDomainID, &vDomainLocalModule) != S_OK) - { - // Not initialized, go to next thread - // and continue looping - CurThread = vThread.nextThread; - continue; - } - } - else - { - if (g_sos->GetDomainLocalModuleDataFromModule(pMT->Module, &vDomainLocalModule) != S_OK) - { - // Not initialized, go to next thread - // and continue looping - CurThread = vThread.nextThread; - continue; - } - } - // Get the TLM DacpThreadLocalModuleData vThreadLocalModule; if (g_sos->GetThreadLocalModuleData(CurThread, (int)dwModuleIndex, &vThreadLocalModule) != S_OK) @@ -1121,17 +1086,6 @@ void DisplayThreadStatic (DacpModuleData* pModule, DacpMethodTableData* pMT, Dac continue; } - Flags = 0; - GetDLMFlags(&vDomainLocalModule, pMT, &Flags); - - if ((Flags&1) == 0) - { - // Not initialized, go to next thread - // and continue looping - CurThread = vThread.nextThread; - continue; - } - ExtOut(" %x:", vThread.osThreadId); DisplayDataMember(pFD, dwTmp, FALSE); } @@ -1243,8 +1197,6 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT numInstanceFields = 0; } - BOOL fIsShared = pMTD->bIsShared; - if (pMTD->ParentMethodTable) { DacpMethodTableData vParentMethTable; @@ -1292,7 +1244,7 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT dwAddr = vFieldDesc.NextField; DWORD offset = vFieldDesc.dwOffset; - if(!((vFieldDesc.bIsThreadLocal || fIsShared) && vFieldDesc.bIsStatic)) + if(!(vFieldDesc.bIsThreadLocal && vFieldDesc.bIsStatic)) { if (!bValueClass) { @@ -1334,10 +1286,7 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT if (vFieldDesc.bIsStatic && vFieldDesc.bIsThreadLocal) { numStaticFields ++; - if (fIsShared) - ExtOut("%8s %" POINTERSIZE "s", "shared", vFieldDesc.bIsThreadLocal ? "TLstatic" : "CLstatic"); - else - ExtOut("%8s ", vFieldDesc.bIsThreadLocal ? "TLstatic" : "CLstatic"); + ExtOut("%8s ", vFieldDesc.bIsThreadLocal ? "TLstatic" : "CLstatic"); NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false); ExtOut(" %S\n", g_mdName); @@ -1353,7 +1302,7 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT DacpModuleData vModule; if (vModule.Request(g_sos,pMTD->Module) == S_OK) { - DisplayThreadStatic(&vModule, pMTD, &vFieldDesc, fIsShared); + DisplayThreadStatic(&vModule, pMTD, &vFieldDesc); } } } @@ -1363,47 +1312,24 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT { numStaticFields ++; - if (fIsShared) - { - ExtOut("%8s %" POINTERSIZE "s", "shared", "static"); + ExtOut("%8s ", "static"); - NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false); - ExtOut(" %S\n", g_mdName); + DacpDomainLocalModuleData vDomainLocalModule; - if (IsMiniDumpFile()) - { - ExtOut(" \n"); - } - else - { - DacpModuleData vModule; - if (vModule.Request(g_sos,pMTD->Module) == S_OK) - { - DisplaySharedStatic(vModule.dwModuleID, pMTD, &vFieldDesc); - } - } + // The MethodTable isn't shared, so the module must not be loaded domain neutral. We can + // get the specific DomainLocalModule instance without needing to know the AppDomain in advance. + if (g_sos->GetDomainLocalModuleDataFromModule(pMTD->Module, &vDomainLocalModule) != S_OK) + { + ExtOut(" \n"); } else { - ExtOut("%8s ", "static"); - - DacpDomainLocalModuleData vDomainLocalModule; - - // The MethodTable isn't shared, so the module must not be loaded domain neutral. We can - // get the specific DomainLocalModule instance without needing to know the AppDomain in advance. - if (g_sos->GetDomainLocalModuleDataFromModule(pMTD->Module, &vDomainLocalModule) != S_OK) - { - ExtOut(" \n"); - } - else - { - DWORD_PTR dwTmp; - GetStaticFieldPTR(&dwTmp, &vDomainLocalModule, pMTD, &vFieldDesc); - DisplayDataMember(&vFieldDesc, dwTmp); + DWORD_PTR dwTmp; + GetStaticFieldPTR(&dwTmp, &vDomainLocalModule, pMTD, &vFieldDesc); + DisplayDataMember(&vFieldDesc, dwTmp); - NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false); - ExtOut(" %S\n", g_mdName); - } + NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false); + ExtOut(" %S\n", g_mdName); } } else @@ -2490,7 +2416,8 @@ DWORD_PTR *ModuleFromName(__in_opt LPSTR mName, int *numModule) ArrayHolder pAssemblyArray = NULL; ArrayHolder pModules = NULL; int arrayLength = 0; - if (!ClrSafeInt::addition(adsData.DomainCount, 2, arrayLength)) + int numSpecialDomains = (adsData.sharedDomain != NULL) ? 2 : 1; + if (!ClrSafeInt::addition(adsData.DomainCount, numSpecialDomains, arrayLength)) { ExtOut("\n"); return NULL; @@ -2504,8 +2431,11 @@ DWORD_PTR *ModuleFromName(__in_opt LPSTR mName, int *numModule) } pArray[0] = adsData.systemDomain; - pArray[1] = adsData.sharedDomain; - if (g_sos->GetAppDomainList(adsData.DomainCount, pArray.GetPtr()+2, NULL)!=S_OK) + if (adsData.sharedDomain != NULL) + { + pArray[1] = adsData.sharedDomain; + } + if (g_sos->GetAppDomainList(adsData.DomainCount, pArray.GetPtr()+numSpecialDomains, NULL)!=S_OK) { ExtOut("Unable to get array of AppDomains\n"); return NULL; @@ -2531,7 +2461,7 @@ DWORD_PTR *ModuleFromName(__in_opt LPSTR mName, int *numModule) char fileName[sizeof(StringData)/2]; // Search all domains to find a module - for (int n = 0; n < adsData.DomainCount+2; n++) + for (int n = 0; n < adsData.DomainCount+numSpecialDomains; n++) { if (IsInterrupt()) { @@ -3269,7 +3199,8 @@ void GetDomainList (DWORD_PTR *&domainList, int &numDomain) // Do prefast integer checks before the malloc. size_t AllocSize; LONG DomainAllocCount; - if (!ClrSafeInt::addition(adsData.DomainCount, 2, DomainAllocCount) || + LONG NumExtraDomains = (adsData.sharedDomain != NULL) ? 2 : 1; + if (!ClrSafeInt::addition(adsData.DomainCount, NumExtraDomains, DomainAllocCount) || !ClrSafeInt::multiply(DomainAllocCount, sizeof(PVOID), AllocSize) || (domainList = new DWORD_PTR[DomainAllocCount]) == NULL) { @@ -3277,7 +3208,10 @@ void GetDomainList (DWORD_PTR *&domainList, int &numDomain) } domainList[numDomain++] = (DWORD_PTR) adsData.systemDomain; - domainList[numDomain++] = (DWORD_PTR) adsData.sharedDomain; + if (adsData.sharedDomain != NULL) + { + domainList[numDomain++] = (DWORD_PTR) adsData.sharedDomain; + } CLRDATA_ADDRESS *pArray = new CLRDATA_ADDRESS[adsData.DomainCount]; if (pArray==NULL) diff --git a/src/inc/MSCOREE.IDL b/src/inc/MSCOREE.IDL index 5917e4c09..92aa0b7c7 100644 --- a/src/inc/MSCOREE.IDL +++ b/src/inc/MSCOREE.IDL @@ -40,13 +40,6 @@ cpp_quote("EXTERN_GUID(CLSID_ComCallUnmarshal, 0x3F281000,0xE95A,0x11d2,0x88,0x6 cpp_quote("EXTERN_GUID(CLSID_ComCallUnmarshalV4, 0x45fb4600,0xe6e8,0x4928,0xb2,0x5e,0x50,0x47,0x6f,0xf7,0x94,0x25);") #endif // FEATURE_COMINTEROP - -#ifdef FEATURE_COMINTEROP -// IID IManagedObject : uuid(C3FCC19E-A970-11d2-8B5A-00A0C9B7C9C4) -cpp_quote("EXTERN_GUID(IID_IManagedObject, 0xc3fcc19e, 0xa970, 0x11d2, 0x8b, 0x5a, 0x00, 0xa0, 0xc9, 0xb7, 0xc9, 0xc4);") -#endif // FEATURE_COMINTEROP - - #ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING // IID ICLRAppDomainResourceMonitor: uuid(C62DE18C-2E23-4AEA-8423-B40C1FC59EAE) cpp_quote("EXTERN_GUID(IID_ICLRAppDomainResourceMonitor, 0XC62DE18C, 0X2E23, 0X4AEA, 0X84, 0X23, 0XB4, 0X0C, 0X1F, 0XC5, 0X9E, 0XAE);") @@ -992,29 +985,6 @@ library mscoree cpp_quote("#define CCW_PTR int *") #endif // WIN64 -#ifdef FEATURE_COMINTEROP - //***************************************************************************** - // Interface for controlling a managed object - //***************************************************************************** - [ - object, - oleautomation, - uuid(C3FCC19E-A970-11d2-8B5A-00A0C9B7C9C4), - helpstring("Managed Object Interface"), - pointer_default(unique), - proxy - ] - interface IManagedObject : IUnknown - { - // helper to serialize the object and marshal it to the client - HRESULT GetSerializedBuffer( [out] BSTR *pBSTR); - - // Object identity includes, process guid, appdomain id, ccw - HRESULT GetObjectIdentity([out] BSTR* pBSTRGUID, [out] int* AppDomainID, [out] CCW_PTR pCCW); - }; -#endif // FEATURE_COMINTEROP - - #ifdef FEATURE_COMINTEROP //***************************************************************************** // IMarshal implementation for 1.0, 1.1, and 2.0 COM callable wrappers diff --git a/src/inc/cor.h b/src/inc/cor.h index a050eb42a..3494b05e4 100644 --- a/src/inc/cor.h +++ b/src/inc/cor.h @@ -1956,7 +1956,6 @@ typedef enum nltAnsi = 2, // ansi keyword specified nltUnicode = 3, // unicode keyword specified nltAuto = 4, // auto keyword specified - nltOle = 5, // ole keyword specified nltMaxValue = 7, // used so we can assert how many bits are required for this enum } CorNativeLinkType; diff --git a/src/inc/cordebug.idl b/src/inc/cordebug.idl index fea48d794..ce1bf4a49 100644 --- a/src/inc/cordebug.idl +++ b/src/inc/cordebug.idl @@ -225,19 +225,19 @@ typedef struct CorDebugGuidToTypeMapping /* * Callback interface for providing access to a particular target process. The - * debugging services will call functions on this interface to access memory - * and other data in the target process. The debugger client must implement + * debugging services will call functions on this interface to access memory + * and other data in the target process. The debugger client must implement * this interface as appropriate for the particular target (for example, a live * process or a memory dump). The DataTarget will only be invoked from within - * the implementation of other ICorDebug APIs (i.e. the debugger client has - * control over which thread it is invoked on, and when) + * the implementation of other ICorDebug APIs (i.e. the debugger client has + * control over which thread it is invoked on, and when) * * Error HRESULTS returned by DataTarget APIs will propagate up and be returned * by the active ICorDebug API call. * * The DataTarget implementation must always return up-to-date information - * about the target. The target process should be stopped (not changing - * in any way) while ICorDebug APIs (and hence DataTarget APIs) are being + * about the target. The target process should be stopped (not changing + * in any way) while ICorDebug APIs (and hence DataTarget APIs) are being * called. If the target is a live process and it's state changes, * OpenVirtualProcess needs to be called again to provide a replacement * ICorDebugProcess instance. @@ -251,18 +251,18 @@ typedef struct CorDebugGuidToTypeMapping interface ICorDebugDataTarget : IUnknown { /* - * GetPlatform returns the processor architecture and operating system on - * which the target process is (or was) running. + * GetPlatform returns the processor architecture and operating system on + * which the target process is (or was) running. * - * This is used by ICorDebug to determine details of the target process - * such as its pointer size, address space layout, register set, + * This is used by ICorDebug to determine details of the target process + * such as its pointer size, address space layout, register set, * instruction format, context layout, and calling conventions, etc. * This platforms in this list are the only ones supported by this version * of ICorDebug, but more may be added in future versions. * - * Note that this may actually indicate the platform which is being + * Note that this may actually indicate the platform which is being * emulated for the target, not the actual hardware in use. For example, - * a process running in the WOW on Windows x64 should use + * a process running in the WOW on Windows x64 should use * CORDB_PLATFORM_WINDOWS_X86. * * Implementations should be sure to describe what the platform of the @@ -282,7 +282,7 @@ interface ICorDebugDataTarget : IUnknown CORDB_PLATFORM_WINDOWS_ARM64, // Windows on ARM64 CORDB_PLATFORM_POSIX_AMD64, // Posix supporting OS on Intel x64 - CORDB_PLATFORM_POSIX_X86, // Posix supporting OS on Intel x86 + CORDB_PLATFORM_POSIX_X86, // Posix supporting OS on Intel x86 CORDB_PLATFORM_POSIX_ARM, // Posix supporting OS on ARM32 CORDB_PLATFORM_POSIX_ARM64 // Posix supporting OS on ARM64 } CorDebugPlatform; @@ -292,13 +292,13 @@ interface ICorDebugDataTarget : IUnknown /* * ReadVirtual - Read virtual memory from the target process. * - * Requests contiguous memory starting at the specified target address to - * be read from the target process into the supplied buffer. If at least - * the first byte (at the specified start address) can be read, the call + * Requests contiguous memory starting at the specified target address to + * be read from the target process into the supplied buffer. If at least + * the first byte (at the specified start address) can be read, the call * should return success (to support efficient reading of data structures * with self-describing length, like null-terminated strings). * - * On success, the actual number of bytes read must be stored into + * On success, the actual number of bytes read must be stored into * pBytesRead. */ HRESULT ReadVirtual([in] CORDB_ADDRESS address, @@ -309,12 +309,12 @@ interface ICorDebugDataTarget : IUnknown /* * GetThreadContext - Get the thread context (register values) for a thread. * - * Requests the current thread context for the specified (operating-system - * defined) thread identifier. The size and format of the context record - * is platform dependant, and is determined by the result of the call to - * GetPlatform. - * - * The context flags specify, in a platform-dependent manor, which portions + * Requests the current thread context for the specified (operating-system + * defined) thread identifier. The size and format of the context record + * is platform dependant, and is determined by the result of the call to + * GetPlatform. + * + * The context flags specify, in a platform-dependent manor, which portions * of the context should be read. contextSize specifies the size of the * supplied buffer, but the function is free to not fill the whole buffer * if it is possible to determine the actual size from the context. @@ -488,7 +488,7 @@ interface ICorDebugMergedAssemblyRecord : IUnknown * These names do not include qualifiers such as file extensions, culture, version, or public key token */ HRESULT GetSimpleName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]); - + /* * GetVersion - Gives the assembly version information */ @@ -507,7 +507,7 @@ interface ICorDebugMergedAssemblyRecord : IUnknown /* * GetPublicKeyToken - Gives the assembly public key token (the last 8 bytes of a SHA1 hash of the public key) */ - HRESULT GetPublicKeyToken([in] ULONG32 cbPublicKeyToken, [out] ULONG32 *pcbPublicKeyToken, + HRESULT GetPublicKeyToken([in] ULONG32 cbPublicKeyToken, [out] ULONG32 *pcbPublicKeyToken, [out, size_is(cbPublicKeyToken), length_is(*pcbPublicKeyToken)] BYTE pbPublicKeyToken[]); /* @@ -696,7 +696,7 @@ interface ICorDebugVirtualUnwinder : IUnknown [out] ULONG32* contextSize, [out, size_is(cbContextBuf)] BYTE contextBuf[]); - /* + /* * Advances to the callers context. * * If a failing HRESULT is returned ICorDebug APIs will return CORDBG_E_DATA_TARGET_ERROR. @@ -812,7 +812,7 @@ interface ICorDebugDataTarget3 : IUnknown }; /* - * Data target that knows how to obtain debugee's process id. + * Data target that knows how to obtain debugee's process id. * Debugee is not necessarily a living process at that time or on the same machine. */ [ @@ -832,20 +832,20 @@ interface ICorDebugDataTarget4 : IUnknown }; /* - * Mutable extension to the data target. This version of ICorDebugDataTarget - * can be implemented by targets that wish to support modification of the target + * Mutable extension to the data target. This version of ICorDebugDataTarget + * can be implemented by targets that wish to support modification of the target * process (such as for live invasive debugging). * - * All of these APIs are optional in the sense that no core inspection-based + * All of these APIs are optional in the sense that no core inspection-based * debugging functionality will be lost by not implementing this interface or * by the failure of these methods. Any failure HRESULT from these APIs will * propagate out as the HRESULT from the ICorDebug API call. * * Note that a single ICorDebug API call may result in multiple mutations, - * and there is no mechanism for ensuring related mutations are applied + * and there is no mechanism for ensuring related mutations are applied * transactionally (all-or-none). This means that if a mutation fails after * others (for the same ICorDebug call) have succeeded, the target process may - * be left in an inconsistent state and debugging may become unreliable. + * be left in an inconsistent state and debugging may become unreliable. */ [ object, @@ -879,7 +879,7 @@ interface ICorDebugMutableDataTarget : ICorDebugDataTarget [in] ULONG32 contextSize, [in, size_is(contextSize)] const BYTE * pContext); - /* + /* * Invoke to change the continue-status for the outstanding debug-event on * the specified thread. * @@ -887,7 +887,7 @@ interface ICorDebugMutableDataTarget : ICorDebugDataTarget * dwThreadId - OS Thread Id of the debug event * continueStatus - New continue status being requested. See the * definition of CORDB_CONTINUE_STATUS for details. - * + * * This API is used when the Debugger makes an ICorDebug API request * which requires the current debug event to be handled in a way that is * potentially different from which it would be otherwise. For example, @@ -902,8 +902,8 @@ interface ICorDebugMutableDataTarget : ICorDebugDataTarget /* - * Interface used by the data access services layer to locate metadata - * of assemblies in a target. + * Interface used by the data access services layer to locate metadata + * of assemblies in a target. * * The API client must implement this interface as appropriate for the * particular target (for example, a live process or a memory dump). @@ -1131,7 +1131,7 @@ interface ICorDebugManagedCallback : IUnknown [in] ICorDebugThread *thread); /* - * ExitThread is called when a thread which has run managed code exits. + * ExitThread is called when a thread which has run managed code exits. * Once this callback is fired, the thread no longer will appear in thread enumerations. */ @@ -1289,14 +1289,14 @@ interface ICorDebugManagedCallback : IUnknown [in] ICorDebugThread *pThread); /* - * UpdateModuleSymbols is called when PDB debug symbols are available for an - * in-memory module. This is a debugger's chance to load the symbols + * UpdateModuleSymbols is called when PDB debug symbols are available for an + * in-memory module. This is a debugger's chance to load the symbols * (using ISymUnmanagedBinder::GetReaderForStream), and bind source-level * breakpoints for the module. - * + * * This callback is no longer dispatched for dynamic modules. Instead, * debuggers should call ICorDebugModule3::CreateReaderForInMemorySymbols - * to obtain a symbol reader for a dynamic module. + * to obtain a symbol reader for a dynamic module. */ HRESULT UpdateModuleSymbols([in] ICorDebugAppDomain *pAppDomain, [in] ICorDebugModule *pModule, @@ -1335,21 +1335,66 @@ interface ICorDebugManagedCallback : IUnknown interface ICorDebugManagedCallback3 : IUnknown { /* Callback indicating an enabled custom debugger notification has been - * raised. pThread points to the thread that issued the notification. - * A subsequent call to GetCurrentCustomDebuggerNotification will retrieve the object that was passed to + * raised. pThread points to the thread that issued the notification. + * A subsequent call to GetCurrentCustomDebuggerNotification will retrieve the object that was passed to * System.Diagnostics.Debugger.CustomNotification, whose type will be one * that has been enabled via SetEnableCustomNotification. - * Note that this will return non-null if and only if we are currently inside a CustomNotification - * callback. + * Note that this will return non-null if and only if we are currently inside a CustomNotification + * callback. * The debugger can read type-specific parameters from fields of the data - * object, and store responses into fields. + * object, and store responses into fields. * ICorDebug imposes no policy on the types of notifications or their * contents, and their semantics are strictly a contract between - * debuggers and applications/frameworks. + * debuggers and applications/frameworks. */ HRESULT CustomNotification([in] ICorDebugThread * pThread, [in] ICorDebugAppDomain * pAppDomain); } +[ + object, + local, + uuid(322911AE-16A5-49BA-84A3-ED69678138A3), + pointer_default(unique) +] + +interface ICorDebugManagedCallback4 : IUnknown +{ + // + // Callback indicating a garbage collection is about to start. + // + // Parameters + // pProcess - the process that is going to perform garbage collection. + // + // Returns + // S_OK - on success + // + HRESULT BeforeGarbageCollection([in] ICorDebugProcess* pProcess); + + // + // Callback indicating a garbage collection is about to complete. + // + // Parameters + // pProcess - the process that is going to complete garbage collection. + // + // Returns + // S_OK - on success + // + HRESULT AfterGarbageCollection([in] ICorDebugProcess* pProcess); + + // + // Callback indicating a data breakpoint is hit + // + // Parameters + // pProcess - the process that hits the data breakpoint + // pThread - the thread that hits the data breakpoint + // pContext - a pointer to the CONTEXT structure + // contextSize - the size of the CONTEXT structure + // + // Returns + // S_OK - on success + // + HRESULT DataBreakpoint([in] ICorDebugProcess* pProcess, [in] ICorDebugThread* pThread, [in] BYTE* pContext, [in] ULONG32 contextSize); +} #pragma warning(disable:28718) /* disable warning 28718 for interface ICorDebugManagedCallback2 */ @@ -1442,7 +1487,7 @@ interface ICorDebugManagedCallback2 : IUnknown /* - * For non-intercepted exceptions, ExceptionUnwind is called at the beginning of the second pass + * For non-intercepted exceptions, ExceptionUnwind is called at the beginning of the second pass * when we start to unwind the stack. For intercepted exceptions, ExceptionUnwind is called when * the interception is complete, conceptually at the end of the second pass. * @@ -1635,15 +1680,15 @@ interface ICorDebug : IUnknown * * This should be set after Initialize and before any calls to CreateProcess or DebugActiveProcess. * - * However, for legacy purposes, it is not absolutely required to set this until - * before the first native debug event is fired. Specifically, if CreateProcess has the + * However, for legacy purposes, it is not absolutely required to set this until + * before the first native debug event is fired. Specifically, if CreateProcess has the * CREATE_SUSPENDED flag, native debug events will not be dispatched until the main thread * is resumed. - * DebugActiveProcess will dispatch native debug events immediately, and so the unmanaged callback + * DebugActiveProcess will dispatch native debug events immediately, and so the unmanaged callback * must be set before DebugActiveProcess is called. * - * Returns: - * S_OK if callback pointer is successfully updated. + * Returns: + * S_OK if callback pointer is successfully updated. * failure on any failure. * */ @@ -1730,7 +1775,7 @@ interface ICorDebug : IUnknown #pragma warning(pop) /* - * A debugger can implement this interface and pass it to ICorDebugRemote to specify the host name of the + * A debugger can implement this interface and pass it to ICorDebugRemote to specify the host name of the * target machine in Mac remote debugging scenarios. This is only supported on Silverlight. */ [ @@ -1743,26 +1788,26 @@ interface ICorDebugRemoteTarget : IUnknown { /* * Return the host name of the target machine. The host name can either be a fully qualified domain name or - * an IPv4 address. If cchHostName is 0 and szHostName is NULL, this function just returns the number of + * an IPv4 address. If cchHostName is 0 and szHostName is NULL, this function just returns the number of * characters including the NULL character in the host name. * - * cchHostName is the number of characters in the buffer szHostName. If this is 0, then szHostName must + * cchHostName is the number of characters in the buffer szHostName. If this is 0, then szHostName must * be NULL. If it is not 0, then szHostName must be non-NULL. - * - * pcchHostName returns the number of characters including the NULL character in the host name. This can + * + * pcchHostName returns the number of characters including the NULL character in the host name. This can * be NULL. - * + * * szHostName is the buffer for returning the host name. */ HRESULT GetHostName([in] ULONG32 cchHostName, [out, annotation("_Out_")] ULONG32 * pcchHostName, - [out, size_is(cchHostName), length_is(*pcchHostName), annotation("_Out_writes_to_opt_(cchHostName, *pcchHostName)")] + [out, size_is(cchHostName), length_is(*pcchHostName), annotation("_Out_writes_to_opt_(cchHostName, *pcchHostName)")] WCHAR szHostName[]); } /* - * A debugger can QI for this interface from an ICorDebug interface in order to specify a target machine in + * A debugger can QI for this interface from an ICorDebug interface in order to specify a target machine in * Mac remote debugging scenarios. This is only supported on Silverlight. */ [ @@ -1911,7 +1956,7 @@ interface ICorDebug2 : IUnknown ver_ICorDebugAppDomain3 = CorDebugVersion_4_5, ver_ICorDebugCode3 = CorDebugVersion_4_5, ver_ICorDebugILFrame3 = CorDebugVersion_4_5, - + CorDebugLatestVersion = CorDebugVersion_4_5 } CorDebugInterfaceVersion; @@ -2064,7 +2109,7 @@ interface ICorDebugController : IUnknown * * Note that currently if unmanaged debugging is enabled this call will * fail due to OS limitations. - * + * * Returns S_OK on success. * */ @@ -2172,13 +2217,13 @@ interface ICorDebugAppDomain : ICorDebugController * callers know the full size of buffer they'd need to allocate to get the full string. * * if (cchName == 0) then we're in "query" mode: - * This fails if szName is non-null or pcchName is null + * This fails if szName is non-null or pcchName is null * Else this function will set pcchName to let the caller know how large of a buffer to allocate * and return S_OK. * - * if (cchName != 0) then + * if (cchName != 0) then * This fails if szName is null. - * Else this copies as much as can fit into szName (it will always null terminate szName) and returns S_OK. + * Else this copies as much as can fit into szName (it will always null terminate szName) and returns S_OK. * pcchName can be null. If it's non-null, we set it. * * The expected usage pattern is that a client will call once to get the size of a buffer needed for the name, @@ -2203,7 +2248,7 @@ interface ICorDebugAppDomain : ICorDebugController HRESULT GetObject([out] ICorDebugValue **ppObject); - /* + /* * DEPRECATED. This does nothing in V3. Attaching is process-wide. */ @@ -2360,7 +2405,7 @@ interface ICorDebugAssembly : IUnknown /* * GetName returns the full path and filename of the assembly. * If the assembly has no filename (i.e. it is in-memory only), - * S_FALSE is returned, and a fabricated string is stored into szName. + * S_FALSE is returned, and a fabricated string is stored into szName. */ HRESULT GetName([in] ULONG32 cchName, @@ -2405,7 +2450,7 @@ interface ICorDebugAssembly3 : IUnknown /* * Gets an enumeration for all the assemblies contained within this assembly * If the assembly isn't a container, the result is S_FALSE and the enumeration - * will be empty. Symbols are needed to compute this result; if they aren't + * will be empty. Symbols are needed to compute this result; if they aren't * present an error will be returned and no enumeration provided. */ HRESULT EnumerateContainedAssemblies(ICorDebugAssemblyEnum **ppAssemblies); @@ -2541,7 +2586,7 @@ typedef struct COR_GC_REFERENCE ICorDebugAppDomain *Domain; // The AppDomain of the handle/object, may be null. ICorDebugValue *Location; // A reference to the object CorGCReferenceType Type; // Where the root came from. - + /* DependentSource - for HandleDependent RefCount - for HandleStrongRefCount @@ -2570,13 +2615,13 @@ cpp_quote("#define _DEF_COR_ARRAY_LAYOUT_") typedef struct COR_ARRAY_LAYOUT { COR_TYPEID componentID; // The type of objects the array contains - + CorElementType componentType; // Whether the component itself is a GC reference, value class, or primitive - + ULONG32 firstElementOffset; // The offset to the first element ULONG32 elementSize; // The size of each element ULONG32 countOffset; // The offset to the number of elements in the array. - + // For multidimensional arrays (works with normal arrays too). ULONG32 rankSize; // The size of the rank ULONG32 numRanks; // The number of ranks in the array (1 for array, N for multidimensional array) @@ -2605,7 +2650,7 @@ typedef struct COR_FIELD mdFieldDef token; // FieldDef token to get the field info ULONG32 offset; // Offset in object of data. COR_TYPEID id; // TYPEID of the field - + CorElementType fieldType; } COR_FIELD; cpp_quote("#endif // _DEF_COR_FIELD_") @@ -2939,15 +2984,15 @@ interface ICorDebugProcess2 : IUnknown interface ICorDebugProcess3 : IUnknown { /* Enables (or disables) custom debugger notifications of a specified - * type (which implements ICustomDebuggerNotification). + * type (which implements ICustomDebuggerNotification). * When this has been enabled, calls to * System.Diagnostics.Debugger.CustomNotification with a data argument * of the specified class will trigger a CustomNotification callback. * Notifications are disabled by default and the debugger must opt-into * any notification types it knows of and wishes to handle. - * Since ICorDebugClass is scoped by appdomains, the debugger needs to - * call this API for every appdomain in the process if it's interested in - * receiving the notification across the entire process. + * Since ICorDebugClass is scoped by appdomains, the debugger needs to + * call this API for every appdomain in the process if it's interested in + * receiving the notification across the entire process. */ HRESULT SetEnableCustomNotification(ICorDebugClass * pClass, BOOL fEnable); @@ -2967,14 +3012,14 @@ interface ICorDebugProcess5 : IUnknown HRESULT GetObject([in] CORDB_ADDRESS addr, [out] ICorDebugObjectValue **pObject); HRESULT EnumerateGCReferences([in] BOOL enumerateWeakReferences, [out] ICorDebugGCReferenceEnum **ppEnum); HRESULT EnumerateHandles([in] CorGCReferenceType types, [out] ICorDebugGCReferenceEnum **ppEnum); - + HRESULT GetTypeID([in] CORDB_ADDRESS obj, [out] COR_TYPEID *pId); HRESULT GetTypeForTypeID([in] COR_TYPEID id, [out] ICorDebugType **ppType); - + HRESULT GetArrayLayout([in] COR_TYPEID id, [out] COR_ARRAY_LAYOUT *pLayout); HRESULT GetTypeLayout([in] COR_TYPEID id, [out] COR_TYPE_LAYOUT *pLayout); HRESULT GetTypeFields([in] COR_TYPEID id, ULONG32 celt, COR_FIELD fields[], ULONG32 *pceltNeeded); - + /* * Enables the specified policy. */ @@ -2985,12 +3030,12 @@ interface ICorDebugProcess5 : IUnknown // Describes formats of pRecord byte blob in DecodeEvent. // This is dependent on the target architecture. typedef enum CorDebugRecordFormat -{ +{ FORMAT_WINDOWS_EXCEPTIONRECORD32 = 1, FORMAT_WINDOWS_EXCEPTIONRECORD64 = 2, } CorDebugRecordFormat; -// dwFlags in DecodeEvent is dependent on the target architecture. +// dwFlags in DecodeEvent is dependent on the target architecture. // Definition of DecodeEvent flags on Windows. typedef enum CorDebugDecodeEventFlagsWindows { @@ -3008,13 +3053,13 @@ typedef enum CorDebugDebugEventKind DEBUG_EVENT_KIND_MANAGED_EXCEPTION_UNHANDLED = 6 } CorDebugDebugEventKind; -// Describes what amount of cached data must be discarded based on changes to the +// Describes what amount of cached data must be discarded based on changes to the // process typedef enum CorDebugStateChange { - PROCESS_RUNNING = 0x0000001, // The process reached a new memory state via - // forward execution. - FLUSH_ALL = 0x0000002, // The process' memory might be arbitrarily + PROCESS_RUNNING = 0x0000001, // The process reached a new memory state via + // forward execution. + FLUSH_ALL = 0x0000002, // The process' memory might be arbitrarily // different than it was before. } CorDebugStateChange; @@ -3058,7 +3103,7 @@ typedef enum CorDebugCodeInvokePurpose CODE_INVOKE_PURPOSE_NONE, CODE_INVOKE_PURPOSE_NATIVE_TO_MANAGED_TRANSITION, // The managed code will run any managed entrypoint // such as a reverse p-invoke. Any more detailed purpose - // is unknown by the runtime. + // is unknown by the runtime. CODE_INVOKE_PURPOSE_CLASS_INIT, // The managed code will run a static constructor CODE_INVOKE_PURPOSE_INTERFACE_DISPATCH, // The managed code will run the implementation for // some interface method that was called @@ -3072,20 +3117,20 @@ typedef enum CorDebugCodeInvokePurpose ] interface ICorDebugProcess6 : IUnknown { - //Decodes managed debug events which have been encapsulated in the payload of + //Decodes managed debug events which have been encapsulated in the payload of //specially crafted native exception debug events HRESULT DecodeEvent( [in, length_is(countBytes), size_is(countBytes)] const BYTE pRecord[], [in] DWORD countBytes, [in] CorDebugRecordFormat format, - [in] DWORD dwFlags, - [in] DWORD dwThreadId, + [in] DWORD dwFlags, + [in] DWORD dwThreadId, [out] ICorDebugDebugEvent **ppEvent); // Debugger calls this to notify ICorDebug that the process is running. // // Notes: - // ProcessStateChanged(PROCESS_RUNNING) has similar semantics to + // ProcessStateChanged(PROCESS_RUNNING) has similar semantics to // ICorDebugProcess::Continue(); HRESULT ProcessStateChanged([in] CorDebugStateChange change); @@ -3098,13 +3143,13 @@ interface ICorDebugProcess6 : IUnknown // various ICorDebug APIs described below. // // Terminology - // The aggregate modules are called containers, the modules inside are called - // sub-modules or virtual modules. Both container modules and sub-modules are - // represented with the ICorDebugModule interface, however the behavior of the + // The aggregate modules are called containers, the modules inside are called + // sub-modules or virtual modules. Both container modules and sub-modules are + // represented with the ICorDebugModule interface, however the behavior of the // interface is slightly different in each case, as described below. - // In addition there may still be modules loaded that weren't merged during build. + // In addition there may still be modules loaded that weren't merged during build. // These modules, called regular modules, are neither container modules nor - // sub-modules. + // sub-modules. // // Modules and assemblies // Multi-module assemblies are not supported for assembly merging scenarios @@ -3127,7 +3172,7 @@ interface ICorDebugProcess6 : IUnknown // -have a reduced set of metadata that corresponds only to the original // assembly that was merged in. // -The metadata names have no mangling. - // -Metadata tokens are unlikely to match with the tokens in the original + // -Metadata tokens are unlikely to match with the tokens in the original // assembly before it was merged in the build process // -ICorDebugModule.GetName() returns the assembly name (not a file path) // -ICorDebug.GetSize() returns the original unmerged image size. @@ -3157,7 +3202,7 @@ interface ICorDebugProcess6 : IUnknown // Disabled - Returns a list of container assemblies + regular assemblies // (no sub-assemblies are shown) // Enabled - Returns the list of sub-assemblies + regular assemblies - // (no container assemblies are shown). + // (no container assemblies are shown). // Note: If any container assembly is missing symbols, none of its // sub-assemblies will be enumerated. If any regular assembly is // missing symbols it may or may not be enumerated. @@ -3178,10 +3223,10 @@ interface ICorDebugProcess6 : IUnknown HRESULT EnableVirtualModuleSplitting(BOOL enableSplitting); // Changes internal state of the debuggee so that the System.Debugger.IsAttached API in the BCL - // returns true. + // returns true. // // Returns - // S_OK - debuggee is succesfully updated + // S_OK - debuggee is succesfully updated // CORDBG_E_MODULE_NOT_LOADED - assembly containing System.Debugger.IsAttached API is not loaded // or some other error is preventing it from being recognized such as missing metadata. This error // is common and benign - it is recommended to try the call again when future assemblies load. @@ -3205,7 +3250,7 @@ interface ICorDebugProcess6 : IUnknown HRESULT GetExportStepInfo([in]LPCWSTR pszExportName, [out]CorDebugCodeInvokeKind* pInvokeKind, [out]CorDebugCodeInvokePurpose* pInvokePurpose); } -typedef enum WriteableMetadataUpdateMode +typedef enum WriteableMetadataUpdateMode { LegacyCompatPolicy, AlwaysShowUpdates @@ -3238,7 +3283,7 @@ interface ICorDebugProcess8 : IUnknown * EnableExceptionCallbacksOutsideOfMyCode enables/disables certain types of exception callback to ICorDebugManagedCallback2. * If the flag is FALSE: * 1) DEBUG_EXCEPTION_FIRST_CHANCE callbacks won't called in the debugger. - * 2) DEBUG_EXCEPTION_CATCH_HANDLER_FOUND callbacks won't be called if an exception never escapes into user code. + * 2) DEBUG_EXCEPTION_CATCH_HANDLER_FOUND callbacks won't be called if an exception never escapes into user code. * (i.e. a path from an exception origin to an exception handler has no methods marked as JMC) * * Default value of this flag is TRUE. @@ -3246,6 +3291,27 @@ interface ICorDebugProcess8 : IUnknown HRESULT EnableExceptionCallbacksOutsideOfMyCode([in] BOOL enableExceptionsOutsideOfJMC); } +[ + object, + local, + uuid(8F378F6F-1017-4461-9890-ECF64C54079F), + pointer_default(unique) +] +interface ICorDebugProcess10 : IUnknown +{ + // + // Enable or disable the GC notification events. The GC notification events are turned off by default + // They will be delivered through ICorDebugManagedCallback4 + // + // Parameters + // fEnable - true to enable the events, false to disable + // + // Returns + // S_OK - on success + // + HRESULT EnableGCNotificationEvents(BOOL fEnable); +} + // Event types MODULE_LOADED and MODULE_UNLOADED implement this interface [ object, @@ -3275,23 +3341,23 @@ interface ICorDebugModuleDebugEvent : ICorDebugDebugEvent ] interface ICorDebugExceptionDebugEvent : ICorDebugDebugEvent { - // The meaning of this stack pointer varies based on event type (available from + // The meaning of this stack pointer varies based on event type (available from // ICorDebugDebugEvent.GetEventType()) // // MANAGED_EXCEPTION_FIRST_CHANCE -> The stack pointer for the frame that threw the exception - // MANAGED_EXCEPTION_USER_FIRST_CHANCE -> The stack pointer for the user-code frame closest to the point of + // MANAGED_EXCEPTION_USER_FIRST_CHANCE -> The stack pointer for the user-code frame closest to the point of // the thrown exception // MANAGED_EXCEPTION_CATCH_HANDLER_FOUND -> The stack pointer for the frame that contains the catch handler // MANAGED_EXCEPTION_UNHANDLED -> *pStackPointer will be NULL HRESULT GetStackPointer([out]CORDB_ADDRESS *pStackPointer); - // The meaning of the IP varies based on event type (available from + // The meaning of the IP varies based on event type (available from // ICorDebugDebugEvent.GetEventType()) // // MANAGED_EXCEPTION_FIRST_CHANCE -> The address of the faulting instruction - // MANAGED_EXCEPTION_USER_FIRST_CHANCE -> Within the frame indicated by GetStackPointer(), - // this is the code address where execution would resume if no exception had been - // raised. The exception may or may not cause different code to be executed in this + // MANAGED_EXCEPTION_USER_FIRST_CHANCE -> Within the frame indicated by GetStackPointer(), + // this is the code address where execution would resume if no exception had been + // raised. The exception may or may not cause different code to be executed in this // frame such as a catch of finally clause. // MANAGED_EXCEPTION_CATCH_HANDLER_FOUND -> Within the frame indicated by GetStackPointer(), // this is the code address where catch handler execution will start @@ -3734,8 +3800,9 @@ interface ICorDebugRegisterSet : IUnknown REGISTER_ARM_D30, REGISTER_ARM_D31, + // ARM64 registers - + REGISTER_ARM64_PC = 0, REGISTER_ARM64_SP, REGISTER_ARM64_FP, @@ -3992,7 +4059,7 @@ interface ICorDebugThread : IUnknown * If the thread's user state includes USER_UNSAFE_POINT, then the thread may block a GC. * This means the suspended thread has a mcuh higher chance of causing a deadlock. * - * This may not affect debug events already queued. Thus a debugger should drain the entire + * This may not affect debug events already queued. Thus a debugger should drain the entire * event queue (via calling HasQueuedCallbacks) before suspending or resuming threads. Else it * may get events on a thread that it believes it has already suspended. * @@ -4243,7 +4310,7 @@ interface ICorDebugThread4 : IUnknown { /* * Returns S_OK if ICorDebugThread::GetCurrentException() is non-NULL and the exception - * it refers to has completed the first pass of exception handling without locating + * it refers to has completed the first pass of exception handling without locating * a catch clause. * Returns S_FALSE if there is no exception, it hasn't completed first pass handling, * or a catch handler was located @@ -4252,13 +4319,13 @@ interface ICorDebugThread4 : IUnknown HRESULT HasUnhandledException(); HRESULT GetBlockingObjects([out] ICorDebugBlockingObjectEnum **ppBlockingObjectEnum); - /* + /* * Gets the current CustomNotification object on the current thread. This could be NULL if no * current notification object exists. If we aren't currently inside a CustomNotification callback, * this will always return NULL. - * A debugger can examine this object to determine how to handle the notification. - * See ICorDebugManagedCallback3::CustomNotification for more information about - * custom notifications. + * A debugger can examine this object to determine how to handle the notification. + * See ICorDebugManagedCallback3::CustomNotification for more information about + * custom notifications. */ HRESULT GetCurrentCustomDebuggerNotification([out] ICorDebugValue ** ppNotificationObject); }; @@ -4280,11 +4347,11 @@ interface ICorDebugStackWalk : IUnknown SET_CONTEXT_FLAG_UNWIND_FRAME = 0x2, } CorDebugSetContextFlag; - /* + /* * Get the current context of this stack frame. - * - * The CONTEXT is retrieved from the ICorDebugStackWalk. As unwinding may only restore a subset of the - * registers, such as only non-volatile registers, the context may not exactly match the register state at + * + * The CONTEXT is retrieved from the ICorDebugStackWalk. As unwinding may only restore a subset of the + * registers, such as only non-volatile registers, the context may not exactly match the register state at * the time of the actual call. */ HRESULT GetContext([in] ULONG32 contextFlags, @@ -4292,14 +4359,14 @@ interface ICorDebugStackWalk : IUnknown [out] ULONG32* contextSize, [out, size_is(contextBufSize)] BYTE contextBuf[]); - /* + /* * Change the current context of this stack walk, allowing the * debugger to move it to an arbitrary context. Does not actually * alter the current context of the thread whose stack is being walked. * * The CONTEXT has to be a valid CONTEXT of a stack frame on the thread. * If the CONTEXT is outside of the current thread's stack range, we'll - * return a failure HRESULT. Otherwise, in the case of an invalid CONTEXT, + * return a failure HRESULT. Otherwise, in the case of an invalid CONTEXT, * the result is undefined. */ HRESULT SetContext([in] CorDebugSetContextFlag flag, @@ -4307,11 +4374,11 @@ interface ICorDebugStackWalk : IUnknown [in, size_is(contextSize)] BYTE context[]); /* - * Attempt to advance the stackwalk to the next frame. + * Attempt to advance the stackwalk to the next frame. * If the current frame type is a native stack frame, Next() will not advance to the caller frame. * Instead, Next() will advance to the next managed stack frame or the next internal frame marker. * - * If a debugger wants to unwind unmanaged stack frames, it needs to start from the + * If a debugger wants to unwind unmanaged stack frames, it needs to start from the * native stack frame itself. It can seed the unwind by calling GetContext(). * * This function will return CORDBG_S_AT_END_OF_STACK when there are no more frames. @@ -4354,7 +4421,7 @@ interface ICorDebugChain : IUnknown * call chain. Note that you cannot make any assumptions about * what is actually stored on the stack - the numeric range is to compare * stack frame locations only. - * The start of a stack range is the leafmost boundary of the chain, and + * The start of a stack range is the leafmost boundary of the chain, and * the end of a stack range is the rootmost boundary of the chain. */ @@ -4486,9 +4553,9 @@ interface ICorDebugFrame : IUnknown HRESULT GetCode([out] ICorDebugCode **ppCode); /* - * GetFunction returns the function for the code which this stack - * frame is running. - * For ICorDebugInternalFrames, this may point to a method the + * GetFunction returns the function for the code which this stack + * frame is running. + * For ICorDebugInternalFrames, this may point to a method the * frame is associated with (which may be in a different AppDomain * from the frame itself), or may fail if the frame doesn't relate to any * particular function. @@ -4499,7 +4566,7 @@ interface ICorDebugFrame : IUnknown /* * GetFunctionToken is a convenience routine to return the token for the * function for the code which this stack frame is running. - * The scope to resolve the token can be gotten from the ICorDebugFunction + * The scope to resolve the token can be gotten from the ICorDebugFunction * associated with this frame. */ @@ -4512,7 +4579,7 @@ interface ICorDebugFrame : IUnknown * cannot make any assumptions about what is actually stored on * the stack - the numeric range is to compare stack frame * locations only. - * The start of a stack range is the leafmost boundary of the frame, and + * The start of a stack range is the leafmost boundary of the frame, and * the end of a stack range is the rootmost boundary of the frame. */ @@ -4616,7 +4683,7 @@ interface ICorDebugInternalFrame2 : IUnknown /* * Check if an internal frame is closer to the leaf than pFrameToCompare. */ - HRESULT IsCloserToLeaf([in] ICorDebugFrame * pFrameToCompare, + HRESULT IsCloserToLeaf([in] ICorDebugFrame * pFrameToCompare, [out] BOOL * pIsCloser); }; @@ -4715,7 +4782,7 @@ interface ICorDebugILFrame : ICorDebugFrame /* * EnumerateArguments returns a list of the arguments available in the * frame. Note that this will include varargs arguments as well as - * arguments declared by the function signature (inlucding the implicit + * arguments declared by the function signature (inlucding the implicit * "this" argument if any). */ @@ -4771,8 +4838,8 @@ interface ICorDebugILFrame2 : IUnknown { /* * Performs an on-stack replacement for an outstanding function remap opportunity. - * This is used to update execution of an edited function to the latest version, - * preserving the current frame state (such as the values of all locals). + * This is used to update execution of an edited function to the latest version, + * preserving the current frame state (such as the values of all locals). * This can only be called when a FunctionRemapOpportunity callback has been delivered * for this leaf frame, and the callback has not yet been continued. newILOffset * is the offset into the new function at which execution should continue. @@ -4845,7 +4912,7 @@ interface ICorDebugILFrame4 : IUnknown * instrumented IL. If the IL is not instrumented the enumeration will * be empty and S_OK is returned. */ - + HRESULT EnumerateLocalVariablesEx([in] ILCodeKind flags, [out] ICorDebugValueEnum **ppValueEnum); /* @@ -4882,7 +4949,7 @@ interface ICorDebugILFrame4 : IUnknown }; /* - * ICorDebugNativeFrame is a specialized interface of ICorDebugFrame for jitted frames, i.e. + * ICorDebugNativeFrame is a specialized interface of ICorDebugFrame for jitted frames, i.e. * native frames for managed methods. * (Note that jitted frames implement both ICorDebugILFrame and ICorDebugNativeFrame.) */ @@ -5034,7 +5101,7 @@ interface ICorDebugNativeFrame2 : IUnknown interface ICorDebugModule3 : IUnknown { /* - * CreateReaderForInMemorySymbols creates a debug symbol reader object (eg. + * CreateReaderForInMemorySymbols creates a debug symbol reader object (eg. * ISymUnmanagedReader) for a dynamic module. This symbol reader becomes stale * and is usually discarded whenever a LoadClass callback is delivered for the * module. @@ -5051,7 +5118,7 @@ interface ICorDebugModule3 : IUnknown * yet available. * * Notes: - * This API can also be used to create a symbol reader object for in-memory + * This API can also be used to create a symbol reader object for in-memory * (non-dynamic) modules, but only after the symbols are first available * (indicated by the UpdateModuleSymbols callback). * @@ -5060,7 +5127,7 @@ interface ICorDebugModule3 : IUnknown * the underlying data may have changed (i.e. a LoadClass event). * * Dynamic modules do not have any symbols available until the first type has been - * loaded into them (as indicated by the LoadClass callback). + * loaded into them (as indicated by the LoadClass callback). */ HRESULT CreateReaderForInMemorySymbols([in] REFIID riid, [out][iid_is(riid)] void **ppObj); @@ -5070,7 +5137,7 @@ interface ICorDebugModule3 : IUnknown * ICorDebugRuntimeUnwindableFrame is a specialized interface of ICorDebugFrame for unmanaged methods * which requires special knowledge to unwind. They are not jitted code. When the debugger sees this type * of frames, it should use ICorDebugStackWalk::Next() to unwind, but it should do inspection itself. - * The debugger can call ICorDebugStackWalk::GetContext() to retrieve the CONTEXT of the frame when it gets + * The debugger can call ICorDebugStackWalk::GetContext() to retrieve the CONTEXT of the frame when it gets * an ICorDebugRuntimeUnwindableFrame. */ @@ -5123,8 +5190,8 @@ interface ICorDebugModule : IUnknown /* * GetName returns a name identifying the module. * - * For on-disk modules this is a full path. For dynamic modules this - * is just the filename if one was provided. Otherwise, and for other + * For on-disk modules this is a full path. For dynamic modules this + * is just the filename if one was provided. Otherwise, and for other * in-memory modules, this is just the simple name stored in the module's * metadata. */ @@ -5443,7 +5510,7 @@ ICorDebugFunction3 is a logical extension to ICorDebugFunction. interface ICorDebugFunction3 : IUnknown { /* - * If this function has an active rejit request it will be returned in + * If this function has an active rejit request it will be returned in * pRejitedILCode. * If there is no active request (a common case) then *ppRejitedILCode = NULL * @@ -5451,7 +5518,7 @@ interface ICorDebugFunction3 : IUnknown * ICorProfilerCallback4::GetReJITParameters(). It may not yet be jitted * and threads may still be executing in the original version of the code. * - * A rejit request becomes inactive during the profiler's call to + * A rejit request becomes inactive during the profiler's call to * ICorProfInfo::RequestRevert. Even after being reverted a thread can still * be executing in the rejited code. */ @@ -5470,20 +5537,20 @@ ICorDebugFunction4 is a logical extension to ICorDebugFunction. interface ICorDebugFunction4 : IUnknown { /* - * Sets a breakpoint at offset 0 of any current or future jitted methods. + * Sets a breakpoint at offset 0 of any current or future jitted methods. */ HRESULT CreateNativeBreakpoint(ICorDebugFunctionBreakpoint **ppBreakpoint); }; /* ICorDebugCode represents an IL or native code blob. - + For methods that take offsets, the units are the same as the units on the CordbCode object. (eg, IL offsets for an IL code object, and native offsets for a native code object) - + V2 allows multiple code-regions. CordbCode presents an abstraction where these are merged together in a single linear, continuous space. So if the code is split - with 0x5 bytes at address 0x1000, and 0x10 bytes at address 0x2000, + with 0x5 bytes at address 0x1000, and 0x10 bytes at address 0x2000, then: - GetAddress() yields a start address of 0x1000. - GetSize() is the size of the merged regions = 0x5+ 0x10 = 0x15 bytes. @@ -5531,7 +5598,7 @@ interface ICorDebugCode : IUnknown /* * CreateBreakpoint creates a breakpoint in the function at the - * given offset. + * given offset. * * If this code is IL code, and there is a jitted native version * of the code, the breakpoint will be applied in the jitted code @@ -5729,25 +5796,25 @@ interface ICorDebugILCode2 : IUnknown /* ICorDebugClass represents a Class (mdTypeDef) in the IL image. - For generic types, it represents the generic type definition (eg. List) not any of - the specific instantiations (eg. List). - + For generic types, it represents the generic type definition (eg. List) not any of + the specific instantiations (eg. List). + Use ICorDebugClass2::GetParameterizedType to build an ICorDebugType from an ICorDebugClass and type parameters. - Classes live in a module and are uniquely identified by a mdTypeDef. + Classes live in a module and are uniquely identified by a mdTypeDef. In other words, you can round-trip a class like so: ICorDebugClass * pClass1 = ...; // some initial class - - ICorDebugModule * pModule = NULL; + + ICorDebugModule * pModule = NULL; pClass1->GetModule(&pModule); mdTypeDef token; pClass1->GetToken(&token); - + ICorDebugClass * pClass2; - pModule->GetClassFromToken(token, &pClass2); - // Now: pClass1 == pClass2 + pModule->GetClassFromToken(token, &pClass2); + // Now: pClass1 == pClass2 */ [ @@ -5779,12 +5846,12 @@ interface ICorDebugClass : IUnknown * Note that if the class accepts type parameters, then you should * use GetStaticField on an appropriate ICorDebugType rather than on the * ICorDebugClass. - * + * * Returns: * S_OK on success. * CORDBG_E_FIELD_NOT_STATIC if the field is not static. * CORDBG_E_STATIC_VAR_NOT_AVAILABLE if field is not yet available (storage for statics - * may be lazily allocated). + * may be lazily allocated). * CORDBG_E_VARIABLE_IS_ACTUALLY_LITERAL if the field is actually a metadata literal. In this * case, the debugger should get the value from the metadata. * error on other errors. @@ -5882,7 +5949,7 @@ interface ICorDebugEval : IUnknown * CallFunction sets up a function call. Note that if the function * is virtual, this will perform virtual dispatch. If the function is * not static, then the first argument must be the "this" object. - * If the function is in an a different AppDomain, a transition will + * If the function is in an a different AppDomain, a transition will * occur (but all arguments must also be in the target AppDomain) */ @@ -6164,7 +6231,7 @@ interface ICorDebugValue3 : IUnknown { /* * GetSize returns the size of the value in bytes. It has the same - * semantics as ICorDebugValue::GetSize except that it works + * semantics as ICorDebugValue::GetSize except that it works * for arrays >4GB. */ @@ -6330,7 +6397,7 @@ interface ICorDebugHeapValue2 : IUnknown interface ICorDebugHeapValue3 : IUnknown { - /* + /* * Gets the owning thread for a monitor lock */ HRESULT GetThreadOwningMonitorLock([out] ICorDebugThread **ppThread, [out] DWORD *pAcquisitionCount); @@ -6573,7 +6640,7 @@ interface ICorDebugVariableHome : IUnknown * Returns E_FAIL if the variable is a function argument. */ HRESULT GetSlotIndex([out] ULONG32 *pSlotIndex); - + /* * GetArgumentIndex - gives the argument index of a function argument. * The argument index can be used to retrieve the metadata for this @@ -6598,7 +6665,7 @@ interface ICorDebugVariableHome : IUnknown // location VLT_INVALID } VariableLocationType; - + /* * GetLocationType - gives the type of native location. See * VariableLocationType. @@ -6615,7 +6682,7 @@ interface ICorDebugVariableHome : IUnknown * register-relative location. */ HRESULT GetRegister([out] CorDebugRegister *pRegister); - + /* * GetOffset - gives the offset from the base register for a variable. * Returns E_FAIL if the variable is not in a register-relative memory @@ -6626,7 +6693,7 @@ interface ICorDebugVariableHome : IUnknown -/* +/* * ICorDebugHandleValue represents a reference value that the debugger has * explicitly created a GC handle to. It does not represent GC Handles in the debuggee process, @@ -6697,18 +6764,18 @@ interface ICorDebugComObjectValue : IUnknown * that are cached by the COM object. */ HRESULT GetCachedInterfaceTypes( - [in] BOOL bIInspectableOnly, + [in] BOOL bIInspectableOnly, [out] ICorDebugTypeEnum **ppInterfacesEnum); /* * GetCachedInterfacePointers returns at most celt values of the * interface pointer values cached by the COM object. It fills - * pcEltFetched with the actual number of fetched elements. + * pcEltFetched with the actual number of fetched elements. * When called with NULL for ptrs, and 0 for celt, it simply returns * the number of elements it needs. */ HRESULT GetCachedInterfacePointers( - [in] BOOL bIInspectableOnly, + [in] BOOL bIInspectableOnly, [in] ULONG32 celt, [out] ULONG32 *pcEltFetched, [out, size_is(celt), length_is(*pcEltFetched)] CORDB_ADDRESS * ptrs); @@ -6957,7 +7024,7 @@ interface ICorDebugVariableHomeEnum : ICorDebugEnum ICorDebugVariableHome *homes[], [out] ULONG *pceltFetched); }; - + [ object, local, @@ -7006,7 +7073,7 @@ interface ICorDebugTypeEnum : ICorDebugEnum * represent instantiated generic types (Eg, List) * Use the metadata interfaces to get static (Compile-time) information about the type. * - * A type (and all of its type parameters) lives in an single AppDomain and becomes + * A type (and all of its type parameters) lives in an single AppDomain and becomes * invalid once the containing ICorDebugAppDomain is unloaded. * * Types may be lazily loaded, so if the debugger queries for a type that hasn't been @@ -7265,7 +7332,7 @@ interface ICorDebugMDA : IUnknown // Get the flags associated w/ the MDA. New flags may be added in future versions. typedef enum CorDebugMDAFlags { - // If this flag is high, then the thread may have slipped since the MDA was fired. + // If this flag is high, then the thread may have slipped since the MDA was fired. MDA_FLAG_SLIP = 0x2 } CorDebugMDAFlags; HRESULT GetFlags([in] CorDebugMDAFlags * pFlags); diff --git a/src/inc/corhdr.h b/src/inc/corhdr.h index b44d2b74e..9b891d810 100644 --- a/src/inc/corhdr.h +++ b/src/inc/corhdr.h @@ -748,6 +748,7 @@ typedef enum CorAssemblyFlags afPA_IA64 = 0x0030, // Processor Architecture: Itanium (PE32+) afPA_AMD64 = 0x0040, // Processor Architecture: AMD X64 (PE32+) afPA_ARM = 0x0050, // Processor Architecture: ARM (PE32) + afPA_ARM64 = 0x0060, // Processor Architecture: ARM64 (PE32+) afPA_NoPlatform = 0x0070, // applies to any platform but cannot run on any (e.g. reference assembly), should not have "specified" set afPA_Specified = 0x0080, // Propagate PA flags to AssemblyRef record afPA_Mask = 0x0070, // Bits describing the processor architecture @@ -777,6 +778,7 @@ typedef enum CorAssemblyFlags #define IsAfPA_IA64(x) (((x) & afPA_Mask) == afPA_IA64) #define IsAfPA_AMD64(x) (((x) & afPA_Mask) == afPA_AMD64) #define IsAfPA_ARM(x) (((x) & afPA_Mask) == afPA_ARM) +#define IsAfPA_ARM64(x) (((x) & afPA_Mask) == afPA_ARM64) #define IsAfPA_NoPlatform(x) (((x) & afPA_FullMask) == afPA_NoPlatform) #define IsAfPA_Specified(x) ((x) & afPA_Specified) #define PAIndex(x) (((x) & afPA_Mask) >> afPA_Shift) @@ -1817,10 +1819,6 @@ typedef enum CorAttributeTargets #define DEFAULTDOMAIN_MTA_TYPE "System.MTAThreadAttribute" #define DEFAULTDOMAIN_MTA_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID} -#define DEFAULTDOMAIN_LOADEROPTIMIZATION_TYPE_W L"System.LoaderOptimizationAttribute" -#define DEFAULTDOMAIN_LOADEROPTIMIZATION_TYPE "System.LoaderOptimizationAttribute" -#define DEFAULTDOMAIN_LOADEROPTIMIZATION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I1} - #define NONVERSIONABLE_TYPE_W L"System.Runtime.Versioning.NonVersionableAttribute" #define NONVERSIONABLE_TYPE "System.Runtime.Versioning.NonVersionableAttribute" diff --git a/src/inc/dacprivate.h b/src/inc/dacprivate.h index 47e79a131..978d8a8c5 100644 --- a/src/inc/dacprivate.h +++ b/src/inc/dacprivate.h @@ -299,7 +299,7 @@ struct MSLAYOUT DacpMethodTableData : ZeroInit DWORD ComponentSize; mdTypeDef cl; // Metadata token DWORD dwAttrClass; // cached metadata - BOOL bIsShared; // flags & enum_flag_DomainNeutral + BOOL bIsShared; // Always false, preserved for backward compatibility BOOL bIsDynamic; BOOL bContainsPointers; @@ -472,7 +472,7 @@ struct MSLAYOUT DacpAssemblyData : ZeroInit BOOL isDynamic; UINT ModuleCount; UINT LoadContext; - BOOL isDomainNeutral; + BOOL isDomainNeutral; // Always false, preserved for backward compatibility DWORD dwLocationFlags; HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr, CLRDATA_ADDRESS baseDomainPtr) diff --git a/src/inc/switches.h b/src/inc/switches.h index 3d8c876bc..e47c78ce2 100644 --- a/src/inc/switches.h +++ b/src/inc/switches.h @@ -193,17 +193,6 @@ #define FEATURE_MINIMETADATA_IN_TRIAGEDUMPS #endif // defined(FEATURE_CORESYSTEM) -#if defined(FEATURE_PREJIT) && defined(FEATURE_CORESYSTEM) -// Desktop CLR allows profilers and debuggers to opt out of loading NGENd images, and to -// JIT everything instead. "FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS" is roughly the -// equivalent for Apollo, where MSIL images may not be available at all. -// FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS allows profilers or debuggers to state -// they don't want to use pregenerated code, and to instead load the NGENd image but -// treat it as if it were MSIL by ignoring the prejitted code and prebaked structures, -// and instead to JIT and load types at run-time. -#define FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS -#endif - // If defined, support interpretation. #if !defined(CROSSGEN_COMPILE)