diff options
author | Mike McLaughlin <mikem@microsoft.com> | 2015-03-06 14:51:27 -0800 |
---|---|---|
committer | Mike McLaughlin <mikem@microsoft.com> | 2015-03-06 14:51:27 -0800 |
commit | ef81f96ee92cb4a16077b2f135fda5e20b451643 (patch) | |
tree | 793d3ecb80aaee705f94231dacee2501bb66b877 /src | |
parent | 0d2dfa00f7fa2f2d31389d001cefe3cbfa2cfd9b (diff) | |
parent | 182d4e2ef3bea406de49147bb732767fa6190f93 (diff) | |
download | coreclr-ef81f96ee92cb4a16077b2f135fda5e20b451643.tar.gz coreclr-ef81f96ee92cb4a16077b2f135fda5e20b451643.tar.bz2 coreclr-ef81f96ee92cb4a16077b2f135fda5e20b451643.zip |
Merge remote-tracking branch 'upstream/master' into dacglobals1
Conflicts:
src/debug/ee/CMakeLists.txt
Diffstat (limited to 'src')
55 files changed, 1294 insertions, 18194 deletions
diff --git a/src/debug/daccess/ddunpack.cpp b/src/debug/daccess/ddunpack.cpp deleted file mode 100644 index 9c2fa48c96..0000000000 --- a/src/debug/daccess/ddunpack.cpp +++ /dev/null @@ -1,4048 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -// Unpacker -// -// Lives on EE side of the fence -// -// Note that this file is generated by ndp\clr\src\Debug\tools\BuildDDMarshal\. -// Changes should be made to output\DDUnpack_template.cpp in that directory. -// - - -#include "stdafx.h" - -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) -#include "dacdbiinterface.h" - -#include "ddshared.h" - -#include "ddmarshalutil.h" - -#include "ddunpack.h" - -#include "../shared/stringcopyholder.cpp" - -// Suppress PREFast warning about overly large function -// These functions are automatically generated. -#if defined(_PREFAST_) -#pragma warning(disable:21000) -#endif - -// general callback for Callback functions. -template <class T> -void GeneralEnumerationCallback(T vmAppDomain, void * pUserData) -{ - WriteBuffer * pResult = (WriteBuffer *) pUserData; - - DWORD dw = 1; // Continue - WriteToBuffer(pResult, dw); - WriteToBuffer(pResult, vmAppDomain); -} - - - - -// -// These stubs are called by the handler -// -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT CheckDbiVersion(const DbiVersion * pVersion) -void DDUnpack::Unpack_CheckDbiVersion(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - DbiVersion _pVersion; // storage - const DbiVersion * pVersion = &_pVersion; - ReadFromBuffer(pSend, &_pVersion); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->CheckDbiVersion(pVersion); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CheckDbiVersion - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT FlushCache() -void DDUnpack::Unpack_FlushCache(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->FlushCache(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method FlushCache - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void DacSetTargetConsistencyChecks(bool fEnableAsserts) -void DDUnpack::Unpack_DacSetTargetConsistencyChecks(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - bool fEnableAsserts; - ReadFromBuffer(pSend, fEnableAsserts); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->DacSetTargetConsistencyChecks(fEnableAsserts); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method DacSetTargetConsistencyChecks - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void Destroy() -void DDUnpack::Unpack_Destroy(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->Destroy(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method Destroy - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsLeftSideInitialized() -void DDUnpack::Unpack_IsLeftSideInitialized(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsLeftSideInitialized(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsLeftSideInitialized - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_AppDomain GetAppDomainFromId(ULONG appdomainId) -void DDUnpack::Unpack_GetAppDomainFromId(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - ULONG appdomainId; - ReadFromBuffer(pSend, appdomainId); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_AppDomain _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainFromId(appdomainId); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainFromId - -//--------------------------------------------------------------------- -// Unpacking stub for: -// ULONG GetAppDomainId(VMPTR_AppDomain vmAppDomain) -void DDUnpack::Unpack_GetAppDomainId(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - ULONG _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainId(vmAppDomain); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainId - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetAppDomainObject(VMPTR_AppDomain vmAppDomain) -void DDUnpack::Unpack_GetAppDomainObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainObject(vmAppDomain); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsDefaultDomain(VMPTR_AppDomain vmAppDomain) -void DDUnpack::Unpack_IsDefaultDomain(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsDefaultDomain(vmAppDomain); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsDefaultDomain - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetAssemblyFromDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, VMPTR_Assembly * vmAssembly) -void DDUnpack::Unpack_GetAssemblyFromDomainAssembly(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainAssembly vmDomainAssembly; - ReadFromBuffer(pSend, vmDomainAssembly); - VMPTR_Assembly _vmAssembly; // storage - VMPTR_Assembly * vmAssembly = &_vmAssembly; - // vmAssembly does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetAssemblyFromDomainAssembly(vmDomainAssembly, vmAssembly); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, vmAssembly); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAssemblyFromDomainAssembly - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsAssemblyFullyTrusted(VMPTR_DomainAssembly vmDomainAssembly) -void DDUnpack::Unpack_IsAssemblyFullyTrusted(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainAssembly vmDomainAssembly; - ReadFromBuffer(pSend, vmDomainAssembly); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsAssemblyFullyTrusted(vmDomainAssembly); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsAssemblyFullyTrusted - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName) -void DDUnpack::Unpack_GetAppDomainFullName(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - StringCopyHolder _pStrName; // storage - StringCopyHolder* pStrName = &_pStrName; - // pStrName does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetAppDomainFullName(vmAppDomain, pStrName); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrName); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainFullName - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetModuleSimpleName(VMPTR_Module vmModule, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetModuleSimpleName(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetModuleSimpleName(vmModule, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModuleSimpleName - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL GetAssemblyPath(VMPTR_Assembly vmAssembly, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetAssemblyPath(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Assembly vmAssembly; - ReadFromBuffer(pSend, vmAssembly); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAssemblyPath(vmAssembly, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAssemblyPath - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) -void DDUnpack::Unpack_ResolveTypeReference(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - TypeRefData _pTypeRefInfo; // storage - const TypeRefData * pTypeRefInfo = &_pTypeRefInfo; - ReadFromBuffer(pSend, &_pTypeRefInfo); // serialize to storage - TypeRefData _pTargetRefInfo; // storage - TypeRefData * pTargetRefInfo = &_pTargetRefInfo; - ReadFromBuffer(pSend, &_pTargetRefInfo); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->ResolveTypeReference(pTypeRefInfo, pTargetRefInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTargetRefInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method ResolveTypeReference - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL GetModulePath(VMPTR_Module vmModule, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetModulePath(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetModulePath(vmModule, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModulePath - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL GetModuleNGenPath(VMPTR_Module vmModule, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetModuleNGenPath(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetModuleNGenPath(vmModule, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModuleNGenPath - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetMetadata(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer) -void DDUnpack::Unpack_GetMetadata(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - TargetBuffer _pTargetBuffer; // storage - TargetBuffer * pTargetBuffer = &_pTargetBuffer; - // pTargetBuffer does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetMetadata(vmModule, pTargetBuffer); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTargetBuffer); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetMetadata - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer, IDacDbiInterface::SymbolFormat * pSymbolFormat) -void DDUnpack::Unpack_GetSymbolsBuffer(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - TargetBuffer _pTargetBuffer; // storage - TargetBuffer * pTargetBuffer = &_pTargetBuffer; - // pTargetBuffer does not need to be copied on input - IDacDbiInterface::SymbolFormat _pSymbolFormat; // storage - IDacDbiInterface::SymbolFormat * pSymbolFormat = &_pSymbolFormat; - // pSymbolFormat does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetSymbolsBuffer(vmModule, pTargetBuffer, pSymbolFormat); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTargetBuffer); - WriteToBuffer(pResult, pSymbolFormat); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetSymbolsBuffer - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData) -void DDUnpack::Unpack_GetModuleData(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - ModuleInfo _pData; // storage - ModuleInfo * pData = &_pData; - // pData does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetModuleData(vmModule, pData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModuleData - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData) -void DDUnpack::Unpack_GetDomainFileData(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - DomainFileInfo _pData; // storage - DomainFileInfo * pData = &_pData; - // pData does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetDomainFileData(vmDomainFile, pData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetDomainFileData - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, VMPTR_Module * pModule) -void DDUnpack::Unpack_GetModuleForDomainFile(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - VMPTR_Module _pModule; // storage - VMPTR_Module * pModule = &_pModule; - // pModule does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetModuleForDomainFile(vmDomainFile, pModule); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pModule); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModuleForDomainFile - -//--------------------------------------------------------------------- -// Unpacking stub for: -// IDacDbiInterface::AddressType GetAddressType(CORDB_ADDRESS address) -void DDUnpack::Unpack_GetAddressType(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS address; - ReadFromBuffer(pSend, address); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - IDacDbiInterface::AddressType _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAddressType(address); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAddressType - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsTransitionStub(CORDB_ADDRESS address) -void DDUnpack::Unpack_IsTransitionStub(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS address; - ReadFromBuffer(pSend, address); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsTransitionStub(address); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsTransitionStub - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL * pfAllowJITOpts, BOOL * pfEnableEnC) -void DDUnpack::Unpack_GetCompilerFlags(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - BOOL _pfAllowJITOpts; // storage - BOOL * pfAllowJITOpts = &_pfAllowJITOpts; - // pfAllowJITOpts does not need to be copied on input - BOOL _pfEnableEnC; // storage - BOOL * pfEnableEnC = &_pfEnableEnC; - // pfEnableEnC does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetCompilerFlags(vmDomainFile, pfAllowJITOpts, pfEnableEnC); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pfAllowJITOpts); - WriteToBuffer(pResult, pfEnableEnC); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCompilerFlags - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT SetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL fAllowJitOpts, BOOL fEnableEnC) -void DDUnpack::Unpack_SetCompilerFlags(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - BOOL fAllowJitOpts; - ReadFromBuffer(pSend, fAllowJitOpts); - BOOL fEnableEnC; - ReadFromBuffer(pSend, fEnableEnC); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->SetCompilerFlags(vmDomainFile, fAllowJitOpts, fEnableEnC); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method SetCompilerFlags - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateAppDomains(IDacDbiInterface::FP_APPDOMAIN_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateAppDomains(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateAppDomains(GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateAppDomains - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateAssembliesInAppDomain(VMPTR_AppDomain vmAppDomain, IDacDbiInterface::FP_ASSEMBLY_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateAssembliesInAppDomain(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateAssembliesInAppDomain(vmAppDomain, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateAssembliesInAppDomain - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateModulesInAssembly(VMPTR_DomainAssembly vmAssembly, IDacDbiInterface::FP_MODULE_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateModulesInAssembly(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainAssembly vmAssembly; - ReadFromBuffer(pSend, vmAssembly); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateModulesInAssembly(vmAssembly, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateModulesInAssembly - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void RequestSyncAtEvent() -void DDUnpack::Unpack_RequestSyncAtEvent(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->RequestSyncAtEvent(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method RequestSyncAtEvent - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void MarkDebuggerAttachPending() -void DDUnpack::Unpack_MarkDebuggerAttachPending(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->MarkDebuggerAttachPending(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method MarkDebuggerAttachPending - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void MarkDebuggerAttached(BOOL fAttached) -void DDUnpack::Unpack_MarkDebuggerAttached(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - BOOL fAttached; - ReadFromBuffer(pSend, fAttached); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->MarkDebuggerAttached(fAttached); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method MarkDebuggerAttached - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void Hijack(VMPTR_Thread vmThread, ULONG32 dwThreadId, const EXCEPTION_RECORD * pRecord, T_CONTEXT * pOriginalContext, ULONG32 cbSizeContext, EHijackReason::EHijackReason reason, void * pUserData, CORDB_ADDRESS * pRemoteContextAddr) -void DDUnpack::Unpack_Hijack(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Callbacks not yet implemented - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method Hijack - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateConnections(IDacDbiInterface::FP_CONNECTION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateConnections(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Callbacks not yet implemented - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateConnections - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateThreads(IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateThreads(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateThreads(GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateThreads - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool IsThreadMarkedDead(VMPTR_Thread vmThread) -void DDUnpack::Unpack_IsThreadMarkedDead(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsThreadMarkedDead(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsThreadMarkedDead - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HANDLE GetThreadHandle(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetThreadHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Callbacks not yet implemented - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetThreadHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetThreadObject(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetThreadObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetThreadObject(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetThreadObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void SetDebugState(VMPTR_Thread vmThread, CorDebugThreadState debugState) -void DDUnpack::Unpack_SetDebugState(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - CorDebugThreadState debugState; - ReadFromBuffer(pSend, debugState); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->SetDebugState(vmThread, debugState); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method SetDebugState - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL HasUnhandledException(VMPTR_Thread vmThread) -void DDUnpack::Unpack_HasUnhandledException(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->HasUnhandledException(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method HasUnhandledException - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CorDebugUserState GetUserState(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetUserState(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CorDebugUserState _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetUserState(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetUserState - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CONNID GetConnectionID(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetConnectionID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CONNID _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetConnectionID(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetConnectionID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// TASKID GetTaskID(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetTaskID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - TASKID _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetTaskID(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetTaskID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// DWORD TryGetVolatileOSThreadID(VMPTR_Thread vmThread) -void DDUnpack::Unpack_TryGetVolatileOSThreadID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - DWORD _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->TryGetVolatileOSThreadID(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method TryGetVolatileOSThreadID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// DWORD GetUniqueThreadID(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetUniqueThreadID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - DWORD _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetUniqueThreadID(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetUniqueThreadID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetCurrentException(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetCurrentException(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCurrentException(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCurrentException - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetCurrentCustomDebuggerNotification(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetCurrentCustomDebuggerNotification(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCurrentCustomDebuggerNotification(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCurrentCustomDebuggerNotification - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetCurrentAppDomain(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_AppDomain _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCurrentAppDomain(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCurrentAppDomain - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef) -void DDUnpack::Unpack_ResolveAssembly(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainFile vmScope; - ReadFromBuffer(pSend, vmScope); - mdToken tkAssemblyRef; - ReadFromBuffer(pSend, tkAssemblyRef); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_DomainAssembly _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->ResolveAssembly(vmScope, tkAssemblyRef); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method ResolveAssembly - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetNativeCodeSequencePointsAndVarInfo(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS startAddress, BOOL fCodeAvailabe, NativeVarData * pNativeVarData, SequencePoints * pSequencePoints) -void DDUnpack::Unpack_GetNativeCodeSequencePointsAndVarInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_MethodDesc vmMethodDesc; - ReadFromBuffer(pSend, vmMethodDesc); - CORDB_ADDRESS startAddress; - ReadFromBuffer(pSend, startAddress); - BOOL fCodeAvailabe; - ReadFromBuffer(pSend, fCodeAvailabe); - NativeVarData _pNativeVarData; // storage - NativeVarData * pNativeVarData = &_pNativeVarData; - // pNativeVarData does not need to be copied on input - SequencePoints _pSequencePoints; // storage - SequencePoints * pSequencePoints = &_pSequencePoints; - // pSequencePoints does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetNativeCodeSequencePointsAndVarInfo(vmMethodDesc, startAddress, fCodeAvailabe, pNativeVarData, pSequencePoints); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pNativeVarData); - WriteToBuffer(pResult, pSequencePoints); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetNativeCodeSequencePointsAndVarInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_CONTEXT GetManagedStoppedContext(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetManagedStoppedContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_CONTEXT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetManagedStoppedContext(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetManagedStoppedContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void CreateStackWalk(VMPTR_Thread vmThread, DT_CONTEXT * pInternalContextBuffer, StackWalkHandle * ppSFIHandle) -void DDUnpack::Unpack_CreateStackWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - DT_CONTEXT _pInternalContextBuffer; // storage - DT_CONTEXT * pInternalContextBuffer = &_pInternalContextBuffer; - ReadFromBuffer(pSend, &_pInternalContextBuffer); // serialize to storage - StackWalkHandle _ppSFIHandle; // storage - StackWalkHandle * ppSFIHandle = &_ppSFIHandle; - // ppSFIHandle does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->CreateStackWalk(vmThread, pInternalContextBuffer, ppSFIHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pInternalContextBuffer); - WriteToBuffer(pResult, ppSFIHandle); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CreateStackWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void DeleteStackWalk(StackWalkHandle ppSFIHandle) -void DDUnpack::Unpack_DeleteStackWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - StackWalkHandle ppSFIHandle; - ReadFromBuffer(pSend, ppSFIHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->DeleteStackWalk(ppSFIHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method DeleteStackWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetStackWalkCurrentContext(StackWalkHandle pSFIHandle, DT_CONTEXT * pContext) -void DDUnpack::Unpack_GetStackWalkCurrentContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - DT_CONTEXT _pContext; // storage - DT_CONTEXT * pContext = &_pContext; - ReadFromBuffer(pSend, &_pContext); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetStackWalkCurrentContext(pSFIHandle, pContext); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pContext); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStackWalkCurrentContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void SetStackWalkCurrentContext(VMPTR_Thread vmThread, StackWalkHandle pSFIHandle, CorDebugSetContextFlag flag, DT_CONTEXT * pContext) -void DDUnpack::Unpack_SetStackWalkCurrentContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - CorDebugSetContextFlag flag; - ReadFromBuffer(pSend, flag); - DT_CONTEXT _pContext; // storage - DT_CONTEXT * pContext = &_pContext; - ReadFromBuffer(pSend, &_pContext); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->SetStackWalkCurrentContext(vmThread, pSFIHandle, flag, pContext); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pContext); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method SetStackWalkCurrentContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL UnwindStackWalkFrame(StackWalkHandle pSFIHandle) -void DDUnpack::Unpack_UnwindStackWalkFrame(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->UnwindStackWalkFrame(pSFIHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method UnwindStackWalkFrame - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT CheckContext(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) -void DDUnpack::Unpack_CheckContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - DT_CONTEXT _pContext; // storage - const DT_CONTEXT * pContext = &_pContext; - ReadFromBuffer(pSend, &_pContext); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->CheckContext(vmThread, pContext); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CheckContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// IDacDbiInterface::FrameType GetStackWalkCurrentFrameInfo(StackWalkHandle pSFIHandle, DebuggerIPCE_STRData * pFrameData) -void DDUnpack::Unpack_GetStackWalkCurrentFrameInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - DebuggerIPCE_STRData _pFrameData; // storage - DebuggerIPCE_STRData * pFrameData = &_pFrameData; - ReadFromBuffer(pSend, &_pFrameData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - IDacDbiInterface::FrameType _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetStackWalkCurrentFrameInfo(pSFIHandle, pFrameData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pFrameData); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStackWalkCurrentFrameInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// ULONG32 GetCountOfInternalFrames(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetCountOfInternalFrames(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - ULONG32 _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCountOfInternalFrames(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCountOfInternalFrames - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateInternalFrames(VMPTR_Thread vmThread, IDacDbiInterface::FP_INTERNAL_FRAME_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateInternalFrames(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateInternalFrames(vmThread, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateInternalFrames - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsMatchingParentFrame(FramePointer fpToCheck, FramePointer fpParent) -void DDUnpack::Unpack_IsMatchingParentFrame(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - FramePointer fpToCheck; - ReadFromBuffer(pSend, fpToCheck); - FramePointer fpParent; - ReadFromBuffer(pSend, fpParent); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsMatchingParentFrame(fpToCheck, fpParent); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsMatchingParentFrame - -//--------------------------------------------------------------------- -// Unpacking stub for: -// ULONG32 GetStackParameterSize(CORDB_ADDRESS controlPC) -void DDUnpack::Unpack_GetStackParameterSize(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS controlPC; - ReadFromBuffer(pSend, controlPC); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - ULONG32 _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetStackParameterSize(controlPC); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStackParameterSize - -//--------------------------------------------------------------------- -// Unpacking stub for: -// FramePointer GetFramePointer(StackWalkHandle pSFIHandle) -void DDUnpack::Unpack_GetFramePointer(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - FramePointer _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetFramePointer(pSFIHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetFramePointer - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsLeafFrame(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) -void DDUnpack::Unpack_IsLeafFrame(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - DT_CONTEXT _pContext; // storage - const DT_CONTEXT * pContext = &_pContext; - ReadFromBuffer(pSend, &_pContext); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsLeafFrame(vmThread, pContext); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsLeafFrame - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetContext(VMPTR_Thread vmThread, DT_CONTEXT * pContextBuffer) -void DDUnpack::Unpack_GetContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - DT_CONTEXT _pContextBuffer; // storage - DT_CONTEXT * pContextBuffer = &_pContextBuffer; - ReadFromBuffer(pSend, &_pContextBuffer); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetContext(vmThread, pContextBuffer); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pContextBuffer); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void ConvertContextToDebuggerRegDisplay(const DT_CONTEXT * pInContext, DebuggerREGDISPLAY * pOutDRD, BOOL fActive) -void DDUnpack::Unpack_ConvertContextToDebuggerRegDisplay(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - DT_CONTEXT _pInContext; // storage - const DT_CONTEXT * pInContext = &_pInContext; - ReadFromBuffer(pSend, &_pInContext); // serialize to storage - DebuggerREGDISPLAY _pOutDRD; // storage - DebuggerREGDISPLAY * pOutDRD = &_pOutDRD; - ReadFromBuffer(pSend, &_pOutDRD); // serialize to storage - BOOL fActive; - ReadFromBuffer(pSend, fActive); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->ConvertContextToDebuggerRegDisplay(pInContext, pOutDRD, fActive); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pOutDRD); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method ConvertContextToDebuggerRegDisplay - -//--------------------------------------------------------------------- -// Unpacking stub for: -// IDacDbiInterface::DynamicMethodType IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc) -void DDUnpack::Unpack_IsILStubOrLCGMethod(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_MethodDesc vmMethodDesc; - ReadFromBuffer(pSend, vmMethodDesc); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - IDacDbiInterface::DynamicMethodType _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsILStubOrLCGMethod(vmMethodDesc); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsILStubOrLCGMethod - -//--------------------------------------------------------------------- -// Unpacking stub for: -// TargetBuffer GetVarArgSig(CORDB_ADDRESS VASigCookieAddr, CORDB_ADDRESS * pArgBase) -void DDUnpack::Unpack_GetVarArgSig(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS VASigCookieAddr; - ReadFromBuffer(pSend, VASigCookieAddr); - CORDB_ADDRESS _pArgBase; // storage - CORDB_ADDRESS * pArgBase = &_pArgBase; - // pArgBase does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - TargetBuffer _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetVarArgSig(VASigCookieAddr, pArgBase); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pArgBase); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetVarArgSig - -//--------------------------------------------------------------------- -// Unpacking stub for: -// GENERICS_TYPE_TOKEN ResolveExactGenericArgsToken(DWORD dwExactGenericArgsTokenIndex, GENERICS_TYPE_TOKEN rawToken) -void DDUnpack::Unpack_ResolveExactGenericArgsToken(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - DWORD dwExactGenericArgsTokenIndex; - ReadFromBuffer(pSend, dwExactGenericArgsTokenIndex); - GENERICS_TYPE_TOKEN rawToken; - ReadFromBuffer(pSend, rawToken); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - GENERICS_TYPE_TOKEN _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->ResolveExactGenericArgsToken(dwExactGenericArgsTokenIndex, rawToken); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method ResolveExactGenericArgsToken - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken) -void DDUnpack::Unpack_GetILCodeAndSig(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - mdToken functionToken; - ReadFromBuffer(pSend, functionToken); - TargetBuffer _pCodeInfo; // storage - TargetBuffer * pCodeInfo = &_pCodeInfo; - // pCodeInfo does not need to be copied on input - mdToken _pLocalSigToken; // storage - mdToken * pLocalSigToken = &_pLocalSigToken; - // pLocalSigToken does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetILCodeAndSig(vmDomainFile, functionToken, pCodeInfo, pLocalSigToken); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pCodeInfo); - WriteToBuffer(pResult, pLocalSigToken); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetILCodeAndSig - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, mdToken functionToken, NativeCodeFunctionData * pCodeInfo) -void DDUnpack::Unpack_GetNativeCodeInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - mdToken functionToken; - ReadFromBuffer(pSend, functionToken); - NativeCodeFunctionData _pCodeInfo; // storage - NativeCodeFunctionData * pCodeInfo = &_pCodeInfo; - // pCodeInfo does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetNativeCodeInfo(vmDomainFile, functionToken, pCodeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pCodeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetNativeCodeInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetNativeCodeInfoForAddr(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS hotCodeStartAddr, NativeCodeFunctionData * pCodeInfo) -void DDUnpack::Unpack_GetNativeCodeInfoForAddr(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_MethodDesc vmMethodDesc; - ReadFromBuffer(pSend, vmMethodDesc); - CORDB_ADDRESS hotCodeStartAddr; - ReadFromBuffer(pSend, hotCodeStartAddr); - NativeCodeFunctionData _pCodeInfo; // storage - NativeCodeFunctionData * pCodeInfo = &_pCodeInfo; - ReadFromBuffer(pSend, &_pCodeInfo); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetNativeCodeInfoForAddr(vmMethodDesc, hotCodeStartAddr, pCodeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pCodeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetNativeCodeInfoForAddr - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetClassInfo(VMPTR_AppDomain vmAppDomain, VMPTR_Module vmModule, mdTypeDef metadataToken, VMPTR_TypeHandle thExact, VMPTR_TypeHandle thApprox, ClassInfo * pData) -void DDUnpack::Unpack_GetClassInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - mdTypeDef metadataToken; - ReadFromBuffer(pSend, metadataToken); - VMPTR_TypeHandle thExact; - ReadFromBuffer(pSend, thExact); - VMPTR_TypeHandle thApprox; - ReadFromBuffer(pSend, thApprox); - ClassInfo _pData; // storage - ClassInfo * pData = &_pData; - ReadFromBuffer(pSend, &_pData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetClassInfo(vmAppDomain, vmModule, metadataToken, thExact, thApprox, pData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetClassInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetInstantiationFieldInfo(VMPTR_DomainFile vmDomainFile, mdTypeDef metadataToken, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList<FieldData> * pFieldList, SIZE_T * pObjectSize) -void DDUnpack::Unpack_GetInstantiationFieldInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - mdTypeDef metadataToken; - ReadFromBuffer(pSend, metadataToken); - VMPTR_TypeHandle vmThExact; - ReadFromBuffer(pSend, vmThExact); - VMPTR_TypeHandle vmThApprox; - ReadFromBuffer(pSend, vmThApprox); - DacDbiArrayList<FieldData> _pFieldList; // storage - DacDbiArrayList<FieldData> * pFieldList = &_pFieldList; - // pFieldList does not need to be copied on input - SIZE_T _pObjectSize; // storage - SIZE_T * pObjectSize = &_pObjectSize; - // pObjectSize does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetInstantiationFieldInfo(vmDomainFile, metadataToken, vmThExact, vmThApprox, pFieldList, pObjectSize); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pFieldList); - WriteToBuffer(pResult, pObjectSize); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetInstantiationFieldInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, DebuggerIPCE_ExpandedTypeData * pTypeInfo) -void DDUnpack::Unpack_TypeHandleToExpandedTypeInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - AreValueTypesBoxed boxed; - ReadFromBuffer(pSend, boxed); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - VMPTR_TypeHandle vmTypeHandle; - ReadFromBuffer(pSend, vmTypeHandle); - DebuggerIPCE_ExpandedTypeData _pTypeInfo; // storage - DebuggerIPCE_ExpandedTypeData * pTypeInfo = &_pTypeInfo; - ReadFromBuffer(pSend, &_pTypeInfo); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->TypeHandleToExpandedTypeInfo(boxed, vmAppDomain, vmTypeHandle, pTypeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method TypeHandleToExpandedTypeInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetObjectExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, CORDB_ADDRESS addr, DebuggerIPCE_ExpandedTypeData * pTypeInfo) -void DDUnpack::Unpack_GetObjectExpandedTypeInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - AreValueTypesBoxed boxed; - ReadFromBuffer(pSend, boxed); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - CORDB_ADDRESS addr; - ReadFromBuffer(pSend, addr); - DebuggerIPCE_ExpandedTypeData _pTypeInfo; // storage - DebuggerIPCE_ExpandedTypeData * pTypeInfo = &_pTypeInfo; - // pTypeInfo does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetObjectExpandedTypeInfo(boxed, vmAppDomain, addr, pTypeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObjectExpandedTypeInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_TypeHandle GetApproxTypeHandle(TypeInfoList * pTypeData) -void DDUnpack::Unpack_GetApproxTypeHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - TypeInfoList _pTypeData; // storage - TypeInfoList * pTypeData = &_pTypeData; - ReadFromBuffer(pSend, &_pTypeData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_TypeHandle _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetApproxTypeHandle(pTypeData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeData); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetApproxTypeHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_TypeHandle GetExactTypeHandle(DebuggerIPCE_ExpandedTypeData * pTypeData, ArgInfoList * pArgInfo) -void DDUnpack::Unpack_GetExactTypeHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - DebuggerIPCE_ExpandedTypeData _pTypeData; // storage - DebuggerIPCE_ExpandedTypeData * pTypeData = &_pTypeData; - ReadFromBuffer(pSend, &_pTypeData); // serialize to storage - ArgInfoList _pArgInfo; // storage - ArgInfoList * pArgInfo = &_pArgInfo; - ReadFromBuffer(pSend, &_pArgInfo); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_TypeHandle _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetExactTypeHandle(pTypeData, pArgInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeData); - WriteToBuffer(pResult, pArgInfo); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetExactTypeHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetMethodDescParams(VMPTR_AppDomain vmAppDomain, VMPTR_MethodDesc vmMethodDesc, GENERICS_TYPE_TOKEN genericsToken, UINT32 * pcGenericClassTypeParams, TypeParamsList * pGenericTypeParams) -void DDUnpack::Unpack_GetMethodDescParams(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - VMPTR_MethodDesc vmMethodDesc; - ReadFromBuffer(pSend, vmMethodDesc); - GENERICS_TYPE_TOKEN genericsToken; - ReadFromBuffer(pSend, genericsToken); - UINT32 _pcGenericClassTypeParams; // storage - UINT32 * pcGenericClassTypeParams = &_pcGenericClassTypeParams; - // pcGenericClassTypeParams does not need to be copied on input - TypeParamsList _pGenericTypeParams; // storage - TypeParamsList * pGenericTypeParams = &_pGenericTypeParams; - // pGenericTypeParams does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetMethodDescParams(vmAppDomain, vmMethodDesc, genericsToken, pcGenericClassTypeParams, pGenericTypeParams); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pcGenericClassTypeParams); - WriteToBuffer(pResult, pGenericTypeParams); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetMethodDescParams - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CORDB_ADDRESS GetThreadOrContextStaticAddress(VMPTR_FieldDesc vmField, VMPTR_Thread vmRuntimeThread) -void DDUnpack::Unpack_GetThreadOrContextStaticAddress(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_FieldDesc vmField; - ReadFromBuffer(pSend, vmField); - VMPTR_Thread vmRuntimeThread; - ReadFromBuffer(pSend, vmRuntimeThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CORDB_ADDRESS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetThreadOrContextStaticAddress(vmField, vmRuntimeThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetThreadOrContextStaticAddress - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CORDB_ADDRESS GetCollectibleTypeStaticAddress(VMPTR_FieldDesc vmField, VMPTR_AppDomain vmAppDomain) -void DDUnpack::Unpack_GetCollectibleTypeStaticAddress(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_FieldDesc vmField; - ReadFromBuffer(pSend, vmField); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CORDB_ADDRESS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCollectibleTypeStaticAddress(vmField, vmAppDomain); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCollectibleTypeStaticAddress - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetEnCHangingFieldInfo(const EnCHangingFieldInfo * pEnCFieldInfo, FieldData * pFieldData, BOOL * pfStatic) -void DDUnpack::Unpack_GetEnCHangingFieldInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - EnCHangingFieldInfo _pEnCFieldInfo; // storage - const EnCHangingFieldInfo * pEnCFieldInfo = &_pEnCFieldInfo; - ReadFromBuffer(pSend, &_pEnCFieldInfo); // serialize to storage - FieldData _pFieldData; // storage - FieldData * pFieldData = &_pFieldData; - // pFieldData does not need to be copied on input - BOOL _pfStatic; // storage - BOOL * pfStatic = &_pfStatic; - // pfStatic does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetEnCHangingFieldInfo(pEnCFieldInfo, pFieldData, pfStatic); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pFieldData); - WriteToBuffer(pResult, pfStatic); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetEnCHangingFieldInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetTypeHandleParams(VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, TypeParamsList * pParams) -void DDUnpack::Unpack_GetTypeHandleParams(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - VMPTR_TypeHandle vmTypeHandle; - ReadFromBuffer(pSend, vmTypeHandle); - TypeParamsList _pParams; // storage - TypeParamsList * pParams = &_pParams; - // pParams does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetTypeHandleParams(vmAppDomain, vmTypeHandle, pParams); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pParams); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetTypeHandleParams - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetSimpleType(VMPTR_AppDomain vmAppDomain, CorElementType simpleType, mdTypeDef * pMetadataToken, VMPTR_DomainFile * pVmDomainFile) -void DDUnpack::Unpack_GetSimpleType(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - CorElementType simpleType; - ReadFromBuffer(pSend, simpleType); - mdTypeDef _pMetadataToken; // storage - mdTypeDef * pMetadataToken = &_pMetadataToken; - // pMetadataToken does not need to be copied on input - VMPTR_DomainFile _pVmDomainFile; // storage - VMPTR_DomainFile * pVmDomainFile = &_pVmDomainFile; - // pVmDomainFile does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetSimpleType(vmAppDomain, simpleType, pMetadataToken, pVmDomainFile); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pMetadataToken); - WriteToBuffer(pResult, pVmDomainFile); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetSimpleType - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetTypedByRefInfo(CORDB_ADDRESS pTypedByRef, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) -void DDUnpack::Unpack_GetTypedByRefInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS pTypedByRef; - ReadFromBuffer(pSend, pTypedByRef); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - DebuggerIPCE_ObjectData _pObjectData; // storage - DebuggerIPCE_ObjectData * pObjectData = &_pObjectData; - ReadFromBuffer(pSend, &_pObjectData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetTypedByRefInfo(pTypedByRef, vmAppDomain, pObjectData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pObjectData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetTypedByRefInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetStringData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) -void DDUnpack::Unpack_GetStringData(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS objectAddress; - ReadFromBuffer(pSend, objectAddress); - DebuggerIPCE_ObjectData _pObjectData; // storage - DebuggerIPCE_ObjectData * pObjectData = &_pObjectData; - ReadFromBuffer(pSend, &_pObjectData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetStringData(objectAddress, pObjectData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pObjectData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStringData - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetArrayData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) -void DDUnpack::Unpack_GetArrayData(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS objectAddress; - ReadFromBuffer(pSend, objectAddress); - DebuggerIPCE_ObjectData _pObjectData; // storage - DebuggerIPCE_ObjectData * pObjectData = &_pObjectData; - ReadFromBuffer(pSend, &_pObjectData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetArrayData(objectAddress, pObjectData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pObjectData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetArrayData - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetBasicObjectInfo(CORDB_ADDRESS objectAddress, CorElementType type, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) -void DDUnpack::Unpack_GetBasicObjectInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS objectAddress; - ReadFromBuffer(pSend, objectAddress); - CorElementType type; - ReadFromBuffer(pSend, type); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - DebuggerIPCE_ObjectData _pObjectData; // storage - DebuggerIPCE_ObjectData * pObjectData = &_pObjectData; - ReadFromBuffer(pSend, &_pObjectData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetBasicObjectInfo(objectAddress, type, vmAppDomain, pObjectData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pObjectData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetBasicObjectInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void TestCrst(VMPTR_Crst vmCrst) -void DDUnpack::Unpack_TestCrst(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Crst vmCrst; - ReadFromBuffer(pSend, vmCrst); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->TestCrst(vmCrst); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method TestCrst - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void TestRWLock(VMPTR_SimpleRWLock vmRWLock) -void DDUnpack::Unpack_TestRWLock(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_SimpleRWLock vmRWLock; - ReadFromBuffer(pSend, vmRWLock); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->TestRWLock(vmRWLock); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method TestRWLock - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CORDB_ADDRESS GetDebuggerControlBlockAddress() -void DDUnpack::Unpack_GetDebuggerControlBlockAddress(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CORDB_ADDRESS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetDebuggerControlBlockAddress(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetDebuggerControlBlockAddress - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_Object GetObjectFromRefPtr(CORDB_ADDRESS ptr) -void DDUnpack::Unpack_GetObjectFromRefPtr(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS ptr; - ReadFromBuffer(pSend, ptr); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_Object _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetObjectFromRefPtr(ptr); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObjectFromRefPtr - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_Object GetObject(CORDB_ADDRESS ptr) -void DDUnpack::Unpack_GetObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS ptr; - ReadFromBuffer(pSend, ptr); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_Object _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetObject(ptr); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetVmObjectHandle(CORDB_ADDRESS handleAddress) -void DDUnpack::Unpack_GetVmObjectHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS handleAddress; - ReadFromBuffer(pSend, handleAddress); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetVmObjectHandle(handleAddress); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetVmObjectHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle) -void DDUnpack::Unpack_IsVmObjectHandleValid(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_OBJECTHANDLE vmHandle; - ReadFromBuffer(pSend, vmHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsVmObjectHandleValid(vmHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsVmObjectHandleValid - -//--------------------------------------------------------------------- -// Unpacking stub for: -// ULONG GetAppDomainIdFromVmObjectHandle(VMPTR_OBJECTHANDLE vmHandle) -void DDUnpack::Unpack_GetAppDomainIdFromVmObjectHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_OBJECTHANDLE vmHandle; - ReadFromBuffer(pSend, vmHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - ULONG _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainIdFromVmObjectHandle(vmHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainIdFromVmObjectHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CORDB_ADDRESS GetHandleAddressFromVmHandle(VMPTR_OBJECTHANDLE vmHandle) -void DDUnpack::Unpack_GetHandleAddressFromVmHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_OBJECTHANDLE vmHandle; - ReadFromBuffer(pSend, vmHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CORDB_ADDRESS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetHandleAddressFromVmHandle(vmHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetHandleAddressFromVmHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// TargetBuffer GetObjectContents(VMPTR_Object obj) -void DDUnpack::Unpack_GetObjectContents(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Object obj; - ReadFromBuffer(pSend, obj); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - TargetBuffer _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetObjectContents(obj); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObjectContents - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateBlockingObjects(VMPTR_Thread vmThread, IDacDbiInterface::FP_BLOCKINGOBJECT_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateBlockingObjects(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateBlockingObjects(vmThread, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateBlockingObjects - -//--------------------------------------------------------------------- -// Unpacking stub for: -// MonitorLockInfo GetThreadOwningMonitorLock(VMPTR_Object vmObject) -void DDUnpack::Unpack_GetThreadOwningMonitorLock(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - MonitorLockInfo _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetThreadOwningMonitorLock(vmObject); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetThreadOwningMonitorLock - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateMonitorEventWaitList(VMPTR_Object vmObject, IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateMonitorEventWaitList(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateMonitorEventWaitList(vmObject, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateMonitorEventWaitList - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsManagedDebugEventPending() -void DDUnpack::Unpack_IsManagedDebugEventPending(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsManagedDebugEventPending(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsManagedDebugEventPending - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool GetMetaDataFileInfoFromPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwImageSize, bool & isNGEN, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetMetaDataFileInfoFromPEFile(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_PEFile vmPEFile; - ReadFromBuffer(pSend, vmPEFile); - DWORD dwTimeStamp; - ReadFromBuffer(pSend, dwTimeStamp); - DWORD dwImageSize; - ReadFromBuffer(pSend, dwImageSize); - bool isNGEN; - ReadFromBuffer(pSend, isNGEN); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetMetaDataFileInfoFromPEFile(vmPEFile, dwTimeStamp, dwImageSize, isNGEN, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, dwTimeStamp); - WriteToBuffer(pResult, dwImageSize); - WriteToBuffer(pResult, isNGEN); - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetMetaDataFileInfoFromPEFile - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool GetILImageInfoFromNgenPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwSize, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetILImageInfoFromNgenPEFile(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_PEFile vmPEFile; - ReadFromBuffer(pSend, vmPEFile); - DWORD dwTimeStamp; - ReadFromBuffer(pSend, dwTimeStamp); - DWORD dwSize; - ReadFromBuffer(pSend, dwSize); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetILImageInfoFromNgenPEFile(vmPEFile, dwTimeStamp, dwSize, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, dwTimeStamp); - WriteToBuffer(pResult, dwSize); - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetILImageInfoFromNgenPEFile - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool IsThreadSuspendedOrHijacked(VMPTR_Thread vmThread) -void DDUnpack::Unpack_IsThreadSuspendedOrHijacked(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsThreadSuspendedOrHijacked(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsThreadSuspendedOrHijacked - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool AreGCStructuresValid() -void DDUnpack::Unpack_AreGCStructuresValid(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->AreGCStructuresValid(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method AreGCStructuresValid - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT CreateHeapWalk(HeapWalkHandle * pHandle) -void DDUnpack::Unpack_CreateHeapWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - HeapWalkHandle _pHandle; // storage - HeapWalkHandle * pHandle = &_pHandle; - // pHandle does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->CreateHeapWalk(pHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pHandle); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CreateHeapWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void DeleteHeapWalk(HeapWalkHandle handle) -void DDUnpack::Unpack_DeleteHeapWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - HeapWalkHandle handle; - ReadFromBuffer(pSend, handle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->DeleteHeapWalk(handle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method DeleteHeapWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT WalkHeap(HeapWalkHandle handle, ULONG count, COR_HEAPOBJECT * objects, ULONG * pFetched) -void DDUnpack::Unpack_WalkHeap(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - HeapWalkHandle handle; - ReadFromBuffer(pSend, handle); - ULONG count; - ReadFromBuffer(pSend, count); - COR_HEAPOBJECT _objects; // storage - COR_HEAPOBJECT * objects = &_objects; - // objects does not need to be copied on input - ULONG _pFetched; // storage - ULONG * pFetched = &_pFetched; - // pFetched does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->WalkHeap(handle, count, objects, pFetched); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, objects); - WriteToBuffer(pResult, pFetched); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method WalkHeap - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT GetHeapSegments(DacDbiArrayList<COR_SEGMENT> * pSegments) -void DDUnpack::Unpack_GetHeapSegments(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - DacDbiArrayList<COR_SEGMENT> _pSegments; // storage - DacDbiArrayList<COR_SEGMENT> * pSegments = &_pSegments; - // pSegments does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetHeapSegments(pSegments); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pSegments); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetHeapSegments - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool IsValidObject(CORDB_ADDRESS obj) -void DDUnpack::Unpack_IsValidObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS obj; - ReadFromBuffer(pSend, obj); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsValidObject(obj); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsValidObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool GetAppDomainForObject(CORDB_ADDRESS obj, VMPTR_AppDomain * pApp, VMPTR_Module * pModule, VMPTR_DomainFile * pDomainFile) -void DDUnpack::Unpack_GetAppDomainForObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Initialize a holder to swap in & out the g_pAllocator - DD_UNPACK_ENTER_MAY_THROW; - - // Parameters - CORDB_ADDRESS obj; - ReadFromBuffer(pSend, obj); - VMPTR_AppDomain _pApp; // storage - VMPTR_AppDomain * pApp = &_pApp; - // pApp does not need to be copied on input - VMPTR_Module _pModule; // storage - VMPTR_Module * pModule = &_pModule; - // pModule does not need to be copied on input - VMPTR_DomainFile _pDomainFile; // storage - VMPTR_DomainFile * pDomainFile = &_pDomainFile; - // pDomainFile does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainForObject(obj, pApp, pModule, pDomainFile); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pApp); - WriteToBuffer(pResult, pModule); - WriteToBuffer(pResult, pDomainFile); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainForObject - - -// -// Handler -// -void DDUnpack::HandleDDMessage(ReadBuffer * pSend, WriteBuffer * pResult) -{ - DD_MessageId id; - ReadFromBuffer(pSend, id); - - switch(id) - { - - case DDID_CheckDbiVersion: - Unpack_CheckDbiVersion(pSend, pResult); - break; - - case DDID_FlushCache: - Unpack_FlushCache(pSend, pResult); - break; - - case DDID_DacSetTargetConsistencyChecks: - Unpack_DacSetTargetConsistencyChecks(pSend, pResult); - break; - - case DDID_Destroy: - Unpack_Destroy(pSend, pResult); - break; - - case DDID_IsLeftSideInitialized: - Unpack_IsLeftSideInitialized(pSend, pResult); - break; - - case DDID_GetAppDomainFromId: - Unpack_GetAppDomainFromId(pSend, pResult); - break; - - case DDID_GetAppDomainId: - Unpack_GetAppDomainId(pSend, pResult); - break; - - case DDID_GetAppDomainObject: - Unpack_GetAppDomainObject(pSend, pResult); - break; - - case DDID_IsDefaultDomain: - Unpack_IsDefaultDomain(pSend, pResult); - break; - - case DDID_GetAssemblyFromDomainAssembly: - Unpack_GetAssemblyFromDomainAssembly(pSend, pResult); - break; - - case DDID_IsAssemblyFullyTrusted: - Unpack_IsAssemblyFullyTrusted(pSend, pResult); - break; - - case DDID_GetAppDomainFullName: - Unpack_GetAppDomainFullName(pSend, pResult); - break; - - case DDID_GetModuleSimpleName: - Unpack_GetModuleSimpleName(pSend, pResult); - break; - - case DDID_GetAssemblyPath: - Unpack_GetAssemblyPath(pSend, pResult); - break; - - case DDID_ResolveTypeReference: - Unpack_ResolveTypeReference(pSend, pResult); - break; - - case DDID_GetModulePath: - Unpack_GetModulePath(pSend, pResult); - break; - - case DDID_GetModuleNGenPath: - Unpack_GetModuleNGenPath(pSend, pResult); - break; - - case DDID_GetMetadata: - Unpack_GetMetadata(pSend, pResult); - break; - - case DDID_GetSymbolsBuffer: - Unpack_GetSymbolsBuffer(pSend, pResult); - break; - - case DDID_GetModuleData: - Unpack_GetModuleData(pSend, pResult); - break; - - case DDID_GetDomainFileData: - Unpack_GetDomainFileData(pSend, pResult); - break; - - case DDID_GetModuleForDomainFile: - Unpack_GetModuleForDomainFile(pSend, pResult); - break; - - case DDID_GetAddressType: - Unpack_GetAddressType(pSend, pResult); - break; - - case DDID_IsTransitionStub: - Unpack_IsTransitionStub(pSend, pResult); - break; - - case DDID_GetCompilerFlags: - Unpack_GetCompilerFlags(pSend, pResult); - break; - - case DDID_SetCompilerFlags: - Unpack_SetCompilerFlags(pSend, pResult); - break; - - case DDID_EnumerateAppDomains: - Unpack_EnumerateAppDomains(pSend, pResult); - break; - - case DDID_EnumerateAssembliesInAppDomain: - Unpack_EnumerateAssembliesInAppDomain(pSend, pResult); - break; - - case DDID_EnumerateModulesInAssembly: - Unpack_EnumerateModulesInAssembly(pSend, pResult); - break; - - case DDID_RequestSyncAtEvent: - Unpack_RequestSyncAtEvent(pSend, pResult); - break; - - case DDID_MarkDebuggerAttachPending: - Unpack_MarkDebuggerAttachPending(pSend, pResult); - break; - - case DDID_MarkDebuggerAttached: - Unpack_MarkDebuggerAttached(pSend, pResult); - break; - - case DDID_Hijack: - Unpack_Hijack(pSend, pResult); - break; - - case DDID_EnumerateConnections: - Unpack_EnumerateConnections(pSend, pResult); - break; - - case DDID_EnumerateThreads: - Unpack_EnumerateThreads(pSend, pResult); - break; - - case DDID_IsThreadMarkedDead: - Unpack_IsThreadMarkedDead(pSend, pResult); - break; - - case DDID_GetThreadHandle: - Unpack_GetThreadHandle(pSend, pResult); - break; - - case DDID_GetThreadObject: - Unpack_GetThreadObject(pSend, pResult); - break; - - case DDID_SetDebugState: - Unpack_SetDebugState(pSend, pResult); - break; - - case DDID_HasUnhandledException: - Unpack_HasUnhandledException(pSend, pResult); - break; - - case DDID_GetUserState: - Unpack_GetUserState(pSend, pResult); - break; - - case DDID_GetConnectionID: - Unpack_GetConnectionID(pSend, pResult); - break; - - case DDID_GetTaskID: - Unpack_GetTaskID(pSend, pResult); - break; - - case DDID_TryGetVolatileOSThreadID: - Unpack_TryGetVolatileOSThreadID(pSend, pResult); - break; - - case DDID_GetUniqueThreadID: - Unpack_GetUniqueThreadID(pSend, pResult); - break; - - case DDID_GetCurrentException: - Unpack_GetCurrentException(pSend, pResult); - break; - - case DDID_GetCurrentCustomDebuggerNotification: - Unpack_GetCurrentCustomDebuggerNotification(pSend, pResult); - break; - - case DDID_GetCurrentAppDomain: - Unpack_GetCurrentAppDomain(pSend, pResult); - break; - - case DDID_ResolveAssembly: - Unpack_ResolveAssembly(pSend, pResult); - break; - - case DDID_GetNativeCodeSequencePointsAndVarInfo: - Unpack_GetNativeCodeSequencePointsAndVarInfo(pSend, pResult); - break; - - case DDID_GetManagedStoppedContext: - Unpack_GetManagedStoppedContext(pSend, pResult); - break; - - case DDID_CreateStackWalk: - Unpack_CreateStackWalk(pSend, pResult); - break; - - case DDID_DeleteStackWalk: - Unpack_DeleteStackWalk(pSend, pResult); - break; - - case DDID_GetStackWalkCurrentContext: - Unpack_GetStackWalkCurrentContext(pSend, pResult); - break; - - case DDID_SetStackWalkCurrentContext: - Unpack_SetStackWalkCurrentContext(pSend, pResult); - break; - - case DDID_UnwindStackWalkFrame: - Unpack_UnwindStackWalkFrame(pSend, pResult); - break; - - case DDID_CheckContext: - Unpack_CheckContext(pSend, pResult); - break; - - case DDID_GetStackWalkCurrentFrameInfo: - Unpack_GetStackWalkCurrentFrameInfo(pSend, pResult); - break; - - case DDID_GetCountOfInternalFrames: - Unpack_GetCountOfInternalFrames(pSend, pResult); - break; - - case DDID_EnumerateInternalFrames: - Unpack_EnumerateInternalFrames(pSend, pResult); - break; - - case DDID_IsMatchingParentFrame: - Unpack_IsMatchingParentFrame(pSend, pResult); - break; - - case DDID_GetStackParameterSize: - Unpack_GetStackParameterSize(pSend, pResult); - break; - - case DDID_GetFramePointer: - Unpack_GetFramePointer(pSend, pResult); - break; - - case DDID_IsLeafFrame: - Unpack_IsLeafFrame(pSend, pResult); - break; - - case DDID_GetContext: - Unpack_GetContext(pSend, pResult); - break; - - case DDID_ConvertContextToDebuggerRegDisplay: - Unpack_ConvertContextToDebuggerRegDisplay(pSend, pResult); - break; - - case DDID_IsILStubOrLCGMethod: - Unpack_IsILStubOrLCGMethod(pSend, pResult); - break; - - case DDID_GetVarArgSig: - Unpack_GetVarArgSig(pSend, pResult); - break; - - case DDID_ResolveExactGenericArgsToken: - Unpack_ResolveExactGenericArgsToken(pSend, pResult); - break; - - case DDID_GetILCodeAndSig: - Unpack_GetILCodeAndSig(pSend, pResult); - break; - - case DDID_GetNativeCodeInfo: - Unpack_GetNativeCodeInfo(pSend, pResult); - break; - - case DDID_GetNativeCodeInfoForAddr: - Unpack_GetNativeCodeInfoForAddr(pSend, pResult); - break; - - case DDID_GetClassInfo: - Unpack_GetClassInfo(pSend, pResult); - break; - - case DDID_GetInstantiationFieldInfo: - Unpack_GetInstantiationFieldInfo(pSend, pResult); - break; - - case DDID_TypeHandleToExpandedTypeInfo: - Unpack_TypeHandleToExpandedTypeInfo(pSend, pResult); - break; - - case DDID_GetObjectExpandedTypeInfo: - Unpack_GetObjectExpandedTypeInfo(pSend, pResult); - break; - - case DDID_GetApproxTypeHandle: - Unpack_GetApproxTypeHandle(pSend, pResult); - break; - - case DDID_GetExactTypeHandle: - Unpack_GetExactTypeHandle(pSend, pResult); - break; - - case DDID_GetMethodDescParams: - Unpack_GetMethodDescParams(pSend, pResult); - break; - - case DDID_GetThreadOrContextStaticAddress: - Unpack_GetThreadOrContextStaticAddress(pSend, pResult); - break; - - case DDID_GetCollectibleTypeStaticAddress: - Unpack_GetCollectibleTypeStaticAddress(pSend, pResult); - break; - - case DDID_GetEnCHangingFieldInfo: - Unpack_GetEnCHangingFieldInfo(pSend, pResult); - break; - - case DDID_GetTypeHandleParams: - Unpack_GetTypeHandleParams(pSend, pResult); - break; - - case DDID_GetSimpleType: - Unpack_GetSimpleType(pSend, pResult); - break; - - case DDID_GetTypedByRefInfo: - Unpack_GetTypedByRefInfo(pSend, pResult); - break; - - case DDID_GetStringData: - Unpack_GetStringData(pSend, pResult); - break; - - case DDID_GetArrayData: - Unpack_GetArrayData(pSend, pResult); - break; - - case DDID_GetBasicObjectInfo: - Unpack_GetBasicObjectInfo(pSend, pResult); - break; - - case DDID_TestCrst: - Unpack_TestCrst(pSend, pResult); - break; - - case DDID_TestRWLock: - Unpack_TestRWLock(pSend, pResult); - break; - - case DDID_GetDebuggerControlBlockAddress: - Unpack_GetDebuggerControlBlockAddress(pSend, pResult); - break; - - case DDID_GetObjectFromRefPtr: - Unpack_GetObjectFromRefPtr(pSend, pResult); - break; - - case DDID_GetObject: - Unpack_GetObject(pSend, pResult); - break; - - case DDID_GetVmObjectHandle: - Unpack_GetVmObjectHandle(pSend, pResult); - break; - - case DDID_IsVmObjectHandleValid: - Unpack_IsVmObjectHandleValid(pSend, pResult); - break; - - case DDID_GetAppDomainIdFromVmObjectHandle: - Unpack_GetAppDomainIdFromVmObjectHandle(pSend, pResult); - break; - - case DDID_GetHandleAddressFromVmHandle: - Unpack_GetHandleAddressFromVmHandle(pSend, pResult); - break; - - case DDID_GetObjectContents: - Unpack_GetObjectContents(pSend, pResult); - break; - - case DDID_EnumerateBlockingObjects: - Unpack_EnumerateBlockingObjects(pSend, pResult); - break; - - case DDID_GetThreadOwningMonitorLock: - Unpack_GetThreadOwningMonitorLock(pSend, pResult); - break; - - case DDID_EnumerateMonitorEventWaitList: - Unpack_EnumerateMonitorEventWaitList(pSend, pResult); - break; - - case DDID_IsManagedDebugEventPending: - Unpack_IsManagedDebugEventPending(pSend, pResult); - break; - - case DDID_GetMetaDataFileInfoFromPEFile: - Unpack_GetMetaDataFileInfoFromPEFile(pSend, pResult); - break; - - case DDID_GetILImageInfoFromNgenPEFile: - Unpack_GetILImageInfoFromNgenPEFile(pSend, pResult); - break; - - case DDID_IsThreadSuspendedOrHijacked: - Unpack_IsThreadSuspendedOrHijacked(pSend, pResult); - break; - - case DDID_AreGCStructuresValid: - Unpack_AreGCStructuresValid(pSend, pResult); - break; - - case DDID_CreateHeapWalk: - Unpack_CreateHeapWalk(pSend, pResult); - break; - - case DDID_DeleteHeapWalk: - Unpack_DeleteHeapWalk(pSend, pResult); - break; - - case DDID_WalkHeap: - Unpack_WalkHeap(pSend, pResult); - break; - - case DDID_GetHeapSegments: - Unpack_GetHeapSegments(pSend, pResult); - break; - - case DDID_IsValidObject: - Unpack_IsValidObject(pSend, pResult); - break; - - case DDID_GetAppDomainForObject: - Unpack_GetAppDomainForObject(pSend, pResult); - break; - - - } // end switch -} // end HandleDDMessage method - -#endif //FEATURE_DBGIPC_TRANSPORT_VM - -// end of file diff --git a/src/debug/daccess/ddunpack.h b/src/debug/daccess/ddunpack.h deleted file mode 100644 index ec9e25a0e9..0000000000 --- a/src/debug/daccess/ddunpack.h +++ /dev/null @@ -1,411 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -// Unpacker -// -// Lives on EE side of the fence -// -// Note that this file is generated by ndp\clr\src\Debug\tools\BuildDDMarshal\. -// Changes should be made to output\DDUnpack_template.h in that directory. -// - - -#ifndef _DDUNPACK_H_ -#define _DDUNPACK_H_ - -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - -#include "ddmarshalutil.h" -#include "ddshared.h" - -extern "C" IDacDbiInterface::IAllocator * g_pAllocator; - -class DDAllocatorHolder -{ -public: - DDAllocatorHolder(IDacDbiInterface::IAllocator * pAllocator) - { - // not reentrant - _ASSERTE(g_pAllocator == NULL); - g_pAllocator = pAllocator; - } - - ~DDAllocatorHolder() - { - g_pAllocator = NULL; - } -}; - -#define DD_UNPACK_ENTER_MAY_THROW \ - DDAllocatorHolder __ddunpackHolder(this->m_pAllocator); - -// Header for unpacking -// -class DDUnpack - { - protected: - IDacDbiInterface * m_pReal; - IDacDbiInterface::IAllocator * m_pAllocator; - public: - DDUnpack(IDacDbiInterface * pReal, IDacDbiInterface::IAllocator * pAllocator) - { - m_pReal = pReal; - m_pAllocator = pAllocator; - } - - // Main entry point - // This will then delegate to the proper unpacking stubs. - void HandleDDMessage(ReadBuffer * pSend, WriteBuffer * pResult); - - - // - // Stubs - // - -//--------------------------------------------------------------------- -// Unpacking stubs - // HRESULT CheckDbiVersion(const DbiVersion * pVersion) - void Unpack_CheckDbiVersion(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT FlushCache() - void Unpack_FlushCache(ReadBuffer * pSend, WriteBuffer * pResult); - - // void DacSetTargetConsistencyChecks(bool fEnableAsserts) - void Unpack_DacSetTargetConsistencyChecks(ReadBuffer * pSend, WriteBuffer * pResult); - - // void Destroy() - void Unpack_Destroy(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsLeftSideInitialized() - void Unpack_IsLeftSideInitialized(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_AppDomain GetAppDomainFromId(ULONG appdomainId) - void Unpack_GetAppDomainFromId(ReadBuffer * pSend, WriteBuffer * pResult); - - // ULONG GetAppDomainId(VMPTR_AppDomain vmAppDomain) - void Unpack_GetAppDomainId(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetAppDomainObject(VMPTR_AppDomain vmAppDomain) - void Unpack_GetAppDomainObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsDefaultDomain(VMPTR_AppDomain vmAppDomain) - void Unpack_IsDefaultDomain(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetAssemblyFromDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, VMPTR_Assembly * vmAssembly) - void Unpack_GetAssemblyFromDomainAssembly(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsAssemblyFullyTrusted(VMPTR_DomainAssembly vmDomainAssembly) - void Unpack_IsAssemblyFullyTrusted(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName) - void Unpack_GetAppDomainFullName(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetModuleSimpleName(VMPTR_Module vmModule, IStringHolder * pStrFilename) - void Unpack_GetModuleSimpleName(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL GetAssemblyPath(VMPTR_Assembly vmAssembly, IStringHolder * pStrFilename) - void Unpack_GetAssemblyPath(ReadBuffer * pSend, WriteBuffer * pResult); - - // void ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) - void Unpack_ResolveTypeReference(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL GetModulePath(VMPTR_Module vmModule, IStringHolder * pStrFilename) - void Unpack_GetModulePath(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL GetModuleNGenPath(VMPTR_Module vmModule, IStringHolder * pStrFilename) - void Unpack_GetModuleNGenPath(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetMetadata(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer) - void Unpack_GetMetadata(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer, IDacDbiInterface::SymbolFormat * pSymbolFormat) - void Unpack_GetSymbolsBuffer(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData) - void Unpack_GetModuleData(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData) - void Unpack_GetDomainFileData(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, VMPTR_Module * pModule) - void Unpack_GetModuleForDomainFile(ReadBuffer * pSend, WriteBuffer * pResult); - - // IDacDbiInterface::AddressType GetAddressType(CORDB_ADDRESS address) - void Unpack_GetAddressType(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsTransitionStub(CORDB_ADDRESS address) - void Unpack_IsTransitionStub(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL * pfAllowJITOpts, BOOL * pfEnableEnC) - void Unpack_GetCompilerFlags(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT SetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL fAllowJitOpts, BOOL fEnableEnC) - void Unpack_SetCompilerFlags(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateAppDomains(IDacDbiInterface::FP_APPDOMAIN_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateAppDomains(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateAssembliesInAppDomain(VMPTR_AppDomain vmAppDomain, IDacDbiInterface::FP_ASSEMBLY_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateAssembliesInAppDomain(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateModulesInAssembly(VMPTR_DomainAssembly vmAssembly, IDacDbiInterface::FP_MODULE_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateModulesInAssembly(ReadBuffer * pSend, WriteBuffer * pResult); - - // void RequestSyncAtEvent() - void Unpack_RequestSyncAtEvent(ReadBuffer * pSend, WriteBuffer * pResult); - - // void MarkDebuggerAttachPending() - void Unpack_MarkDebuggerAttachPending(ReadBuffer * pSend, WriteBuffer * pResult); - - // void MarkDebuggerAttached(BOOL fAttached) - void Unpack_MarkDebuggerAttached(ReadBuffer * pSend, WriteBuffer * pResult); - - // void Hijack(VMPTR_Thread vmThread, ULONG32 dwThreadId, const EXCEPTION_RECORD * pRecord, T_CONTEXT * pOriginalContext, ULONG32 cbSizeContext, EHijackReason::EHijackReason reason, void * pUserData, CORDB_ADDRESS * pRemoteContextAddr) - void Unpack_Hijack(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateConnections(IDacDbiInterface::FP_CONNECTION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateConnections(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateThreads(IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateThreads(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool IsThreadMarkedDead(VMPTR_Thread vmThread) - void Unpack_IsThreadMarkedDead(ReadBuffer * pSend, WriteBuffer * pResult); - - // HANDLE GetThreadHandle(VMPTR_Thread vmThread) - void Unpack_GetThreadHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetThreadObject(VMPTR_Thread vmThread) - void Unpack_GetThreadObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // void SetDebugState(VMPTR_Thread vmThread, CorDebugThreadState debugState) - void Unpack_SetDebugState(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL HasUnhandledException(VMPTR_Thread vmThread) - void Unpack_HasUnhandledException(ReadBuffer * pSend, WriteBuffer * pResult); - - // CorDebugUserState GetUserState(VMPTR_Thread vmThread) - void Unpack_GetUserState(ReadBuffer * pSend, WriteBuffer * pResult); - - // CONNID GetConnectionID(VMPTR_Thread vmThread) - void Unpack_GetConnectionID(ReadBuffer * pSend, WriteBuffer * pResult); - - // TASKID GetTaskID(VMPTR_Thread vmThread) - void Unpack_GetTaskID(ReadBuffer * pSend, WriteBuffer * pResult); - - // DWORD TryGetVolatileOSThreadID(VMPTR_Thread vmThread) - void Unpack_TryGetVolatileOSThreadID(ReadBuffer * pSend, WriteBuffer * pResult); - - // DWORD GetUniqueThreadID(VMPTR_Thread vmThread) - void Unpack_GetUniqueThreadID(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetCurrentException(VMPTR_Thread vmThread) - void Unpack_GetCurrentException(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetCurrentCustomDebuggerNotification(VMPTR_Thread vmThread) - void Unpack_GetCurrentCustomDebuggerNotification(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread) - void Unpack_GetCurrentAppDomain(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef) - void Unpack_ResolveAssembly(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetNativeCodeSequencePointsAndVarInfo(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS startAddress, BOOL fCodeAvailabe, NativeVarData * pNativeVarData, SequencePoints * pSequencePoints) - void Unpack_GetNativeCodeSequencePointsAndVarInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_CONTEXT GetManagedStoppedContext(VMPTR_Thread vmThread) - void Unpack_GetManagedStoppedContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // void CreateStackWalk(VMPTR_Thread vmThread, DT_CONTEXT * pInternalContextBuffer, StackWalkHandle * ppSFIHandle) - void Unpack_CreateStackWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // void DeleteStackWalk(StackWalkHandle ppSFIHandle) - void Unpack_DeleteStackWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetStackWalkCurrentContext(StackWalkHandle pSFIHandle, DT_CONTEXT * pContext) - void Unpack_GetStackWalkCurrentContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // void SetStackWalkCurrentContext(VMPTR_Thread vmThread, StackWalkHandle pSFIHandle, CorDebugSetContextFlag flag, DT_CONTEXT * pContext) - void Unpack_SetStackWalkCurrentContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL UnwindStackWalkFrame(StackWalkHandle pSFIHandle) - void Unpack_UnwindStackWalkFrame(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT CheckContext(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) - void Unpack_CheckContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // IDacDbiInterface::FrameType GetStackWalkCurrentFrameInfo(StackWalkHandle pSFIHandle, DebuggerIPCE_STRData * pFrameData) - void Unpack_GetStackWalkCurrentFrameInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // ULONG32 GetCountOfInternalFrames(VMPTR_Thread vmThread) - void Unpack_GetCountOfInternalFrames(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateInternalFrames(VMPTR_Thread vmThread, IDacDbiInterface::FP_INTERNAL_FRAME_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateInternalFrames(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsMatchingParentFrame(FramePointer fpToCheck, FramePointer fpParent) - void Unpack_IsMatchingParentFrame(ReadBuffer * pSend, WriteBuffer * pResult); - - // ULONG32 GetStackParameterSize(CORDB_ADDRESS controlPC) - void Unpack_GetStackParameterSize(ReadBuffer * pSend, WriteBuffer * pResult); - - // FramePointer GetFramePointer(StackWalkHandle pSFIHandle) - void Unpack_GetFramePointer(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsLeafFrame(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) - void Unpack_IsLeafFrame(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetContext(VMPTR_Thread vmThread, DT_CONTEXT * pContextBuffer) - void Unpack_GetContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // void ConvertContextToDebuggerRegDisplay(const DT_CONTEXT * pInContext, DebuggerREGDISPLAY * pOutDRD, BOOL fActive) - void Unpack_ConvertContextToDebuggerRegDisplay(ReadBuffer * pSend, WriteBuffer * pResult); - - // IDacDbiInterface::DynamicMethodType IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc) - void Unpack_IsILStubOrLCGMethod(ReadBuffer * pSend, WriteBuffer * pResult); - - // TargetBuffer GetVarArgSig(CORDB_ADDRESS VASigCookieAddr, CORDB_ADDRESS * pArgBase) - void Unpack_GetVarArgSig(ReadBuffer * pSend, WriteBuffer * pResult); - - // GENERICS_TYPE_TOKEN ResolveExactGenericArgsToken(DWORD dwExactGenericArgsTokenIndex, GENERICS_TYPE_TOKEN rawToken) - void Unpack_ResolveExactGenericArgsToken(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken) - void Unpack_GetILCodeAndSig(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, mdToken functionToken, NativeCodeFunctionData * pCodeInfo) - void Unpack_GetNativeCodeInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetNativeCodeInfoForAddr(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS hotCodeStartAddr, NativeCodeFunctionData * pCodeInfo) - void Unpack_GetNativeCodeInfoForAddr(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetClassInfo(VMPTR_AppDomain vmAppDomain, VMPTR_Module vmModule, mdTypeDef metadataToken, VMPTR_TypeHandle thExact, VMPTR_TypeHandle thApprox, ClassInfo * pData) - void Unpack_GetClassInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetInstantiationFieldInfo(VMPTR_DomainFile vmDomainFile, mdTypeDef metadataToken, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList<FieldData> * pFieldList, SIZE_T * pObjectSize) - void Unpack_GetInstantiationFieldInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, DebuggerIPCE_ExpandedTypeData * pTypeInfo) - void Unpack_TypeHandleToExpandedTypeInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetObjectExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, CORDB_ADDRESS addr, DebuggerIPCE_ExpandedTypeData * pTypeInfo) - void Unpack_GetObjectExpandedTypeInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_TypeHandle GetApproxTypeHandle(TypeInfoList * pTypeData) - void Unpack_GetApproxTypeHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_TypeHandle GetExactTypeHandle(DebuggerIPCE_ExpandedTypeData * pTypeData, ArgInfoList * pArgInfo) - void Unpack_GetExactTypeHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetMethodDescParams(VMPTR_AppDomain vmAppDomain, VMPTR_MethodDesc vmMethodDesc, GENERICS_TYPE_TOKEN genericsToken, UINT32 * pcGenericClassTypeParams, TypeParamsList * pGenericTypeParams) - void Unpack_GetMethodDescParams(ReadBuffer * pSend, WriteBuffer * pResult); - - // CORDB_ADDRESS GetThreadOrContextStaticAddress(VMPTR_FieldDesc vmField, VMPTR_Thread vmRuntimeThread) - void Unpack_GetThreadOrContextStaticAddress(ReadBuffer * pSend, WriteBuffer * pResult); - - // CORDB_ADDRESS GetCollectibleTypeStaticAddress(VMPTR_FieldDesc vmField, VMPTR_AppDomain vmAppDomain) - void Unpack_GetCollectibleTypeStaticAddress(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetEnCHangingFieldInfo(const EnCHangingFieldInfo * pEnCFieldInfo, FieldData * pFieldData, BOOL * pfStatic) - void Unpack_GetEnCHangingFieldInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetTypeHandleParams(VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, TypeParamsList * pParams) - void Unpack_GetTypeHandleParams(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetSimpleType(VMPTR_AppDomain vmAppDomain, CorElementType simpleType, mdTypeDef * pMetadataToken, VMPTR_DomainFile * pVmDomainFile) - void Unpack_GetSimpleType(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetTypedByRefInfo(CORDB_ADDRESS pTypedByRef, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) - void Unpack_GetTypedByRefInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetStringData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) - void Unpack_GetStringData(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetArrayData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) - void Unpack_GetArrayData(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetBasicObjectInfo(CORDB_ADDRESS objectAddress, CorElementType type, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) - void Unpack_GetBasicObjectInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void TestCrst(VMPTR_Crst vmCrst) - void Unpack_TestCrst(ReadBuffer * pSend, WriteBuffer * pResult); - - // void TestRWLock(VMPTR_SimpleRWLock vmRWLock) - void Unpack_TestRWLock(ReadBuffer * pSend, WriteBuffer * pResult); - - // CORDB_ADDRESS GetDebuggerControlBlockAddress() - void Unpack_GetDebuggerControlBlockAddress(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_Object GetObjectFromRefPtr(CORDB_ADDRESS ptr) - void Unpack_GetObjectFromRefPtr(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_Object GetObject(CORDB_ADDRESS ptr) - void Unpack_GetObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetVmObjectHandle(CORDB_ADDRESS handleAddress) - void Unpack_GetVmObjectHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle) - void Unpack_IsVmObjectHandleValid(ReadBuffer * pSend, WriteBuffer * pResult); - - // ULONG GetAppDomainIdFromVmObjectHandle(VMPTR_OBJECTHANDLE vmHandle) - void Unpack_GetAppDomainIdFromVmObjectHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // CORDB_ADDRESS GetHandleAddressFromVmHandle(VMPTR_OBJECTHANDLE vmHandle) - void Unpack_GetHandleAddressFromVmHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // TargetBuffer GetObjectContents(VMPTR_Object obj) - void Unpack_GetObjectContents(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateBlockingObjects(VMPTR_Thread vmThread, IDacDbiInterface::FP_BLOCKINGOBJECT_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateBlockingObjects(ReadBuffer * pSend, WriteBuffer * pResult); - - // MonitorLockInfo GetThreadOwningMonitorLock(VMPTR_Object vmObject) - void Unpack_GetThreadOwningMonitorLock(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateMonitorEventWaitList(VMPTR_Object vmObject, IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateMonitorEventWaitList(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsManagedDebugEventPending() - void Unpack_IsManagedDebugEventPending(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool GetMetaDataFileInfoFromPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwImageSize, bool & isNGEN, IStringHolder * pStrFilename) - void Unpack_GetMetaDataFileInfoFromPEFile(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool GetILImageInfoFromNgenPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwSize, IStringHolder * pStrFilename) - void Unpack_GetILImageInfoFromNgenPEFile(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool IsThreadSuspendedOrHijacked(VMPTR_Thread vmThread) - void Unpack_IsThreadSuspendedOrHijacked(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool AreGCStructuresValid() - void Unpack_AreGCStructuresValid(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT CreateHeapWalk(HeapWalkHandle * pHandle) - void Unpack_CreateHeapWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // void DeleteHeapWalk(HeapWalkHandle handle) - void Unpack_DeleteHeapWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT WalkHeap(HeapWalkHandle handle, ULONG count, COR_HEAPOBJECT * objects, ULONG * pFetched) - void Unpack_WalkHeap(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT GetHeapSegments(DacDbiArrayList<COR_SEGMENT> * pSegments) - void Unpack_GetHeapSegments(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool IsValidObject(CORDB_ADDRESS obj) - void Unpack_IsValidObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool GetAppDomainForObject(CORDB_ADDRESS obj, VMPTR_AppDomain * pApp, VMPTR_Module * pModule, VMPTR_DomainFile * pDomainFile) - void Unpack_GetAppDomainForObject(ReadBuffer * pSend, WriteBuffer * pResult); - - }; - -#endif // _DDUNPACK_H_ - -#endif //FEATURE_DBGIPC_TRANSPORT_VM - -// end of file diff --git a/src/debug/debug-pal/.gitmirror b/src/debug/debug-pal/.gitmirror new file mode 100644 index 0000000000..f507630f94 --- /dev/null +++ b/src/debug/debug-pal/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror.
\ No newline at end of file diff --git a/src/debug/debug-pal/CMakeLists.txt b/src/debug/debug-pal/CMakeLists.txt new file mode 100644 index 0000000000..4070f4b350 --- /dev/null +++ b/src/debug/debug-pal/CMakeLists.txt @@ -0,0 +1,32 @@ + +include_directories(../inc) +include_directories(../../pal/inc) + + +if(WIN32) + #use static crt + add_definitions(-MT) + add_definitions(-DWIN32_LEAN_AND_MEAN) + include_directories(../../inc) #needed for warning control + + set(TWO_WAY_PIPE_SOURCES + win/twowaypipe.cpp + ) +endif(WIN32) + +if(CLR_CMAKE_PLATFORM_UNIX) + add_compile_options(-fPIC) + + add_definitions(-DFEATURE_PAL) + add_definitions(-DPAL_IMPLEMENTATION) + + set(TWO_WAY_PIPE_SOURCES + unix/twowaypipe.cpp + unix/dynamiclibaddress.cpp + ) + +endif(CLR_CMAKE_PLATFORM_UNIX) + +add_library(debug-pal STATIC ${TWO_WAY_PIPE_SOURCES}) + +install (TARGETS debug-pal DESTINATION .) diff --git a/src/debug/debug-pal/unix/.gitmirror b/src/debug/debug-pal/unix/.gitmirror new file mode 100644 index 0000000000..f507630f94 --- /dev/null +++ b/src/debug/debug-pal/unix/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror.
\ No newline at end of file diff --git a/src/debug/debug-pal/unix/dynamiclibaddress.cpp b/src/debug/debug-pal/unix/dynamiclibaddress.cpp new file mode 100644 index 0000000000..bd86831d9e --- /dev/null +++ b/src/debug/debug-pal/unix/dynamiclibaddress.cpp @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +#include "windefs.h" +#include <stdio.h> + + +void *GetDynamicLibraryAddressInProcess(DWORD pid, const char *libraryName) +{ +#ifdef HAVE_PROCFS_CTL + // Here we read /proc/<pid>/maps file in order to parse it and figure out what it says + // about a library we are looking for. This file looks something like this: + // + // [address] [perms] [offset] [dev] [inode] [pathname] - HEADER is not preset in an actual file + // + // 35b1800000-35b1820000 r-xp 00000000 08:02 135522 /usr/lib64/ld-2.15.so + // 35b1a1f000-35b1a20000 r--p 0001f000 08:02 135522 /usr/lib64/ld-2.15.so + // 35b1a20000-35b1a21000 rw-p 00020000 08:02 135522 /usr/lib64/ld-2.15.so + // 35b1a21000-35b1a22000 rw-p 00000000 00:00 0 [heap] + // 35b1c00000-35b1dac000 r-xp 00000000 08:02 135870 /usr/lib64/libc-2.15.so + // 35b1dac000-35b1fac000 ---p 001ac000 08:02 135870 /usr/lib64/libc-2.15.so + // 35b1fac000-35b1fb0000 r--p 001ac000 08:02 135870 /usr/lib64/libc-2.15.so + // 35b1fb0000-35b1fb2000 rw-p 001b0000 08:02 135870 /usr/lib64/libc-2.15.so + + void *result = NULL; + + // Making something like: /proc/123/maps + char mapFileName[100]; + int chars = snprintf(mapFileName, sizeof(mapFileName), "/proc/%d/maps", pid); + _ASSERTE(chars > 0 && chars <= sizeof(mapFileName)); + + // Making something like: /libcoreclr.so + char slashLibName[PATH_MAX]; + chars = snprintf(slashLibName, sizeof(slashLibName), "/%s", libraryName); + _ASSERTE(chars > 0 && chars <= sizeof(mapFileName)); + size_t slashLibNameLen = strlen(slashLibName); + + FILE *mapsFile = fopen(mapFileName, "r"); + if (mapsFile == NULL) + { + return NULL; + } + + char *line = NULL; + size_t len = 0; + ssize_t read; + + // Reading maps file line by line + while ((read = getline(&line, &len, mapsFile)) != -1) + { + //Checking if this line ends with /libraryName\n + const char *expectedLibLocation = line + strlen(line) - 1 - slashLibNameLen; + if (expectedLibLocation > line && strncmp(expectedLibLocation, slashLibName, slashLibNameLen) == 0) + { + void *address1, *address2, *offset; + // We found a record for our library + // let's parse address and offset + + if (sscanf(line, "%p-%p %*[-rwxsp] %p", &address1, &address2, &offset) == 3) + { + // We were able to read all the info we need + if (offset == 0) + { + // We found address that corresponds to the very beginning of the lib we're looking for + result = address1; + break; + } + } + } + } + + free(line); // We didn't allocate line, but as per contract of getline we should free it + fclose(mapsFile); + return result; + +#else + _ASSERTE(!"Not implemented on this platform"); + return NULL; +#endif +}
\ No newline at end of file diff --git a/src/debug/debug-pal/unix/twowaypipe.cpp b/src/debug/debug-pal/unix/twowaypipe.cpp new file mode 100644 index 0000000000..d97cc8ec4e --- /dev/null +++ b/src/debug/debug-pal/unix/twowaypipe.cpp @@ -0,0 +1,172 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +#include <unistd.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <stdio.h> +#include <limits.h> + +#include "windefs.h" +#include "twowaypipe.h" + +#define PIPE_NAME_FORMAT_STR "/tmp/clr-debug-pipe-%d-%s" + +static void GetPipeName(char *name, DWORD id, const char *suffix) +{ + int chars = snprintf(name, PATH_MAX, PIPE_NAME_FORMAT_STR, id, suffix); + _ASSERTE(chars > 0 && chars < PATH_MAX); +} + +// Creates a server side of the pipe. +// Id is used to create pipes names and uniquely identify the pipe on the machine. +// true - success, false - failure (use GetLastError() for more details) +bool TwoWayPipe::CreateServer(DWORD id) +{ + _ASSERTE(m_state == NotInitialized); + if (m_state != NotInitialized) + return false; + + m_id = id; + char inPipeName[PATH_MAX]; + char outPipeName[PATH_MAX]; + GetPipeName(inPipeName, id, "in"); + GetPipeName(outPipeName, id, "out"); + + //TODO: REVIEW if S_IRWXU | S_IRWXG is the right access level in prof use + if (mkfifo(inPipeName, S_IRWXU | S_IRWXG) == -1) + { + return false; + } + + if (mkfifo(outPipeName, S_IRWXU | S_IRWXG) == -1) + { + remove(inPipeName); + return false; + } + + m_state = Created; + return true; +} + + +// Connects to a previously opened server side of the pipe. +// Id is used to locate the pipe on the machine. +// true - success, false - failure (use GetLastError() for more details) +bool TwoWayPipe::Connect(DWORD id) +{ + _ASSERTE(m_state == NotInitialized); + if (m_state != NotInitialized) + return false; + + m_id = id; + char inPipeName[PATH_MAX]; + char outPipeName[PATH_MAX]; + //"in" and "out" are switched deliberately, because we're on the client + GetPipeName(inPipeName, id, "out"); + GetPipeName(outPipeName, id, "in"); + + // Pipe opening order is reversed compared to WaitForConnection() + // in order to avaid deadlock. + m_outboundPipe = open(outPipeName, O_WRONLY); + if (m_outboundPipe == INVALID_PIPE) + { + return false; + } + + m_inboundPipe = open(inPipeName, O_RDONLY); + if (m_inboundPipe == INVALID_PIPE) + { + close(m_outboundPipe); + m_outboundPipe = INVALID_PIPE; + return false; + } + + m_state = ClientConnected; + return true; + +} + +// Waits for incoming client connections, assumes GetState() == Created +// true - success, false - failure (use GetLastError() for more details) +bool TwoWayPipe::WaitForConnection() +{ + _ASSERTE(m_state == Created); + if (m_state != Created) + return false; + + char inPipeName[PATH_MAX]; + char outPipeName[PATH_MAX]; + GetPipeName(inPipeName, m_id, "in"); + GetPipeName(outPipeName, m_id, "out"); + + m_inboundPipe = open(inPipeName, O_RDONLY); + if (m_inboundPipe == INVALID_PIPE) + { + return false; + } + + m_outboundPipe = open(outPipeName, O_WRONLY); + if (m_outboundPipe == INVALID_PIPE) + { + close(m_inboundPipe); + m_inboundPipe = INVALID_PIPE; + return false; + } + + m_state = ServerConnected; + return true; +} + +// Reads data from pipe. Returns number of bytes read or a negative number in case of an error. +// use GetLastError() for more details +int TwoWayPipe::Read(void *buffer, DWORD bufferSize) +{ + _ASSERTE(m_state == ServerConnected || m_state == ClientConnected); + return (int)read(m_inboundPipe, buffer, bufferSize); +} + +// Writes data to pipe. Returns number of bytes written or a negative number in case of an error. +// use GetLastError() for more details +int TwoWayPipe::Write(const void *data, DWORD dataSize) +{ + _ASSERTE(m_state == ServerConnected || m_state == ClientConnected); + return (int)write(m_outboundPipe, data, dataSize); +} + +// Disconnect server or client side of the pipe. +// true - success, false - failure (use GetLastError() for more details) +bool TwoWayPipe::Disconnect() +{ + + if (m_outboundPipe != INVALID_PIPE) + { + close(m_outboundPipe); + m_outboundPipe = INVALID_PIPE; + } + + if (m_inboundPipe != INVALID_PIPE) + { + close(m_inboundPipe); + m_inboundPipe = INVALID_PIPE; + } + + if (m_state == ServerConnected || m_state == Created) + { + + char inPipeName[PATH_MAX]; + GetPipeName(inPipeName, m_id, "in"); + remove(inPipeName); + + char outPipeName[PATH_MAX]; + GetPipeName(outPipeName, m_id, "out"); + remove(outPipeName); + } + + m_state = NotInitialized; + return true; +} + diff --git a/src/debug/debug-pal/unix/windefs.h b/src/debug/debug-pal/unix/windefs.h new file mode 100644 index 0000000000..482ef61d89 --- /dev/null +++ b/src/debug/debug-pal/unix/windefs.h @@ -0,0 +1,13 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +// It'd be nice to be able to include some existing header from the main PAL, +// but they tend to pull too much stuff that breaks everything. + +#include <cstddef> +#include <assert.h> +#define _ASSERTE assert + +typedef unsigned int DWORD; diff --git a/src/debug/debug-pal/win/.gitmirror b/src/debug/debug-pal/win/.gitmirror new file mode 100644 index 0000000000..f507630f94 --- /dev/null +++ b/src/debug/debug-pal/win/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror.
\ No newline at end of file diff --git a/src/debug/debug-pal/win/twowaypipe.cpp b/src/debug/debug-pal/win/twowaypipe.cpp new file mode 100644 index 0000000000..49876871c0 --- /dev/null +++ b/src/debug/debug-pal/win/twowaypipe.cpp @@ -0,0 +1,211 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +#include <windows.h> +#include <stdio.h> +#include <wchar.h> +#include <assert.h> +#include "twowaypipe.h" + +#define _ASSERTE assert + +// This file contains implementation of a simple IPC mechanism - bidirectional named pipe. +// It is implemented on top of two one-directional names pipes (fifos on UNIX) + + +// Creates a server side of the pipe. +// Id is used to create pipes names and uniquely identify the pipe on the machine. +// true - success, false - failure (use GetLastError() for more details) +bool TwoWayPipe::CreateServer(DWORD id) +{ + _ASSERTE(m_state == NotInitialized); + if (m_state != NotInitialized) + return false; + + m_inboundPipe = CreateOneWayPipe(id, true); + if (m_inboundPipe == INVALID_HANDLE_VALUE) + { + return false; + } + + m_outboundPipe = CreateOneWayPipe(id, false); + if (m_outboundPipe == INVALID_HANDLE_VALUE) + { + CloseHandle(m_inboundPipe); + m_inboundPipe = INVALID_HANDLE_VALUE; + return false; + } + + m_state = Created; + return true; +} + + +// Connects to a previously opened server side of the pipe. +// Id is used to locate the pipe on the machine. +// true - success, false - failure (use GetLastError() for more details) +bool TwoWayPipe::Connect(DWORD id) +{ + _ASSERTE(m_state == NotInitialized); + if (m_state != NotInitialized) + return false; + + m_inboundPipe = OpenOneWayPipe(id, true); + if (m_inboundPipe == INVALID_HANDLE_VALUE) + { + return false; + } + + m_outboundPipe = OpenOneWayPipe(id, false); + if (m_outboundPipe == INVALID_HANDLE_VALUE) + { + CloseHandle(m_inboundPipe); + m_inboundPipe = INVALID_HANDLE_VALUE; + return false; + } + + m_state = ClientConnected; + return true; + +} + +// Waits for incoming client connections, assumes GetState() == Created +// true - success, false - failure (use GetLastError() for more details) +bool TwoWayPipe::WaitForConnection() +{ + _ASSERTE(m_state == Created); + if (m_state != Created) + return false; + + if (!ConnectNamedPipe(m_inboundPipe, NULL)) + { + auto error = GetLastError(); + if (error != ERROR_PIPE_CONNECTED) + return false; + } + + if (!ConnectNamedPipe(m_outboundPipe, NULL)) + { + auto error = GetLastError(); + if (error != ERROR_PIPE_CONNECTED) + return false; + } + + m_state = ServerConnected; + return true; +} + +// Reads data from pipe. Returns number of bytes read or a negative number in case of an error. +// use GetLastError() for more details +int TwoWayPipe::Read(void *buffer, DWORD bufferSize) +{ + _ASSERTE(m_state == ServerConnected || m_state == ClientConnected); + DWORD bytesRead; + BOOL ok = ReadFile(m_inboundPipe, buffer, bufferSize, &bytesRead, NULL); + + if (ok) + { + return (int)bytesRead; + } + else + { + return -1; + } +} + +// Writes data to pipe. Returns number of bytes written or a negative number in case of an error. +// use GetLastError() for more details +int TwoWayPipe::Write(const void *data, DWORD dataSize) +{ + _ASSERTE(m_state == ServerConnected || m_state == ClientConnected); + DWORD bytesWritten; + BOOL ok = WriteFile(m_outboundPipe, data, dataSize, &bytesWritten, NULL); + + if (ok) + { + FlushFileBuffers(m_outboundPipe); + return (int)bytesWritten; + } + else + { + return -1; + } +} + +// Disconnect server or client side of the pipe. +// true - success, false - failure (use GetLastError() for more details) +bool TwoWayPipe::Disconnect() +{ + if (m_state == ServerConnected) + { + DisconnectNamedPipe(m_outboundPipe); + DisconnectNamedPipe(m_inboundPipe); + CloseHandle(m_outboundPipe); + m_outboundPipe = INVALID_HANDLE_VALUE; + CloseHandle(m_inboundPipe); + m_inboundPipe = INVALID_HANDLE_VALUE; + m_state = NotInitialized; + return true; + } + else if (m_state == ClientConnected) + { + CloseHandle(m_outboundPipe); + m_outboundPipe = INVALID_HANDLE_VALUE; + CloseHandle(m_inboundPipe); + m_inboundPipe = INVALID_HANDLE_VALUE; + m_state = NotInitialized; + return true; + } + else + { + // nothign to do + return true; + } +} + +#define PIPE_NAME_FORMAT_STR L"\\\\.\\pipe\\clr-debug-pipe-%d-%s" + +// Connects to a one sided pipe previously created by CreateOneWayPipe. +// In order to successfully connect id and inbound flag should be the same. +HANDLE TwoWayPipe::OpenOneWayPipe(DWORD id, bool inbound) +{ + WCHAR fullName[MAX_PATH]; + // "in" and "out" are deliberately switched because we're opening a client side connection + int chars = swprintf_s(fullName, MAX_PATH, PIPE_NAME_FORMAT_STR, id, inbound ? L"out" : L"in"); + _ASSERTE(chars > 0); + + HANDLE handle = CreateFileW( + fullName, + inbound ? GENERIC_READ : GENERIC_WRITE, + 0, // no sharing + NULL, // default security attributes + OPEN_EXISTING, // opens existing pipe + 0, // default attributes + NULL); // no template file + + return handle; +} + + +// Creates a one way pipe, id and inboud flag are used for naming. +// Created pipe is supposed to be connected to by OpenOneWayPipe. +HANDLE TwoWayPipe::CreateOneWayPipe(DWORD id, bool inbound) +{ + WCHAR fullName[MAX_PATH]; + int chars = swprintf_s(fullName, MAX_PATH, PIPE_NAME_FORMAT_STR, id, inbound ? L"in" : L"out"); + _ASSERTE(chars > 0); + + HANDLE handle = CreateNamedPipeW(fullName, + (inbound ? PIPE_ACCESS_INBOUND : PIPE_ACCESS_OUTBOUND) | FILE_FLAG_FIRST_PIPE_INSTANCE, + PIPE_TYPE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, + 1, // max number of instances + 4000, //in buffer size + 4000, //out buffer size + 0, // default timeout + NULL); // default security + + return handle; +} + diff --git a/src/debug/di/CMakeLists.txt b/src/debug/di/CMakeLists.txt index 6546b69920..b360aa4e97 100644 --- a/src/debug/di/CMakeLists.txt +++ b/src/debug/di/CMakeLists.txt @@ -13,9 +13,11 @@ set(CORDBDI_SOURCES breakpoint.cpp cordb.cpp divalue.cpp + dbgtransportmanager.cpp hash.cpp module.cpp nativepipeline.cpp + eventredirectionpipeline.cpp platformspecific.cpp process.cpp rsappdomain.cpp diff --git a/src/debug/di/cordb.cpp b/src/debug/di/cordb.cpp index 1267748fc5..04f3099b44 100644 --- a/src/debug/di/cordb.cpp +++ b/src/debug/di/cordb.cpp @@ -210,7 +210,12 @@ BOOL WINAPI DbgDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) #endif #if defined(FEATURE_DBGIPC_TRANSPORT_DI) - g_pDbgTransportManager = NULL; + g_pDbgTransportTarget = new (nothrow) DbgTransportTarget(); + if (g_pDbgTransportTarget == NULL) + return FALSE; + + if (FAILED(g_pDbgTransportTarget->Init())) + return FALSE; #endif // FEATURE_DBGIPC_TRANSPORT_DI } break; @@ -238,58 +243,31 @@ BOOL WINAPI DbgDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) TlsFree(DbgRSThread::s_TlsSlot); DbgRSThread::s_TlsSlot = TLS_OUT_OF_INDEXES; #endif - } - break; - } - - return TRUE; -} #if defined(FEATURE_DBGIPC_TRANSPORT_DI) -// Routines to initialize and shutdown the debugger transport manager. Can't do these operations from DllMain -// since they perform blocking network operations which can easily cause deadlocks on the loader lock. -// Note: These routines are *not* thread safe (it's assumed the caller implements its own serialization). -extern "C" HRESULT __stdcall InitDbgTransportManager() -{ - if (g_pDbgTransportManager) - return S_OK; - - DbgTransportManager *pManager = new (nothrow) DbgTransportManager(); - if (pManager == NULL) - return E_OUTOFMEMORY; + if (g_pDbgTransportTarget != NULL) + { + g_pDbgTransportTarget->Shutdown(); + delete g_pDbgTransportTarget; + g_pDbgTransportTarget = NULL; + } +#endif // FEATURE_DBGIPC_TRANSPORT_DI - HRESULT hr = pManager->Init(); - if (FAILED(hr)) - { - pManager->Shutdown(); - delete pManager; - return hr; + } + break; } - _ASSERTE(g_pDbgTransportManager == NULL); - g_pDbgTransportManager = pManager; - - return S_OK; + return TRUE; } -extern "C" void __stdcall ShutdownDbgTransportManager() -{ - if (g_pDbgTransportManager) - { - g_pDbgTransportManager->Shutdown(); - delete g_pDbgTransportManager; - g_pDbgTransportManager = NULL; - } -} -#endif // FEATURE_DBGIPC_TRANSPORT_DI // The obsolete v1 CLSID - see comment above for details. static const GUID CLSID_CorDebug_V1 = {0x6fef44d0,0x39e7,0x4c77, { 0xbe,0x8e,0xc9,0xf8,0xcf,0x98,0x86,0x30}}; #if defined(FEATURE_DBGIPC_TRANSPORT_DI) -// include the GUID for Mac SilverLight debugging -#include <maccoreclrdebugguids.h> +// GUID for pipe-based debugging (Unix platforms) +const GUID CLSID_CorDebug_Telesto = {0x8bd1daae, 0x188e, 0x42f4, {0xb0, 0x09, 0x08, 0xfa, 0xfd, 0x17, 0x81, 0x3b}}; // The debug engine needs to implement an internal Visual Studio debugger interface (defined by the CPDE) // which augments launch and attach requests so that we can obtain information from the port supplier (the @@ -321,7 +299,7 @@ STDAPI DllGetClassObjectInternal( // Return code. else #endif #if defined(FEATURE_DBGIPC_TRANSPORT_DI) - if (rclsid == CLSID_CorDebug_Mac_SilverLight) + if (rclsid == CLSID_CorDebug_Telesto) { pfnCreateObject = Cordb::CreateObjectTelesto; } @@ -571,7 +549,7 @@ DbiSetThreadContext(HANDLE hThread, *ctx = *(CONTEXT*)lpContext; res = ::SetThreadContext(hThread, ctx); _aligned_free(ctx); - } + } else { // malloc does not set the last error, but the caller of SetThreadContext diff --git a/src/debug/di/dbgtransportmanager.cpp b/src/debug/di/dbgtransportmanager.cpp index e00e3f9c82..e9b619de18 100644 --- a/src/debug/di/dbgtransportmanager.cpp +++ b/src/debug/di/dbgtransportmanager.cpp @@ -3,185 +3,16 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // - #include "stdafx.h" #include "dbgtransportsession.h" #include "dbgtransportmanager.h" #include "coreclrremotedebugginginterfaces.h" -#ifdef FEATURE_DBGIPC_TRANSPORT_DI - -// -// Provides access to various process enumeration and control facilities for a remote machine. -// - -// The one and only instance of the DbgTransportManager in the process. -DbgTransportManager *g_pDbgTransportManager = NULL; - -DbgTransportManager::DbgTransportManager() -{ - memset(this, 0, sizeof(*this)); -} - -// Startup/shutdown calls. These are ref-counted (cordbg, for instance, is constructed in such a way that -// the command shell will attempt to load mscordbi and initialize an associated DbgTransportManager -// multiple times). -HRESULT DbgTransportManager::Init() -{ - if (InterlockedIncrement(&m_lRefCount) == 1) - { - m_sLock.Init("DbgTransportManager Lock", RSLock::cLockFlat, RSLock::LL_DBG_TRANSPORT_MANAGER_LOCK); - m_pTargets = NULL; - } - - return S_OK; -} - -void DbgTransportManager::Shutdown() -{ - if (InterlockedDecrement(&m_lRefCount) == 0) - { - m_sLock.Destroy(); - - while (m_pTargets) - { - TargetRef *pTargetRef = m_pTargets; - m_pTargets = pTargetRef->m_pNext; - - pTargetRef->m_pTarget->Shutdown(); - delete pTargetRef->m_pTarget; - - delete pTargetRef; - } - } -} - -// Attempt to connect to a debugging proxy on the machine at the given address and with the specified port -// number. If the port number is given as zero use the port stored in user debugger configuration. On success -// a pointer to a DbgTransportTarget object will be returned. -HRESULT DbgTransportManager::ConnectToTarget(DWORD dwIPAddress, USHORT usPort, DbgTransportTarget **ppTarget) -{ - RSLockHolder lock(&m_sLock); - - // Look for an existing target with matching IP address and port number. - TargetRef *pTargetRef = m_pTargets; - while (pTargetRef) - { - // Matches must have identical IP address and port number and must also be in a good connection state - // (otherwise we're looking at a target that hit a network error and is just waiting until outstanding - // references to it have been released -- in these circumstances we allow a new target to be allocated - // in order to re-attempt connection to the proxy). - if (pTargetRef->m_dwIPAddress == dwIPAddress && - pTargetRef->m_usPort == usPort && - !pTargetRef->m_pTarget->IsProxyConnectionBad()) - { - pTargetRef->m_dwRefCount++; - *ppTarget = pTargetRef->m_pTarget; - return S_OK; - } - - pTargetRef = pTargetRef->m_pNext; - } - // If we get here there wasn't an appropriate existing entry, so create one. - - // First the reference structure used to track the target. - pTargetRef = new (nothrow) TargetRef(); - if (pTargetRef == NULL) - return E_OUTOFMEMORY; - - // Then the target object itself. - DbgTransportTarget *pTarget = new (nothrow) DbgTransportTarget(); - if (pTargetRef == NULL) - { - delete pTargetRef; - return E_OUTOFMEMORY; - } - - // Initialize the target (this will attempt a connection to the proxy immediately). - HRESULT hr = pTarget->Init(dwIPAddress, usPort); - if (FAILED(hr)) - { - pTarget->Shutdown(); - delete pTarget; - delete pTargetRef; - return hr; - } - - // Everything's good, go ahead and initialize and link in the target reference. - pTargetRef->m_dwRefCount = 1; - pTargetRef->m_pTarget = pTarget; - pTargetRef->m_dwIPAddress = dwIPAddress; - pTargetRef->m_usPort = usPort; - - pTargetRef->m_pNext = m_pTargets; - m_pTargets = pTargetRef; - - *ppTarget = pTarget; - return S_OK; -} - -// Add another reference to a target already acquired by ConnectToTarget (used by clients when they want -// to hand a target out to independent code). -void DbgTransportManager::ReferenceTarget(DbgTransportTarget *pTarget) -{ - RSLockHolder lock(&m_sLock); - - // We need to locate the target reference for this target. - TargetRef *pTargetRef = m_pTargets; - while (pTargetRef) - { - if (pTargetRef->m_pTarget == pTarget) - { - pTargetRef->m_dwRefCount++; - return; - } - pTargetRef = pTargetRef->m_pNext; - } - - // Shouldn't get here. - _ASSERTE(FALSE); -} - -// Release reference to a DbgTransportTarget. If this is the last active reference then the connection to the -// proxy will be severed and the object deallocated. -void DbgTransportManager::ReleaseTarget(DbgTransportTarget *pTarget) -{ - RSLockHolder lock(&m_sLock); - - // We need to locate the target reference for this target (and the previous reference so we can perform - // the fixup to remove the entry from the queue if this was the last reference to the target). - TargetRef *pTargetRef = m_pTargets; - TargetRef *pLastRef = NULL; - while (pTargetRef) - { - if (pTargetRef->m_pTarget == pTarget) - { - pTargetRef->m_dwRefCount--; - if (pTargetRef->m_dwRefCount == 0) - { - // This was the last reference to this particular target. Remove it from the queue and - // deallocate it. - if (pLastRef) - pLastRef->m_pNext = pTargetRef->m_pNext; - else - m_pTargets = pTargetRef->m_pNext; - - delete pTargetRef; - - pTarget->Shutdown(); - delete pTarget; - } - return; - } - pLastRef = pTargetRef; - pTargetRef = pTargetRef->m_pNext; - } +#ifdef FEATURE_DBGIPC_TRANSPORT_DI - // Shouldn't get here. - _ASSERTE(FALSE); -} +DbgTransportTarget *g_pDbgTransportTarget = NULL; DbgTransportTarget::DbgTransportTarget() { @@ -189,136 +20,9 @@ DbgTransportTarget::DbgTransportTarget() } // Initialization routine called only by the DbgTransportManager. -HRESULT DbgTransportTarget::Init(DWORD dwIPAddress, USHORT usPort) +HRESULT DbgTransportTarget::Init() { - m_ullLastUpdate = 0; - m_fShutdown = false; - - // Target platform is initially unknown. This gets set when the proxy replies to our initial GetSystemInfo - // message. - m_ePlatform = DTP_Unknown; - - // If a port number hasn't been specified query the debugger configuration for the current user, this will - // give us the default. - if (usPort == 0) - { - DbgConfiguration sDbgConfig; - if (!GetDebuggerConfiguration(&sDbgConfig)) - { - DbgTransportLog(LC_Always, "Failed to locate debugger configuration"); - return CORDBG_E_REMOTE_INVALID_CONFIG; - } - _ASSERTE(sDbgConfig.m_fEnabled); // Debugging is always enabled on right side. - m_usProxyPort = sDbgConfig.m_usProxyPort; - } - else - m_usProxyPort = usPort; - - // Do the same for IP address except the fallback is an environment variable (and after that 127.0.0.1 for - // local debugging). - if (dwIPAddress == 0) - { - LPWSTR wszProxyIP = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgTransportProxyAddress); - if (wszProxyIP != NULL) - { - int cbReq = WszWideCharToMultiByte(CP_UTF8, 0, wszProxyIP, -1, 0, 0, 0, 0); - char *szProxyIP = new (nothrow) char[cbReq + 1]; - if (szProxyIP != NULL) - { - WszWideCharToMultiByte(CP_UTF8, 0, wszProxyIP, -1, szProxyIP, cbReq + 1, 0,0); - m_dwProxyIP = DBGIPC_NTOHL(inet_addr(szProxyIP)); - } - - REGUTIL::FreeConfigString(wszProxyIP); - } - if (m_dwProxyIP == 0) - m_dwProxyIP = DBGIPC_NTOHL(inet_addr("127.0.0.1")); - } - else - m_dwProxyIP = dwIPAddress; - - // Allocate the connection manager and initialize it. - m_pConnectionManager = AllocateSecConnMgr(); - if (m_pConnectionManager == NULL) - return E_OUTOFMEMORY; - - SecConnStatus eStatus = m_pConnectionManager->Initialize(); - if (eStatus != SCS_Success) - { - DbgTransportLog(LC_Always, "Failed to initialize connection manager with %u", eStatus); - switch (eStatus) - { - case SCS_OutOfMemory: - return E_OUTOFMEMORY; - case SCS_InvalidConfiguration: - return CORDBG_E_REMOTE_INVALID_CONFIG; - default: - return E_FAIL; - } - } - m_sLock.Init("DbgTransportTarget Lock", RSLock::cLockFlat, RSLock::LL_DBG_TRANSPORT_TARGET_LOCK); - m_fInitLock = true; - - // Outgoing requests are identified with a monotonically increasing ID starting from 1. - m_dwNextRequestID = 1; - - // We store a singly-linked list of requests to the proxy that haven't been replied yet. - m_pRequestList = NULL; - - // Attempt to contact the proxy and form a connection to it. - eStatus = m_pConnectionManager->AllocateConnection(m_dwProxyIP, m_usProxyPort, &m_pConnection); - if (eStatus == SCS_Success) - eStatus = m_pConnection->Connect(); - if (eStatus != SCS_Success) - { - DbgTransportLog(LC_Always, "Failed to connect to proxy with %u", eStatus); - switch (eStatus) - { - case SCS_OutOfMemory: - return E_OUTOFMEMORY; - case SCS_UnknownTarget: - return CORDBG_E_REMOTE_UNKNOWN_TARGET; - case SCS_NoListener: - return CORDBG_E_REMOTE_NO_LISTENER; - case SCS_NetworkFailure: - return CORDBG_E_REMOTE_NETWORK_FAILURE; - case SCS_MismatchedCerts: - return CORDBG_E_REMOTE_MISMATCHED_CERTS; - default: - return E_ABORT; - } - } - - // Create a thread used to monitor remote process state. - m_hProcessEventThread = CreateThread(NULL, 0, ProcessEventWorkerStatic, this, 0, NULL); - if (m_hProcessEventThread == NULL) - return E_OUTOFMEMORY; - - // Send the initial message to the proxy which informs it of our protocol version and queries the target - // platform and protocol version. This must be done after the thread above is started since we rely on - // this thread to process replies. - DWORD dwProxyMajorVersion; - DWORD dwProxyMinorVersion; - HRESULT hr = MakeProxyRequest(DPMT_GetSystemInfo, - &dwProxyMajorVersion, - &dwProxyMinorVersion, - &m_ePlatform); - if (FAILED(hr)) - { - DbgTransportLog(LC_Always, "GetSystemInfo request to proxy failed with %08X", hr); - return hr; - } - - // Check that we can deal with the proxy's protocol. - if (dwProxyMajorVersion != kCurrentMajorVersion) - { - DbgTransportLog(LC_Always, "Don't understand proxy protocol v%u.%u", - dwProxyMajorVersion, dwProxyMinorVersion); - return CORDBG_E_REMOTE_MISMATCHED_PROTOCOLS; - } - - m_fProxyConnectionBad = false; return S_OK; } @@ -328,89 +32,19 @@ void DbgTransportTarget::Shutdown() { DbgTransportLog(LC_Always, "DbgTransportTarget shutting down"); - m_fShutdown = true; - m_fProxyConnectionBad = true; - - if (m_hProcessEventThread) - { - // Unwedge the process event thread if it's blocked in a Receive(). - m_pConnection->CancelReceive(); - - // Wait for the process event thread to see the shutdown status and close itself down. - WaitForSingleObject(m_hProcessEventThread, INFINITE); - CloseHandle(m_hProcessEventThread); - } - - // Cleanup process list. - DeallocateProcessList(m_pProcessList); - - if (m_pConnection) - m_pConnection->Destroy(); - - if (m_pConnectionManager) - m_pConnectionManager->Destroy(); - - if (m_fInitLock) - m_sLock.Destroy(); -} - -// Indicates when the connection to a proxy has failed: this target object will remain until the last -// reference to it is released (DbgTransportManager::ReleaseTransport) but will fail all further requests. The -// manager will then allow a new attempt to create a connection to the proxy to be made (wrapped in a new -// DbgTransportTarget). -bool DbgTransportTarget::IsProxyConnectionBad() -{ - return m_fProxyConnectionBad; -} - -// Fill caller allocated table at pdwProcesses with the pids of processes currently alive on the target -// system. Return the number of slots filled in *pcProcesses. The size of the table is given by cSlots. If -// more than this number of processes are alive then *pcProcesses is set to the total number and E_ABORT -// returned. -HRESULT DbgTransportTarget::EnumProcesses(DWORD *pdwProcesses, DWORD cSlots, DWORD *pcProcesses) -{ - if (m_fProxyConnectionBad) - return E_ABORT; - - *pcProcesses = 0; - - // Get an up-to-date process list from the proxy. - UpdateProcessList(); - - // Must access the process list under the lock. { RSLockHolder lock(&m_sLock); - - // Populate the output table from the new process list. - DWORD i = 0; - DWORD cSlotsLeft = cSlots; - - // Fill the output table with as many process IDs as we have (or until we run out of slots). Carry on - // to the end of the process regardless so we can report how many processes there actually are. - for (ProcessEntry *pProcess = m_pProcessList; pProcess; pProcess = pProcess->m_pNext) + while (m_pProcessList) { - // Entries for dead processes can persist until an associated transport is released. Don't report - // these. - if (pProcess->m_fExited) - continue; - - if (cSlotsLeft) - { - pdwProcesses[i] = pProcess->m_dwPID; - cSlotsLeft--; - } - - i++; + ProcessEntry *pDelProcess = m_pProcessList; + m_pProcessList = m_pProcessList->m_pNext; + delete pDelProcess; } - - // Return total count to caller. - *pcProcesses = i; - - } // Leave lock - - return *pcProcesses > cSlots ? E_ABORT : S_OK; + } + m_sLock.Destroy(); } + // Given a PID attempt to find or create a DbgTransportSession instance to manage a connection to a runtime in // that process. Returns E_UNEXPECTED if the process can't be found. Also returns a handle that can be waited // on for process termination. @@ -418,455 +52,167 @@ HRESULT DbgTransportTarget::GetTransportForProcess(DWORD dwPID DbgTransportSession **ppTransport, HANDLE *phProcessHandle) { - if (m_fProxyConnectionBad) - return E_ABORT; + RSLockHolder lock(&m_sLock); + HRESULT hr = S_OK; - // Get an up-to-date process list from the proxy. - UpdateProcessList(); + ProcessEntry *entry = LocateProcessByPID(dwPID); - // Process list can only be examined under the lock. + if (entry == NULL) { - RSLockHolder lock(&m_sLock); - - // Scan each process in the list. - ProcessEntry *pProcess = m_pProcessList; - while (pProcess) - { - if (pProcess->m_dwPID == dwPID) - { - // We've found a match. - if (pProcess->m_fExited) - { - // But it was for a dead process. Don't report this one (though we know the process is dead so - // return E_UNEXPECTED). - return E_UNEXPECTED; - } - RetryTransport: - // If we already know about runtimes in this process then attempt to attach to the first one. - // CORECLRTODO: In the next version we'll wire up the additional logic to enable the caller to - // indicate which runtime they want to target within a single process. - if (pProcess->m_pRuntimes) - { - RuntimeEntry *pRuntime = pProcess->m_pRuntimes; + NewHolder<ProcessEntry> newEntry = new(nothrow) ProcessEntry(); + if (newEntry == NULL) + return E_OUTOFMEMORY; - // If we have a runtime entry already then the LS is already present and we know the port - // to connect to. If there's already a transport in place then we can (and must) use that. - // Otherwise we can allocate and initialize one based on the port information. - DbgTransportSession *pTransport = pRuntime->m_pDbgTransport; - if (pTransport == NULL) - { - // No transport yet, allocate one. - pTransport = new (nothrow) DbgTransportSession(); - if (pTransport == NULL) - return E_OUTOFMEMORY; + NewHolder<DbgTransportSession> transport = new(nothrow) DbgTransportSession(); + if (transport == NULL) + { + return E_OUTOFMEMORY; + } - // Initialize it (this immediately starts the remote connection process). - HRESULT hr = pTransport->Init(m_dwProxyIP, pRuntime->m_usPort, pProcess->m_hExitedEvent); - if (FAILED(hr)) - { - lock.Release(); - pTransport->Shutdown(); - delete pTransport; - return hr; - } - pRuntime->m_pDbgTransport = pTransport; - } + HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPID); + if (hProcess == NULL) + { + return HRESULT_FROM_GetLastError(); + } - // One more caller knows about this transport instance. (Which in turn is another reason - // the process can't be deleted yet). - pRuntime->m_cTransportRef++; - pProcess->m_cProcessRef++; + // Initialize it (this immediately starts the remote connection process). + hr = transport->Init(dwPID, hProcess); + if (FAILED(hr)) + { + transport->Shutdown(); + CloseHandle(hProcess); + return hr; + } - *ppTransport = pTransport; - if (!DuplicateHandle(GetCurrentProcess(), - pProcess->m_hExitedEvent, - GetCurrentProcess(), - phProcessHandle, - 0, // ignored since we are going to pass DUPLICATE_SAME_ACCESS - FALSE, - DUPLICATE_SAME_ACCESS)) - { - lock.Release(); - return HRESULT_FROM_GetLastError(); - } - return S_OK; - } + entry = newEntry; + newEntry.SuppressRelease(); + entry->m_dwPID = dwPID; + entry->m_hProcess = hProcess; + entry->m_transport = transport; + transport.SuppressRelease(); + entry->m_cProcessRef = 0; - // If we get here we've found the process record but there's no known runtime yet. The proxy - // will send us an event if either a runtime starts up or the process dies, so we'll wait on - // both of these. We can't wait with the lock held so increment the ref count on the process - // (to keep the entry and the events we're about to wait on valid) and drop the lock first. - - pProcess->m_cProcessRef++; - lock.Release(); - - // We need to send an early attach notification to the proxy so that when the next runtime - // starts up and registers it will know to suspend itself until we attach (i.e. this is the - // early attach). Obviously we're racing with runtime startup here but that's by definition. - bool fProcessExited; - HRESULT hr = MakeProxyRequest(DPMT_EarlyAttach, pProcess->m_pruidProcess, &fProcessExited); - if (FAILED(hr)) - { - lock.Acquire(); - pProcess->m_cProcessRef--; - return hr; - } - - // The process might have managed to exit before we even built a process entry for it on this - // side. In that case a process termination might have been missed. Checking for the exit - // status again with the EarlyAttach request above closes the hole (we establish a process - // entry and lock it in place so any termination events from that point on will be caught, - // then we fire an EarlyAttach and check the current status). - if (fProcessExited) - { - lock.Acquire(); - pProcess->m_cProcessRef--; - pProcess->m_fExited = true; - SetEvent(pProcess->m_hExitedEvent); - return E_UNEXPECTED; - } - - DbgTransportLog(LC_Always, "Waiting on runtime starting or process termination for %08X(%u, %u)", - pProcess, pProcess->m_dwPID, pProcess->m_pruidProcess); - - HANDLE rgEvents[] = { pProcess->m_hRuntimeStartedEvent, pProcess->m_hExitedEvent }; - DWORD dwResult = WaitForMultipleObjectsEx(2, rgEvents, FALSE, INFINITE, FALSE); - _ASSERTE(dwResult == WAIT_OBJECT_0 || dwResult == (WAIT_OBJECT_0 + 1)); - - DbgTransportLog(LC_Always, " %s", dwResult == WAIT_OBJECT_0 ? "Runtime started" : "Process terminated"); - - // Take the lock again and determine what our status is. - lock.Acquire(); - - // We have no further need to keep this process record alive (once we drop the lock). - _ASSERTE(pProcess->m_cProcessRef > 0); - pProcess->m_cProcessRef--; - - // If the process terminated then exit with E_UNEXPECTED. Note that this might be a zombie - // entry marked with m_fExited = true in this case, but rather than duplicate entry cleanup - // code we'll let the next process list update flush this record (now that the ref count has - // been decremented). - if (dwResult == (WAIT_OBJECT_0 + 1)) - return E_UNEXPECTED; - - // We should have at least one runtime entry now; just jump back to the code that knows how to - // re-use or allocate a transport on it. - _ASSERTE(pProcess->m_pRuntimes); - goto RetryTransport; - } - - pProcess = pProcess->m_pNext; - } - } // Leave lock - - // Didn't find a process with a matching PID. - return E_UNEXPECTED; -} + // Adding new entry to the list. + entry->m_pNext = m_pProcessList; + m_pProcessList = entry; + } -// Returns true if the given PID identifies a running process which is hosting at least one CoreCLR -// runtime. -bool DbgTransportTarget::IsManagedProcess(DWORD dwPID) -{ - // Maybe we already know the process is managed. + entry->m_cProcessRef++; + _ASSERTE(entry->m_cProcessRef > 0); + _ASSERTE(entry->m_transport != NULL); + _ASSERTE(entry->m_hProcess > 0); + + *ppTransport = entry->m_transport; + if (!DuplicateHandle(GetCurrentProcess(), + entry->m_hProcess, + GetCurrentProcess(), + phProcessHandle, + 0, // ignored since we are going to pass DUPLICATE_SAME_ACCESS + FALSE, + DUPLICATE_SAME_ACCESS)) { - RSLockHolder lock(&m_sLock); - ProcessEntry *pProcess = LocateProcessByPID(dwPID); -#ifdef _PREFAST_ -#pragma warning(push) -#pragma warning(disable:6011) // Prefast doesn't understand the guard to avoid de-referencing a NULL pointer below. -#endif // _PREFAST_ - if (pProcess && pProcess->m_pRuntimes) - return true; -#ifdef _PREFAST_ -#pragma warning(pop) -#endif // _PREFAST_ - } // Leave lock - - // Get an up-to-date process list from the proxy in case we've haven't done this for a while and a runtime - // has started up in the meantime. - UpdateProcessList(); + return HRESULT_FROM_GetLastError(); + } - // Try once again. - { - RSLockHolder lock(&m_sLock); - ProcessEntry *pProcess = LocateProcessByPID(dwPID); - return pProcess ? pProcess->m_pRuntimes != NULL : false; - } // Leave lock + return hr; } + // Release another reference to the transport associated with dwPID. Once all references are gone (modulo the // manager's own weak reference) clean up the transport and deallocate it. void DbgTransportTarget::ReleaseTransport(DbgTransportSession *pTransport) { - DbgTransportSession *pTransportToShutdown = NULL; - - // Process list can only be examined under the lock. - { - RSLockHolder lock(&m_sLock); - - // Scan all processes we know about. - ProcessEntry *pProcess = m_pProcessList; - while (pProcess) - { - // Scan each runtime we know about in the current process. - RuntimeEntry *pRuntime = pProcess->m_pRuntimes; - while (pRuntime) - { - if (pRuntime->m_pDbgTransport == pTransport) - { - // Found it. + RSLockHolder lock(&m_sLock); - // Decrement the transport ref count. This is also one less reason to hold onto the - // process record. - _ASSERTE(pRuntime->m_cTransportRef > 0 && pProcess->m_cProcessRef > 0); - pRuntime->m_cTransportRef--; - pProcess->m_cProcessRef--; + ProcessEntry *entry = m_pProcessList; - // If nobody references this transport any more we can shut it down and delete it. Don't - // do this under the lock however. - if (pRuntime->m_cTransportRef == 0) - { - pTransportToShutdown = pRuntime->m_pDbgTransport; - pRuntime->m_pDbgTransport = NULL; - } + // Pointer to the pointer that points to *entry. + // It either points to m_pProcessList or m_pNext of some entry. + // It is used to fix the linked list after deletion of an entry. + ProcessEntry **prevPtr = &m_pProcessList; - lock.Release(); + // Looking for ProcessEntry with a given transport + while (entry) + { - // If we made the transport inaccessible above we can shut it down and deallocate it now. - if (pTransportToShutdown) - { - pTransportToShutdown->Shutdown(); - delete pTransportToShutdown; - } + _ASSERTE(entry->m_cProcessRef > 0); + _ASSERTE(entry->m_transport != NULL); + _ASSERTE(entry->m_hProcess > 0); - return; - } + if (entry->m_transport == pTransport) + { + // Mark that it has one less holder now + entry->m_cProcessRef--; - pRuntime = pRuntime->m_pNext; + // If no more holders remove the entry from the list and free resources + if (entry->m_cProcessRef == 0) + { + *prevPtr = entry->m_pNext; + delete entry; } - - pProcess = pProcess->m_pNext; + return; } - } // Leave lock + prevPtr = &entry->m_pNext; + entry = entry->m_pNext; + } - _ASSERTE(!"Failed to find ProcessEntry to release transport reference"); + _ASSERTE(!"Trying to release transport that doesn't belong to this DbgTransportTarget"); + pTransport->Shutdown(); + delete pTransport; } -// Run the command line given on the remote machine to create a process. Return the PID of this process. When -// and if the process starts a runtime and registers with the proxy it will be told to halt and wait for a -// debugger attach. -HRESULT DbgTransportTarget::CreateProcess(LPCWSTR wszCommand, - LPCWSTR wszArgs, - LPCWSTR wszCurrentDirectory, - LPVOID pvEnvironment, - DWORD *pdwPID) +HRESULT DbgTransportTarget::CreateProcess(LPCWSTR lpApplicationName, + LPCWSTR lpCommandLine, + LPSECURITY_ATTRIBUTES lpProcessAttributes, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + BOOL bInheritHandles, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPCWSTR lpCurrentDirectory, + LPSTARTUPINFOW lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation) { - if (m_fProxyConnectionBad) - return E_ABORT; - DWORD cchCommand = wszCommand ? wcslen(wszCommand) : 0; - DWORD cchArgs = wszArgs ? wcslen(wszArgs) : 0; + BOOL result = WszCreateProcess(lpApplicationName, + lpCommandLine, + lpProcessAttributes, + lpThreadAttributes, + bInheritHandles, + dwCreationFlags, + lpEnvironment, + lpCurrentDirectory, + lpStartupInfo, + lpProcessInformation); - // Proxy expects the command line as a single string. - LPWSTR wszCommandLine = (LPWSTR)_alloca((cchCommand + 1 + cchArgs + 1) * sizeof(WCHAR)); - wszCommandLine[0] = W('\0'); - if (wszCommand) + if (!result) { - wcscat(wszCommandLine, wszCommand); - wcscat(wszCommandLine, W(" ")); + return HRESULT_FROM_GetLastError(); } - if (wszArgs) - wcscat(wszCommandLine, wszArgs); - // Check how big a UTF8 version of the command line would be. - int cbReqd = WszWideCharToMultiByte(CP_UTF8, 0, wszCommandLine, -1, 0, 0, 0, 0); - - LPSTR szCommandLine = (LPSTR)_alloca(cbReqd); - - // Do the conversion from 16-bit. - WszWideCharToMultiByte(CP_UTF8, 0, wszCommandLine, -1, szCommandLine, cbReqd, 0, 0); - - // If a default directory is supplied then convert it to UTF8. - LPSTR szCurrentDirectory = NULL; - if (wszCurrentDirectory) - { - cbReqd = WszWideCharToMultiByte(CP_UTF8, 0, wszCurrentDirectory, -1, 0, 0, 0, 0); - szCurrentDirectory = (LPSTR)_alloca(cbReqd); - WszWideCharToMultiByte(CP_UTF8, 0, wszCurrentDirectory, -1, szCurrentDirectory, cbReqd, 0, 0); - } - - // Prepare to format an attribute block containing all the launch parameters we'll send to the proxy. - // There are two phases: first we plan how much space will be required in the block then we allocate the - // block and fill it in. - DbgAttributeBlockWriter sAttrWriter; - - sAttrWriter.ScheduleStringValue(szCommandLine); - - if (szCurrentDirectory) - sAttrWriter.ScheduleStringValue(szCurrentDirectory); - - // Determine how large the environment block is (if it's supplied). - DWORD cbEnvironment = 0; - if (pvEnvironment) - { - char *szEnv = (char *)pvEnvironment; - - // The environment is a series of nul-terminated strings followed by a final nul. - while (*szEnv) - { - DWORD cbString = strlen(szEnv) + 1; - cbEnvironment += cbString; - szEnv += cbString; - } - - // Account for final nul. - cbEnvironment++; - } - - if (cbEnvironment) - sAttrWriter.ScheduleValue(cbEnvironment); - - // By now we know how large an attribute block we need. - DWORD cbAttributeBlock = sAttrWriter.GetRequiredBufferSize(); - BYTE *pbAttributeBlock = new (nothrow) BYTE[cbAttributeBlock]; - if (pbAttributeBlock == NULL) - return E_OUTOFMEMORY; - - // Initialize the attribute block. - sAttrWriter.BeginFormatting((char*)pbAttributeBlock); - - sAttrWriter.AddStringValue(DAT_CommandLine, szCommandLine); - if (szCurrentDirectory) - sAttrWriter.AddStringValue(DAT_DefaultDirectory, szCurrentDirectory); - if (cbEnvironment) - sAttrWriter.AddValue(DAT_Environment, (char*)pvEnvironment, cbEnvironment); - - // Allocate a new process entry up front (but don't link it into the list until we know we've created the - // remote process). - ProcessEntry *pProcess = new (nothrow) ProcessEntry(); - if (pProcess == NULL) - { - delete [] pbAttributeBlock; - return E_OUTOFMEMORY; - } - memset(pProcess, 0, sizeof(ProcessEntry)); - - strncpy(pProcess->m_szCommandLine, szCommandLine, kMaxCommandLine); - pProcess->m_szCommandLine[kMaxCommandLine - 1] = '\0'; - - pProcess->m_hExitedEvent = WszCreateEvent(NULL, TRUE, FALSE, NULL); // Manual reset, not signalled - if (pProcess->m_hExitedEvent == NULL) - { - delete [] pbAttributeBlock; - delete pProcess; - return E_OUTOFMEMORY; - } - - pProcess->m_hRuntimeStartedEvent = WszCreateEvent(NULL, TRUE, FALSE, NULL); // Manual reset, not signalled - if (pProcess->m_hRuntimeStartedEvent == NULL) - { - delete [] pbAttributeBlock; - delete pProcess; - return E_OUTOFMEMORY; - } - - // Send the launch request to the proxy. It will reply with a PID or an hresult on failure. - HRESULT hr = MakeProxyRequest(DPMT_LaunchProcess, - pbAttributeBlock, - &pProcess->m_dwPID, - &pProcess->m_pruidProcess); - - delete [] pbAttributeBlock; - - if (SUCCEEDED(hr)) - { - // The remote process has been created. - *pdwPID = pProcess->m_dwPID; - - // Take the lock and check whether we already have an entry for this process (this can happen due to - // an EnumProcesses from another thread). - { - RSLockHolder lock(&m_sLock); - ProcessEntry *pSearchProcess = m_pProcessList; - while (pSearchProcess) - { - if (pSearchProcess->m_pruidProcess == pProcess->m_pruidProcess) - break; - pSearchProcess = pSearchProcess->m_pNext; - } - - if (pSearchProcess) - { - // Someone else has already made the update. Discard our unneeded copy. - delete pProcess; - } - else - { - // No current entry for this process, link it in. - pProcess->m_pNext = m_pProcessList; - m_pProcessList = pProcess; - } - } // Leave lock - } - else - { - // The process was not created, throw away the process entry we'd prepared. - delete pProcess; - } - - return hr; + return S_OK; } // Kill the process identified by PID. void DbgTransportTarget::KillProcess(DWORD dwPID) { - if (m_fProxyConnectionBad) - return; - - PRUID pruidTarget = 0; - - // Look up the process by PID so we can find the corresponding PRUID (which is the proxy's version of the - // PID). - { - RSLockHolder lock(&m_sLock); - ProcessEntry *pProcess = LocateProcessByPID(dwPID); - if (pProcess) - pruidTarget = pProcess->m_pruidProcess; - } // Leave lock - - if (pruidTarget) + HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwPID); + if (hProcess != NULL) { - HRESULT hr = MakeProxyRequest(DPMT_TerminateProcess, pruidTarget); - if (FAILED(hr)) - { - // Network failure could prevent our terminate from getting through. We don't currently support - // rebuilding a network connection and retrying, so report the process as dead to prevent a hang - // in the debugger on this end. - RSLockHolder lock(&m_sLock); - ProcessEntry *pProcess = LocateProcessByPID(dwPID); - if (pProcess) - { - pProcess->m_fExited = true; - SetEvent(pProcess->m_hExitedEvent); - } - } // Leave lock + TerminateProcess(hProcess, 0); + CloseHandle(hProcess); } } -// Ask the remote debugger proxy for an updated list of processes and reflect these changes into our local -// process list. Any failure will leave the current process list state unchanged. -void DbgTransportTarget::UpdateProcessList() +DbgTransportTarget::ProcessEntry::~ProcessEntry() { - // As an optimization, don't update the process list more than once a second. - if ((CLRGetTickCount64() - m_ullLastUpdate) <= 1000) - return; - m_ullLastUpdate = CLRGetTickCount64(); + CloseHandle(m_hProcess); + m_hProcess = NULL; - // Send message to the proxy asking for a list of processes and CoreCLR instances. By the time the - // MakeProxyRequest request call below completes the process/runtime database will have been updated. - MakeProxyRequest(DPMT_EnumProcesses); + m_transport->Shutdown(); + delete m_transport; + m_transport = NULL; } // Locate a process entry by PID. Assumes the lock is already held. @@ -884,1031 +230,4 @@ DbgTransportTarget::ProcessEntry *DbgTransportTarget::LocateProcessByPID(DWORD d return NULL; } -DbgTransportTarget::RuntimeEntry::~RuntimeEntry() -{ - // If there's still a transport attached to the remote runtime shut it down and delete it. - if (m_pDbgTransport) - { - m_pDbgTransport->Shutdown(); - delete m_pDbgTransport; - } -} - -DbgTransportTarget::ProcessEntry::~ProcessEntry() -{ - // Clean up any records for runtimes hosted within this process. - while (m_pRuntimes) - { - RuntimeEntry *pDelRuntime = m_pRuntimes; - m_pRuntimes = m_pRuntimes->m_pNext; - delete pDelRuntime; - } - - if (m_hExitedEvent) - CloseHandle(m_hExitedEvent); - - if (m_hRuntimeStartedEvent) - CloseHandle(m_hRuntimeStartedEvent); -} - -// Deallocate all resources associated with a process list. -void DbgTransportTarget::DeallocateProcessList(ProcessEntry *pProcessList) -{ - while (pProcessList) - { - ProcessEntry *pDelProcess = pProcessList; - pProcessList = pProcessList->m_pNext; - delete pDelProcess; - } -} - -// Format and send a request to the proxy then wait on a reply (if appropriate) and return results to the -// caller. -HRESULT DbgTransportTarget::MakeProxyRequest(DbgProxyMessageType eType, ...) -{ - va_list args; - - va_start(args, eType); - - // We allocate space for some request related context on the stack. For the duration of the request (until - // a reply is received) this context is linked on a global request queue so the process event thread can - // handle matching replies to requests. - Request sRequest; - sRequest.m_pNext = NULL; - sRequest.m_hrResult = S_OK; - - // DPMT_TerminateProcess requests don't expect a reply. - if (eType != DPMT_TerminateProcess) - { - sRequest.m_hCompletionEvent = WszCreateEvent(NULL, FALSE, FALSE, NULL); // Auto-reset, not signalled - if (sRequest.m_hCompletionEvent == NULL) - return E_OUTOFMEMORY; - } - else - sRequest.m_hCompletionEvent = NULL; - - // Space for the message header. - DbgProxyMessageHeader sMessage; - - // Format common message fields. - memset(&sMessage, 0, sizeof(sMessage)); - sMessage.m_eType = eType; - - // Based on request type fill in the remainder of the request fields and record the addresses of the - // caller's output buffer(s) if any. - BYTE *pbAttributeBlock = NULL; - DWORD cbAttributeBlock = 0; - switch (eType) - { - case DPMT_GetSystemInfo: - DbgTransportLog(LC_Always, "Sending 'GetSystemInfo'"); - sMessage.VariantData.GetSystemInfo.m_uiMajorVersion = kCurrentMajorVersion; - sMessage.VariantData.GetSystemInfo.m_uiMinorVersion = kCurrentMinorVersion; - sRequest.OutputBuffers.GetSystemInfo.m_pdwMajorVersion = va_arg(args, DWORD*); - sRequest.OutputBuffers.GetSystemInfo.m_pdwMinorVersion = va_arg(args, DWORD*); - sRequest.OutputBuffers.GetSystemInfo.m_pePlatform = va_arg(args, DbgTargetPlatform*); - break; - - case DPMT_EnumProcesses: - DbgTransportLog(LC_Always, "Sending 'EnumProcesses'"); - break; - - case DPMT_LaunchProcess: - { - DbgTransportLog(LC_Always, "Sending 'LaunchProcess'"); - pbAttributeBlock = va_arg(args, BYTE*); - DbgAttributeBlockReader sAttrReader((char*)pbAttributeBlock); - cbAttributeBlock = sAttrReader.GetBlockSize(); - sMessage.VariantData.LaunchProcess.m_cbAttributeBlock = cbAttributeBlock; - sRequest.OutputBuffers.LaunchProcess.m_pdwPID = va_arg(args, DWORD*); - sRequest.OutputBuffers.LaunchProcess.m_ppruidProcess = va_arg(args, PRUID*); - break; - } - - case DPMT_EarlyAttach: - DbgTransportLog(LC_Always, "Sending 'EarlyAttach'"); - sMessage.VariantData.EarlyAttach.m_pruidProcess = va_arg(args, DWORD); - sRequest.OutputBuffers.EarlyAttach.m_pfProcessExited = va_arg(args, bool*); - break; - - case DPMT_TerminateProcess: - DbgTransportLog(LC_Always, "Sending 'TerminateProcess'"); - sMessage.VariantData.TerminateProcess.m_pruidProcess = va_arg(args, DWORD); - break; - - default: - _ASSERTE(!"Illegal message type for MakeProxyRequest"); - va_end(args); - return E_FAIL; - } - va_end(args); - - // We must hold the lock in order to send messages, allocate request IDs or touch the request queue. - { - RSLockHolder lock(&m_sLock); - - // While under the lock we can check the connection state without races. We either see the connection - // state is bad and abort the operation now or we successfully queue the request (in which case it is - // the process event thread's responsibility to abort the request if an error occurs). - if (m_fProxyConnectionBad) - { - if (sRequest.m_hCompletionEvent) - CloseHandle(sRequest.m_hCompletionEvent); - return E_ABORT; - } - - // Allocate a request ID and add the request to the queue (except for messages that don't expect a - // reply). - if (sRequest.m_hCompletionEvent != NULL) - { - // Allocate a unique ID for this request. This will allow us to match the reply that comes back. - sRequest.m_dwID = sMessage.m_uiRequestID = m_dwNextRequestID++; - - // The request queue is not ordered, so just place the new request at the head. - sRequest.m_pNext = m_pRequestList; - m_pRequestList = &sRequest; - } - else - sMessage.m_uiRequestID = 0; - - // Now the type and request ID have been filled in we can calculate the value of the magic field used - // as an extra layer of validation in the message format. - sMessage.m_uiMagic = DBGPROXY_MAGIC_VALUE(&sMessage); - - // Send the message header. - if (!m_pConnection->Send((unsigned char*)&sMessage, sizeof(sMessage))) - { - DbgTransportLog(LC_Always, "DbgTransportTarget::MakeProxyRequest(): Send() failed"); - if (sRequest.m_hCompletionEvent) - { - m_pRequestList = sRequest.m_pNext; - CloseHandle(sRequest.m_hCompletionEvent); - } - - return E_ABORT; - } - - // Launch requests have additional data (an attribute block). - if (eType == DPMT_LaunchProcess) - { - _ASSERTE(pbAttributeBlock && cbAttributeBlock); - - if (!m_pConnection->Send(pbAttributeBlock, cbAttributeBlock)) - { - DbgTransportLog(LC_Always, "DbgTransportTarget::MakeProxyRequest(): Send() failed"); - - m_pRequestList = sRequest.m_pNext; - CloseHandle(sRequest.m_hCompletionEvent); - - return E_ABORT; - } - } - - } // Leave lock - - // We're done if we don't expect a reply. - if (sRequest.m_hCompletionEvent == NULL) - return S_OK; - - // Now wait on the completion event (this will be signalled by the process event thread once it has - // matched a reply to our request successfully). - WaitForSingleObject(sRequest.m_hCompletionEvent, INFINITE); - - // No more need for the completionm event. - CloseHandle(sRequest.m_hCompletionEvent); - - // Return the completion result from the transmission record. - return sRequest.m_hrResult; -} - -// Static entry point for the process event thread. -DWORD WINAPI DbgTransportTarget::ProcessEventWorkerStatic(LPVOID lpvContext) -{ - // Just dispatch straight to the version that's an instance method. - ((DbgTransportTarget*)lpvContext)->ProcessEventWorker(); - return 0; -} - -// Instance method version of the worker, called from ProcessEventWorkerStatic(). -void DbgTransportTarget::ProcessEventWorker() -{ - // Loop handling requests until we're told to shutdown or hit a network error. - while (!m_fShutdown) - { - // How the worker reacts to the incoming data is driven by shared state set up by other threads in - // this process calling MakeProxyRequest(). These calls cause a message to be sent directly to the - // proxy but also set up state so that this thread will know how to dispatch replies from the proxy - // back to the originating thread. - - // There are three sizes of message that we can receive: most messages will fit in the common message - // header but DPMT_RuntimeStarted needs something a little larger (an additional DbgProxyRuntimeInfo - // structure) and DPMT_ProcessList includes an variable sized list of process and runtime records. - // Allocate storage for a common header on the stack and always receive the header into this. We'll - // handle any extra data required on a case by case basis (which is easy since there's no requirement - // to actually assemble the incoming message into a single contiguous buffer at any point). - DbgProxyMessageHeader sMessage; - - if (!m_pConnection->Receive((unsigned char *)&sMessage, sizeof(sMessage))) - { - DbgTransportLog(LC_Always, "DbgTransportTarget: Receive() failed"); - goto NetworkError; - } - - // Validate the magic number in the header that we use as an additional check of the messages's - // integrity (this makes it much harder to launch a network attack based on sending random data). - if (sMessage.m_uiMagic != DBGPROXY_MAGIC_VALUE(&sMessage)) - { - DbgTransportLog(LC_Always, "DbgTransportTarget: message failed magic number test"); - goto NetworkError; - } - - // Most of the incoming messages are replies to requests that we have on our request queue. Locate the - // original request (keyed off the ID returned in the reply). - Request *pRequest = NULL; - if (sMessage.m_eType != DPMT_RuntimeStarted && - sMessage.m_eType != DPMT_ProcessTerminated) - { - pRequest = LocateOriginalRequest(&sMessage); - if (pRequest == NULL) - { - DbgTransportLog(LC_Always, "DbgTransportTarget: can't find request for reply %u", - (unsigned)sMessage.m_uiRequestID); - goto NetworkError; - } - } - - // Process the rest of the message based on the type. - switch (sMessage.m_eType) - { - case DPMT_SystemInfo: - DbgTransportLog(LC_Always, "Received 'SystemInfo'"); - PREFIX_ASSUME(pRequest != NULL); - - *pRequest->OutputBuffers.GetSystemInfo.m_pdwMajorVersion = - sMessage.VariantData.SystemInfo.m_uiMajorVersion; - *pRequest->OutputBuffers.GetSystemInfo.m_pdwMinorVersion = - sMessage.VariantData.SystemInfo.m_uiMinorVersion; - *pRequest->OutputBuffers.GetSystemInfo.m_pePlatform = - sMessage.VariantData.SystemInfo.m_ePlatform; - break; - - case DPMT_ProcessList: - DbgTransportLog(LC_Always, "Received 'ProcessList(%u, %u)'", - (unsigned)sMessage.VariantData.ProcessList.m_uiProcessRecords, - (unsigned)sMessage.VariantData.ProcessList.m_uiRuntimeRecords); - PREFIX_ASSUME(pRequest != NULL); - - ProcessProcessList(&sMessage, pRequest); - if (FAILED(pRequest->m_hrResult)) - goto NetworkError; - break; - - case DPMT_ProcessLaunched: - DbgTransportLog(LC_Always, "Received 'ProcessLaunched'"); - PREFIX_ASSUME(pRequest != NULL); - - // We successfully launched a process remotely (or an error code indicating why we could not). - // On success copy PID and PRUID of the new process back to the requester. - switch (sMessage.VariantData.ProcessLaunched.m_eResult) - { - case DPLR_Success: - pRequest->m_hrResult = S_OK; - *pRequest->OutputBuffers.LaunchProcess.m_pdwPID = - sMessage.VariantData.ProcessLaunched.m_uiPID; - *pRequest->OutputBuffers.LaunchProcess.m_ppruidProcess = - sMessage.VariantData.ProcessLaunched.m_pruidProcess; - break; - case DPLR_OutOfMemory: - pRequest->m_hrResult = E_OUTOFMEMORY; - break; - case DPLR_Denied: - pRequest->m_hrResult = E_ACCESSDENIED; - break; - case DPLR_NotFound: - pRequest->m_hrResult = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - break; - case DPLR_UnspecifiedError: - pRequest->m_hrResult = E_FAIL; - break; - default: - _ASSERTE(!"Unknown ProcessLaunched result code"); - pRequest->m_hrResult = E_FAIL; - } - break; - - case DPMT_RuntimeStarted: - { - DbgTransportLog(LC_Always, "Received 'RuntimeStarted'"); - - // RuntimeStarted sends a process info block as well as runtime info (in case the process is new - // as well). - - // Read DbgProxyProcessInfo structure. - DbgProxyProcessInfo sProcessInfo; - if (!m_pConnection->Receive((unsigned char *)&sProcessInfo, sizeof(sProcessInfo))) - { - DbgTransportLog(LC_Always, "DbgTransportTarget: Receive() failed"); - goto NetworkError; - } - - // Read DbgProxyRuntimeInfo structure. - DbgProxyRuntimeInfo sRuntimeInfo; - if (!m_pConnection->Receive((unsigned char *)&sRuntimeInfo, sizeof(sRuntimeInfo))) - { - DbgTransportLog(LC_Always, "DbgTransportTarget: Receive() failed"); - goto NetworkError; - } - - // A runtime has started up in some process on the target machine. - // Add a runtime record to our database (if it's not already there). - if (!ProcessRuntimeStarted(&sProcessInfo, &sRuntimeInfo)) - goto NetworkError; - break; - } - - case DPMT_ProcessTerminated: - { - DbgTransportLog(LC_Always, "Received 'ProcessTerminated'"); - - // A process has terminated on the target machine. - // See if we were tracking the process on our side and if so either delete the entry (if it's - // not being used) or fire the process termination event. - { - RSLockHolder lock(&m_sLock); - - ProcessEntry *pProcess = m_pProcessList; - ProcessEntry *pLastProcess = NULL; - while (pProcess) - { - if (pProcess->m_pruidProcess == sMessage.VariantData.ProcessTerminated.m_pruidProcess) - { - // Found a matching entry. Is it in use? - if (pProcess->m_cProcessRef > 0) - { - // Can't delete the entry. Signal the process exited event (which will move some - // users off). - SetEvent(pProcess->m_hExitedEvent); - pProcess->m_fExited = true; - } - else - { - // Nobody's using this process entry, we can unlink and deallocate it. - if (pLastProcess) - pLastProcess->m_pNext = pProcess->m_pNext; - else - m_pProcessList = pProcess->m_pNext; - delete pProcess; - } - break; - } - pLastProcess = pProcess; - pProcess = pProcess->m_pNext; - } - } // Leave lock - break; - } - - case DPMT_EarlyAttachDone: - DbgTransportLog(LC_Always, "Received 'EarlyAttachDone(%s)'", - sMessage.VariantData.EarlyAttachDone.m_fProcessExited ? "dead" : "alive"); - PREFIX_ASSUME(pRequest != NULL); - - // The only thing we need to do here is pass back the indication of whether the process - // managed to exit before the attach was registered. - *pRequest->OutputBuffers.EarlyAttach.m_pfProcessExited = - sMessage.VariantData.EarlyAttachDone.m_fProcessExited; - break; - - default: - _ASSERTE(!"Invalid message typr"); - } - - // If this was a reply then the original request has been updated at this point. We only need to - // remove it from the global queue and signal the completion event to unblock the requesting thread. - if (pRequest) - { - RSLockHolder lock(&m_sLock); - - // Look for the previous item in the queue. - Request *pSearchRequest = m_pRequestList; - while (pSearchRequest) - { - if (pSearchRequest->m_pNext == pRequest) - { - pSearchRequest->m_pNext = pRequest->m_pNext; - break; - } - pSearchRequest = pSearchRequest->m_pNext; - } - - // No match, maybe the transmission was at the head of the queue. - if (pSearchRequest == NULL) - { - _ASSERTE(m_pRequestList == pRequest); - m_pRequestList = pRequest->m_pNext; - } - - // Now complete the request to the caller. - SetEvent(pRequest->m_hCompletionEvent); - } // Leave lock - - // Loop round for the next message. - } - - NetworkError: - - // We get here if we were asked to shutdown or hit a network error. - m_fProxyConnectionBad = true; - - // Abort any outstanding requests. - { - RSLockHolder lock(&m_sLock); - - Request *pRequest = m_pRequestList; - while (pRequest) - { - Request *pAbortRequest = pRequest; - pRequest = pRequest->m_pNext; - - pAbortRequest->m_hrResult = E_ABORT; - SetEvent(pAbortRequest->m_hCompletionEvent); - } - } // Leave lock - - // If this isn't shutdown (i.e. we got here as the result of a network error) run through the process list - // and report them all as terminated (better than having the debugger time-out some request and then hang - // forever as it tries to terminate the process itself). - if (!m_fShutdown) - { - for (ProcessEntry *pProcess = m_pProcessList; pProcess; pProcess = pProcess->m_pNext) - { - if (!pProcess->m_fExited) - { - pProcess->m_fExited = true; - SetEvent(pProcess->m_hExitedEvent); - } - } - } -} - -// If this message is a reply to a right-side request locate that request. Otherwise return NULL. -DbgTransportTarget::Request *DbgTransportTarget::LocateOriginalRequest(DbgProxyMessageHeader *pMessage) -{ - // Search the request queue for a matching ID. - Request *pRequest; - { - RSLockHolder lock(&m_sLock); - - pRequest = m_pRequestList; - while (pRequest) - { - if (pRequest->m_dwID == pMessage->m_uiRequestID) - break; - pRequest = pRequest->m_pNext; - } - } // Leave lock - - return pRequest; -} - -// Process an incoming ProcessList message. -void DbgTransportTarget::ProcessProcessList(DbgProxyMessageHeader *pMessage, - Request *pRequest) -{ - // The message header is followed by a sequence of DbgProxyProcessInfo records then a sequence of - // DbgProxyRuntimeInfo records. The lengths of both of these sequences are provided in the header. - DWORD cProcessRecords = pMessage->VariantData.ProcessList.m_uiProcessRecords; - DWORD cRuntimeRecords = pMessage->VariantData.ProcessList.m_uiRuntimeRecords; - - // Impose some reasonable bounds to catch badly formed replies (and so we don't have to worry about - // integer overflow in the allocation code that follows). - if (cProcessRecords > 1024 || cRuntimeRecords > 1024) - { - _ASSERTE(!"Badly formed ProcessList message"); - pRequest->m_hrResult = E_UNEXPECTED; - return; - } - - // Allocate space for all the process and runtime records in one contiguous block. - DWORD cbRecordBuffer = (cProcessRecords * sizeof(DbgProxyProcessInfo)) + - (cRuntimeRecords * sizeof(DbgProxyRuntimeInfo)); - BYTE *pbRecordBuffer = new (nothrow) BYTE[cbRecordBuffer]; - if (pbRecordBuffer == NULL) - { - DbgTransportLog(LC_Always, "Failed to allocate memory for %u process records and %u runtime records", - cProcessRecords, cRuntimeRecords); - pRequest->m_hrResult = E_OUTOFMEMORY; - return; - } - - DbgProxyProcessInfo *pProcessRecords = (DbgProxyProcessInfo*)pbRecordBuffer; - DbgProxyRuntimeInfo *pRuntimeRecords = (DbgProxyRuntimeInfo*)(pProcessRecords + cProcessRecords); - - // If we've gotten to this point we believe the message looks valid and we have all resources - // allocated necessary to receive the response for this portion of the reply. - if (!m_pConnection->Receive(pbRecordBuffer, cbRecordBuffer)) - { - DbgTransportLog(LC_Always, "ProcessProcessList: Receive() failed"); - pRequest->m_hrResult = E_FAIL; - return; - } - - // Now parse the records and make any necessary updates to the cached process/runtime state we already - // have. - { - RSLockHolder lock(&m_sLock); - - // First we walk the current list of processes and mark each entry as potentially removeable. This is - // part of the algorithm to detect processes which have terminated, see the next stage for the rest. - ProcessEntry *pProcess = m_pProcessList; - while (pProcess) - { - pProcess->m_fRemove = true; - pProcess = pProcess->m_pNext; - } - - // Next we traverse the incoming list of process records, determining which we already know about - // (and marking the corresponding ProcessEntry) and those that are new (for which we create new - // ProcessEntry structures). - for (DWORD i = 0; i < cProcessRecords; i++) - { - // See if we can locate an existing ProcessEntry (i.e. one with the same PRUID as the current - // process record). - pProcess = m_pProcessList; - while (pProcess) - { - if (pProcess->m_pruidProcess == pProcessRecords[i].m_pruidProcess) - { - _ASSERTE(pProcess->m_dwPID == pProcessRecords[i].m_uiPID); - - // We've found a match so we indicate that this ProcessEntry is still live. - pProcess->m_fRemove = false; - break; - } - - pProcess = pProcess->m_pNext; - } - - // If we didn't find a matching ProcessEntry create one now. - if (pProcess == NULL) - { - pProcess = new (nothrow) ProcessEntry(); - if (pProcess == NULL) - goto FailedUpdate; - - pProcess->m_pNext = m_pProcessList; - pProcess->m_dwPID = pProcessRecords[i].m_uiPID; - pProcess->m_pruidProcess = pProcessRecords[i].m_pruidProcess; - strcpy_s(pProcess->m_szCommandLine, kMaxCommandLine, pProcessRecords[i].m_szCommandLine); - pProcess->m_pRuntimes = NULL; - pProcess->m_hExitedEvent = NULL; - pProcess->m_hRuntimeStartedEvent = NULL; - pProcess->m_fExited = false; - pProcess->m_fRemove = false; - pProcess->m_cProcessRef = 0; - - // Allocate event used to signal this process' termination. - pProcess->m_hExitedEvent = WszCreateEvent(NULL, TRUE, FALSE, NULL); // Manual reset, not signalled - if (pProcess->m_hExitedEvent == NULL) - { - delete pProcess; - goto FailedUpdate; - } - - // Allocate event used to signal the first runtime has started within this process. - pProcess->m_hRuntimeStartedEvent = WszCreateEvent(NULL, TRUE, FALSE, NULL); // Manual reset, not signalled - if (pProcess->m_hRuntimeStartedEvent == NULL) - { - delete pProcess; - goto FailedUpdate; - } - - // Link the new process entry to the database. - m_pProcessList = pProcess; - } - } - - // Now walk the updated ProcessEntry structures. Each that wasn't marked as being present in the - // incoming process infos indicates a dead process. We either remove such entries or, if they're being - // used currently (have a connected debugger session etc.), we simply mark them as dead so they won't - // appear in process enumerations and we'll delete them as soon as their use count falls to zero. - pProcess = m_pProcessList; - ProcessEntry *pLastProcess = NULL; - while (pProcess) - { - if (pProcess->m_fRemove) - { - // The process has terminated. Can we release the ProcessEntry yet? - if (pProcess->m_cProcessRef == 0) - { - // Nobody is using the process, we can get rid of it. - - // Unlink the entry from the list. - if (pLastProcess) - pLastProcess->m_pNext = pProcess->m_pNext; - else - m_pProcessList = pProcess->m_pNext; - - // Since we've removed this entry from the list the last entry remains the same for the - // next iteration of the loop. We have to extract the next entry from the current one - // before we deallocate it. - ProcessEntry *pDeleteEntry = pProcess; - pProcess = pProcess->m_pNext; - - // Finally we can delete the current entry (this automatically takes care of any runtime - // entries and other process entry owned resources). - delete pDeleteEntry; - - continue; - } - else - { - // Process is in use. Simply mark it as exited for now. - pProcess->m_fExited = true; - SetEvent(pProcess->m_hExitedEvent); - } - } - - pLastProcess = pProcess; - pProcess = pProcess->m_pNext; - } - - // Next we walk the incoming runtime records. Here we're just looking for new runtimes to add since we - // don't currently support shutting down a runtime without terminating the process. - for (DWORD i = 0; i < cRuntimeRecords; i++) - { - // First find the parent ProcessEntry record. This must exist (if the proxy sent a runtime record - // it must send the parent process record). - pProcess = m_pProcessList; - while (pProcess) - { - if (pProcess->m_pruidProcess == pRuntimeRecords[i].m_pruidProcess) - { - pProcess->m_fRemove = false; - break; - } - - pProcess = pProcess->m_pNext; - } - PREFIX_ASSUME(pProcess != NULL); - - // Walk the list of RuntimeEntry records associated with this ProcessEntry to see if we already - // have this entry. - RuntimeEntry *pRuntime = pProcess->m_pRuntimes; - while (pRuntime) - { - if (pRuntime->m_pruidRuntime == pRuntimeRecords[i].m_pruidRuntime) - { - // We already have this entry. - _ASSERTE(pRuntime->m_usPort == pRuntimeRecords[i].m_usPort); - break; - } - - pRuntime = pRuntime->m_pNext; - } - - // If this is a new runtime add a corresponding RuntimeEntry. - if (pRuntime == NULL) - { - pRuntime = new (nothrow) RuntimeEntry(); - if (pRuntime == NULL) - goto FailedUpdate; - - pRuntime->m_pruidRuntime = pRuntimeRecords[i].m_pruidRuntime; - pRuntime->m_usPort = pRuntimeRecords[i].m_usPort; - pRuntime->m_pDbgTransport = NULL; - pRuntime->m_cTransportRef = 0; - - // Link the runtime entry onto the process. - pRuntime->m_pNext = pProcess->m_pRuntimes; - pProcess->m_pRuntimes = pRuntime; - - // Since there's at least one runtime for this process make sure the runtime started event is set. - SetEvent(pProcess->m_hRuntimeStartedEvent); - } - } - } - - // We're done, all incoming data has been consumed. - delete [] pbRecordBuffer; - return; - - FailedUpdate: - pRequest->m_hrResult = E_OUTOFMEMORY; - delete [] pbRecordBuffer; -} - -// Process an incoming RuntimeStarted datagram. -bool DbgTransportTarget::ProcessRuntimeStarted(DbgProxyProcessInfo *pProcessInfo, - DbgProxyRuntimeInfo *pRuntimeInfo) -{ - // A runtime has started up in some process on the target machine. - // Add a runtime record to our database (if it's not already there). - { - RSLockHolder lock(&m_sLock); - - // Search for the parent process in our list. - ProcessEntry *pProcess = m_pProcessList; - while (pProcess) - { - if (pProcess->m_pruidProcess == pRuntimeInfo->m_pruidProcess) - break; - pProcess = pProcess->m_pNext; - } - - DbgTransportLog(LC_Always, "Processing 'RuntimeStarted' for (%u, %u, %u)", - (unsigned)pProcessInfo->m_uiPID, - (PRUID)pRuntimeInfo->m_pruidProcess, - (PRUID)pRuntimeInfo->m_pruidRuntime); - - // If we haven't recorded the process yet create an entry for it. - if (pProcess == NULL) - { - pProcess = new (nothrow) ProcessEntry(); - if (pProcess == NULL) - return false; - - DbgTransportLog(LC_Always, " No existing process record, created %08X", pProcess); - - memset(pProcess, 0, sizeof(ProcessEntry)); - pProcess->m_dwPID = pProcessInfo->m_uiPID; - pProcess->m_pruidProcess = pProcessInfo->m_pruidProcess; - strcpy(pProcess->m_szCommandLine, pProcessInfo->m_szCommandLine); - - pProcess->m_hExitedEvent = WszCreateEvent(NULL, TRUE, FALSE, NULL); // Manual reset, not signalled - if (pProcess->m_hExitedEvent == NULL) - { - delete pProcess; - return false; - } - - pProcess->m_hRuntimeStartedEvent = WszCreateEvent(NULL, TRUE, FALSE, NULL); // Manual reset, not signalled - if (pProcess->m_hRuntimeStartedEvent == NULL) - { - delete pProcess; - return false; - } - - // Link the new process entry into the list. - pProcess->m_pNext = m_pProcessList; - m_pProcessList = pProcess; - } - else - DbgTransportLog(LC_Always, " Found existing process record %08X", pProcess); - - // Now we have a process record we can look for a runtime entry. - RuntimeEntry *pRuntime = pProcess->m_pRuntimes; - while (pRuntime) - { - if (pRuntime->m_pruidRuntime == pRuntimeInfo->m_pruidRuntime) - break; - pRuntime = pRuntime->m_pNext; - } - - // If we didn't have an entry for this runtime create one now. - if (pRuntime == NULL) - { - pRuntime = new (nothrow) RuntimeEntry(); - if (pRuntime == NULL) - return false; - - DbgTransportLog(LC_Always, " No existing runtime record, created %08X", pRuntime); - - pRuntime->m_pruidRuntime = pRuntimeInfo->m_pruidRuntime; - pRuntime->m_usPort = pRuntimeInfo->m_usPort; - pRuntime->m_pDbgTransport = NULL; - pRuntime->m_cTransportRef = 0; - - // Link the runtime entry onto the process. - pRuntime->m_pNext = pProcess->m_pRuntimes; - pProcess->m_pRuntimes = pRuntime; - - // Since there's at least one runtime for this process make sure the runtime started event is set. - SetEvent(pProcess->m_hRuntimeStartedEvent); - } - else - DbgTransportLog(LC_Always, " Found existing runtime record %08X", pRuntime); - } // Leave lock - - return true; -} - -// A version of EnumProcesses used when we're controlled by the Visual Studio debugger. This API is exposed to -// our port supplier implementation via the ICoreClrDebugTarget interface implemented by the -// CoreClrDebugTarget class implemented in DbgTransportManager.cpp. -HRESULT DbgTransportTarget::EnumProcessesForVS(DWORD *pcProcs, CoreClrDebugProcInfo **ppProcs) -{ - *pcProcs = 0; - *ppProcs = NULL; - - // Update our process and runtime view from the remote target. - UpdateProcessList(); - - // Acquire the lock to get a consistent view of current state. - { - RSLockHolder lock(&m_sLock); - - ProcessEntry *pProcess; - DWORD cProcesses = 0; - - // Count the number of processes we know about. - for (pProcess = m_pProcessList; pProcess; pProcess = pProcess->m_pNext) - { - // Skip reporting of processes that have already exited (and we're waiting to clean up). - if (pProcess->m_fExited) - continue; - cProcesses++; - } - - // We're done if there aren't any. - if (cProcesses == 0) - return S_OK; - - // Otherwise allocate an array large enough to hold information about each process. - CoreClrDebugProcInfo *pProcInfos = new (nothrow) CoreClrDebugProcInfo[cProcesses]; - if (pProcInfos == NULL) - return E_OUTOFMEMORY; - - // Iterate over the processes again, this time filling in the data for each one in the output array. - DWORD idxCurrentProc = 0; - for (pProcess = m_pProcessList; pProcess; pProcess = pProcess->m_pNext) - { - // Skip reporting of processes that have already exited (and we're waiting to clean up). - if (pProcess->m_fExited) - continue; - - pProcInfos[idxCurrentProc].m_dwPID = pProcess->m_dwPID; - pProcInfos[idxCurrentProc].m_dwInternalID = pProcess->m_pruidProcess; - - if (MultiByteToWideChar(CP_UTF8, 0, pProcess->m_szCommandLine, -1, pProcInfos[idxCurrentProc].m_wszName, kMaxCommandLine) == 0) - { - delete [] pProcInfos; - return E_OUTOFMEMORY; - } - - idxCurrentProc++; - } - - *pcProcs = cProcesses; - *ppProcs = pProcInfos; - } - - return S_OK; -} - -// A similar API for VS that enumerates runtimes running within the given process. Returns S_FALSE if -// there are none. -HRESULT DbgTransportTarget::EnumRuntimesForVS(PRUID pruidProcess, DWORD *pcRuntimes, CoreClrDebugRuntimeInfo **ppRuntimes) -{ - *pcRuntimes = 0; - *ppRuntimes = NULL; - - // Update our process and runtime view from the remote target. - UpdateProcessList(); - - // Acquire the lock to get a consistent view of current state. - { - RSLockHolder lock(&m_sLock); - - // Look for the process record with the matching PRUID. - ProcessEntry *pProcess; - for (pProcess = m_pProcessList; pProcess; pProcess = pProcess->m_pNext) - { - if (pProcess->m_fExited) - continue; - if (pProcess->m_pruidProcess == pruidProcess) - break; - } - - // We couldn't find a match -- the process must have terminated so it certainly doesn't have any - // runtimes. - if (pProcess == NULL) - return S_FALSE; - - // Count the runtime instances running in the process. - DWORD cRuntimes = 0; - RuntimeEntry *pRuntime; - for (pRuntime = pProcess->m_pRuntimes; pRuntime; pRuntime = pRuntime->m_pNext) - cRuntimes++; - - // We're done if there aren't any. - if (cRuntimes == 0) - return S_OK; - - // Otherwise allocate an array large enough to hold information about each runtime. - CoreClrDebugRuntimeInfo *pRuntimeInfos = new (nothrow) CoreClrDebugRuntimeInfo[cRuntimes]; - if (pRuntimeInfos == NULL) - return E_OUTOFMEMORY; - - // Iterate over the runtimes again, this time filling in data for each one in the output array. - DWORD idxCurrentRuntime = 0; - for (pRuntime = pProcess->m_pRuntimes; pRuntime; pRuntime = pRuntime->m_pNext) - { - pRuntimeInfos[idxCurrentRuntime].m_dwInternalID = pRuntime->m_pruidRuntime; - idxCurrentRuntime++; - } - - *pcRuntimes = cRuntimes; - *ppRuntimes = pRuntimeInfos; - } - - return S_OK; -} - - -// When we're being driven by the Visual Studio debugger CoreCLR supplies an entity known as a port supplier -// to handle interactions between VS and the remote system when setting up debug sessions. The port supplier -// implements the connection to the remote proxy by talking to DbgTransportTarget instances controlled via the -// following class through a psuedo-COM interface, ICoreClrDebugTarget, described in -// debug\inc\CoreClrRemoteDebuggingInterfaces.h. -class CoreClrDebugTarget : public ICoreClrDebugTarget -{ -public: - CoreClrDebugTarget(DWORD dwAddress) : - m_lRefCount(1), - m_dwAddress(dwAddress), - m_pTarget(NULL) - { - } - - ~CoreClrDebugTarget() - { - if (m_pTarget) - g_pDbgTransportManager->ReleaseTarget(m_pTarget); - } - - STDMETHODIMP_(void) AddRef() - { - InterlockedIncrement(&m_lRefCount); - } - - STDMETHODIMP_(void) Release() - { - LONG lRef = InterlockedDecrement(&m_lRefCount); - if (lRef == 0) - delete this; - } - - // Enumerate all processes on the target system (whether they have managed code or not). The memory - // returned is deallocated via FreeMemory(). - STDMETHODIMP EnumProcesses(DWORD *pcProcs, CoreClrDebugProcInfo **ppProcs) - { - return m_pTarget->EnumProcessesForVS(pcProcs, ppProcs); - } - - // Enumerate all runtimes running in the given process on the target system. The memory returned is - // deallocated via FreeMemory(). - STDMETHODIMP EnumRuntimes(DWORD dwInternalProcessID, DWORD *pcRuntimes, CoreClrDebugRuntimeInfo **ppRuntimes) - { - return m_pTarget->EnumRuntimesForVS((PRUID)dwInternalProcessID, pcRuntimes, ppRuntimes); - } - - // Free memory allocated via EnumProcesses or EnumRuntimes. - STDMETHODIMP_(void) FreeMemory(void *pMemory) - { - delete [] (BYTE*)pMemory; - } - - // Non-exported method used by CreateCoreClrDebugTarget below to connect an instance of DbgTransportTarget - // to the remote system's proxy process. - HRESULT Init() - { - HRESULT hr = g_pDbgTransportManager->ConnectToTarget(m_dwAddress, 0, &m_pTarget); - if (FAILED(hr)) - return hr; - - return S_OK; - } - -private: - LONG m_lRefCount; // COM-style ref count - DWORD m_dwAddress; // IPv4 address of target system - DbgTransportTarget *m_pTarget; // Currently connected DbgTransportTarget -}; - -// Function exported by mscordbi_mac* to allow the port supplier used by Visual Studio to query remote system -// state. -extern "C" HRESULT __stdcall CreateCoreClrDebugTarget(DWORD dwAddress, ICoreClrDebugTarget **ppTarget) -{ - HRESULT hr; - - *ppTarget = NULL; - - // Allocate a new object implementing ICoreClrDebugTarget. - CoreClrDebugTarget *pTarget = new (nothrow) CoreClrDebugTarget(dwAddress); - if (pTarget == NULL) - return E_OUTOFMEMORY; - - // Attempt to connect it to the remote system. - hr = pTarget->Init(); - if (FAILED(hr)) - { - delete pTarget; - return hr; - } - - *ppTarget = static_cast<ICoreClrDebugTarget*>(pTarget); - return S_OK; -} - #endif // FEATURE_DBGIPC_TRANSPORT_DI diff --git a/src/debug/di/dbgtransportmanager.h b/src/debug/di/dbgtransportmanager.h index a28d1c718a..c94083595d 100644 --- a/src/debug/di/dbgtransportmanager.h +++ b/src/debug/di/dbgtransportmanager.h @@ -9,35 +9,32 @@ #ifdef FEATURE_DBGIPC_TRANSPORT_DI -#include "dbgproxy.h" #include "coreclrremotedebugginginterfaces.h" -// -// Provides access to various process enumeration and control facilities for a remote machine. -// -// The top-level entity is a DbgTransportManager. Usually one of these will be allocated per debugger process. -// The manager maintains a pool of DbgTransportTarget objects. Each of these track a connection to the proxy -// on a single target machine. In addition to managing the proxy connection a collection of -// DbgTransportSession objects is maintained, each corresponding to a debug session with a specific CoreCLR -// runtime instance. -// -// Target machine specific state. +// TODO: Ideally we'd like to remove this class and don't do any process related book keeping in DBI. + +// This is a registry of all the processes a debugger knows about, different components call it in order to +// obtain right instance of DbgTransportSession for a given PID. It keeps list of processes and transports for them. +// It also handles things like creating and killing a process. + +// Usual lifecycle looks like this: +// Debug a new process: +// * CreateProcess(&pid) +// * GetTransportForProcess(pid, &transport) +// * ReleaseTransport(transport) +// * KillProcess(pid) + +// Attach to an existing process: +// * Obtain pid from a user +// * GetTransportForProcess(pid, &transport) +// * ReleaseTransport(transport) + class DbgTransportTarget { public: DbgTransportTarget(); - // Fill caller allocated table at pdwProcesses with the pids of processes currently alive on the target - // system. Return the number of slots filled in *pcProcesses. The size of the table is given by cSlots. If - // more than this number of processes are alive then *pcProcesses is set to the total number and - // E_OUTOFMEMORY returned. - HRESULT EnumProcesses(DWORD *pdwProcesses, DWORD cSlots, DWORD *pcProcesses); - - // Returns true if the given PID identifies a running process which is hosting at least one CoreCLR - // runtime. - bool IsManagedProcess(DWORD dwPID); - // Given a PID attempt to find or create a DbgTransportSession instance to manage a connection to a // runtime in that process. Returns E_UNEXPECTED if the process can't be found. Also returns a handle that // can be waited on for process termination. @@ -47,194 +44,44 @@ public: // connection at this point). void ReleaseTransport(DbgTransportSession *pTransport); - // Run the command line given on the remote machine to create a process. Return the PID of this process. - // When and if the process starts a runtime and registers with the proxy it will be told to halt and wait - // for a debugger attach. - HRESULT CreateProcess(LPCWSTR wszCommand, - LPCWSTR wszArgs, - LPCWSTR wszCurrentDirectory, - LPVOID pvEnvironment, - DWORD *pdwPID); + // When and if the process starts the runtime will be told to halt and wait for a debugger attach. + HRESULT CreateProcess(LPCWSTR lpApplicationName, + LPCWSTR lpCommandLine, + LPSECURITY_ATTRIBUTES lpProcessAttributes, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + BOOL bInheritHandles, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPCWSTR lpCurrentDirectory, + LPSTARTUPINFOW lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation); // Kill the process identified by PID. void KillProcess(DWORD dwPID); - // Indicates when the connection to a proxy has failed: this target object will remain until the last - // reference to it is released (DbgTransportManager::ReleaseTransport) but will fail all further requests. - // The manager will then allow a new attempt to create a connection to the proxy to be made (wrapped in a - // new DbgTransportTarget). - bool IsProxyConnectionBad(); - - // A version of EnumProcesses used when we're controlled by the Visual Studio debugger. This API is - // exposed to our port supplier implementation via the ICoreClrDebugTarget interface implemented by the - // CoreClrDebugTarget class implemented in DbgTransportManager.cpp. - HRESULT EnumProcessesForVS(DWORD *pcProcs, CoreClrDebugProcInfo **ppProcs); - - // A similar API for VS that enumerates runtimes running within the given process. Returns S_FALSE if - // there are none. - HRESULT EnumRuntimesForVS(PRUID pruidProcess, DWORD *pcRuntimes, CoreClrDebugRuntimeInfo **ppRuntimes); - -private: - friend class DbgTransportManager; - - // Initialization and shutdown routines called only by the DbgTransportManager. - HRESULT Init(DWORD dwIPAddress, USHORT usPort); + HRESULT Init(); void Shutdown(); - // Data saved for each runtime instance the manager currently knows about. Saved in a singly linked, NULL - // terminated list on each ProcessEntry (m_pRuntimes). - struct RuntimeEntry - { - RuntimeEntry *m_pNext; // Next entry in the list - PRUID m_pruidRuntime; // Proxy ID for this specific runtime instance - USHORT m_usPort; // Port number to connect session to. - DbgTransportSession *m_pDbgTransport; // Transport to this runtime or NULL - DWORD m_cTransportRef; // Number of references to the transport still outstanding - - ~RuntimeEntry(); - }; - - // Data saved for each process the manager currently knows about. Saved in a singly linked, NULL - // terminated list (m_pProcessList). +private: struct ProcessEntry { ProcessEntry *m_pNext; // Next entry in the list DWORD m_dwPID; // Process ID for this entry - PRUID m_pruidProcess; // Proxy's ID for this process - char m_szCommandLine[kMaxCommandLine]; // Command line process is running - RuntimeEntry *m_pRuntimes; // Singly linked list of runtimes in process - HANDLE m_hExitedEvent; // Event signalled once process terminates - HANDLE m_hRuntimeStartedEvent; //Event signalled when first runtime is created in this process - bool m_fExited; // Marks processes that have exited but still have a transport - bool m_fRemove; // Used only during process list updates, see ProcessProcessList - DWORD m_cProcessRef; // Reasons the process can't be deleted yet + HANDLE m_hProcess; // Process handle + DbgTransportSession *m_transport; // Debugger's connection to the process + DWORD m_cProcessRef; // Ref count ~ProcessEntry(); }; - // Record of outgoing request that requires a reply. - struct Request - { - Request *m_pNext; // Next in queue of outstanding requests - DWORD m_dwID; // ID assigned to request (to match reply) - HANDLE m_hCompletionEvent; // Event to signal once the request is completed - HRESULT m_hrResult; // Completion result of request - union // Request specific output buffers - { - struct - { - DWORD *m_pdwMajorVersion; // Protocol version employed by the proxy - DWORD *m_pdwMinorVersion; // Protocol version employed by the proxy - DbgTargetPlatform *m_pePlatform; // Platform type of target system - } GetSystemInfo; - - struct - { - DWORD *m_pdwPID; // PID of launched process - PRUID *m_ppruidProcess; // PRUID of launched process - } LaunchProcess; - - struct - { - bool *m_pfProcessExited; // Process exited before we could record the attach - } EarlyAttach; - - } OutputBuffers; - }; - - ULONGLONG m_ullLastUpdate; // tick count of the last time the process list is updated - bool m_fInitLock; // Used to track whether we initialized m_sLock in Init() - DWORD m_dwProxyIP; // Proxy IP address in host byte order - USHORT m_usProxyPort; // Proxy port number in host byte order - DbgTargetPlatform m_ePlatform; // Platform type of the target (e.g. MacX86) ProcessEntry *m_pProcessList; // Head of list of currently alive processes (unsorted) - RSLock m_sLock; // Lock protecting read and write access to the process list - bool m_fShutdown; // Flag set once Shutdown() has been called - HANDLE m_hProcessEventThread; // Handle for the process event thread - SecConnMgr *m_pConnectionManager; // Factory for network connections - SecConn *m_pConnection; // Connection to the proxy - SOCKET m_hSocket; // UDP socket used to communicate with proxy - DWORD m_dwNextRequestID; // Next ID to be assigned to an outgoing request - Request *m_pRequestList; // List of requests to proxy that haven't had a reply - bool m_fProxyConnectionBad; // Initially false, any network failure will transition it - // to true for good and all further requests on this - // target will fail. - - // Ask the remote debugger proxy for an updated list of processes and reflect these changes into our local - // process list. Any failure will leave the current process list state unchanged. - void UpdateProcessList(); + RSLock m_sLock; // Lock protecting read and write access to the target list // Locate a process entry by PID. Assumes the lock is already held. ProcessEntry *LocateProcessByPID(DWORD dwPID); - - // Deallocate all resources associated with a process list. - void DeallocateProcessList(ProcessEntry *pProcessList); - - // Format and send a request to the proxy then wait on a reply (if appropriate) and return results to the - // caller. - HRESULT MakeProxyRequest(DbgProxyMessageType eType, ...); - - // Static entry point for the process event thread. - static DWORD WINAPI ProcessEventWorkerStatic(LPVOID lpvContext); - - // Instance method version of the worker, called from ProcessEventWorkerStatic(). - void ProcessEventWorker(); - - // If this message is a reply to a right-side request locate that request. Otherwise return NULL. - Request *LocateOriginalRequest(DbgProxyMessageHeader *pMessage); - - // Process an incoming ProcessList message. - void ProcessProcessList(DbgProxyMessageHeader *pMessage, - Request *pRequest); - - // Process an incoming RuntimeStarted message. - bool ProcessRuntimeStarted(DbgProxyProcessInfo *pProcessInfo, - DbgProxyRuntimeInfo *pRuntimeInfo); -}; - -// Process level state. -class DbgTransportManager -{ -public: - DbgTransportManager(); - - // Startup/shutdown calls. These are ref-counted (cordbg, for instance, is constructed in such a way that - // the command shell will attempt to load mscordbi and initialize an associated DbgTransportManager - // multiple times). - HRESULT Init(); - void Shutdown(); - - // Attempt to connect to a debugging proxy on the machine at the given address and with the specified port - // number. If the port number is given as zero use the port stored in user debugger configuration. On - // success a pointer to a DbgTransportTarget object will be returned. - HRESULT ConnectToTarget(DWORD dwIPAddress, USHORT usPort, DbgTransportTarget **ppTarget); - - // Add another reference to a target already acquired by ConnectToTarget (used by clients when they want - // to hand a target out to independent code). - void ReferenceTarget(DbgTransportTarget *pTarget); - - // Release reference to a DbgTransportTarget. If this is the last active reference then the connection to - // the proxy will be severed and the object deallocated. - void ReleaseTarget(DbgTransportTarget *pTarget); - -private: - // Private structure used to track references to DbgTransportTargets we've allocated. - struct TargetRef - { - TargetRef *m_pNext; // Next target in singly linked list (or NULL for end of list) - DbgTransportTarget *m_pTarget; // The actual target object - DWORD m_dwIPAddress; // IP address of the target machine - USHORT m_usPort; // TCP port of the proxy on the machine - DWORD m_dwRefCount; // Number of clients with a reference to this target - }; - - LONG m_lRefCount; // Number of references to this manager outstanding - TargetRef *m_pTargets; // Singly linked list of targets allocated so far - RSLock m_sLock; // Lock protecting read and write access to the target list }; -// The one and only instance of the DbgTransportManager in the process. -extern DbgTransportManager *g_pDbgTransportManager; +extern DbgTransportTarget *g_pDbgTransportTarget; #endif // FEATURE_DBGIPC_TRANSPORT_DI diff --git a/src/debug/di/dbgtransportpipeline.cpp b/src/debug/di/dbgtransportpipeline.cpp index b03e59e6c8..9fd1d9090b 100644 --- a/src/debug/di/dbgtransportpipeline.cpp +++ b/src/debug/di/dbgtransportpipeline.cpp @@ -137,11 +137,6 @@ private: m_pProxy->ReleaseTransport(m_pTransport); } m_pTransport = NULL; - - if (m_pProxy) - { - g_pDbgTransportManager->ReleaseTarget(m_pProxy); - } m_pProxy = NULL; } @@ -209,16 +204,17 @@ HRESULT DbgTransportPipeline::CreateProcessUnderDebugger( // Connect to the debugger proxy on the remote machine and ask it to create a process for us. HRESULT hr = E_FAIL; - // Establish a connection to the proxy of the remote machine. - hr = g_pDbgTransportManager->ConnectToTarget(machineInfo.GetIPAddress(), machineInfo.GetPort(), &m_pProxy); - if (SUCCEEDED(hr)) - { - hr = m_pProxy->CreateProcess(lpApplicationName, - lpCommandLine, - lpCurrentDirectory, - lpEnvironment, - &(lpProcessInformation->dwProcessId)); - } + m_pProxy = g_pDbgTransportTarget; + hr = m_pProxy->CreateProcess(lpApplicationName, + lpCommandLine, + lpProcessAttributes, + lpThreadAttributes, + bInheritHandles, + dwCreationFlags, + lpEnvironment, + lpCurrentDirectory, + lpStartupInfo, + lpProcessInformation); if (SUCCEEDED(hr)) { @@ -288,25 +284,23 @@ HRESULT DbgTransportPipeline::DebugActiveProcess(MachineInfo machineInfo, DWORD HRESULT hr = E_FAIL; - // Establish a connection to the proxy of the remote machine. - hr = g_pDbgTransportManager->ConnectToTarget(machineInfo.GetIPAddress(), machineInfo.GetPort(), &m_pProxy); + m_pProxy = g_pDbgTransportTarget; + + // Establish a connection to the actual runtime to be debugged. + hr = m_pProxy->GetTransportForProcess(processId, &m_pTransport, &m_hProcess); if (SUCCEEDED(hr)) { - // Establish a connection to the actual runtime to be debugged. - hr = m_pProxy->GetTransportForProcess(processId, &m_pTransport, &m_hProcess); - if (SUCCEEDED(hr)) + // TODO: Pass this timeout as a parameter all the way from debugger + // Wait for the connection to become useable (or time out). + if (!m_pTransport->WaitForSessionToOpen(10000)) { - // Wait for the connection to become useable (or time out). - if (!m_pTransport->WaitForSessionToOpen(10000)) - { - hr = CORDBG_E_TIMEOUT; - } - else + hr = CORDBG_E_TIMEOUT; + } + else + { + if (!m_pTransport->UseAsDebugger(&m_ticket)) { - if (!m_pTransport->UseAsDebugger(&m_ticket)) - { - hr = CORDBG_E_DEBUGGER_ALREADY_ATTACHED; - } + hr = CORDBG_E_DEBUGGER_ALREADY_ATTACHED; } } } diff --git a/src/debug/di/ddpack.cpp b/src/debug/di/ddpack.cpp deleted file mode 100644 index 5f68c6a34a..0000000000 --- a/src/debug/di/ddpack.cpp +++ /dev/null @@ -1,3731 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -// DDPack.cpp -// Implementation of DDMarshal. -// Lives on DI side. Packs DDInterface calls into a byte stream. -// -// Note that this file is generated by ndp\clr\src\Debug\tools\BuildDDMarshal\. -// Changes should be made to output\DDPack_template.cpp in that directory. -// - - -#include "stdafx.h" - -#ifdef FEATURE_DBGIPC_TRANSPORT_DI -#include "dacdbiinterface.h" - -#include "ddpack.h" - -#include "rspriv.h" // for StringCopyHolder - -#include "ddshared.h" - -// Get common marshaling utilities -#include "ddmarshalutil.h" - - -// Suppress PREFast warning about overly large function -// These functions are automatically generated. -#if defined(_PREFAST_) -#pragma warning(disable:21000) -#endif - -/* -// Called in Real DacDbi-Implementation space. Part of the unpacking stubs. -// Needs -//void HandleDDMessage(ReadBuffer * pSend, WriteBuffer * pResult); - -// Called by Packing stubs from Right-side. -void DDMarshal::SendDDMessage(WriteBuffer * pSend, ReadBuffer * pResult) -{ - // For now, this is an in-memory transport. Simulate sending an event. - // When this becomes IPC events, we'll need a CordbProcess* - ReadBuffer pSend2; - pSend2.Open(pSend); - - WriteBuffer pResult2; - m_pUnpack->HandleDDMessage(&pSend2, &pResult2); - pResult->Open(&pResult2); -} -*/ - -HRESULT DDMarshal::Init() -{ - HandleHolder hDummy; - HRESULT hr = E_FAIL; - - MachineInfo machineInfo = m_pProcess->GetShim()->GetMachineInfo(); - - hr = g_pDbgTransportManager->ConnectToTarget(machineInfo.GetIPAddress(), machineInfo.GetPort(), &m_pProxy); - if (FAILED(hr)) - { - goto Label_Exit; - } - - hr = m_pProxy->GetTransportForProcess(m_pProcess->GetPid(), &m_pTransport, &hDummy); - if (FAILED(hr)) - { - goto Label_Exit; - } - - if (!m_pTransport->WaitForSessionToOpen(10000)) - { - hr = CORDBG_E_TIMEOUT; - goto Label_Exit; - } - -Label_Exit: - if (FAILED(hr)) - { - if (m_pTransport != NULL) - { - m_pProxy->ReleaseTransport(m_pTransport); - } - - if (m_pProxy != NULL) - { - g_pDbgTransportManager->ReleaseTarget(m_pProxy); - } - } - return hr; -} - -void DDMarshal::Destroy() -{ - // The LS DAC resources will be cleaned up when InProcDac is destructed. - if (m_pTransport != NULL) - { - m_pProxy->ReleaseTransport(m_pTransport); - } - - if (m_pProxy != NULL) - { - g_pDbgTransportManager->ReleaseTarget(m_pProxy); - } -} - - - -// {%PackImpls%} - -// -// Impls -// - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::CheckDbiVersion -HRESULT DDMarshal::CheckDbiVersion(const DbiVersion * pVersion) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_CheckDbiVersion); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pVersion); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method CheckDbiVersion - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetLocalInterfaceHashAndTimestamp -void DDMarshal::GetLocalInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2) -{ - hash1 = 0xe5ffdbe6; - hash2 = 0xf26b43be; - hash3 = 0x6c9685ac; - hash4 = 0xdd723940; - timestamp1 = 0x1cc67fb; - timestamp2 = 0xe3ad5a06; -} // end method GetLocalInterfaceHashAndTimestamp - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetRemoteInterfaceHashAndTimestamp -void DDMarshal::GetRemoteInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetRemoteInterfaceHashAndTimestamp); // message id - // Copy in-parameters to the send-buffer - // hash1 does not need to be copied on input - // hash2 does not need to be copied on input - // hash3 does not need to be copied on input - // hash4 does not need to be copied on input - // timestamp1 does not need to be copied on input - // timestamp2 does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, hash1); - ReadFromBuffer(&bRecv, hash2); - ReadFromBuffer(&bRecv, hash3); - ReadFromBuffer(&bRecv, hash4); - ReadFromBuffer(&bRecv, timestamp1); - ReadFromBuffer(&bRecv, timestamp2); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetRemoteInterfaceHashAndTimestamp - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::FlushCache -HRESULT DDMarshal::FlushCache() -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_FlushCache); // message id - // Copy in-parameters to the send-buffer - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method FlushCache - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::DacSetTargetConsistencyChecks -void DDMarshal::DacSetTargetConsistencyChecks(bool fEnableAsserts) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_DacSetTargetConsistencyChecks); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, fEnableAsserts); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method DacSetTargetConsistencyChecks - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsLeftSideInitialized -BOOL DDMarshal::IsLeftSideInitialized() -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsLeftSideInitialized); // message id - // Copy in-parameters to the send-buffer - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsLeftSideInitialized - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAppDomainFromId -VMPTR_AppDomain DDMarshal::GetAppDomainFromId(ULONG appdomainId) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAppDomainFromId); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, appdomainId); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_AppDomain _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetAppDomainFromId - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAppDomainId -ULONG DDMarshal::GetAppDomainId(VMPTR_AppDomain vmAppDomain) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAppDomainId); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - ULONG _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetAppDomainId - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAppDomainObject -VMPTR_OBJECTHANDLE DDMarshal::GetAppDomainObject(VMPTR_AppDomain vmAppDomain) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAppDomainObject); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_OBJECTHANDLE _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetAppDomainObject - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsDefaultDomain -BOOL DDMarshal::IsDefaultDomain(VMPTR_AppDomain vmAppDomain) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsDefaultDomain); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsDefaultDomain - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAssemblyFromDomainAssembly -void DDMarshal::GetAssemblyFromDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, VMPTR_Assembly * vmAssembly) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAssemblyFromDomainAssembly); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainAssembly); - // vmAssembly does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, vmAssembly); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetAssemblyFromDomainAssembly - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsAssemblyFullyTrusted -BOOL DDMarshal::IsAssemblyFullyTrusted(VMPTR_DomainAssembly vmDomainAssembly) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsAssemblyFullyTrusted); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainAssembly); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsAssemblyFullyTrusted - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAppDomainFullName -void DDMarshal::GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAppDomainFullName); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - // pStrName does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pStrName); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetAppDomainFullName - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetModuleSimpleName -void DDMarshal::GetModuleSimpleName(VMPTR_Module vmModule, IStringHolder * pStrFilename) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetModuleSimpleName); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmModule); - // pStrFilename does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pStrFilename); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetModuleSimpleName - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAssemblyPath -BOOL DDMarshal::GetAssemblyPath(VMPTR_Assembly vmAssembly, IStringHolder * pStrFilename) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAssemblyPath); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAssembly); - // pStrFilename does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pStrFilename); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetAssemblyPath - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::ResolveTypeReference -void DDMarshal::ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_ResolveTypeReference); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pTypeRefInfo); - WriteToBuffer(&bSend, pTargetRefInfo); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pTargetRefInfo); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method ResolveTypeReference - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetModulePath -BOOL DDMarshal::GetModulePath(VMPTR_Module vmModule, IStringHolder * pStrFilename) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetModulePath); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmModule); - // pStrFilename does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pStrFilename); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetModulePath - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetModuleNGenPath -BOOL DDMarshal::GetModuleNGenPath(VMPTR_Module vmModule, IStringHolder * pStrFilename) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetModuleNGenPath); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmModule); - // pStrFilename does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pStrFilename); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetModuleNGenPath - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetMetadata -void DDMarshal::GetMetadata(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetMetadata); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmModule); - // pTargetBuffer does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pTargetBuffer); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetMetadata - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetSymbolsBuffer -void DDMarshal::GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer, IDacDbiInterface::SymbolFormat * pSymbolFormat) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetSymbolsBuffer); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmModule); - // pTargetBuffer does not need to be copied on input - // pSymbolFormat does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pTargetBuffer); - ReadFromBuffer(&bRecv, pSymbolFormat); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetSymbolsBuffer - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetModuleData -void DDMarshal::GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetModuleData); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmModule); - // pData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetModuleData - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetDomainFileData -void DDMarshal::GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetDomainFileData); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainFile); - // pData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetDomainFileData - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetModuleForDomainFile -void DDMarshal::GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, VMPTR_Module * pModule) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetModuleForDomainFile); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainFile); - // pModule does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pModule); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetModuleForDomainFile - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAddressType -IDacDbiInterface::AddressType DDMarshal::GetAddressType(CORDB_ADDRESS address) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAddressType); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, address); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - IDacDbiInterface::AddressType _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetAddressType - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsTransitionStub -BOOL DDMarshal::IsTransitionStub(CORDB_ADDRESS address) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsTransitionStub); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, address); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsTransitionStub - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetCompilerFlags -void DDMarshal::GetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL * pfAllowJITOpts, BOOL * pfEnableEnC) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetCompilerFlags); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainFile); - // pfAllowJITOpts does not need to be copied on input - // pfEnableEnC does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pfAllowJITOpts); - ReadFromBuffer(&bRecv, pfEnableEnC); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetCompilerFlags - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::SetCompilerFlags -HRESULT DDMarshal::SetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL fAllowJitOpts, BOOL fEnableEnC) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_SetCompilerFlags); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainFile); - WriteToBuffer(&bSend, fAllowJitOpts); - WriteToBuffer(&bSend, fEnableEnC); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method SetCompilerFlags - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnumerateAppDomains -void DDMarshal::EnumerateAppDomains(IDacDbiInterface::FP_APPDOMAIN_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_EnumerateAppDomains); // message id - // Copy in-parameters to the send-buffer - // fpCallback does not need to be copied on input - // pUserData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - // Result buffer contains the entire enumeration. Now iterate through that - // locally and invoke the user's callback. - while (true) - { - // Check status word before each element. - // 1 means there's another item. 2 means it's the end of the enumeration. - DWORD dw; - ReadFromBuffer(&bRecv, dw); - if (dw == 2) - break; - _ASSERTE(dw == 1); - - VMPTR_AppDomain data; - ReadFromBuffer(&bRecv, data); - - // Invoke user callback. This may throw. - fpCallback(data, pUserData); - } - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method EnumerateAppDomains - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnumerateAssembliesInAppDomain -void DDMarshal::EnumerateAssembliesInAppDomain(VMPTR_AppDomain vmAppDomain, IDacDbiInterface::FP_ASSEMBLY_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_EnumerateAssembliesInAppDomain); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - // fpCallback does not need to be copied on input - // pUserData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - // Result buffer contains the entire enumeration. Now iterate through that - // locally and invoke the user's callback. - while (true) - { - // Check status word before each element. - // 1 means there's another item. 2 means it's the end of the enumeration. - DWORD dw; - ReadFromBuffer(&bRecv, dw); - if (dw == 2) - break; - _ASSERTE(dw == 1); - - VMPTR_DomainAssembly data; - ReadFromBuffer(&bRecv, data); - - // Invoke user callback. This may throw. - fpCallback(data, pUserData); - } - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method EnumerateAssembliesInAppDomain - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnumerateModulesInAssembly -void DDMarshal::EnumerateModulesInAssembly(VMPTR_DomainAssembly vmAssembly, IDacDbiInterface::FP_MODULE_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_EnumerateModulesInAssembly); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAssembly); - // fpCallback does not need to be copied on input - // pUserData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - // Result buffer contains the entire enumeration. Now iterate through that - // locally and invoke the user's callback. - while (true) - { - // Check status word before each element. - // 1 means there's another item. 2 means it's the end of the enumeration. - DWORD dw; - ReadFromBuffer(&bRecv, dw); - if (dw == 2) - break; - _ASSERTE(dw == 1); - - VMPTR_DomainFile data; - ReadFromBuffer(&bRecv, data); - - // Invoke user callback. This may throw. - fpCallback(data, pUserData); - } - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method EnumerateModulesInAssembly - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::RequestSyncAtEvent -void DDMarshal::RequestSyncAtEvent() -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_RequestSyncAtEvent); // message id - // Copy in-parameters to the send-buffer - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method RequestSyncAtEvent - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::MarkDebuggerAttachPending -void DDMarshal::MarkDebuggerAttachPending() -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_MarkDebuggerAttachPending); // message id - // Copy in-parameters to the send-buffer - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method MarkDebuggerAttachPending - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::MarkDebuggerAttached -void DDMarshal::MarkDebuggerAttached(BOOL fAttached) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_MarkDebuggerAttached); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, fAttached); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method MarkDebuggerAttached - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::Hijack -void DDMarshal::Hijack(VMPTR_Thread vmThread, ULONG32 dwThreadId, const EXCEPTION_RECORD * pRecord, T_CONTEXT * pOriginalContext, ULONG32 cbSizeContext, EHijackReason::EHijackReason reason, void * pUserData, CORDB_ADDRESS * pRemoteContextAddr) -{ - _ASSERTE(!"Calling unimplemented callback:Hijack"); -} // end method Hijack - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnumerateConnections -void DDMarshal::EnumerateConnections(IDacDbiInterface::FP_CONNECTION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -{ - _ASSERTE(!"Calling unimplemented callback:EnumerateConnections"); -} // end method EnumerateConnections - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnumerateThreads -void DDMarshal::EnumerateThreads(IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_EnumerateThreads); // message id - // Copy in-parameters to the send-buffer - // fpCallback does not need to be copied on input - // pUserData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - // Result buffer contains the entire enumeration. Now iterate through that - // locally and invoke the user's callback. - while (true) - { - // Check status word before each element. - // 1 means there's another item. 2 means it's the end of the enumeration. - DWORD dw; - ReadFromBuffer(&bRecv, dw); - if (dw == 2) - break; - _ASSERTE(dw == 1); - - VMPTR_Thread data; - ReadFromBuffer(&bRecv, data); - - // Invoke user callback. This may throw. - fpCallback(data, pUserData); - } - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method EnumerateThreads - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsThreadMarkedDead -bool DDMarshal::IsThreadMarkedDead(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsThreadMarkedDead); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - bool _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsThreadMarkedDead - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetThreadHandle -HANDLE DDMarshal::GetThreadHandle(VMPTR_Thread vmThread) -{ - _ASSERTE(!"Calling unimplemented callback:GetThreadHandle"); - ThrowHR(E_NOTIMPL); -} // end method GetThreadHandle - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetThreadObject -VMPTR_OBJECTHANDLE DDMarshal::GetThreadObject(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetThreadObject); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_OBJECTHANDLE _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetThreadObject - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::SetDebugState -void DDMarshal::SetDebugState(VMPTR_Thread vmThread, CorDebugThreadState debugState) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_SetDebugState); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - WriteToBuffer(&bSend, debugState); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method SetDebugState - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::HasUnhandledException -BOOL DDMarshal::HasUnhandledException(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_HasUnhandledException); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method HasUnhandledException - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetUserState -CorDebugUserState DDMarshal::GetUserState(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetUserState); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - CorDebugUserState _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetUserState - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetConnectionID -CONNID DDMarshal::GetConnectionID(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetConnectionID); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - CONNID _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetConnectionID - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetTaskID -TASKID DDMarshal::GetTaskID(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetTaskID); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - TASKID _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetTaskID - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::TryGetVolatileOSThreadID -DWORD DDMarshal::TryGetVolatileOSThreadID(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_TryGetVolatileOSThreadID); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - DWORD _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method TryGetVolatileOSThreadID - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetUniqueThreadID -DWORD DDMarshal::GetUniqueThreadID(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetUniqueThreadID); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - DWORD _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetUniqueThreadID - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetCurrentException -VMPTR_OBJECTHANDLE DDMarshal::GetCurrentException(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetCurrentException); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_OBJECTHANDLE _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetCurrentException - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetCurrentCustomDebuggerNotification -VMPTR_OBJECTHANDLE DDMarshal::GetCurrentCustomDebuggerNotification(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetCurrentCustomDebuggerNotification); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_OBJECTHANDLE _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetCurrentCustomDebuggerNotification - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetCurrentAppDomain -VMPTR_AppDomain DDMarshal::GetCurrentAppDomain(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetCurrentAppDomain); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_AppDomain _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetCurrentAppDomain - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::ResolveAssembly -VMPTR_DomainAssembly DDMarshal::ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_ResolveAssembly); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmScope); - WriteToBuffer(&bSend, tkAssemblyRef); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_DomainAssembly _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method ResolveAssembly - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetNativeCodeSequencePointsAndVarInfo -void DDMarshal::GetNativeCodeSequencePointsAndVarInfo(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS startAddress, BOOL fCodeAvailabe, NativeVarData * pNativeVarData, SequencePoints * pSequencePoints) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetNativeCodeSequencePointsAndVarInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmMethodDesc); - WriteToBuffer(&bSend, startAddress); - WriteToBuffer(&bSend, fCodeAvailabe); - // pNativeVarData does not need to be copied on input - // pSequencePoints does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pNativeVarData); - ReadFromBuffer(&bRecv, pSequencePoints); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetNativeCodeSequencePointsAndVarInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetManagedStoppedContext -VMPTR_CONTEXT DDMarshal::GetManagedStoppedContext(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetManagedStoppedContext); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_CONTEXT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetManagedStoppedContext - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::CreateStackWalk -void DDMarshal::CreateStackWalk(VMPTR_Thread vmThread, DT_CONTEXT * pInternalContextBuffer, StackWalkHandle * ppSFIHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_CreateStackWalk); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - WriteToBuffer(&bSend, pInternalContextBuffer); - // ppSFIHandle does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pInternalContextBuffer); - ReadFromBuffer(&bRecv, ppSFIHandle); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method CreateStackWalk - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::DeleteStackWalk -void DDMarshal::DeleteStackWalk(StackWalkHandle ppSFIHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_DeleteStackWalk); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, ppSFIHandle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method DeleteStackWalk - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetStackWalkCurrentContext -void DDMarshal::GetStackWalkCurrentContext(StackWalkHandle pSFIHandle, DT_CONTEXT * pContext) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetStackWalkCurrentContext); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pSFIHandle); - WriteToBuffer(&bSend, pContext); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pContext); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetStackWalkCurrentContext - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::SetStackWalkCurrentContext -void DDMarshal::SetStackWalkCurrentContext(VMPTR_Thread vmThread, StackWalkHandle pSFIHandle, CorDebugSetContextFlag flag, DT_CONTEXT * pContext) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_SetStackWalkCurrentContext); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - WriteToBuffer(&bSend, pSFIHandle); - WriteToBuffer(&bSend, flag); - WriteToBuffer(&bSend, pContext); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pContext); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method SetStackWalkCurrentContext - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::UnwindStackWalkFrame -BOOL DDMarshal::UnwindStackWalkFrame(StackWalkHandle pSFIHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_UnwindStackWalkFrame); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pSFIHandle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method UnwindStackWalkFrame - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::CheckContext -HRESULT DDMarshal::CheckContext(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_CheckContext); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - WriteToBuffer(&bSend, pContext); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method CheckContext - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetStackWalkCurrentFrameInfo -IDacDbiInterface::FrameType DDMarshal::GetStackWalkCurrentFrameInfo(StackWalkHandle pSFIHandle, DebuggerIPCE_STRData * pFrameData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetStackWalkCurrentFrameInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pSFIHandle); - DebuggerIPCE_STRData temp_pFrameData; // backing storage for optional parameter - if (pFrameData == NULL) - pFrameData = &temp_pFrameData; - WriteToBuffer(&bSend, pFrameData); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pFrameData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - IDacDbiInterface::FrameType _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetStackWalkCurrentFrameInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetCountOfInternalFrames -ULONG32 DDMarshal::GetCountOfInternalFrames(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetCountOfInternalFrames); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - ULONG32 _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetCountOfInternalFrames - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnumerateInternalFrames -void DDMarshal::EnumerateInternalFrames(VMPTR_Thread vmThread, IDacDbiInterface::FP_INTERNAL_FRAME_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_EnumerateInternalFrames); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - // fpCallback does not need to be copied on input - // pUserData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - // Result buffer contains the entire enumeration. Now iterate through that - // locally and invoke the user's callback. - while (true) - { - // Check status word before each element. - // 1 means there's another item. 2 means it's the end of the enumeration. - DWORD dw; - ReadFromBuffer(&bRecv, dw); - if (dw == 2) - break; - _ASSERTE(dw == 1); - - DebuggerIPCE_STRData data; - ReadFromBuffer(&bRecv, data); - - // Invoke user callback. This may throw. - fpCallback(&data, pUserData); - } - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method EnumerateInternalFrames - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsMatchingParentFrame -BOOL DDMarshal::IsMatchingParentFrame(FramePointer fpToCheck, FramePointer fpParent) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsMatchingParentFrame); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, fpToCheck); - WriteToBuffer(&bSend, fpParent); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsMatchingParentFrame - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetStackParameterSize -ULONG32 DDMarshal::GetStackParameterSize(CORDB_ADDRESS controlPC) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetStackParameterSize); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, controlPC); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - ULONG32 _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetStackParameterSize - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetFramePointer -FramePointer DDMarshal::GetFramePointer(StackWalkHandle pSFIHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetFramePointer); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pSFIHandle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - FramePointer _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetFramePointer - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsLeafFrame -BOOL DDMarshal::IsLeafFrame(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsLeafFrame); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - WriteToBuffer(&bSend, pContext); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsLeafFrame - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetContext -void DDMarshal::GetContext(VMPTR_Thread vmThread, DT_CONTEXT * pContextBuffer) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetContext); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - WriteToBuffer(&bSend, pContextBuffer); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pContextBuffer); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetContext - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::ConvertContextToDebuggerRegDisplay -void DDMarshal::ConvertContextToDebuggerRegDisplay(const DT_CONTEXT * pInContext, DebuggerREGDISPLAY * pOutDRD, BOOL fActive) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_ConvertContextToDebuggerRegDisplay); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pInContext); - WriteToBuffer(&bSend, pOutDRD); - WriteToBuffer(&bSend, fActive); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pOutDRD); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method ConvertContextToDebuggerRegDisplay - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsILStubOrLCGMethod -IDacDbiInterface::DynamicMethodType DDMarshal::IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsILStubOrLCGMethod); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmMethodDesc); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - IDacDbiInterface::DynamicMethodType _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsILStubOrLCGMethod - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetVarArgSig -TargetBuffer DDMarshal::GetVarArgSig(CORDB_ADDRESS VASigCookieAddr, CORDB_ADDRESS * pArgBase) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetVarArgSig); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, VASigCookieAddr); - // pArgBase does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pArgBase); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - TargetBuffer _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetVarArgSig - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::RequiresAlign8 -BOOL DDMarshal::RequiresAlign8(VMPTR_TypeHandle thExact) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_RequiresAlign8); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, thExact); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method RequiresAlign8 - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::ResolveExactGenericArgsToken -GENERICS_TYPE_TOKEN DDMarshal::ResolveExactGenericArgsToken(DWORD dwExactGenericArgsTokenIndex, GENERICS_TYPE_TOKEN rawToken) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_ResolveExactGenericArgsToken); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, dwExactGenericArgsTokenIndex); - WriteToBuffer(&bSend, rawToken); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - GENERICS_TYPE_TOKEN _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method ResolveExactGenericArgsToken - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetILCodeAndSig -void DDMarshal::GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetILCodeAndSig); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainFile); - WriteToBuffer(&bSend, functionToken); - // pCodeInfo does not need to be copied on input - // pLocalSigToken does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pCodeInfo); - ReadFromBuffer(&bRecv, pLocalSigToken); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetILCodeAndSig - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetNativeCodeInfo -void DDMarshal::GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, mdToken functionToken, NativeCodeFunctionData * pCodeInfo) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetNativeCodeInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainFile); - WriteToBuffer(&bSend, functionToken); - // pCodeInfo does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pCodeInfo); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetNativeCodeInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetNativeCodeInfoForAddr -void DDMarshal::GetNativeCodeInfoForAddr(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS hotCodeStartAddr, NativeCodeFunctionData * pCodeInfo) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetNativeCodeInfoForAddr); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmMethodDesc); - WriteToBuffer(&bSend, hotCodeStartAddr); - WriteToBuffer(&bSend, pCodeInfo); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pCodeInfo); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetNativeCodeInfoForAddr - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetClassInfo -void DDMarshal::GetClassInfo(VMPTR_AppDomain vmAppDomain, VMPTR_Module vmModule, mdTypeDef metadataToken, VMPTR_TypeHandle thExact, VMPTR_TypeHandle thApprox, ClassInfo * pData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetClassInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, vmModule); - WriteToBuffer(&bSend, metadataToken); - WriteToBuffer(&bSend, thExact); - WriteToBuffer(&bSend, thApprox); - WriteToBuffer(&bSend, pData); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetClassInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetInstantiationFieldInfo -void DDMarshal::GetInstantiationFieldInfo(VMPTR_DomainFile vmDomainFile, mdTypeDef metadataToken, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList<FieldData> * pFieldList, SIZE_T * pObjectSize) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetInstantiationFieldInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmDomainFile); - WriteToBuffer(&bSend, metadataToken); - WriteToBuffer(&bSend, vmThExact); - WriteToBuffer(&bSend, vmThApprox); - // pFieldList does not need to be copied on input - // pObjectSize does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pFieldList); - ReadFromBuffer(&bRecv, pObjectSize); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetInstantiationFieldInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::TypeHandleToExpandedTypeInfo -void DDMarshal::TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, DebuggerIPCE_ExpandedTypeData * pTypeInfo) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_TypeHandleToExpandedTypeInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, boxed); - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, vmTypeHandle); - WriteToBuffer(&bSend, pTypeInfo); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pTypeInfo); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method TypeHandleToExpandedTypeInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetObjectExpandedTypeInfo -void DDMarshal::GetObjectExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, CORDB_ADDRESS addr, DebuggerIPCE_ExpandedTypeData * pTypeInfo) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetObjectExpandedTypeInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, boxed); - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, addr); - // pTypeInfo does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pTypeInfo); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetObjectExpandedTypeInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetObjectExpandedTypeInfoFromID -void DDMarshal::GetObjectExpandedTypeInfoFromID(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, COR_TYPEID id, DebuggerIPCE_ExpandedTypeData * pTypeInfo) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetObjectExpandedTypeInfoFromID); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, boxed); - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, id); - // pTypeInfo does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pTypeInfo); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetObjectExpandedTypeInfoFromID - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetApproxTypeHandle -VMPTR_TypeHandle DDMarshal::GetApproxTypeHandle(TypeInfoList * pTypeData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetApproxTypeHandle); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pTypeData); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pTypeData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_TypeHandle _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetApproxTypeHandle - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetExactTypeHandle -HRESULT DDMarshal::GetExactTypeHandle(DebuggerIPCE_ExpandedTypeData * pTypeData, ArgInfoList * pArgInfo, VMPTR_TypeHandle & vmTypeHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetExactTypeHandle); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pTypeData); - WriteToBuffer(&bSend, pArgInfo); - WriteToBuffer(&bSend, vmTypeHandle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pTypeData); - ReadFromBuffer(&bRecv, pArgInfo); - ReadFromBuffer(&bRecv, vmTypeHandle); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetExactTypeHandle - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetMethodDescParams -void DDMarshal::GetMethodDescParams(VMPTR_AppDomain vmAppDomain, VMPTR_MethodDesc vmMethodDesc, GENERICS_TYPE_TOKEN genericsToken, UINT32 * pcGenericClassTypeParams, TypeParamsList * pGenericTypeParams) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetMethodDescParams); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, vmMethodDesc); - WriteToBuffer(&bSend, genericsToken); - // pcGenericClassTypeParams does not need to be copied on input - // pGenericTypeParams does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pcGenericClassTypeParams); - ReadFromBuffer(&bRecv, pGenericTypeParams); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetMethodDescParams - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetThreadOrContextStaticAddress -CORDB_ADDRESS DDMarshal::GetThreadOrContextStaticAddress(VMPTR_FieldDesc vmField, VMPTR_Thread vmRuntimeThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetThreadOrContextStaticAddress); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmField); - WriteToBuffer(&bSend, vmRuntimeThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - CORDB_ADDRESS _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetThreadOrContextStaticAddress - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetCollectibleTypeStaticAddress -CORDB_ADDRESS DDMarshal::GetCollectibleTypeStaticAddress(VMPTR_FieldDesc vmField, VMPTR_AppDomain vmAppDomain) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetCollectibleTypeStaticAddress); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmField); - WriteToBuffer(&bSend, vmAppDomain); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - CORDB_ADDRESS _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetCollectibleTypeStaticAddress - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetEnCHangingFieldInfo -void DDMarshal::GetEnCHangingFieldInfo(const EnCHangingFieldInfo * pEnCFieldInfo, FieldData * pFieldData, BOOL * pfStatic) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetEnCHangingFieldInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pEnCFieldInfo); - // pFieldData does not need to be copied on input - // pfStatic does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pFieldData); - ReadFromBuffer(&bRecv, pfStatic); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetEnCHangingFieldInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetTypeHandleParams -void DDMarshal::GetTypeHandleParams(VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, TypeParamsList * pParams) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetTypeHandleParams); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, vmTypeHandle); - // pParams does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pParams); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetTypeHandleParams - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetSimpleType -void DDMarshal::GetSimpleType(VMPTR_AppDomain vmAppDomain, CorElementType simpleType, mdTypeDef * pMetadataToken, VMPTR_Module * pVmModule, VMPTR_DomainFile * pVmDomainFile) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetSimpleType); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, simpleType); - // pMetadataToken does not need to be copied on input - // pVmModule does not need to be copied on input - // pVmDomainFile does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pMetadataToken); - ReadFromBuffer(&bRecv, pVmModule); - ReadFromBuffer(&bRecv, pVmDomainFile); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetSimpleType - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsExceptionObject -BOOL DDMarshal::IsExceptionObject(VMPTR_Object vmObject) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsExceptionObject); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmObject); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsExceptionObject - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetStackFramesFromException -void DDMarshal::GetStackFramesFromException(VMPTR_Object vmObject, DacDbiArrayList<DacExceptionCallStackData> & dacStackFrames) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetStackFramesFromException); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmObject); - WriteToBuffer(&bSend, dacStackFrames); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, dacStackFrames); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetStackFramesFromException - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsRcw -BOOL DDMarshal::IsRcw(VMPTR_Object vmObject) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsRcw); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmObject); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsRcw - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetRcwCachedInterfaceTypes -void DDMarshal::GetRcwCachedInterfaceTypes(VMPTR_Object vmObject, VMPTR_AppDomain vmAppDomain, BOOL bIInspectableOnly, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pDacInterfaces) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetRcwCachedInterfaceTypes); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmObject); - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, bIInspectableOnly); - // pDacInterfaces does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pDacInterfaces); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetRcwCachedInterfaceTypes - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetRcwCachedInterfacePointers -void DDMarshal::GetRcwCachedInterfacePointers(VMPTR_Object vmObject, BOOL bIInspectableOnly, DacDbiArrayList<CORDB_ADDRESS> * pDacItfPtrs) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetRcwCachedInterfacePointers); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmObject); - WriteToBuffer(&bSend, bIInspectableOnly); - // pDacItfPtrs does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pDacItfPtrs); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetRcwCachedInterfacePointers - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetCachedWinRTTypesForIIDs -void DDMarshal::GetCachedWinRTTypesForIIDs(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> & iids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetCachedWinRTTypesForIIDs); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, iids); - // pTypes does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, iids); - ReadFromBuffer(&bRecv, pTypes); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetCachedWinRTTypesForIIDs - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetCachedWinRTTypes -void DDMarshal::GetCachedWinRTTypes(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> * piids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetCachedWinRTTypes); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmAppDomain); - // piids does not need to be copied on input - // pTypes does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, piids); - ReadFromBuffer(&bRecv, pTypes); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetCachedWinRTTypes - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetTypedByRefInfo -void DDMarshal::GetTypedByRefInfo(CORDB_ADDRESS pTypedByRef, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetTypedByRefInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, pTypedByRef); - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, pObjectData); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pObjectData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetTypedByRefInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetStringData -void DDMarshal::GetStringData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetStringData); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, objectAddress); - WriteToBuffer(&bSend, pObjectData); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pObjectData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetStringData - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetArrayData -void DDMarshal::GetArrayData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetArrayData); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, objectAddress); - WriteToBuffer(&bSend, pObjectData); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pObjectData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetArrayData - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetBasicObjectInfo -void DDMarshal::GetBasicObjectInfo(CORDB_ADDRESS objectAddress, CorElementType type, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetBasicObjectInfo); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, objectAddress); - WriteToBuffer(&bSend, type); - WriteToBuffer(&bSend, vmAppDomain); - WriteToBuffer(&bSend, pObjectData); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pObjectData); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetBasicObjectInfo - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::TestCrst -void DDMarshal::TestCrst(VMPTR_Crst vmCrst) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_TestCrst); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmCrst); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method TestCrst - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::TestRWLock -void DDMarshal::TestRWLock(VMPTR_SimpleRWLock vmRWLock) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_TestRWLock); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmRWLock); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method TestRWLock - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetDebuggerControlBlockAddress -CORDB_ADDRESS DDMarshal::GetDebuggerControlBlockAddress() -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetDebuggerControlBlockAddress); // message id - // Copy in-parameters to the send-buffer - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - CORDB_ADDRESS _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetDebuggerControlBlockAddress - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetObjectFromRefPtr -VMPTR_Object DDMarshal::GetObjectFromRefPtr(CORDB_ADDRESS ptr) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetObjectFromRefPtr); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, ptr); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_Object _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetObjectFromRefPtr - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetObject -VMPTR_Object DDMarshal::GetObject(CORDB_ADDRESS ptr) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetObject); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, ptr); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_Object _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetObject - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnableNGENPolicy -HRESULT DDMarshal::EnableNGENPolicy(CorDebugNGENPolicy ePolicy) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_EnableNGENPolicy); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, ePolicy); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method EnableNGENPolicy - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetVmObjectHandle -VMPTR_OBJECTHANDLE DDMarshal::GetVmObjectHandle(CORDB_ADDRESS handleAddress) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetVmObjectHandle); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, handleAddress); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - VMPTR_OBJECTHANDLE _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetVmObjectHandle - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsVmObjectHandleValid -BOOL DDMarshal::IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsVmObjectHandleValid); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmHandle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - BOOL _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsVmObjectHandleValid - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsWinRTModule -HRESULT DDMarshal::IsWinRTModule(VMPTR_Module vmModule, BOOL & isWinRT) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsWinRTModule); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmModule); - WriteToBuffer(&bSend, isWinRT); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, isWinRT); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsWinRTModule - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAppDomainIdFromVmObjectHandle -ULONG DDMarshal::GetAppDomainIdFromVmObjectHandle(VMPTR_OBJECTHANDLE vmHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAppDomainIdFromVmObjectHandle); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmHandle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - ULONG _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetAppDomainIdFromVmObjectHandle - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetHandleAddressFromVmHandle -CORDB_ADDRESS DDMarshal::GetHandleAddressFromVmHandle(VMPTR_OBJECTHANDLE vmHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetHandleAddressFromVmHandle); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmHandle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - CORDB_ADDRESS _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetHandleAddressFromVmHandle - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetObjectContents -TargetBuffer DDMarshal::GetObjectContents(VMPTR_Object obj) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetObjectContents); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, obj); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - TargetBuffer _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetObjectContents - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnumerateBlockingObjects -void DDMarshal::EnumerateBlockingObjects(VMPTR_Thread vmThread, IDacDbiInterface::FP_BLOCKINGOBJECT_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_EnumerateBlockingObjects); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - // fpCallback does not need to be copied on input - // pUserData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - // Result buffer contains the entire enumeration. Now iterate through that - // locally and invoke the user's callback. - while (true) - { - // Check status word before each element. - // 1 means there's another item. 2 means it's the end of the enumeration. - DWORD dw; - ReadFromBuffer(&bRecv, dw); - if (dw == 2) - break; - _ASSERTE(dw == 1); - - DacBlockingObject data; - ReadFromBuffer(&bRecv, data); - - // Invoke user callback. This may throw. - fpCallback(data, pUserData); - } - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method EnumerateBlockingObjects - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetThreadOwningMonitorLock -MonitorLockInfo DDMarshal::GetThreadOwningMonitorLock(VMPTR_Object vmObject) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetThreadOwningMonitorLock); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmObject); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - MonitorLockInfo _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetThreadOwningMonitorLock - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::EnumerateMonitorEventWaitList -void DDMarshal::EnumerateMonitorEventWaitList(VMPTR_Object vmObject, IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_EnumerateMonitorEventWaitList); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmObject); - // fpCallback does not need to be copied on input - // pUserData does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - // Result buffer contains the entire enumeration. Now iterate through that - // locally and invoke the user's callback. - while (true) - { - // Check status word before each element. - // 1 means there's another item. 2 means it's the end of the enumeration. - DWORD dw; - ReadFromBuffer(&bRecv, dw); - if (dw == 2) - break; - _ASSERTE(dw == 1); - - VMPTR_Thread data; - ReadFromBuffer(&bRecv, data); - - // Invoke user callback. This may throw. - fpCallback(data, pUserData); - } - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method EnumerateMonitorEventWaitList - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAttachStateFlags -CLR_DEBUGGING_PROCESS_FLAGS DDMarshal::GetAttachStateFlags() -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAttachStateFlags); // message id - // Copy in-parameters to the send-buffer - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - CLR_DEBUGGING_PROCESS_FLAGS _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetAttachStateFlags - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetMetaDataFileInfoFromPEFile -bool DDMarshal::GetMetaDataFileInfoFromPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwImageSize, bool & isNGEN, IStringHolder * pStrFilename) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetMetaDataFileInfoFromPEFile); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmPEFile); - WriteToBuffer(&bSend, dwTimeStamp); - WriteToBuffer(&bSend, dwImageSize); - WriteToBuffer(&bSend, isNGEN); - // pStrFilename does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, dwTimeStamp); - ReadFromBuffer(&bRecv, dwImageSize); - ReadFromBuffer(&bRecv, isNGEN); - ReadFromBuffer(&bRecv, pStrFilename); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - bool _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetMetaDataFileInfoFromPEFile - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetILImageInfoFromNgenPEFile -bool DDMarshal::GetILImageInfoFromNgenPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwSize, IStringHolder * pStrFilename) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetILImageInfoFromNgenPEFile); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmPEFile); - WriteToBuffer(&bSend, dwTimeStamp); - WriteToBuffer(&bSend, dwSize); - // pStrFilename does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, dwTimeStamp); - ReadFromBuffer(&bRecv, dwSize); - ReadFromBuffer(&bRecv, pStrFilename); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - bool _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetILImageInfoFromNgenPEFile - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsThreadSuspendedOrHijacked -bool DDMarshal::IsThreadSuspendedOrHijacked(VMPTR_Thread vmThread) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsThreadSuspendedOrHijacked); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, vmThread); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - bool _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsThreadSuspendedOrHijacked - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::AreGCStructuresValid -bool DDMarshal::AreGCStructuresValid() -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_AreGCStructuresValid); // message id - // Copy in-parameters to the send-buffer - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - bool _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method AreGCStructuresValid - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::CreateHeapWalk -HRESULT DDMarshal::CreateHeapWalk(HeapWalkHandle * pHandle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_CreateHeapWalk); // message id - // Copy in-parameters to the send-buffer - // pHandle does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pHandle); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method CreateHeapWalk - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::DeleteHeapWalk -void DDMarshal::DeleteHeapWalk(HeapWalkHandle handle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_DeleteHeapWalk); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, handle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method DeleteHeapWalk - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::WalkHeap -HRESULT DDMarshal::WalkHeap(HeapWalkHandle handle, ULONG count, COR_HEAPOBJECT * objects, ULONG * pFetched) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_WalkHeap); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, handle); - WriteToBuffer(&bSend, count); - // objects does not need to be copied on input - // pFetched does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, objects); - ReadFromBuffer(&bRecv, pFetched); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method WalkHeap - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetHeapSegments -HRESULT DDMarshal::GetHeapSegments(DacDbiArrayList<COR_SEGMENT> * pSegments) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetHeapSegments); // message id - // Copy in-parameters to the send-buffer - // pSegments does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pSegments); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetHeapSegments - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::IsValidObject -bool DDMarshal::IsValidObject(CORDB_ADDRESS obj) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_IsValidObject); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, obj); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - bool _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method IsValidObject - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetAppDomainForObject -bool DDMarshal::GetAppDomainForObject(CORDB_ADDRESS obj, VMPTR_AppDomain * pApp, VMPTR_Module * pModule, VMPTR_DomainFile * pDomainFile) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetAppDomainForObject); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, obj); - // pApp does not need to be copied on input - // pModule does not need to be copied on input - // pDomainFile does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pApp); - ReadFromBuffer(&bRecv, pModule); - ReadFromBuffer(&bRecv, pDomainFile); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - bool _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetAppDomainForObject - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::CreateRefWalk -HRESULT DDMarshal::CreateRefWalk(RefWalkHandle * pHandle, BOOL walkStacks, BOOL walkFQ, UINT32 handleWalkMask) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_CreateRefWalk); // message id - // Copy in-parameters to the send-buffer - // pHandle does not need to be copied on input - WriteToBuffer(&bSend, walkStacks); - WriteToBuffer(&bSend, walkFQ); - WriteToBuffer(&bSend, handleWalkMask); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pHandle); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method CreateRefWalk - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::DeleteRefWalk -void DDMarshal::DeleteRefWalk(RefWalkHandle handle) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_DeleteRefWalk); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, handle); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method DeleteRefWalk - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::WalkRefs -HRESULT DDMarshal::WalkRefs(RefWalkHandle handle, ULONG count, DacGcReference * refs, ULONG * pFetched) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_WalkRefs); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, handle); - WriteToBuffer(&bSend, count); - // refs does not need to be copied on input - // pFetched does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, refs); - ReadFromBuffer(&bRecv, pFetched); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method WalkRefs - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetTypeID -HRESULT DDMarshal::GetTypeID(CORDB_ADDRESS obj, COR_TYPEID * pType) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetTypeID); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, obj); - WriteToBuffer(&bSend, pType); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pType); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetTypeID - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetObjectFields -HRESULT DDMarshal::GetObjectFields(COR_TYPEID id, ULONG32 celt, COR_FIELD * layout, ULONG32 * pceltFetched) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetObjectFields); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, id); - WriteToBuffer(&bSend, celt); - // layout does not need to be copied on input - // pceltFetched does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, layout); - ReadFromBuffer(&bRecv, pceltFetched); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetObjectFields - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetTypeLayout -HRESULT DDMarshal::GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT * pLayout) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetTypeLayout); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, id); - WriteToBuffer(&bSend, pLayout); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pLayout); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetTypeLayout - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetArrayLayout -HRESULT DDMarshal::GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT * pLayout) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetArrayLayout); // message id - // Copy in-parameters to the send-buffer - WriteToBuffer(&bSend, id); - WriteToBuffer(&bSend, pLayout); - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pLayout); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - // Check return value - HRESULT _retValue; - ReadFromBuffer(&bRecv, _retValue); - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read - return _retValue; -} // end method GetArrayLayout - -//--------------------------------------------------------------------- -// Stub for virtual IDacDbiInterface::GetGCHeapInformation -void DDMarshal::GetGCHeapInformation(COR_HEAPINFO * pHeapInfo) -{ - WriteBuffer bSend; - ReadBuffer bRecv; - - WriteToBuffer(&bSend, DDID_GetGCHeapInformation); // message id - // Copy in-parameters to the send-buffer - // pHeapInfo does not need to be copied on input - - SendDDMessage(&bSend, &bRecv); - - //Copy out-parameters (including status and return value) from receive buffer - ReadFromBuffer(&bRecv, pHeapInfo); - - // Throw last so that any out-params are still updated. - HRESULT hrException; - ReadFromBuffer(&bRecv, hrException); - IfFailThrow(hrException); - - _ASSERTE(bRecv.IsAtEnd()); // ensure buffer is fully read -} // end method GetGCHeapInformation - - -#endif //FEATURE_DBGIPC_TRANSPORT_DI - -// end of file - diff --git a/src/debug/di/ddpack.h b/src/debug/di/ddpack.h deleted file mode 100644 index a83eb1ccb7..0000000000 --- a/src/debug/di/ddpack.h +++ /dev/null @@ -1,346 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -// Packer -// -// Lives on debugger right-side -// -// Note that this file is generated by ndp\clr\src\Debug\tools\BuildDDMarshal\. -// Changes should be made to output\DDPack_template.h in that directory. -// - - -#ifndef _DD_PACK_H_ -#define _DD_PACK_H_ - -#ifdef FEATURE_DBGIPC_TRANSPORT_DI - - class WriteBuffer; - class ReadBuffer; - - // Flow is: - // RS --> DDPack --> byte streams --> DDUnpack --> Real IDacDbiInterface - - // PAck up DD interface to a byte-sream. - class DDMarshal : public IDacDbiInterface - { - public: - /* - DDMarshal(IDacDbiInterface * pReal, DDUnpack * pUnpack) - { - m_pReal = pReal; - m_pUnpack = pUnpack; - } - // Used for trivial wrappers where we can't marshal yet. - IDacDbiInterface * m_pReal; - - // The unpacker that gets called on the other side. - DDUnpack * m_pUnpack; - - */ - - DDMarshal(CordbProcess * pProcess) - { - m_pProcess = pProcess; - m_sLock.Init("DDMarshal Lock", RSLock::cLockFlat, RSLock::LL_DD_MARSHAL_LOCK); - } - - ~DDMarshal() - { - m_sLock.Destroy(); - } - - HRESULT Init(); - - DbgTransportTarget * m_pProxy; - DbgTransportSession * m_pTransport; - CordbProcess * m_pProcess; - RSLock m_sLock; - - // Each DD interface boils down to calling Send. - void SendDDMessage(WriteBuffer * pSend, ReadBuffer * pResult); - - - // Sig without '=0' at end; - // virtual BOOL IsAssemblyFullyTrusted(VMPTR_DomainAssembly vmDomainAssembly, T* myRef, MyStruct * pStruct); -// -// Signature definitions -// -virtual HRESULT CheckDbiVersion(const DbiVersion * pVersion); - -virtual void GetLocalInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2); - -virtual void GetRemoteInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2); - -virtual HRESULT FlushCache(); - -virtual void DacSetTargetConsistencyChecks(bool fEnableAsserts); - -virtual void Destroy(); - -virtual BOOL IsLeftSideInitialized(); - -virtual VMPTR_AppDomain GetAppDomainFromId(ULONG appdomainId); - -virtual ULONG GetAppDomainId(VMPTR_AppDomain vmAppDomain); - -virtual VMPTR_OBJECTHANDLE GetAppDomainObject(VMPTR_AppDomain vmAppDomain); - -virtual BOOL IsDefaultDomain(VMPTR_AppDomain vmAppDomain); - -virtual void GetAssemblyFromDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, VMPTR_Assembly * vmAssembly); - -virtual BOOL IsAssemblyFullyTrusted(VMPTR_DomainAssembly vmDomainAssembly); - -virtual void GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName); - -virtual void GetModuleSimpleName(VMPTR_Module vmModule, IStringHolder * pStrFilename); - -virtual BOOL GetAssemblyPath(VMPTR_Assembly vmAssembly, IStringHolder * pStrFilename); - -virtual void ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo); - -virtual BOOL GetModulePath(VMPTR_Module vmModule, IStringHolder * pStrFilename); - -virtual BOOL GetModuleNGenPath(VMPTR_Module vmModule, IStringHolder * pStrFilename); - -virtual void GetMetadata(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer); - -virtual void GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer, IDacDbiInterface::SymbolFormat * pSymbolFormat); - -virtual void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData); - -virtual void GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData); - -virtual void GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, VMPTR_Module * pModule); - -virtual IDacDbiInterface::AddressType GetAddressType(CORDB_ADDRESS address); - -virtual BOOL IsTransitionStub(CORDB_ADDRESS address); - -virtual void GetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL * pfAllowJITOpts, BOOL * pfEnableEnC); - -virtual HRESULT SetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL fAllowJitOpts, BOOL fEnableEnC); - -virtual void EnumerateAppDomains(IDacDbiInterface::FP_APPDOMAIN_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData); - -virtual void EnumerateAssembliesInAppDomain(VMPTR_AppDomain vmAppDomain, IDacDbiInterface::FP_ASSEMBLY_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData); - -virtual void EnumerateModulesInAssembly(VMPTR_DomainAssembly vmAssembly, IDacDbiInterface::FP_MODULE_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData); - -virtual void RequestSyncAtEvent(); - -virtual void MarkDebuggerAttachPending(); - -virtual void MarkDebuggerAttached(BOOL fAttached); - -virtual void Hijack(VMPTR_Thread vmThread, ULONG32 dwThreadId, const EXCEPTION_RECORD * pRecord, T_CONTEXT * pOriginalContext, ULONG32 cbSizeContext, EHijackReason::EHijackReason reason, void * pUserData, CORDB_ADDRESS * pRemoteContextAddr); - -virtual void EnumerateConnections(IDacDbiInterface::FP_CONNECTION_CALLBACK fpCallback, CALLBACK_DATA pUserData); - -virtual void EnumerateThreads(IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData); - -virtual bool IsThreadMarkedDead(VMPTR_Thread vmThread); - -virtual HANDLE GetThreadHandle(VMPTR_Thread vmThread); - -virtual VMPTR_OBJECTHANDLE GetThreadObject(VMPTR_Thread vmThread); - -virtual void SetDebugState(VMPTR_Thread vmThread, CorDebugThreadState debugState); - -virtual BOOL HasUnhandledException(VMPTR_Thread vmThread); - -virtual CorDebugUserState GetUserState(VMPTR_Thread vmThread); - -virtual CONNID GetConnectionID(VMPTR_Thread vmThread); - -virtual TASKID GetTaskID(VMPTR_Thread vmThread); - -virtual DWORD TryGetVolatileOSThreadID(VMPTR_Thread vmThread); - -virtual DWORD GetUniqueThreadID(VMPTR_Thread vmThread); - -virtual VMPTR_OBJECTHANDLE GetCurrentException(VMPTR_Thread vmThread); - -virtual VMPTR_OBJECTHANDLE GetCurrentCustomDebuggerNotification(VMPTR_Thread vmThread); - -virtual VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread); - -virtual VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef); - -virtual void GetNativeCodeSequencePointsAndVarInfo(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS startAddress, BOOL fCodeAvailabe, NativeVarData * pNativeVarData, SequencePoints * pSequencePoints); - -virtual VMPTR_CONTEXT GetManagedStoppedContext(VMPTR_Thread vmThread); - -virtual void CreateStackWalk(VMPTR_Thread vmThread, DT_CONTEXT * pInternalContextBuffer, StackWalkHandle * ppSFIHandle); - -virtual void DeleteStackWalk(StackWalkHandle ppSFIHandle); - -virtual void GetStackWalkCurrentContext(StackWalkHandle pSFIHandle, DT_CONTEXT * pContext); - -virtual void SetStackWalkCurrentContext(VMPTR_Thread vmThread, StackWalkHandle pSFIHandle, CorDebugSetContextFlag flag, DT_CONTEXT * pContext); - -virtual BOOL UnwindStackWalkFrame(StackWalkHandle pSFIHandle); - -virtual HRESULT CheckContext(VMPTR_Thread vmThread, const DT_CONTEXT * pContext); - -virtual IDacDbiInterface::FrameType GetStackWalkCurrentFrameInfo(StackWalkHandle pSFIHandle, DebuggerIPCE_STRData * pFrameData); - -virtual ULONG32 GetCountOfInternalFrames(VMPTR_Thread vmThread); - -virtual void EnumerateInternalFrames(VMPTR_Thread vmThread, IDacDbiInterface::FP_INTERNAL_FRAME_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData); - -virtual BOOL IsMatchingParentFrame(FramePointer fpToCheck, FramePointer fpParent); - -virtual ULONG32 GetStackParameterSize(CORDB_ADDRESS controlPC); - -virtual FramePointer GetFramePointer(StackWalkHandle pSFIHandle); - -virtual BOOL IsLeafFrame(VMPTR_Thread vmThread, const DT_CONTEXT * pContext); - -virtual void GetContext(VMPTR_Thread vmThread, DT_CONTEXT * pContextBuffer); - -virtual void ConvertContextToDebuggerRegDisplay(const DT_CONTEXT * pInContext, DebuggerREGDISPLAY * pOutDRD, BOOL fActive); - -virtual IDacDbiInterface::DynamicMethodType IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc); - -virtual TargetBuffer GetVarArgSig(CORDB_ADDRESS VASigCookieAddr, CORDB_ADDRESS * pArgBase); - -virtual BOOL RequiresAlign8(VMPTR_TypeHandle thExact); - -virtual GENERICS_TYPE_TOKEN ResolveExactGenericArgsToken(DWORD dwExactGenericArgsTokenIndex, GENERICS_TYPE_TOKEN rawToken); - -virtual void GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken); - -virtual void GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, mdToken functionToken, NativeCodeFunctionData * pCodeInfo); - -virtual void GetNativeCodeInfoForAddr(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS hotCodeStartAddr, NativeCodeFunctionData * pCodeInfo); - -virtual void GetClassInfo(VMPTR_AppDomain vmAppDomain, VMPTR_Module vmModule, mdTypeDef metadataToken, VMPTR_TypeHandle thExact, VMPTR_TypeHandle thApprox, ClassInfo * pData); - -virtual void GetInstantiationFieldInfo(VMPTR_DomainFile vmDomainFile, mdTypeDef metadataToken, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList<FieldData> * pFieldList, SIZE_T * pObjectSize); - -virtual void TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, DebuggerIPCE_ExpandedTypeData * pTypeInfo); - -virtual void GetObjectExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, CORDB_ADDRESS addr, DebuggerIPCE_ExpandedTypeData * pTypeInfo); - -virtual void GetObjectExpandedTypeInfoFromID(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, COR_TYPEID id, DebuggerIPCE_ExpandedTypeData * pTypeInfo); - -virtual VMPTR_TypeHandle GetApproxTypeHandle(TypeInfoList * pTypeData); - -virtual HRESULT GetExactTypeHandle(DebuggerIPCE_ExpandedTypeData * pTypeData, ArgInfoList * pArgInfo, VMPTR_TypeHandle & vmTypeHandle); - -virtual void GetMethodDescParams(VMPTR_AppDomain vmAppDomain, VMPTR_MethodDesc vmMethodDesc, GENERICS_TYPE_TOKEN genericsToken, UINT32 * pcGenericClassTypeParams, TypeParamsList * pGenericTypeParams); - -virtual CORDB_ADDRESS GetThreadOrContextStaticAddress(VMPTR_FieldDesc vmField, VMPTR_Thread vmRuntimeThread); - -virtual CORDB_ADDRESS GetCollectibleTypeStaticAddress(VMPTR_FieldDesc vmField, VMPTR_AppDomain vmAppDomain); - -virtual void GetEnCHangingFieldInfo(const EnCHangingFieldInfo * pEnCFieldInfo, FieldData * pFieldData, BOOL * pfStatic); - -virtual void GetTypeHandleParams(VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, TypeParamsList * pParams); - -virtual void GetSimpleType(VMPTR_AppDomain vmAppDomain, CorElementType simpleType, mdTypeDef * pMetadataToken, VMPTR_Module * pVmModule, VMPTR_DomainFile * pVmDomainFile); - -virtual BOOL IsExceptionObject(VMPTR_Object vmObject); - -virtual void GetStackFramesFromException(VMPTR_Object vmObject, DacDbiArrayList<DacExceptionCallStackData> & dacStackFrames); - -virtual BOOL IsRcw(VMPTR_Object vmObject); - -virtual void GetRcwCachedInterfaceTypes(VMPTR_Object vmObject, VMPTR_AppDomain vmAppDomain, BOOL bIInspectableOnly, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pDacInterfaces); - -virtual void GetRcwCachedInterfacePointers(VMPTR_Object vmObject, BOOL bIInspectableOnly, DacDbiArrayList<CORDB_ADDRESS> * pDacItfPtrs); - -virtual void GetCachedWinRTTypesForIIDs(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> & iids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes); - -virtual void GetCachedWinRTTypes(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> * piids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes); - -virtual void GetTypedByRefInfo(CORDB_ADDRESS pTypedByRef, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData); - -virtual void GetStringData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData); - -virtual void GetArrayData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData); - -virtual void GetBasicObjectInfo(CORDB_ADDRESS objectAddress, CorElementType type, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData); - -virtual void TestCrst(VMPTR_Crst vmCrst); - -virtual void TestRWLock(VMPTR_SimpleRWLock vmRWLock); - -virtual CORDB_ADDRESS GetDebuggerControlBlockAddress(); - -virtual VMPTR_Object GetObjectFromRefPtr(CORDB_ADDRESS ptr); - -virtual VMPTR_Object GetObject(CORDB_ADDRESS ptr); - -virtual HRESULT EnableNGENPolicy(CorDebugNGENPolicy ePolicy); - -virtual VMPTR_OBJECTHANDLE GetVmObjectHandle(CORDB_ADDRESS handleAddress); - -virtual BOOL IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle); - -virtual HRESULT IsWinRTModule(VMPTR_Module vmModule, BOOL & isWinRT); - -virtual ULONG GetAppDomainIdFromVmObjectHandle(VMPTR_OBJECTHANDLE vmHandle); - -virtual CORDB_ADDRESS GetHandleAddressFromVmHandle(VMPTR_OBJECTHANDLE vmHandle); - -virtual TargetBuffer GetObjectContents(VMPTR_Object obj); - -virtual void EnumerateBlockingObjects(VMPTR_Thread vmThread, IDacDbiInterface::FP_BLOCKINGOBJECT_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData); - -virtual MonitorLockInfo GetThreadOwningMonitorLock(VMPTR_Object vmObject); - -virtual void EnumerateMonitorEventWaitList(VMPTR_Object vmObject, IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData); - -virtual CLR_DEBUGGING_PROCESS_FLAGS GetAttachStateFlags(); - -virtual bool GetMetaDataFileInfoFromPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwImageSize, bool & isNGEN, IStringHolder * pStrFilename); - -virtual bool GetILImageInfoFromNgenPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwSize, IStringHolder * pStrFilename); - -virtual bool IsThreadSuspendedOrHijacked(VMPTR_Thread vmThread); - -virtual bool AreGCStructuresValid(); - -virtual HRESULT CreateHeapWalk(HeapWalkHandle * pHandle); - -virtual void DeleteHeapWalk(HeapWalkHandle handle); - -virtual HRESULT WalkHeap(HeapWalkHandle handle, ULONG count, COR_HEAPOBJECT * objects, ULONG * pFetched); - -virtual HRESULT GetHeapSegments(DacDbiArrayList<COR_SEGMENT> * pSegments); - -virtual bool IsValidObject(CORDB_ADDRESS obj); - -virtual bool GetAppDomainForObject(CORDB_ADDRESS obj, VMPTR_AppDomain * pApp, VMPTR_Module * pModule, VMPTR_DomainFile * pDomainFile); - -virtual HRESULT CreateRefWalk(RefWalkHandle * pHandle, BOOL walkStacks, BOOL walkFQ, UINT32 handleWalkMask); - -virtual void DeleteRefWalk(RefWalkHandle handle); - -virtual HRESULT WalkRefs(RefWalkHandle handle, ULONG count, DacGcReference * refs, ULONG * pFetched); - -virtual HRESULT GetTypeID(CORDB_ADDRESS obj, COR_TYPEID * pType); - -virtual HRESULT GetObjectFields(COR_TYPEID id, ULONG32 celt, COR_FIELD * layout, ULONG32 * pceltFetched); - -virtual HRESULT GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT * pLayout); - -virtual HRESULT GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT * pLayout); - -virtual void GetGCHeapInformation(COR_HEAPINFO * pHeapInfo); - - - - }; - -#endif //FEATURE_DBGIPC_TRANSPORT_DI - - -#endif // _DD_PACK_H_ - -// end of file diff --git a/src/debug/di/eventchannel.h b/src/debug/di/eventchannel.h index 232f6e0a10..9bdd2c7479 100644 --- a/src/debug/di/eventchannel.h +++ b/src/debug/di/eventchannel.h @@ -58,7 +58,7 @@ // - LS: code:DebuggerRCThread::SendIPCEvent // // In a sense, you can think of the LS and the RS sharing 3 channels: one for debug events (see -// code:INativeEventPipeline), one for DDI calls (see code:IDacDbiInterface and code:DDMarshal::SendDDMessage), +// code:INativeEventPipeline), one for DDI calls (see code:IDacDbiInterface), // and one for "IPC" events. This is the interface for the "IPC" events. // diff --git a/src/debug/di/platformspecific.cpp b/src/debug/di/platformspecific.cpp index b7cdfe228e..1acd4fc186 100644 --- a/src/debug/di/platformspecific.cpp +++ b/src/debug/di/platformspecific.cpp @@ -17,8 +17,6 @@ #include "dbgtransportpipeline.cpp" #include "shimremotedatatarget.cpp" #include "remoteeventchannel.cpp" -#include "ddpack.cpp" -#elif FEATURE_PAL #else #include "WindowsPipeline.cpp" #include "EventRedirectionPipeline.cpp" diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp index fcf9d8ff35..2653f5627f 100644 --- a/src/debug/di/process.cpp +++ b/src/debug/di/process.cpp @@ -1198,6 +1198,7 @@ HRESULT ShimProcess::DebugActiveProcess( _ASSERTE(SUCCEEDED(hr)); +#if !defined(FEATURE_DBGIPC_TRANSPORT_DI) // Don't do this when we are remote debugging since we won't be getting the loader breakpoint. // We don't support JIT attach in remote debugging scenarios anyway. // @@ -1229,6 +1230,7 @@ HRESULT ShimProcess::DebugActiveProcess( // Wait for the completion of marking pending attach bit or debugger detaching WaitForMultipleObjectsEx(dwHandles, arrHandles, FALSE, INFINITE, FALSE); } +#endif //!FEATURE_DBGIPC_TRANSPORT_DI } EX_CATCH_HRESULT(hr); @@ -2138,10 +2140,10 @@ HRESULT CordbProcess::QueryInterface(REFIID id, void **pInterface) { *pInterface = static_cast<ICorDebugProcess7*>(this); } - else if (id == IID_ICorDebugProcess8) - { - *pInterface = static_cast<ICorDebugProcess8*>(this); - } + else if (id == IID_ICorDebugProcess8) + { + *pInterface = static_cast<ICorDebugProcess8*>(this); + } #ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL else if (id == IID_ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly) { @@ -7491,7 +7493,7 @@ void CordbProcess::GetEventBlock(BOOL * pfBlockExists) // Verify that the control block is valid. // This will throw on error. VerifyControlBlock(); - + *pfBlockExists = true; } else @@ -7654,8 +7656,8 @@ HRESULT CordbProcess::GetRuntimeOffsets() #elif FEATURE_PAL m_hHelperThread = NULL; //RS is supposed to be able to live without a helper thread handle. #else - m_hHelperThread = OpenThread(SYNCHRONIZE, FALSE, dwHelperTid); - CONSISTENCY_CHECK_MSGF(m_hHelperThread != NULL, ("Failed to get helper-thread handle. tid=0x%x\n", dwHelperTid)); + m_hHelperThread = OpenThread(SYNCHRONIZE, FALSE, dwHelperTid); + CONSISTENCY_CHECK_MSGF(m_hHelperThread != NULL, ("Failed to get helper-thread handle. tid=0x%x\n", dwHelperTid)); #endif } @@ -9825,12 +9827,11 @@ HRESULT CordbProcess::EnsureClrInstanceIdSet() { #ifdef FEATURE_CORESYSTEM - _ASSERTE(m_cordb->GetTargetCLR() != 0); - if(m_cordb->GetTargetCLR() != 0) - { - m_clrInstanceId = PTR_TO_CORDB_ADDRESS(m_cordb->GetTargetCLR()); - return S_OK; - } + if(m_cordb->GetTargetCLR() != 0) + { + m_clrInstanceId = PTR_TO_CORDB_ADDRESS(m_cordb->GetTargetCLR()); + return S_OK; + } #endif // The only case in which we're allowed to request the "default" CLR instance @@ -11827,26 +11828,26 @@ CordbUnmanagedThread * CordbProcess::GetUnmanagedThreadFromEvent(const DEBUG_EVE this->GetEventBlock(&fBlockExists); - // If we have the debugger control block, and if that control block has the address of the thread proc for - // the helper thread, then we're initialized enough on the Left Side to recgonize the helper thread based on - // its thread proc's address. - if (this->GetDCB() != NULL) - { - // get the latest LS DCB information - UpdateRightSideDCB(); - if ((this->GetDCB()->m_helperThreadStartAddr != NULL) && (pUnmanagedThread != NULL)) - { - void * pStartAddr = GetThreadUserStartAddr(pEvent); - - if (pStartAddr == this->GetDCB()->m_helperThreadStartAddr) - { - // Remember the ID of the helper thread. - this->m_helperThreadId = pEvent->dwThreadId; - - LOG((LF_CORDB, LL_INFO1000, "W32ET::W32EL: Left Side Helper Thread is 0x%x\n", pEvent->dwThreadId)); - } - } - } + // If we have the debugger control block, and if that control block has the address of the thread proc for + // the helper thread, then we're initialized enough on the Left Side to recgonize the helper thread based on + // its thread proc's address. + if (this->GetDCB() != NULL) + { + // get the latest LS DCB information + UpdateRightSideDCB(); + if ((this->GetDCB()->m_helperThreadStartAddr != NULL) && (pUnmanagedThread != NULL)) + { + void * pStartAddr = GetThreadUserStartAddr(pEvent); + + if (pStartAddr == this->GetDCB()->m_helperThreadStartAddr) + { + // Remember the ID of the helper thread. + this->m_helperThreadId = pEvent->dwThreadId; + + LOG((LF_CORDB, LL_INFO1000, "W32ET::W32EL: Left Side Helper Thread is 0x%x\n", pEvent->dwThreadId)); + } + } + } } EX_CATCH_HRESULT(hr) { diff --git a/src/debug/di/remoteeventchannel.cpp b/src/debug/di/remoteeventchannel.cpp index 7699808f55..f57ecff884 100644 --- a/src/debug/di/remoteeventchannel.cpp +++ b/src/debug/di/remoteeventchannel.cpp @@ -101,15 +101,9 @@ HRESULT NewEventChannelForThisPlatform(CORDB_ADDRESS pLeftSideDCB, RemoteEventChannel * pEventChannel = NULL; DebuggerIPCControlBlock * pDCBBuffer = NULL; - DbgTransportTarget * pProxy = NULL; + DbgTransportTarget * pProxy = g_pDbgTransportTarget; DbgTransportSession * pTransport = NULL; - hr = g_pDbgTransportManager->ConnectToTarget(machineInfo.GetIPAddress(), machineInfo.GetPort(), &pProxy); - if (FAILED(hr)) - { - goto Label_Exit; - } - hr = pProxy->GetTransportForProcess(dwProcessId, &pTransport, &hDummy); if (FAILED(hr)) { @@ -154,12 +148,6 @@ Label_Exit: { pProxy->ReleaseTransport(pTransport); } - - if (pProxy != NULL) - { - g_pDbgTransportManager->ReleaseTarget(pProxy); - } - if (pDCBBuffer != NULL) { delete pDCBBuffer; @@ -222,11 +210,6 @@ void RemoteEventChannel::Delete() m_pProxy->ReleaseTransport(m_pTransport); } - if (m_pProxy != NULL) - { - g_pDbgTransportManager->ReleaseTarget(m_pProxy); - } - delete this; } @@ -315,7 +298,7 @@ HRESULT RemoteEventChannel::SendEventToLeftSide(DebuggerIPCEvent * pEvent, SIZE_ HRESULT RemoteEventChannel::GetReplyFromLeftSide(DebuggerIPCEvent * pReplyEvent, SIZE_T eventSize) { // Delegate to the transport. - m_pTransport->GetNextEvent(pReplyEvent, eventSize); + m_pTransport->GetNextEvent(pReplyEvent, (DWORD)eventSize); return S_OK; } diff --git a/src/debug/di/shimlocaldatatarget.cpp b/src/debug/di/shimlocaldatatarget.cpp index 66dd64a02d..45d0b6cebe 100644 --- a/src/debug/di/shimlocaldatatarget.cpp +++ b/src/debug/di/shimlocaldatatarget.cpp @@ -80,6 +80,9 @@ private: // Note: throws BOOL CompatibleHostAndTargetPlatforms(HANDLE hTargetProcess) { +#if defined(FEATURE_PAL) + return TRUE; +#else // get the platform for the host process BOOL fHostProcessIsWow64 = FALSE; BOOL fSuccess = FALSE; @@ -118,6 +121,7 @@ BOOL CompatibleHostAndTargetPlatforms(HANDLE hTargetProcess) { return TRUE; } +#endif } // CompatibleHostAndTargetPlatforms // Helper macro to check for failure conditions at the start of data-target methods. diff --git a/src/debug/di/shimpriv.h b/src/debug/di/shimpriv.h index a402abf503..c3a505175c 100644 --- a/src/debug/di/shimpriv.h +++ b/src/debug/di/shimpriv.h @@ -518,10 +518,8 @@ protected: HANDLE m_markAttachPendingEvent; HANDLE m_terminatingEvent; -#if !defined(FEATURE_CORESYSTEM) - // Finds the base address of mscorwks.dll + // Finds the base address of [core]clr.dll CORDB_ADDRESS GetCLRInstanceBaseAddress(); -#endif // !defined(FEATURE_CORESYSTEM) // // Event Queues diff --git a/src/debug/di/shimprocess.cpp b/src/debug/di/shimprocess.cpp index d289923302..39d41ddac9 100644 --- a/src/debug/di/shimprocess.cpp +++ b/src/debug/di/shimprocess.cpp @@ -19,7 +19,11 @@ #include <limits.h> #include "shimpriv.h" +#if defined(FEATURE_PAL) +#include "debug-pal.h" +#else #include <tlhelp32.h> +#endif //--------------------------------------------------------------------------------------- // @@ -1083,8 +1087,8 @@ HRESULT ShimProcess::QueueFakeThreadAttachEventsNoOrder() HRESULT ShimProcess::QueueFakeThreadAttachEventsNativeOrder() { #ifdef FEATURE_CORESYSTEM - _ASSERTE("NYI"); - return E_FAIL; + _ASSERTE("NYI"); + return E_FAIL; #else ICorDebugProcess * pProcess = GetProcess(); @@ -1731,22 +1735,22 @@ void ShimProcess::PreDispatchEvent(bool fRealCreateProcessEvent /*= false*/) } -#if !defined(FEATURE_CORESYSTEM) - // ---------------------------------------------------------------------------- // ShimProcess::GetCLRInstanceBaseAddress -// Finds the base address of mscorwks.dll +// Finds the base address of [core]clr.dll // Arguments: none -// Return value: returns the base address of mscorwks.dll if possible or NULL otherwise +// Return value: returns the base address of [core]clr.dll if possible or NULL otherwise // CORDB_ADDRESS ShimProcess::GetCLRInstanceBaseAddress() { - // get a "snapshot" of all modules in the target + CORDB_ADDRESS baseAddress = CORDB_ADDRESS(NULL); DWORD dwPid = m_pLiveDataTarget->GetPid(); +#if defined(FEATURE_PAL) + baseAddress = PTR_TO_CORDB_ADDRESS (GetDynamicLibraryAddressInProcess(dwPid, MAKEDLLNAME_A(MAIN_CLR_MODULE_NAME_A))); +#elif !defined(FEATURE_CORESYSTEM) + // get a "snapshot" of all modules in the target HandleHolder hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwPid); MODULEENTRY32 moduleEntry = { 0 }; - CORDB_ADDRESS baseAddress = CORDB_ADDRESS(NULL); - if (hSnapshot == INVALID_HANDLE_VALUE) { @@ -1775,10 +1779,9 @@ CORDB_ADDRESS ShimProcess::GetCLRInstanceBaseAddress() } while (Module32Next(hSnapshot, &moduleEntry)); } } - +#endif return baseAddress; } // ShimProcess::GetCLRInstanceBaseAddress -#endif // ---------------------------------------------------------------------------- // ShimProcess::FindLoadedCLR @@ -1799,18 +1802,11 @@ CORDB_ADDRESS ShimProcess::GetCLRInstanceBaseAddress() // HRESULT ShimProcess::FindLoadedCLR(CORDB_ADDRESS * pClrInstanceId) { - // - // Look up the image base of mscorwks from shared memory. - // Note that we could instead use OS facilities to look at the real module list, - // such as CreateToolHelp32Snapshot, and LoadModuleFirst - // - -#if !defined(FEATURE_CORESYSTEM) - *pClrInstanceId = GetCLRInstanceBaseAddress(); -#else - _ASSERTE(!"Attempting to get CLR base address on non-Windows platform"); +#if defined(FEATURE_CORESYSTEM) && !defined(FEATURE_PAL) + _ASSERTE(!"Attempting to get CLR base address on Windows-core platform"); return E_NOTIMPL; -#endif +#else + *pClrInstanceId = GetCLRInstanceBaseAddress(); if (*pClrInstanceId == 0) { @@ -1818,6 +1814,7 @@ HRESULT ShimProcess::FindLoadedCLR(CORDB_ADDRESS * pClrInstanceId) } return S_OK; +#endif } //--------------------------------------------------------------------------------------- diff --git a/src/debug/di/shimremotedatatarget.cpp b/src/debug/di/shimremotedatatarget.cpp index 77b834fa15..3498700ac1 100644 --- a/src/debug/di/shimremotedatatarget.cpp +++ b/src/debug/di/shimremotedatatarget.cpp @@ -130,11 +130,6 @@ void ShimRemoteDataTarget::Dispose() m_pProxy->ReleaseTransport(m_pTransport); } - if (m_pProxy != NULL) - { - g_pDbgTransportManager->ReleaseTarget(m_pProxy); - } - m_hr = CORDBG_E_OBJECT_NEUTERED; } @@ -163,15 +158,9 @@ HRESULT BuildPlatformSpecificDataTarget(MachineInfo machineInfo, HRESULT hr = E_FAIL; ShimRemoteDataTarget * pRemoteDataTarget = NULL; - DbgTransportTarget * pProxy = NULL; + DbgTransportTarget * pProxy = g_pDbgTransportTarget; DbgTransportSession * pTransport = NULL; - hr = g_pDbgTransportManager->ConnectToTarget(machineInfo.GetIPAddress(), machineInfo.GetPort(), &pProxy); - if (FAILED(hr)) - { - goto Label_Exit; - } - hr = pProxy->GetTransportForProcess(processId, &pTransport, &hDummy); if (FAILED(hr)) { @@ -210,10 +199,6 @@ Label_Exit: { pProxy->ReleaseTransport(pTransport); } - if (pProxy != NULL) - { - g_pDbgTransportManager->ReleaseTarget(pProxy); - } } } @@ -225,14 +210,28 @@ HRESULT STDMETHODCALLTYPE ShimRemoteDataTarget::GetPlatform( CorDebugPlatform *pPlatform) { - // Assume that we're running on Windows debugging a process on Mac for now. -#if defined(DBG_TARGET_ARM) - *pPlatform = CORDB_PLATFORM_WINDOWS_ARM; -#elif defined(DBG_TARGET_X86) - *pPlatform = CORDB_PLATFORM_WINDOWS_X86; +#ifdef FEATURE_PAL + #if defined(DBG_TARGET_X86) + *pPlatform = CORDB_PLATFORM_MAC_X86; + #elif defined(DBG_TARGET_AMD64) + *pPlatform = CORDB_PLATFORM_MAC_AMD64; + #else + #error Unknown Processor. + #endif #else -#error Unknown Processor. + #if defined(DBG_TARGET_X86) + *pPlatform = CORDB_PLATFORM_WINDOWS_X86; + #elif defined(DBG_TARGET_AMD64) + *pPlatform = CORDB_PLATFORM_WINDOWS_AMD64; + #elif defined(DBG_TARGET_ARM) + *pPlatform = CORDB_PLATFORM_WINDOWS_ARM; + #elif defined(DBG_TARGET_ARM64) + *pPlatform = CORDB_PLATFORM_WINDOWS_ARM64; + #else + #error Unknown Processor. + #endif #endif + return S_OK; } diff --git a/src/debug/ee/CMakeLists.txt b/src/debug/ee/CMakeLists.txt index bd4849e316..aa59a7a957 100644 --- a/src/debug/ee/CMakeLists.txt +++ b/src/debug/ee/CMakeLists.txt @@ -36,18 +36,11 @@ set(CORDBEE_SOURCES_DAC ${CORDBEE_SOURCES_DAC_AND_WKS} ) -if(WIN32) - list(APPEND CORDBEE_SOURCES_WKS - # The following files need to be ported to Linux - inprocdac.cpp - dbgtransportproxy.cpp - ddunpack.cpp - ) -else() +if(CLR_CMAKE_PLATFORM_UNIX) list(APPEND CORDBEE_SOURCES_WKS dactable.cpp ) -endif(WIN32) +endif(CLR_CMAKE_PLATFORM_UNIX) if (IS_64BIT_BUILD EQUAL 1) list(APPEND CORDBEE_SOURCES_WKS amd64/amd64walker.cpp) diff --git a/src/debug/ee/EE.props b/src/debug/ee/EE.props index 409f5048a5..90b9f815fd 100644 --- a/src/debug/ee/EE.props +++ b/src/debug/ee/EE.props @@ -36,9 +36,6 @@ <SourcesNodac Include="$(Clrbase)\src\Debug\EE\Canary.cpp" /> <SourcesNodac Include="$(Clrbase)\src\Debug\EE\shared.cpp" /> <SourcesNodac Include="$(Clrbase)\src\Debug\EE\frameinfo.cpp" /> - <SourcesNodac Include="$(Clrbase)\src\Debug\EE\InProcDac.cpp" /> - <SourcesNodac Include="$(Clrbase)\src\Debug\EE\DbgTransportProxy.cpp" /> - <SourcesNodac Include="$(Clrbase)\src\Debug\EE\ddunpack.cpp" /> </ItemGroup> <ItemGroup> <I386Sources Condition="'$(TargetArch)' == 'i386'" Include="$(Clrbase)\src\Debug\EE\i386\x86walker.cpp" /> diff --git a/src/debug/ee/dbgtransportproxy.cpp b/src/debug/ee/dbgtransportproxy.cpp deleted file mode 100644 index 7847d9aff3..0000000000 --- a/src/debug/ee/dbgtransportproxy.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - - -#include "stdafx.h" -#include "dbgtransportsession.h" -#include "dbgtransportproxy.h" -#include "dbgproxy.h" - -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - -// -// Provides access to the debugging proxy process from the left side. -// - -DbgTransportProxy::DbgTransportProxy() -{ - memset(this, 0, sizeof(*this)); -} - -// Startup and shutdown. Initialization takes the port number (in host byte order) that the left side will -// wait on for debugger connections. -HRESULT DbgTransportProxy::Init(unsigned short usPort) -{ - // Query the debugger configuration for the current user, this will give us the port number the proxy is - // using. By the time the this method is called we know that debugging is configured on for this process. - DbgConfiguration sDbgConfig; - if (!GetDebuggerConfiguration(&sDbgConfig)) - return E_OUTOFMEMORY; - _ASSERTE(sDbgConfig.m_fEnabled); - m_usProxyPort = sDbgConfig.m_usProxyPort; - - m_usPort = usPort; - - // Initialize some data the proxy needs when we register. - m_uiPID = GetCurrentProcessId(); - - // Allocate the connection manager and initialize it. - m_pConnectionManager = AllocateSecConnMgr(); - if (m_pConnectionManager == NULL) - return E_OUTOFMEMORY; - - SecConnStatus eStatus = m_pConnectionManager->Initialize(); - if (eStatus != SCS_Success) - return eStatus == SCS_OutOfMemory ? E_OUTOFMEMORY : E_FAIL; - - return S_OK; -} - -void DbgTransportProxy::Shutdown() -{ - if (m_pConnectionManager) - m_pConnectionManager->Destroy(); -} - -// Talk with the proxy process and register this instantiation of the runtime with it. The reply from the -// proxy will indicate whether a debugger wishes to attach to us before any managed code is allowed to -// run. This method is synchronous and will wait for the reply from the proxy (or a timeout). -DbgProxyResult DbgTransportProxy::RegisterWithProxy() -{ - // Attempt a connection to the proxy. Any failure is treated as the proxy not being there. No time for - // retries and timeouts, we're holding up process startup. - SecConn *pConnection = NULL; - SecConnStatus eStatus = m_pConnectionManager->AllocateConnection(DBGIPC_NTOHL(inet_addr("127.0.0.1")), - m_usProxyPort, - &pConnection); - if (eStatus == SCS_Success) - eStatus = pConnection->Connect(); - - if (eStatus != SCS_Success) - { - DbgTransportLog(LC_Proxy, "DbgTransportProxy::RegisterWithProxy(): failed to connect to proxy"); - if (pConnection) - pConnection->Destroy(); - return RequestTimedOut; - } - - // Format a registration message for the proxy. - DbgProxyRegisterRuntimeMessage sRequest; - sRequest.m_sHeader.m_eType = DPMT_RegisterRuntime; - sRequest.m_sHeader.m_uiRequestID = 0; - sRequest.m_sHeader.m_uiMagic = DBGPROXY_MAGIC_VALUE(&sRequest.m_sHeader); - sRequest.m_sHeader.m_uiReserved = 0; - sRequest.m_uiMajorVersion = kCurrentMajorVersion; - sRequest.m_uiMinorVersion = kCurrentMinorVersion; - sRequest.m_uiPID = m_uiPID; - sRequest.m_usPort = m_usPort; - - // Send the message. If we can't even do that we act as though the proxy timed out on us (runtime startup - // will continue and this process will not be debuggable). - if (!pConnection->Send((unsigned char*)&sRequest, sizeof(sRequest))) - { - DbgTransportLog(LC_Proxy, "DbgTransportProxy::RegisterWithProxy(): failed to send registration to proxy"); - return RequestTimedOut; - } - - // Wait for the reply. - DbgProxyMessageHeader sReply; - if (!pConnection->Receive((unsigned char*)&sReply, sizeof(sReply))) - { - DbgTransportLog(LC_Proxy, "DbgTransportProxy::RegisterWithProxy(): failed to receive reply from proxy"); - return RequestTimedOut; - } - - // Validate reply. - if (sReply.m_eType != DPMT_RuntimeRegistered || - sReply.VariantData.RuntimeRegistered.m_uiMajorVersion != (unsigned)kCurrentMajorVersion || - sReply.m_uiMagic != DBGPROXY_MAGIC_VALUE(&sReply)) - { - DbgTransportLog(LC_Proxy, "DbgTransportProxy::RegisterWithProxy(): bad reply from the proxy"); - return RequestTimedOut; - } - - bool fWaitForDebugger = sReply.VariantData.RuntimeRegistered.m_fWaitForDebuggerAttach; - DbgTransportLog(LC_Proxy, "DbgTransportProxy::RegisterWithProxy(): %s for the debugger", - fWaitForDebugger ? "Waiting" : "Not waiting"); - return fWaitForDebugger ? PendingDebuggerAttach : RequestSuccessful; -} - -#endif // FEATURE_DBGIPC_TRANSPORT_VM diff --git a/src/debug/ee/dbgtransportproxy.h b/src/debug/ee/dbgtransportproxy.h deleted file mode 100644 index 25f8a501b3..0000000000 --- a/src/debug/ee/dbgtransportproxy.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - - -#ifndef __DBG_TRANSPORT_PROXY_INCLUDED -#define __DBG_TRANSPORT_PROXY_INCLUDED - -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - -#include "dbgproxy.h" - -// -// Provides access to the debugging proxy process from the left side. -// - -// The answers the proxy can give to us during runtime startup. -enum DbgProxyResult -{ - RequestSuccessful, // Successfully registered the runtime, no debugger is currently interested in us - RequestTimedOut, // Timed-out trying to reach the proxy (it's probably not configured or started) - PendingDebuggerAttach // Successfully registered the runtime, a debugger wishes to attach before code is run -}; - -class DbgTransportProxy -{ -public: - DbgTransportProxy(); - - // Startup and shutdown. Initialization takes the port number (in host byte order) that the left side - // will wait on for debugger connections. - HRESULT Init(unsigned short usPort); - void Shutdown(); - - // Talk with the proxy process and register this instantiation of the runtime with it. The reply from the - // proxy will indicate whether a debugger wishes to attach to us before any managed code is allowed to - // run. This method is synchronous and will wait for the reply from the proxy (or a timeout). - DbgProxyResult RegisterWithProxy(); - -private: - unsigned int m_uiPID; // PID of the current process - unsigned short m_usPort; // Port the LS waits on for debugger connections - unsigned short m_usProxyPort; // Port the proxy waits on for requests - - SecConnMgr *m_pConnectionManager; // Factory for network connections -}; - -#endif // FEATURE_DBGIPC_TRANSPORT_VM - -#endif // __DBG_TRANSPORT_PROXY_INCLUDED diff --git a/src/debug/ee/ddunpack.cpp b/src/debug/ee/ddunpack.cpp deleted file mode 100644 index 90b65c8a98..0000000000 --- a/src/debug/ee/ddunpack.cpp +++ /dev/null @@ -1,4578 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -// Unpacker -// -// Lives on EE side of the fence -// -// Note that this file is generated by ndp\clr\src\Debug\tools\BuildDDMarshal\. -// Changes should be made to output\DDUnpack_template.cpp in that directory. -// - - -#include "stdafx.h" - -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) -#include "dacdbiinterface.h" - -#include "ddshared.h" - -#include "ddmarshalutil.h" - -#include "ddunpack.h" - -#include "../shared/stringcopyholder.cpp" - -// Suppress PREFast warning about overly large function -// These functions are automatically generated. -#if defined(_PREFAST_) -#pragma warning(disable:21000) -#endif - -// general callback for Callback functions. -template <class T> -void GeneralEnumerationCallback(T vmAppDomain, void * pUserData) -{ - WriteBuffer * pResult = (WriteBuffer *) pUserData; - - DWORD dw = 1; // Continue - WriteToBuffer(pResult, dw); - WriteToBuffer(pResult, vmAppDomain); -} - - - - -// -// These stubs are called by the handler -// -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT CheckDbiVersion(const DbiVersion * pVersion) -void DDUnpack::Unpack_CheckDbiVersion(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - DbiVersion _pVersion; // storage - const DbiVersion * pVersion = &_pVersion; - ReadFromBuffer(pSend, &_pVersion); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->CheckDbiVersion(pVersion); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CheckDbiVersion - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetLocalInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2) -void DDUnpack::Unpack_GetLocalInterfaceHashAndTimestamp(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Callbacks not yet implemented - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetLocalInterfaceHashAndTimestamp - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetRemoteInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2) -void DDUnpack::Unpack_GetRemoteInterfaceHashAndTimestamp(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - DWORD hash1; - // hash1 does not need to be copied on input - DWORD hash2; - // hash2 does not need to be copied on input - DWORD hash3; - // hash3 does not need to be copied on input - DWORD hash4; - // hash4 does not need to be copied on input - DWORD timestamp1; - // timestamp1 does not need to be copied on input - DWORD timestamp2; - // timestamp2 does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - hash1 = 0xe5ffdbe6; - hash2 = 0xf26b43be; - hash3 = 0x6c9685ac; - hash4 = 0xdd723940; - timestamp1 = 0x1cc67fb; - timestamp2 = 0xe3ad5a06; - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hash1); - WriteToBuffer(pResult, hash2); - WriteToBuffer(pResult, hash3); - WriteToBuffer(pResult, hash4); - WriteToBuffer(pResult, timestamp1); - WriteToBuffer(pResult, timestamp2); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetRemoteInterfaceHashAndTimestamp - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT FlushCache() -void DDUnpack::Unpack_FlushCache(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->FlushCache(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method FlushCache - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void DacSetTargetConsistencyChecks(bool fEnableAsserts) -void DDUnpack::Unpack_DacSetTargetConsistencyChecks(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - bool fEnableAsserts; - ReadFromBuffer(pSend, fEnableAsserts); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->DacSetTargetConsistencyChecks(fEnableAsserts); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method DacSetTargetConsistencyChecks - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void Destroy() -void DDUnpack::Unpack_Destroy(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->Destroy(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method Destroy - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsLeftSideInitialized() -void DDUnpack::Unpack_IsLeftSideInitialized(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsLeftSideInitialized(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsLeftSideInitialized - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_AppDomain GetAppDomainFromId(ULONG appdomainId) -void DDUnpack::Unpack_GetAppDomainFromId(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - ULONG appdomainId; - ReadFromBuffer(pSend, appdomainId); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_AppDomain _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainFromId(appdomainId); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainFromId - -//--------------------------------------------------------------------- -// Unpacking stub for: -// ULONG GetAppDomainId(VMPTR_AppDomain vmAppDomain) -void DDUnpack::Unpack_GetAppDomainId(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - ULONG _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainId(vmAppDomain); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainId - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetAppDomainObject(VMPTR_AppDomain vmAppDomain) -void DDUnpack::Unpack_GetAppDomainObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainObject(vmAppDomain); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsDefaultDomain(VMPTR_AppDomain vmAppDomain) -void DDUnpack::Unpack_IsDefaultDomain(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsDefaultDomain(vmAppDomain); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsDefaultDomain - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetAssemblyFromDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, VMPTR_Assembly * vmAssembly) -void DDUnpack::Unpack_GetAssemblyFromDomainAssembly(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainAssembly vmDomainAssembly; - ReadFromBuffer(pSend, vmDomainAssembly); - VMPTR_Assembly _vmAssembly; // storage - VMPTR_Assembly * vmAssembly = &_vmAssembly; - // vmAssembly does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetAssemblyFromDomainAssembly(vmDomainAssembly, vmAssembly); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, vmAssembly); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAssemblyFromDomainAssembly - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsAssemblyFullyTrusted(VMPTR_DomainAssembly vmDomainAssembly) -void DDUnpack::Unpack_IsAssemblyFullyTrusted(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainAssembly vmDomainAssembly; - ReadFromBuffer(pSend, vmDomainAssembly); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsAssemblyFullyTrusted(vmDomainAssembly); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsAssemblyFullyTrusted - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName) -void DDUnpack::Unpack_GetAppDomainFullName(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - StringCopyHolder _pStrName; // storage - StringCopyHolder* pStrName = &_pStrName; - // pStrName does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetAppDomainFullName(vmAppDomain, pStrName); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrName); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainFullName - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetModuleSimpleName(VMPTR_Module vmModule, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetModuleSimpleName(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetModuleSimpleName(vmModule, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModuleSimpleName - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL GetAssemblyPath(VMPTR_Assembly vmAssembly, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetAssemblyPath(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Assembly vmAssembly; - ReadFromBuffer(pSend, vmAssembly); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAssemblyPath(vmAssembly, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAssemblyPath - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) -void DDUnpack::Unpack_ResolveTypeReference(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - TypeRefData _pTypeRefInfo; // storage - const TypeRefData * pTypeRefInfo = &_pTypeRefInfo; - ReadFromBuffer(pSend, &_pTypeRefInfo); // serialize to storage - TypeRefData _pTargetRefInfo; // storage - TypeRefData * pTargetRefInfo = &_pTargetRefInfo; - ReadFromBuffer(pSend, &_pTargetRefInfo); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->ResolveTypeReference(pTypeRefInfo, pTargetRefInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTargetRefInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method ResolveTypeReference - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL GetModulePath(VMPTR_Module vmModule, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetModulePath(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetModulePath(vmModule, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModulePath - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL GetModuleNGenPath(VMPTR_Module vmModule, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetModuleNGenPath(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetModuleNGenPath(vmModule, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModuleNGenPath - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetMetadata(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer) -void DDUnpack::Unpack_GetMetadata(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - TargetBuffer _pTargetBuffer; // storage - TargetBuffer * pTargetBuffer = &_pTargetBuffer; - // pTargetBuffer does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetMetadata(vmModule, pTargetBuffer); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTargetBuffer); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetMetadata - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer, IDacDbiInterface::SymbolFormat * pSymbolFormat) -void DDUnpack::Unpack_GetSymbolsBuffer(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - TargetBuffer _pTargetBuffer; // storage - TargetBuffer * pTargetBuffer = &_pTargetBuffer; - // pTargetBuffer does not need to be copied on input - IDacDbiInterface::SymbolFormat _pSymbolFormat; // storage - IDacDbiInterface::SymbolFormat * pSymbolFormat = &_pSymbolFormat; - // pSymbolFormat does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetSymbolsBuffer(vmModule, pTargetBuffer, pSymbolFormat); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTargetBuffer); - WriteToBuffer(pResult, pSymbolFormat); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetSymbolsBuffer - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData) -void DDUnpack::Unpack_GetModuleData(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - ModuleInfo _pData; // storage - ModuleInfo * pData = &_pData; - // pData does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetModuleData(vmModule, pData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModuleData - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData) -void DDUnpack::Unpack_GetDomainFileData(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - DomainFileInfo _pData; // storage - DomainFileInfo * pData = &_pData; - // pData does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetDomainFileData(vmDomainFile, pData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetDomainFileData - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, VMPTR_Module * pModule) -void DDUnpack::Unpack_GetModuleForDomainFile(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - VMPTR_Module _pModule; // storage - VMPTR_Module * pModule = &_pModule; - // pModule does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetModuleForDomainFile(vmDomainFile, pModule); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pModule); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetModuleForDomainFile - -//--------------------------------------------------------------------- -// Unpacking stub for: -// IDacDbiInterface::AddressType GetAddressType(CORDB_ADDRESS address) -void DDUnpack::Unpack_GetAddressType(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS address; - ReadFromBuffer(pSend, address); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - IDacDbiInterface::AddressType _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAddressType(address); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAddressType - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsTransitionStub(CORDB_ADDRESS address) -void DDUnpack::Unpack_IsTransitionStub(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS address; - ReadFromBuffer(pSend, address); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsTransitionStub(address); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsTransitionStub - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL * pfAllowJITOpts, BOOL * pfEnableEnC) -void DDUnpack::Unpack_GetCompilerFlags(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - BOOL _pfAllowJITOpts; // storage - BOOL * pfAllowJITOpts = &_pfAllowJITOpts; - // pfAllowJITOpts does not need to be copied on input - BOOL _pfEnableEnC; // storage - BOOL * pfEnableEnC = &_pfEnableEnC; - // pfEnableEnC does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetCompilerFlags(vmDomainFile, pfAllowJITOpts, pfEnableEnC); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pfAllowJITOpts); - WriteToBuffer(pResult, pfEnableEnC); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCompilerFlags - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT SetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL fAllowJitOpts, BOOL fEnableEnC) -void DDUnpack::Unpack_SetCompilerFlags(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - BOOL fAllowJitOpts; - ReadFromBuffer(pSend, fAllowJitOpts); - BOOL fEnableEnC; - ReadFromBuffer(pSend, fEnableEnC); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->SetCompilerFlags(vmDomainFile, fAllowJitOpts, fEnableEnC); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method SetCompilerFlags - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateAppDomains(IDacDbiInterface::FP_APPDOMAIN_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateAppDomains(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateAppDomains(GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateAppDomains - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateAssembliesInAppDomain(VMPTR_AppDomain vmAppDomain, IDacDbiInterface::FP_ASSEMBLY_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateAssembliesInAppDomain(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateAssembliesInAppDomain(vmAppDomain, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateAssembliesInAppDomain - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateModulesInAssembly(VMPTR_DomainAssembly vmAssembly, IDacDbiInterface::FP_MODULE_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateModulesInAssembly(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainAssembly vmAssembly; - ReadFromBuffer(pSend, vmAssembly); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateModulesInAssembly(vmAssembly, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateModulesInAssembly - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void RequestSyncAtEvent() -void DDUnpack::Unpack_RequestSyncAtEvent(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->RequestSyncAtEvent(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method RequestSyncAtEvent - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void MarkDebuggerAttachPending() -void DDUnpack::Unpack_MarkDebuggerAttachPending(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->MarkDebuggerAttachPending(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method MarkDebuggerAttachPending - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void MarkDebuggerAttached(BOOL fAttached) -void DDUnpack::Unpack_MarkDebuggerAttached(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - BOOL fAttached; - ReadFromBuffer(pSend, fAttached); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->MarkDebuggerAttached(fAttached); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method MarkDebuggerAttached - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void Hijack(VMPTR_Thread vmThread, ULONG32 dwThreadId, const EXCEPTION_RECORD * pRecord, T_CONTEXT * pOriginalContext, ULONG32 cbSizeContext, EHijackReason::EHijackReason reason, void * pUserData, CORDB_ADDRESS * pRemoteContextAddr) -void DDUnpack::Unpack_Hijack(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Callbacks not yet implemented - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method Hijack - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateConnections(IDacDbiInterface::FP_CONNECTION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateConnections(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Callbacks not yet implemented - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateConnections - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateThreads(IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateThreads(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateThreads(GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateThreads - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool IsThreadMarkedDead(VMPTR_Thread vmThread) -void DDUnpack::Unpack_IsThreadMarkedDead(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsThreadMarkedDead(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsThreadMarkedDead - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HANDLE GetThreadHandle(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetThreadHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - // Callbacks not yet implemented - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetThreadHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetThreadObject(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetThreadObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetThreadObject(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetThreadObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void SetDebugState(VMPTR_Thread vmThread, CorDebugThreadState debugState) -void DDUnpack::Unpack_SetDebugState(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - CorDebugThreadState debugState; - ReadFromBuffer(pSend, debugState); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->SetDebugState(vmThread, debugState); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method SetDebugState - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL HasUnhandledException(VMPTR_Thread vmThread) -void DDUnpack::Unpack_HasUnhandledException(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->HasUnhandledException(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method HasUnhandledException - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CorDebugUserState GetUserState(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetUserState(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CorDebugUserState _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetUserState(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetUserState - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CONNID GetConnectionID(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetConnectionID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CONNID _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetConnectionID(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetConnectionID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// TASKID GetTaskID(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetTaskID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - TASKID _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetTaskID(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetTaskID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// DWORD TryGetVolatileOSThreadID(VMPTR_Thread vmThread) -void DDUnpack::Unpack_TryGetVolatileOSThreadID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - DWORD _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->TryGetVolatileOSThreadID(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method TryGetVolatileOSThreadID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// DWORD GetUniqueThreadID(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetUniqueThreadID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - DWORD _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetUniqueThreadID(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetUniqueThreadID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetCurrentException(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetCurrentException(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCurrentException(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCurrentException - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetCurrentCustomDebuggerNotification(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetCurrentCustomDebuggerNotification(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCurrentCustomDebuggerNotification(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCurrentCustomDebuggerNotification - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetCurrentAppDomain(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_AppDomain _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCurrentAppDomain(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCurrentAppDomain - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef) -void DDUnpack::Unpack_ResolveAssembly(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainFile vmScope; - ReadFromBuffer(pSend, vmScope); - mdToken tkAssemblyRef; - ReadFromBuffer(pSend, tkAssemblyRef); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_DomainAssembly _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->ResolveAssembly(vmScope, tkAssemblyRef); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method ResolveAssembly - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetNativeCodeSequencePointsAndVarInfo(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS startAddress, BOOL fCodeAvailabe, NativeVarData * pNativeVarData, SequencePoints * pSequencePoints) -void DDUnpack::Unpack_GetNativeCodeSequencePointsAndVarInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_MethodDesc vmMethodDesc; - ReadFromBuffer(pSend, vmMethodDesc); - CORDB_ADDRESS startAddress; - ReadFromBuffer(pSend, startAddress); - BOOL fCodeAvailabe; - ReadFromBuffer(pSend, fCodeAvailabe); - NativeVarData _pNativeVarData; // storage - NativeVarData * pNativeVarData = &_pNativeVarData; - // pNativeVarData does not need to be copied on input - SequencePoints _pSequencePoints; // storage - SequencePoints * pSequencePoints = &_pSequencePoints; - // pSequencePoints does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetNativeCodeSequencePointsAndVarInfo(vmMethodDesc, startAddress, fCodeAvailabe, pNativeVarData, pSequencePoints); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pNativeVarData); - WriteToBuffer(pResult, pSequencePoints); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetNativeCodeSequencePointsAndVarInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_CONTEXT GetManagedStoppedContext(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetManagedStoppedContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_CONTEXT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetManagedStoppedContext(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetManagedStoppedContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void CreateStackWalk(VMPTR_Thread vmThread, DT_CONTEXT * pInternalContextBuffer, StackWalkHandle * ppSFIHandle) -void DDUnpack::Unpack_CreateStackWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - DT_CONTEXT _pInternalContextBuffer; // storage - DT_CONTEXT * pInternalContextBuffer = &_pInternalContextBuffer; - ReadFromBuffer(pSend, &_pInternalContextBuffer); // serialize to storage - StackWalkHandle _ppSFIHandle; // storage - StackWalkHandle * ppSFIHandle = &_ppSFIHandle; - // ppSFIHandle does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->CreateStackWalk(vmThread, pInternalContextBuffer, ppSFIHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pInternalContextBuffer); - WriteToBuffer(pResult, ppSFIHandle); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CreateStackWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void DeleteStackWalk(StackWalkHandle ppSFIHandle) -void DDUnpack::Unpack_DeleteStackWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - StackWalkHandle ppSFIHandle; - ReadFromBuffer(pSend, ppSFIHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->DeleteStackWalk(ppSFIHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method DeleteStackWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetStackWalkCurrentContext(StackWalkHandle pSFIHandle, DT_CONTEXT * pContext) -void DDUnpack::Unpack_GetStackWalkCurrentContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - DT_CONTEXT _pContext; // storage - DT_CONTEXT * pContext = &_pContext; - ReadFromBuffer(pSend, &_pContext); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetStackWalkCurrentContext(pSFIHandle, pContext); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pContext); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStackWalkCurrentContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void SetStackWalkCurrentContext(VMPTR_Thread vmThread, StackWalkHandle pSFIHandle, CorDebugSetContextFlag flag, DT_CONTEXT * pContext) -void DDUnpack::Unpack_SetStackWalkCurrentContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - CorDebugSetContextFlag flag; - ReadFromBuffer(pSend, flag); - DT_CONTEXT _pContext; // storage - DT_CONTEXT * pContext = &_pContext; - ReadFromBuffer(pSend, &_pContext); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->SetStackWalkCurrentContext(vmThread, pSFIHandle, flag, pContext); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pContext); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method SetStackWalkCurrentContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL UnwindStackWalkFrame(StackWalkHandle pSFIHandle) -void DDUnpack::Unpack_UnwindStackWalkFrame(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->UnwindStackWalkFrame(pSFIHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method UnwindStackWalkFrame - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT CheckContext(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) -void DDUnpack::Unpack_CheckContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - DT_CONTEXT _pContext; // storage - const DT_CONTEXT * pContext = &_pContext; - ReadFromBuffer(pSend, &_pContext); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->CheckContext(vmThread, pContext); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CheckContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// IDacDbiInterface::FrameType GetStackWalkCurrentFrameInfo(StackWalkHandle pSFIHandle, DebuggerIPCE_STRData * pFrameData) -void DDUnpack::Unpack_GetStackWalkCurrentFrameInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - DebuggerIPCE_STRData _pFrameData; // storage - DebuggerIPCE_STRData * pFrameData = &_pFrameData; - ReadFromBuffer(pSend, &_pFrameData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - IDacDbiInterface::FrameType _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetStackWalkCurrentFrameInfo(pSFIHandle, pFrameData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pFrameData); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStackWalkCurrentFrameInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// ULONG32 GetCountOfInternalFrames(VMPTR_Thread vmThread) -void DDUnpack::Unpack_GetCountOfInternalFrames(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - ULONG32 _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCountOfInternalFrames(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCountOfInternalFrames - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateInternalFrames(VMPTR_Thread vmThread, IDacDbiInterface::FP_INTERNAL_FRAME_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateInternalFrames(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateInternalFrames(vmThread, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateInternalFrames - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsMatchingParentFrame(FramePointer fpToCheck, FramePointer fpParent) -void DDUnpack::Unpack_IsMatchingParentFrame(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - FramePointer fpToCheck; - ReadFromBuffer(pSend, fpToCheck); - FramePointer fpParent; - ReadFromBuffer(pSend, fpParent); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsMatchingParentFrame(fpToCheck, fpParent); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsMatchingParentFrame - -//--------------------------------------------------------------------- -// Unpacking stub for: -// ULONG32 GetStackParameterSize(CORDB_ADDRESS controlPC) -void DDUnpack::Unpack_GetStackParameterSize(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS controlPC; - ReadFromBuffer(pSend, controlPC); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - ULONG32 _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetStackParameterSize(controlPC); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStackParameterSize - -//--------------------------------------------------------------------- -// Unpacking stub for: -// FramePointer GetFramePointer(StackWalkHandle pSFIHandle) -void DDUnpack::Unpack_GetFramePointer(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - StackWalkHandle pSFIHandle; - ReadFromBuffer(pSend, pSFIHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - FramePointer _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetFramePointer(pSFIHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetFramePointer - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsLeafFrame(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) -void DDUnpack::Unpack_IsLeafFrame(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - DT_CONTEXT _pContext; // storage - const DT_CONTEXT * pContext = &_pContext; - ReadFromBuffer(pSend, &_pContext); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsLeafFrame(vmThread, pContext); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsLeafFrame - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetContext(VMPTR_Thread vmThread, DT_CONTEXT * pContextBuffer) -void DDUnpack::Unpack_GetContext(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - DT_CONTEXT _pContextBuffer; // storage - DT_CONTEXT * pContextBuffer = &_pContextBuffer; - ReadFromBuffer(pSend, &_pContextBuffer); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetContext(vmThread, pContextBuffer); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pContextBuffer); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetContext - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void ConvertContextToDebuggerRegDisplay(const DT_CONTEXT * pInContext, DebuggerREGDISPLAY * pOutDRD, BOOL fActive) -void DDUnpack::Unpack_ConvertContextToDebuggerRegDisplay(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - DT_CONTEXT _pInContext; // storage - const DT_CONTEXT * pInContext = &_pInContext; - ReadFromBuffer(pSend, &_pInContext); // serialize to storage - DebuggerREGDISPLAY _pOutDRD; // storage - DebuggerREGDISPLAY * pOutDRD = &_pOutDRD; - ReadFromBuffer(pSend, &_pOutDRD); // serialize to storage - BOOL fActive; - ReadFromBuffer(pSend, fActive); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->ConvertContextToDebuggerRegDisplay(pInContext, pOutDRD, fActive); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pOutDRD); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method ConvertContextToDebuggerRegDisplay - -//--------------------------------------------------------------------- -// Unpacking stub for: -// IDacDbiInterface::DynamicMethodType IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc) -void DDUnpack::Unpack_IsILStubOrLCGMethod(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_MethodDesc vmMethodDesc; - ReadFromBuffer(pSend, vmMethodDesc); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - IDacDbiInterface::DynamicMethodType _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsILStubOrLCGMethod(vmMethodDesc); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsILStubOrLCGMethod - -//--------------------------------------------------------------------- -// Unpacking stub for: -// TargetBuffer GetVarArgSig(CORDB_ADDRESS VASigCookieAddr, CORDB_ADDRESS * pArgBase) -void DDUnpack::Unpack_GetVarArgSig(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS VASigCookieAddr; - ReadFromBuffer(pSend, VASigCookieAddr); - CORDB_ADDRESS _pArgBase; // storage - CORDB_ADDRESS * pArgBase = &_pArgBase; - // pArgBase does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - TargetBuffer _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetVarArgSig(VASigCookieAddr, pArgBase); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pArgBase); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetVarArgSig - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL RequiresAlign8(VMPTR_TypeHandle thExact) -void DDUnpack::Unpack_RequiresAlign8(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_TypeHandle thExact; - ReadFromBuffer(pSend, thExact); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->RequiresAlign8(thExact); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method RequiresAlign8 - -//--------------------------------------------------------------------- -// Unpacking stub for: -// GENERICS_TYPE_TOKEN ResolveExactGenericArgsToken(DWORD dwExactGenericArgsTokenIndex, GENERICS_TYPE_TOKEN rawToken) -void DDUnpack::Unpack_ResolveExactGenericArgsToken(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - DWORD dwExactGenericArgsTokenIndex; - ReadFromBuffer(pSend, dwExactGenericArgsTokenIndex); - GENERICS_TYPE_TOKEN rawToken; - ReadFromBuffer(pSend, rawToken); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - GENERICS_TYPE_TOKEN _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->ResolveExactGenericArgsToken(dwExactGenericArgsTokenIndex, rawToken); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method ResolveExactGenericArgsToken - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken) -void DDUnpack::Unpack_GetILCodeAndSig(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - mdToken functionToken; - ReadFromBuffer(pSend, functionToken); - TargetBuffer _pCodeInfo; // storage - TargetBuffer * pCodeInfo = &_pCodeInfo; - // pCodeInfo does not need to be copied on input - mdToken _pLocalSigToken; // storage - mdToken * pLocalSigToken = &_pLocalSigToken; - // pLocalSigToken does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetILCodeAndSig(vmDomainFile, functionToken, pCodeInfo, pLocalSigToken); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pCodeInfo); - WriteToBuffer(pResult, pLocalSigToken); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetILCodeAndSig - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, mdToken functionToken, NativeCodeFunctionData * pCodeInfo) -void DDUnpack::Unpack_GetNativeCodeInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - mdToken functionToken; - ReadFromBuffer(pSend, functionToken); - NativeCodeFunctionData _pCodeInfo; // storage - NativeCodeFunctionData * pCodeInfo = &_pCodeInfo; - // pCodeInfo does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetNativeCodeInfo(vmDomainFile, functionToken, pCodeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pCodeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetNativeCodeInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetNativeCodeInfoForAddr(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS hotCodeStartAddr, NativeCodeFunctionData * pCodeInfo) -void DDUnpack::Unpack_GetNativeCodeInfoForAddr(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_MethodDesc vmMethodDesc; - ReadFromBuffer(pSend, vmMethodDesc); - CORDB_ADDRESS hotCodeStartAddr; - ReadFromBuffer(pSend, hotCodeStartAddr); - NativeCodeFunctionData _pCodeInfo; // storage - NativeCodeFunctionData * pCodeInfo = &_pCodeInfo; - ReadFromBuffer(pSend, &_pCodeInfo); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetNativeCodeInfoForAddr(vmMethodDesc, hotCodeStartAddr, pCodeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pCodeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetNativeCodeInfoForAddr - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetClassInfo(VMPTR_AppDomain vmAppDomain, VMPTR_Module vmModule, mdTypeDef metadataToken, VMPTR_TypeHandle thExact, VMPTR_TypeHandle thApprox, ClassInfo * pData) -void DDUnpack::Unpack_GetClassInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - mdTypeDef metadataToken; - ReadFromBuffer(pSend, metadataToken); - VMPTR_TypeHandle thExact; - ReadFromBuffer(pSend, thExact); - VMPTR_TypeHandle thApprox; - ReadFromBuffer(pSend, thApprox); - ClassInfo _pData; // storage - ClassInfo * pData = &_pData; - ReadFromBuffer(pSend, &_pData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetClassInfo(vmAppDomain, vmModule, metadataToken, thExact, thApprox, pData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetClassInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetInstantiationFieldInfo(VMPTR_DomainFile vmDomainFile, mdTypeDef metadataToken, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList<FieldData> * pFieldList, SIZE_T * pObjectSize) -void DDUnpack::Unpack_GetInstantiationFieldInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_DomainFile vmDomainFile; - ReadFromBuffer(pSend, vmDomainFile); - mdTypeDef metadataToken; - ReadFromBuffer(pSend, metadataToken); - VMPTR_TypeHandle vmThExact; - ReadFromBuffer(pSend, vmThExact); - VMPTR_TypeHandle vmThApprox; - ReadFromBuffer(pSend, vmThApprox); - DacDbiArrayList<FieldData> _pFieldList; // storage - DacDbiArrayList<FieldData> * pFieldList = &_pFieldList; - // pFieldList does not need to be copied on input - SIZE_T _pObjectSize; // storage - SIZE_T * pObjectSize = &_pObjectSize; - // pObjectSize does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetInstantiationFieldInfo(vmDomainFile, metadataToken, vmThExact, vmThApprox, pFieldList, pObjectSize); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pFieldList); - WriteToBuffer(pResult, pObjectSize); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetInstantiationFieldInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, DebuggerIPCE_ExpandedTypeData * pTypeInfo) -void DDUnpack::Unpack_TypeHandleToExpandedTypeInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - AreValueTypesBoxed boxed; - ReadFromBuffer(pSend, boxed); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - VMPTR_TypeHandle vmTypeHandle; - ReadFromBuffer(pSend, vmTypeHandle); - DebuggerIPCE_ExpandedTypeData _pTypeInfo; // storage - DebuggerIPCE_ExpandedTypeData * pTypeInfo = &_pTypeInfo; - ReadFromBuffer(pSend, &_pTypeInfo); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->TypeHandleToExpandedTypeInfo(boxed, vmAppDomain, vmTypeHandle, pTypeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method TypeHandleToExpandedTypeInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetObjectExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, CORDB_ADDRESS addr, DebuggerIPCE_ExpandedTypeData * pTypeInfo) -void DDUnpack::Unpack_GetObjectExpandedTypeInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - AreValueTypesBoxed boxed; - ReadFromBuffer(pSend, boxed); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - CORDB_ADDRESS addr; - ReadFromBuffer(pSend, addr); - DebuggerIPCE_ExpandedTypeData _pTypeInfo; // storage - DebuggerIPCE_ExpandedTypeData * pTypeInfo = &_pTypeInfo; - // pTypeInfo does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetObjectExpandedTypeInfo(boxed, vmAppDomain, addr, pTypeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObjectExpandedTypeInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetObjectExpandedTypeInfoFromID(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, COR_TYPEID id, DebuggerIPCE_ExpandedTypeData * pTypeInfo) -void DDUnpack::Unpack_GetObjectExpandedTypeInfoFromID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - AreValueTypesBoxed boxed; - ReadFromBuffer(pSend, boxed); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - COR_TYPEID id; - ReadFromBuffer(pSend, id); - DebuggerIPCE_ExpandedTypeData _pTypeInfo; // storage - DebuggerIPCE_ExpandedTypeData * pTypeInfo = &_pTypeInfo; - // pTypeInfo does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetObjectExpandedTypeInfoFromID(boxed, vmAppDomain, id, pTypeInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObjectExpandedTypeInfoFromID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_TypeHandle GetApproxTypeHandle(TypeInfoList * pTypeData) -void DDUnpack::Unpack_GetApproxTypeHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - TypeInfoList _pTypeData; // storage - TypeInfoList * pTypeData = &_pTypeData; - ReadFromBuffer(pSend, &_pTypeData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_TypeHandle _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetApproxTypeHandle(pTypeData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeData); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetApproxTypeHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT GetExactTypeHandle(DebuggerIPCE_ExpandedTypeData * pTypeData, ArgInfoList * pArgInfo, VMPTR_TypeHandle & vmTypeHandle) -void DDUnpack::Unpack_GetExactTypeHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - DebuggerIPCE_ExpandedTypeData _pTypeData; // storage - DebuggerIPCE_ExpandedTypeData * pTypeData = &_pTypeData; - ReadFromBuffer(pSend, &_pTypeData); // serialize to storage - ArgInfoList _pArgInfo; // storage - ArgInfoList * pArgInfo = &_pArgInfo; - ReadFromBuffer(pSend, &_pArgInfo); // serialize to storage - VMPTR_TypeHandle vmTypeHandle; - ReadFromBuffer(pSend, vmTypeHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetExactTypeHandle(pTypeData, pArgInfo, vmTypeHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pTypeData); - WriteToBuffer(pResult, pArgInfo); - WriteToBuffer(pResult, vmTypeHandle); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetExactTypeHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetMethodDescParams(VMPTR_AppDomain vmAppDomain, VMPTR_MethodDesc vmMethodDesc, GENERICS_TYPE_TOKEN genericsToken, UINT32 * pcGenericClassTypeParams, TypeParamsList * pGenericTypeParams) -void DDUnpack::Unpack_GetMethodDescParams(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - VMPTR_MethodDesc vmMethodDesc; - ReadFromBuffer(pSend, vmMethodDesc); - GENERICS_TYPE_TOKEN genericsToken; - ReadFromBuffer(pSend, genericsToken); - UINT32 _pcGenericClassTypeParams; // storage - UINT32 * pcGenericClassTypeParams = &_pcGenericClassTypeParams; - // pcGenericClassTypeParams does not need to be copied on input - TypeParamsList _pGenericTypeParams; // storage - TypeParamsList * pGenericTypeParams = &_pGenericTypeParams; - // pGenericTypeParams does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetMethodDescParams(vmAppDomain, vmMethodDesc, genericsToken, pcGenericClassTypeParams, pGenericTypeParams); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pcGenericClassTypeParams); - WriteToBuffer(pResult, pGenericTypeParams); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetMethodDescParams - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CORDB_ADDRESS GetThreadOrContextStaticAddress(VMPTR_FieldDesc vmField, VMPTR_Thread vmRuntimeThread) -void DDUnpack::Unpack_GetThreadOrContextStaticAddress(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_FieldDesc vmField; - ReadFromBuffer(pSend, vmField); - VMPTR_Thread vmRuntimeThread; - ReadFromBuffer(pSend, vmRuntimeThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CORDB_ADDRESS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetThreadOrContextStaticAddress(vmField, vmRuntimeThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetThreadOrContextStaticAddress - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CORDB_ADDRESS GetCollectibleTypeStaticAddress(VMPTR_FieldDesc vmField, VMPTR_AppDomain vmAppDomain) -void DDUnpack::Unpack_GetCollectibleTypeStaticAddress(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_FieldDesc vmField; - ReadFromBuffer(pSend, vmField); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CORDB_ADDRESS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetCollectibleTypeStaticAddress(vmField, vmAppDomain); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCollectibleTypeStaticAddress - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetEnCHangingFieldInfo(const EnCHangingFieldInfo * pEnCFieldInfo, FieldData * pFieldData, BOOL * pfStatic) -void DDUnpack::Unpack_GetEnCHangingFieldInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - EnCHangingFieldInfo _pEnCFieldInfo; // storage - const EnCHangingFieldInfo * pEnCFieldInfo = &_pEnCFieldInfo; - ReadFromBuffer(pSend, &_pEnCFieldInfo); // serialize to storage - FieldData _pFieldData; // storage - FieldData * pFieldData = &_pFieldData; - // pFieldData does not need to be copied on input - BOOL _pfStatic; // storage - BOOL * pfStatic = &_pfStatic; - // pfStatic does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetEnCHangingFieldInfo(pEnCFieldInfo, pFieldData, pfStatic); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pFieldData); - WriteToBuffer(pResult, pfStatic); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetEnCHangingFieldInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetTypeHandleParams(VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, TypeParamsList * pParams) -void DDUnpack::Unpack_GetTypeHandleParams(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - VMPTR_TypeHandle vmTypeHandle; - ReadFromBuffer(pSend, vmTypeHandle); - TypeParamsList _pParams; // storage - TypeParamsList * pParams = &_pParams; - // pParams does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetTypeHandleParams(vmAppDomain, vmTypeHandle, pParams); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pParams); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetTypeHandleParams - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetSimpleType(VMPTR_AppDomain vmAppDomain, CorElementType simpleType, mdTypeDef * pMetadataToken, VMPTR_Module * pVmModule, VMPTR_DomainFile * pVmDomainFile) -void DDUnpack::Unpack_GetSimpleType(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - CorElementType simpleType; - ReadFromBuffer(pSend, simpleType); - mdTypeDef _pMetadataToken; // storage - mdTypeDef * pMetadataToken = &_pMetadataToken; - // pMetadataToken does not need to be copied on input - VMPTR_Module _pVmModule; // storage - VMPTR_Module * pVmModule = &_pVmModule; - // pVmModule does not need to be copied on input - VMPTR_DomainFile _pVmDomainFile; // storage - VMPTR_DomainFile * pVmDomainFile = &_pVmDomainFile; - // pVmDomainFile does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetSimpleType(vmAppDomain, simpleType, pMetadataToken, pVmModule, pVmDomainFile); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pMetadataToken); - WriteToBuffer(pResult, pVmModule); - WriteToBuffer(pResult, pVmDomainFile); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetSimpleType - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsExceptionObject(VMPTR_Object vmObject) -void DDUnpack::Unpack_IsExceptionObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsExceptionObject(vmObject); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsExceptionObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetStackFramesFromException(VMPTR_Object vmObject, DacDbiArrayList<DacExceptionCallStackData> & dacStackFrames) -void DDUnpack::Unpack_GetStackFramesFromException(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - DacDbiArrayList<DacExceptionCallStackData> dacStackFrames; - ReadFromBuffer(pSend, dacStackFrames); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetStackFramesFromException(vmObject, dacStackFrames); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, dacStackFrames); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStackFramesFromException - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsRcw(VMPTR_Object vmObject) -void DDUnpack::Unpack_IsRcw(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsRcw(vmObject); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsRcw - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetRcwCachedInterfaceTypes(VMPTR_Object vmObject, VMPTR_AppDomain vmAppDomain, BOOL bIInspectableOnly, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pDacInterfaces) -void DDUnpack::Unpack_GetRcwCachedInterfaceTypes(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - BOOL bIInspectableOnly; - ReadFromBuffer(pSend, bIInspectableOnly); - DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> _pDacInterfaces; // storage - DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pDacInterfaces = &_pDacInterfaces; - // pDacInterfaces does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetRcwCachedInterfaceTypes(vmObject, vmAppDomain, bIInspectableOnly, pDacInterfaces); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pDacInterfaces); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetRcwCachedInterfaceTypes - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetRcwCachedInterfacePointers(VMPTR_Object vmObject, BOOL bIInspectableOnly, DacDbiArrayList<CORDB_ADDRESS> * pDacItfPtrs) -void DDUnpack::Unpack_GetRcwCachedInterfacePointers(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - BOOL bIInspectableOnly; - ReadFromBuffer(pSend, bIInspectableOnly); - DacDbiArrayList<CORDB_ADDRESS> _pDacItfPtrs; // storage - DacDbiArrayList<CORDB_ADDRESS> * pDacItfPtrs = &_pDacItfPtrs; - // pDacItfPtrs does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetRcwCachedInterfacePointers(vmObject, bIInspectableOnly, pDacItfPtrs); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pDacItfPtrs); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetRcwCachedInterfacePointers - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetCachedWinRTTypesForIIDs(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> & iids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes) -void DDUnpack::Unpack_GetCachedWinRTTypesForIIDs(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - DacDbiArrayList<GUID> iids; - ReadFromBuffer(pSend, iids); - DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> _pTypes; // storage - DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes = &_pTypes; - // pTypes does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetCachedWinRTTypesForIIDs(vmAppDomain, iids, pTypes); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, iids); - WriteToBuffer(pResult, pTypes); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCachedWinRTTypesForIIDs - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetCachedWinRTTypes(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> * piids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes) -void DDUnpack::Unpack_GetCachedWinRTTypes(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - DacDbiArrayList<GUID> _piids; // storage - DacDbiArrayList<GUID> * piids = &_piids; - // piids does not need to be copied on input - DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> _pTypes; // storage - DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes = &_pTypes; - // pTypes does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetCachedWinRTTypes(vmAppDomain, piids, pTypes); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, piids); - WriteToBuffer(pResult, pTypes); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetCachedWinRTTypes - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetTypedByRefInfo(CORDB_ADDRESS pTypedByRef, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) -void DDUnpack::Unpack_GetTypedByRefInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS pTypedByRef; - ReadFromBuffer(pSend, pTypedByRef); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - DebuggerIPCE_ObjectData _pObjectData; // storage - DebuggerIPCE_ObjectData * pObjectData = &_pObjectData; - ReadFromBuffer(pSend, &_pObjectData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetTypedByRefInfo(pTypedByRef, vmAppDomain, pObjectData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pObjectData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetTypedByRefInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetStringData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) -void DDUnpack::Unpack_GetStringData(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS objectAddress; - ReadFromBuffer(pSend, objectAddress); - DebuggerIPCE_ObjectData _pObjectData; // storage - DebuggerIPCE_ObjectData * pObjectData = &_pObjectData; - ReadFromBuffer(pSend, &_pObjectData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetStringData(objectAddress, pObjectData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pObjectData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetStringData - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetArrayData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) -void DDUnpack::Unpack_GetArrayData(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS objectAddress; - ReadFromBuffer(pSend, objectAddress); - DebuggerIPCE_ObjectData _pObjectData; // storage - DebuggerIPCE_ObjectData * pObjectData = &_pObjectData; - ReadFromBuffer(pSend, &_pObjectData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetArrayData(objectAddress, pObjectData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pObjectData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetArrayData - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetBasicObjectInfo(CORDB_ADDRESS objectAddress, CorElementType type, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) -void DDUnpack::Unpack_GetBasicObjectInfo(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS objectAddress; - ReadFromBuffer(pSend, objectAddress); - CorElementType type; - ReadFromBuffer(pSend, type); - VMPTR_AppDomain vmAppDomain; - ReadFromBuffer(pSend, vmAppDomain); - DebuggerIPCE_ObjectData _pObjectData; // storage - DebuggerIPCE_ObjectData * pObjectData = &_pObjectData; - ReadFromBuffer(pSend, &_pObjectData); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetBasicObjectInfo(objectAddress, type, vmAppDomain, pObjectData); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pObjectData); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetBasicObjectInfo - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void TestCrst(VMPTR_Crst vmCrst) -void DDUnpack::Unpack_TestCrst(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Crst vmCrst; - ReadFromBuffer(pSend, vmCrst); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->TestCrst(vmCrst); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method TestCrst - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void TestRWLock(VMPTR_SimpleRWLock vmRWLock) -void DDUnpack::Unpack_TestRWLock(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_SimpleRWLock vmRWLock; - ReadFromBuffer(pSend, vmRWLock); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->TestRWLock(vmRWLock); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method TestRWLock - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CORDB_ADDRESS GetDebuggerControlBlockAddress() -void DDUnpack::Unpack_GetDebuggerControlBlockAddress(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CORDB_ADDRESS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetDebuggerControlBlockAddress(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetDebuggerControlBlockAddress - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_Object GetObjectFromRefPtr(CORDB_ADDRESS ptr) -void DDUnpack::Unpack_GetObjectFromRefPtr(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS ptr; - ReadFromBuffer(pSend, ptr); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_Object _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetObjectFromRefPtr(ptr); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObjectFromRefPtr - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_Object GetObject(CORDB_ADDRESS ptr) -void DDUnpack::Unpack_GetObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS ptr; - ReadFromBuffer(pSend, ptr); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_Object _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetObject(ptr); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT EnableNGENPolicy(CorDebugNGENPolicy ePolicy) -void DDUnpack::Unpack_EnableNGENPolicy(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CorDebugNGENPolicy ePolicy; - ReadFromBuffer(pSend, ePolicy); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->EnableNGENPolicy(ePolicy); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnableNGENPolicy - -//--------------------------------------------------------------------- -// Unpacking stub for: -// VMPTR_OBJECTHANDLE GetVmObjectHandle(CORDB_ADDRESS handleAddress) -void DDUnpack::Unpack_GetVmObjectHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS handleAddress; - ReadFromBuffer(pSend, handleAddress); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - VMPTR_OBJECTHANDLE _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetVmObjectHandle(handleAddress); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetVmObjectHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// BOOL IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle) -void DDUnpack::Unpack_IsVmObjectHandleValid(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_OBJECTHANDLE vmHandle; - ReadFromBuffer(pSend, vmHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - BOOL _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsVmObjectHandleValid(vmHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsVmObjectHandleValid - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT IsWinRTModule(VMPTR_Module vmModule, BOOL & isWinRT) -void DDUnpack::Unpack_IsWinRTModule(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Module vmModule; - ReadFromBuffer(pSend, vmModule); - BOOL isWinRT; - ReadFromBuffer(pSend, isWinRT); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsWinRTModule(vmModule, isWinRT); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, isWinRT); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsWinRTModule - -//--------------------------------------------------------------------- -// Unpacking stub for: -// ULONG GetAppDomainIdFromVmObjectHandle(VMPTR_OBJECTHANDLE vmHandle) -void DDUnpack::Unpack_GetAppDomainIdFromVmObjectHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_OBJECTHANDLE vmHandle; - ReadFromBuffer(pSend, vmHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - ULONG _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainIdFromVmObjectHandle(vmHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainIdFromVmObjectHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CORDB_ADDRESS GetHandleAddressFromVmHandle(VMPTR_OBJECTHANDLE vmHandle) -void DDUnpack::Unpack_GetHandleAddressFromVmHandle(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_OBJECTHANDLE vmHandle; - ReadFromBuffer(pSend, vmHandle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CORDB_ADDRESS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetHandleAddressFromVmHandle(vmHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetHandleAddressFromVmHandle - -//--------------------------------------------------------------------- -// Unpacking stub for: -// TargetBuffer GetObjectContents(VMPTR_Object obj) -void DDUnpack::Unpack_GetObjectContents(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Object obj; - ReadFromBuffer(pSend, obj); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - TargetBuffer _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetObjectContents(obj); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObjectContents - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateBlockingObjects(VMPTR_Thread vmThread, IDacDbiInterface::FP_BLOCKINGOBJECT_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateBlockingObjects(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateBlockingObjects(vmThread, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateBlockingObjects - -//--------------------------------------------------------------------- -// Unpacking stub for: -// MonitorLockInfo GetThreadOwningMonitorLock(VMPTR_Object vmObject) -void DDUnpack::Unpack_GetThreadOwningMonitorLock(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - MonitorLockInfo _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetThreadOwningMonitorLock(vmObject); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetThreadOwningMonitorLock - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void EnumerateMonitorEventWaitList(VMPTR_Object vmObject, IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) -void DDUnpack::Unpack_EnumerateMonitorEventWaitList(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Object vmObject; - ReadFromBuffer(pSend, vmObject); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - // Extra stuff for callback handlers - m_pReal->EnumerateMonitorEventWaitList(vmObject, GeneralEnumerationCallback, pResult); - - } - EX_CATCH_HRESULT(hr); - - // Sentinel for callback list - DWORD dw = 2; // Stop - WriteToBuffer(pResult, dw); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method EnumerateMonitorEventWaitList - -//--------------------------------------------------------------------- -// Unpacking stub for: -// CLR_DEBUGGING_PROCESS_FLAGS GetAttachStateFlags() -void DDUnpack::Unpack_GetAttachStateFlags(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - CLR_DEBUGGING_PROCESS_FLAGS _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAttachStateFlags(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAttachStateFlags - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool GetMetaDataFileInfoFromPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwImageSize, bool & isNGEN, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetMetaDataFileInfoFromPEFile(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_PEFile vmPEFile; - ReadFromBuffer(pSend, vmPEFile); - DWORD dwTimeStamp; - ReadFromBuffer(pSend, dwTimeStamp); - DWORD dwImageSize; - ReadFromBuffer(pSend, dwImageSize); - bool isNGEN; - ReadFromBuffer(pSend, isNGEN); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetMetaDataFileInfoFromPEFile(vmPEFile, dwTimeStamp, dwImageSize, isNGEN, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, dwTimeStamp); - WriteToBuffer(pResult, dwImageSize); - WriteToBuffer(pResult, isNGEN); - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetMetaDataFileInfoFromPEFile - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool GetILImageInfoFromNgenPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwSize, IStringHolder * pStrFilename) -void DDUnpack::Unpack_GetILImageInfoFromNgenPEFile(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_PEFile vmPEFile; - ReadFromBuffer(pSend, vmPEFile); - DWORD dwTimeStamp; - ReadFromBuffer(pSend, dwTimeStamp); - DWORD dwSize; - ReadFromBuffer(pSend, dwSize); - StringCopyHolder _pStrFilename; // storage - StringCopyHolder* pStrFilename = &_pStrFilename; - // pStrFilename does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetILImageInfoFromNgenPEFile(vmPEFile, dwTimeStamp, dwSize, pStrFilename); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, dwTimeStamp); - WriteToBuffer(pResult, dwSize); - WriteToBuffer(pResult, pStrFilename); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetILImageInfoFromNgenPEFile - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool IsThreadSuspendedOrHijacked(VMPTR_Thread vmThread) -void DDUnpack::Unpack_IsThreadSuspendedOrHijacked(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - VMPTR_Thread vmThread; - ReadFromBuffer(pSend, vmThread); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsThreadSuspendedOrHijacked(vmThread); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsThreadSuspendedOrHijacked - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool AreGCStructuresValid() -void DDUnpack::Unpack_AreGCStructuresValid(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->AreGCStructuresValid(); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method AreGCStructuresValid - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT CreateHeapWalk(HeapWalkHandle * pHandle) -void DDUnpack::Unpack_CreateHeapWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - HeapWalkHandle _pHandle; // storage - HeapWalkHandle * pHandle = &_pHandle; - // pHandle does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->CreateHeapWalk(pHandle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pHandle); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CreateHeapWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void DeleteHeapWalk(HeapWalkHandle handle) -void DDUnpack::Unpack_DeleteHeapWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - HeapWalkHandle handle; - ReadFromBuffer(pSend, handle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->DeleteHeapWalk(handle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method DeleteHeapWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT WalkHeap(HeapWalkHandle handle, ULONG count, COR_HEAPOBJECT * objects, ULONG * pFetched) -void DDUnpack::Unpack_WalkHeap(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - HeapWalkHandle handle; - ReadFromBuffer(pSend, handle); - ULONG count; - ReadFromBuffer(pSend, count); - COR_HEAPOBJECT _objects; // storage - COR_HEAPOBJECT * objects = &_objects; - // objects does not need to be copied on input - ULONG _pFetched; // storage - ULONG * pFetched = &_pFetched; - // pFetched does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->WalkHeap(handle, count, objects, pFetched); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, objects); - WriteToBuffer(pResult, pFetched); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method WalkHeap - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT GetHeapSegments(DacDbiArrayList<COR_SEGMENT> * pSegments) -void DDUnpack::Unpack_GetHeapSegments(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - DacDbiArrayList<COR_SEGMENT> _pSegments; // storage - DacDbiArrayList<COR_SEGMENT> * pSegments = &_pSegments; - // pSegments does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetHeapSegments(pSegments); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pSegments); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetHeapSegments - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool IsValidObject(CORDB_ADDRESS obj) -void DDUnpack::Unpack_IsValidObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS obj; - ReadFromBuffer(pSend, obj); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->IsValidObject(obj); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method IsValidObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// bool GetAppDomainForObject(CORDB_ADDRESS obj, VMPTR_AppDomain * pApp, VMPTR_Module * pModule, VMPTR_DomainFile * pDomainFile) -void DDUnpack::Unpack_GetAppDomainForObject(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS obj; - ReadFromBuffer(pSend, obj); - VMPTR_AppDomain _pApp; // storage - VMPTR_AppDomain * pApp = &_pApp; - // pApp does not need to be copied on input - VMPTR_Module _pModule; // storage - VMPTR_Module * pModule = &_pModule; - // pModule does not need to be copied on input - VMPTR_DomainFile _pDomainFile; // storage - VMPTR_DomainFile * pDomainFile = &_pDomainFile; - // pDomainFile does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - bool _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetAppDomainForObject(obj, pApp, pModule, pDomainFile); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pApp); - WriteToBuffer(pResult, pModule); - WriteToBuffer(pResult, pDomainFile); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetAppDomainForObject - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT CreateRefWalk(RefWalkHandle * pHandle, BOOL walkStacks, BOOL walkFQ, UINT32 handleWalkMask) -void DDUnpack::Unpack_CreateRefWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - RefWalkHandle _pHandle; // storage - RefWalkHandle * pHandle = &_pHandle; - // pHandle does not need to be copied on input - BOOL walkStacks; - ReadFromBuffer(pSend, walkStacks); - BOOL walkFQ; - ReadFromBuffer(pSend, walkFQ); - UINT32 handleWalkMask; - ReadFromBuffer(pSend, handleWalkMask); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->CreateRefWalk(pHandle, walkStacks, walkFQ, handleWalkMask); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pHandle); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method CreateRefWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void DeleteRefWalk(RefWalkHandle handle) -void DDUnpack::Unpack_DeleteRefWalk(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - RefWalkHandle handle; - ReadFromBuffer(pSend, handle); - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->DeleteRefWalk(handle); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method DeleteRefWalk - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT WalkRefs(RefWalkHandle handle, ULONG count, DacGcReference * refs, ULONG * pFetched) -void DDUnpack::Unpack_WalkRefs(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - RefWalkHandle handle; - ReadFromBuffer(pSend, handle); - ULONG count; - ReadFromBuffer(pSend, count); - DacGcReference _refs; // storage - DacGcReference * refs = &_refs; - // refs does not need to be copied on input - ULONG _pFetched; // storage - ULONG * pFetched = &_pFetched; - // pFetched does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->WalkRefs(handle, count, refs, pFetched); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, refs); - WriteToBuffer(pResult, pFetched); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method WalkRefs - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT GetTypeID(CORDB_ADDRESS obj, COR_TYPEID * pType) -void DDUnpack::Unpack_GetTypeID(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - CORDB_ADDRESS obj; - ReadFromBuffer(pSend, obj); - COR_TYPEID _pType; // storage - COR_TYPEID * pType = &_pType; - ReadFromBuffer(pSend, &_pType); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetTypeID(obj, pType); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pType); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetTypeID - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT GetObjectFields(COR_TYPEID id, ULONG32 celt, COR_FIELD * layout, ULONG32 * pceltFetched) -void DDUnpack::Unpack_GetObjectFields(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - COR_TYPEID id; - ReadFromBuffer(pSend, id); - ULONG32 celt; - ReadFromBuffer(pSend, celt); - COR_FIELD _layout; // storage - COR_FIELD * layout = &_layout; - // layout does not need to be copied on input - ULONG32 _pceltFetched; // storage - ULONG32 * pceltFetched = &_pceltFetched; - // pceltFetched does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetObjectFields(id, celt, layout, pceltFetched); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, layout); - WriteToBuffer(pResult, pceltFetched); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetObjectFields - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT * pLayout) -void DDUnpack::Unpack_GetTypeLayout(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - COR_TYPEID id; - ReadFromBuffer(pSend, id); - COR_TYPE_LAYOUT _pLayout; // storage - COR_TYPE_LAYOUT * pLayout = &_pLayout; - ReadFromBuffer(pSend, &_pLayout); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetTypeLayout(id, pLayout); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pLayout); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetTypeLayout - -//--------------------------------------------------------------------- -// Unpacking stub for: -// HRESULT GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT * pLayout) -void DDUnpack::Unpack_GetArrayLayout(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - COR_TYPEID id; - ReadFromBuffer(pSend, id); - COR_ARRAY_LAYOUT _pLayout; // storage - COR_ARRAY_LAYOUT * pLayout = &_pLayout; - ReadFromBuffer(pSend, &_pLayout); // serialize to storage - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - HRESULT _retValue; // return result - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - _retValue = m_pReal->GetArrayLayout(id, pLayout); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pLayout); - WriteToBuffer(pResult, hr); // exception result - WriteToBuffer(pResult, _retValue); // copy back return result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetArrayLayout - -//--------------------------------------------------------------------- -// Unpacking stub for: -// void GetGCHeapInformation(COR_HEAPINFO * pHeapInfo) -void DDUnpack::Unpack_GetGCHeapInformation(ReadBuffer * pSend, WriteBuffer * pResult) -{ - - // Parameters - COR_HEAPINFO _pHeapInfo; // storage - COR_HEAPINFO * pHeapInfo = &_pHeapInfo; - // pHeapInfo does not need to be copied on input - _ASSERTE(pSend->IsAtEnd()); // ensure entire buffer is read - - // - // Make the actual call - // - HRESULT hr = S_OK; - EX_TRY - { - m_pReal->GetGCHeapInformation(pHeapInfo); // actual call - - } - EX_CATCH_HRESULT(hr); - // Marshal parameters back - WriteToBuffer(pResult, pHeapInfo); - WriteToBuffer(pResult, hr); // exception result - // Dtors for any DacDbi structures that we marshalled get run here. -} // end method GetGCHeapInformation - - -// -// Handler -// -void DDUnpack::HandleDDMessage(ReadBuffer * pSend, WriteBuffer * pResult) -{ - DD_MessageId id; - ReadFromBuffer(pSend, id); - - switch(id) - { - - case DDID_CheckDbiVersion: - Unpack_CheckDbiVersion(pSend, pResult); - break; - - case DDID_GetLocalInterfaceHashAndTimestamp: - Unpack_GetLocalInterfaceHashAndTimestamp(pSend, pResult); - break; - - case DDID_GetRemoteInterfaceHashAndTimestamp: - Unpack_GetRemoteInterfaceHashAndTimestamp(pSend, pResult); - break; - - case DDID_FlushCache: - Unpack_FlushCache(pSend, pResult); - break; - - case DDID_DacSetTargetConsistencyChecks: - Unpack_DacSetTargetConsistencyChecks(pSend, pResult); - break; - - case DDID_Destroy: - Unpack_Destroy(pSend, pResult); - break; - - case DDID_IsLeftSideInitialized: - Unpack_IsLeftSideInitialized(pSend, pResult); - break; - - case DDID_GetAppDomainFromId: - Unpack_GetAppDomainFromId(pSend, pResult); - break; - - case DDID_GetAppDomainId: - Unpack_GetAppDomainId(pSend, pResult); - break; - - case DDID_GetAppDomainObject: - Unpack_GetAppDomainObject(pSend, pResult); - break; - - case DDID_IsDefaultDomain: - Unpack_IsDefaultDomain(pSend, pResult); - break; - - case DDID_GetAssemblyFromDomainAssembly: - Unpack_GetAssemblyFromDomainAssembly(pSend, pResult); - break; - - case DDID_IsAssemblyFullyTrusted: - Unpack_IsAssemblyFullyTrusted(pSend, pResult); - break; - - case DDID_GetAppDomainFullName: - Unpack_GetAppDomainFullName(pSend, pResult); - break; - - case DDID_GetModuleSimpleName: - Unpack_GetModuleSimpleName(pSend, pResult); - break; - - case DDID_GetAssemblyPath: - Unpack_GetAssemblyPath(pSend, pResult); - break; - - case DDID_ResolveTypeReference: - Unpack_ResolveTypeReference(pSend, pResult); - break; - - case DDID_GetModulePath: - Unpack_GetModulePath(pSend, pResult); - break; - - case DDID_GetModuleNGenPath: - Unpack_GetModuleNGenPath(pSend, pResult); - break; - - case DDID_GetMetadata: - Unpack_GetMetadata(pSend, pResult); - break; - - case DDID_GetSymbolsBuffer: - Unpack_GetSymbolsBuffer(pSend, pResult); - break; - - case DDID_GetModuleData: - Unpack_GetModuleData(pSend, pResult); - break; - - case DDID_GetDomainFileData: - Unpack_GetDomainFileData(pSend, pResult); - break; - - case DDID_GetModuleForDomainFile: - Unpack_GetModuleForDomainFile(pSend, pResult); - break; - - case DDID_GetAddressType: - Unpack_GetAddressType(pSend, pResult); - break; - - case DDID_IsTransitionStub: - Unpack_IsTransitionStub(pSend, pResult); - break; - - case DDID_GetCompilerFlags: - Unpack_GetCompilerFlags(pSend, pResult); - break; - - case DDID_SetCompilerFlags: - Unpack_SetCompilerFlags(pSend, pResult); - break; - - case DDID_EnumerateAppDomains: - Unpack_EnumerateAppDomains(pSend, pResult); - break; - - case DDID_EnumerateAssembliesInAppDomain: - Unpack_EnumerateAssembliesInAppDomain(pSend, pResult); - break; - - case DDID_EnumerateModulesInAssembly: - Unpack_EnumerateModulesInAssembly(pSend, pResult); - break; - - case DDID_RequestSyncAtEvent: - Unpack_RequestSyncAtEvent(pSend, pResult); - break; - - case DDID_MarkDebuggerAttachPending: - Unpack_MarkDebuggerAttachPending(pSend, pResult); - break; - - case DDID_MarkDebuggerAttached: - Unpack_MarkDebuggerAttached(pSend, pResult); - break; - - case DDID_Hijack: - Unpack_Hijack(pSend, pResult); - break; - - case DDID_EnumerateConnections: - Unpack_EnumerateConnections(pSend, pResult); - break; - - case DDID_EnumerateThreads: - Unpack_EnumerateThreads(pSend, pResult); - break; - - case DDID_IsThreadMarkedDead: - Unpack_IsThreadMarkedDead(pSend, pResult); - break; - - case DDID_GetThreadHandle: - Unpack_GetThreadHandle(pSend, pResult); - break; - - case DDID_GetThreadObject: - Unpack_GetThreadObject(pSend, pResult); - break; - - case DDID_SetDebugState: - Unpack_SetDebugState(pSend, pResult); - break; - - case DDID_HasUnhandledException: - Unpack_HasUnhandledException(pSend, pResult); - break; - - case DDID_GetUserState: - Unpack_GetUserState(pSend, pResult); - break; - - case DDID_GetConnectionID: - Unpack_GetConnectionID(pSend, pResult); - break; - - case DDID_GetTaskID: - Unpack_GetTaskID(pSend, pResult); - break; - - case DDID_TryGetVolatileOSThreadID: - Unpack_TryGetVolatileOSThreadID(pSend, pResult); - break; - - case DDID_GetUniqueThreadID: - Unpack_GetUniqueThreadID(pSend, pResult); - break; - - case DDID_GetCurrentException: - Unpack_GetCurrentException(pSend, pResult); - break; - - case DDID_GetCurrentCustomDebuggerNotification: - Unpack_GetCurrentCustomDebuggerNotification(pSend, pResult); - break; - - case DDID_GetCurrentAppDomain: - Unpack_GetCurrentAppDomain(pSend, pResult); - break; - - case DDID_ResolveAssembly: - Unpack_ResolveAssembly(pSend, pResult); - break; - - case DDID_GetNativeCodeSequencePointsAndVarInfo: - Unpack_GetNativeCodeSequencePointsAndVarInfo(pSend, pResult); - break; - - case DDID_GetManagedStoppedContext: - Unpack_GetManagedStoppedContext(pSend, pResult); - break; - - case DDID_CreateStackWalk: - Unpack_CreateStackWalk(pSend, pResult); - break; - - case DDID_DeleteStackWalk: - Unpack_DeleteStackWalk(pSend, pResult); - break; - - case DDID_GetStackWalkCurrentContext: - Unpack_GetStackWalkCurrentContext(pSend, pResult); - break; - - case DDID_SetStackWalkCurrentContext: - Unpack_SetStackWalkCurrentContext(pSend, pResult); - break; - - case DDID_UnwindStackWalkFrame: - Unpack_UnwindStackWalkFrame(pSend, pResult); - break; - - case DDID_CheckContext: - Unpack_CheckContext(pSend, pResult); - break; - - case DDID_GetStackWalkCurrentFrameInfo: - Unpack_GetStackWalkCurrentFrameInfo(pSend, pResult); - break; - - case DDID_GetCountOfInternalFrames: - Unpack_GetCountOfInternalFrames(pSend, pResult); - break; - - case DDID_EnumerateInternalFrames: - Unpack_EnumerateInternalFrames(pSend, pResult); - break; - - case DDID_IsMatchingParentFrame: - Unpack_IsMatchingParentFrame(pSend, pResult); - break; - - case DDID_GetStackParameterSize: - Unpack_GetStackParameterSize(pSend, pResult); - break; - - case DDID_GetFramePointer: - Unpack_GetFramePointer(pSend, pResult); - break; - - case DDID_IsLeafFrame: - Unpack_IsLeafFrame(pSend, pResult); - break; - - case DDID_GetContext: - Unpack_GetContext(pSend, pResult); - break; - - case DDID_ConvertContextToDebuggerRegDisplay: - Unpack_ConvertContextToDebuggerRegDisplay(pSend, pResult); - break; - - case DDID_IsILStubOrLCGMethod: - Unpack_IsILStubOrLCGMethod(pSend, pResult); - break; - - case DDID_GetVarArgSig: - Unpack_GetVarArgSig(pSend, pResult); - break; - - case DDID_RequiresAlign8: - Unpack_RequiresAlign8(pSend, pResult); - break; - - case DDID_ResolveExactGenericArgsToken: - Unpack_ResolveExactGenericArgsToken(pSend, pResult); - break; - - case DDID_GetILCodeAndSig: - Unpack_GetILCodeAndSig(pSend, pResult); - break; - - case DDID_GetNativeCodeInfo: - Unpack_GetNativeCodeInfo(pSend, pResult); - break; - - case DDID_GetNativeCodeInfoForAddr: - Unpack_GetNativeCodeInfoForAddr(pSend, pResult); - break; - - case DDID_GetClassInfo: - Unpack_GetClassInfo(pSend, pResult); - break; - - case DDID_GetInstantiationFieldInfo: - Unpack_GetInstantiationFieldInfo(pSend, pResult); - break; - - case DDID_TypeHandleToExpandedTypeInfo: - Unpack_TypeHandleToExpandedTypeInfo(pSend, pResult); - break; - - case DDID_GetObjectExpandedTypeInfo: - Unpack_GetObjectExpandedTypeInfo(pSend, pResult); - break; - - case DDID_GetObjectExpandedTypeInfoFromID: - Unpack_GetObjectExpandedTypeInfoFromID(pSend, pResult); - break; - - case DDID_GetApproxTypeHandle: - Unpack_GetApproxTypeHandle(pSend, pResult); - break; - - case DDID_GetExactTypeHandle: - Unpack_GetExactTypeHandle(pSend, pResult); - break; - - case DDID_GetMethodDescParams: - Unpack_GetMethodDescParams(pSend, pResult); - break; - - case DDID_GetThreadOrContextStaticAddress: - Unpack_GetThreadOrContextStaticAddress(pSend, pResult); - break; - - case DDID_GetCollectibleTypeStaticAddress: - Unpack_GetCollectibleTypeStaticAddress(pSend, pResult); - break; - - case DDID_GetEnCHangingFieldInfo: - Unpack_GetEnCHangingFieldInfo(pSend, pResult); - break; - - case DDID_GetTypeHandleParams: - Unpack_GetTypeHandleParams(pSend, pResult); - break; - - case DDID_GetSimpleType: - Unpack_GetSimpleType(pSend, pResult); - break; - - case DDID_IsExceptionObject: - Unpack_IsExceptionObject(pSend, pResult); - break; - - case DDID_GetStackFramesFromException: - Unpack_GetStackFramesFromException(pSend, pResult); - break; - - case DDID_IsRcw: - Unpack_IsRcw(pSend, pResult); - break; - - case DDID_GetRcwCachedInterfaceTypes: - Unpack_GetRcwCachedInterfaceTypes(pSend, pResult); - break; - - case DDID_GetRcwCachedInterfacePointers: - Unpack_GetRcwCachedInterfacePointers(pSend, pResult); - break; - - case DDID_GetCachedWinRTTypesForIIDs: - Unpack_GetCachedWinRTTypesForIIDs(pSend, pResult); - break; - - case DDID_GetCachedWinRTTypes: - Unpack_GetCachedWinRTTypes(pSend, pResult); - break; - - case DDID_GetTypedByRefInfo: - Unpack_GetTypedByRefInfo(pSend, pResult); - break; - - case DDID_GetStringData: - Unpack_GetStringData(pSend, pResult); - break; - - case DDID_GetArrayData: - Unpack_GetArrayData(pSend, pResult); - break; - - case DDID_GetBasicObjectInfo: - Unpack_GetBasicObjectInfo(pSend, pResult); - break; - - case DDID_TestCrst: - Unpack_TestCrst(pSend, pResult); - break; - - case DDID_TestRWLock: - Unpack_TestRWLock(pSend, pResult); - break; - - case DDID_GetDebuggerControlBlockAddress: - Unpack_GetDebuggerControlBlockAddress(pSend, pResult); - break; - - case DDID_GetObjectFromRefPtr: - Unpack_GetObjectFromRefPtr(pSend, pResult); - break; - - case DDID_GetObject: - Unpack_GetObject(pSend, pResult); - break; - - case DDID_EnableNGENPolicy: - Unpack_EnableNGENPolicy(pSend, pResult); - break; - - case DDID_GetVmObjectHandle: - Unpack_GetVmObjectHandle(pSend, pResult); - break; - - case DDID_IsVmObjectHandleValid: - Unpack_IsVmObjectHandleValid(pSend, pResult); - break; - - case DDID_IsWinRTModule: - Unpack_IsWinRTModule(pSend, pResult); - break; - - case DDID_GetAppDomainIdFromVmObjectHandle: - Unpack_GetAppDomainIdFromVmObjectHandle(pSend, pResult); - break; - - case DDID_GetHandleAddressFromVmHandle: - Unpack_GetHandleAddressFromVmHandle(pSend, pResult); - break; - - case DDID_GetObjectContents: - Unpack_GetObjectContents(pSend, pResult); - break; - - case DDID_EnumerateBlockingObjects: - Unpack_EnumerateBlockingObjects(pSend, pResult); - break; - - case DDID_GetThreadOwningMonitorLock: - Unpack_GetThreadOwningMonitorLock(pSend, pResult); - break; - - case DDID_EnumerateMonitorEventWaitList: - Unpack_EnumerateMonitorEventWaitList(pSend, pResult); - break; - - case DDID_GetAttachStateFlags: - Unpack_GetAttachStateFlags(pSend, pResult); - break; - - case DDID_GetMetaDataFileInfoFromPEFile: - Unpack_GetMetaDataFileInfoFromPEFile(pSend, pResult); - break; - - case DDID_GetILImageInfoFromNgenPEFile: - Unpack_GetILImageInfoFromNgenPEFile(pSend, pResult); - break; - - case DDID_IsThreadSuspendedOrHijacked: - Unpack_IsThreadSuspendedOrHijacked(pSend, pResult); - break; - - case DDID_AreGCStructuresValid: - Unpack_AreGCStructuresValid(pSend, pResult); - break; - - case DDID_CreateHeapWalk: - Unpack_CreateHeapWalk(pSend, pResult); - break; - - case DDID_DeleteHeapWalk: - Unpack_DeleteHeapWalk(pSend, pResult); - break; - - case DDID_WalkHeap: - Unpack_WalkHeap(pSend, pResult); - break; - - case DDID_GetHeapSegments: - Unpack_GetHeapSegments(pSend, pResult); - break; - - case DDID_IsValidObject: - Unpack_IsValidObject(pSend, pResult); - break; - - case DDID_GetAppDomainForObject: - Unpack_GetAppDomainForObject(pSend, pResult); - break; - - case DDID_CreateRefWalk: - Unpack_CreateRefWalk(pSend, pResult); - break; - - case DDID_DeleteRefWalk: - Unpack_DeleteRefWalk(pSend, pResult); - break; - - case DDID_WalkRefs: - Unpack_WalkRefs(pSend, pResult); - break; - - case DDID_GetTypeID: - Unpack_GetTypeID(pSend, pResult); - break; - - case DDID_GetObjectFields: - Unpack_GetObjectFields(pSend, pResult); - break; - - case DDID_GetTypeLayout: - Unpack_GetTypeLayout(pSend, pResult); - break; - - case DDID_GetArrayLayout: - Unpack_GetArrayLayout(pSend, pResult); - break; - - case DDID_GetGCHeapInformation: - Unpack_GetGCHeapInformation(pSend, pResult); - break; - - - } // end switch -} // end HandleDDMessage method - -#endif //FEATURE_DBGIPC_TRANSPORT_VM - -// end of file diff --git a/src/debug/ee/ddunpack.h b/src/debug/ee/ddunpack.h deleted file mode 100644 index 23be521642..0000000000 --- a/src/debug/ee/ddunpack.h +++ /dev/null @@ -1,498 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -// Unpacker -// -// Lives on EE side of the fence -// -// Note that this file is generated by ndp\clr\src\Debug\tools\BuildDDMarshal\. -// Changes should be made to output\DDUnpack_template.h in that directory. -// - - -#ifndef _DDUNPACK_H_ -#define _DDUNPACK_H_ - -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - -#include "ddmarshalutil.h" -#include "ddshared.h" - - -// This technique is now misnamed, but I am still using it to lower code churn. -// When handing memory back and forth between DAC and DBI we use this (forDbi) new variant -// to ensure that everything goes in the correct heap. In DBI it resolves to new, and in DAC -// it resolves to calling into a special allocator that DBI passed over that ultimately also -// calls DBI new. A few types such as DacDbiArrayList get included on both sides of the DLL -// boundary and they assume there will be a (forDbi) new variant available to them. -// -// Now however we have a new in-proc consumer of DAC and again we need to pass memory blocks -// to it. The most straightforward technique is to consume DAC exactly how DBI does, thus mimicing -// DBI's new variant here so that all the types which straddle the boundary can continue using -// it. At some point we might want to change the naming to something more general... 'forDacCaller' -// perhaps. I don't consider the technique a workaround, just the naming is overly specific. - -#define forDbi (*(forDbiWorker *)NULL) - -// for dbi we just default to new, but we need to have these defined for both dac and dbi -inline void * operator new(size_t lenBytes, const forDbiWorker &) -{ - void * result = new BYTE[lenBytes]; - if (result == NULL) - { - ThrowOutOfMemory(); - } - return result; -} - -inline void * operator new[](size_t lenBytes, const forDbiWorker &) -{ - void * result = new BYTE[lenBytes]; - if (result == NULL) - { - ThrowOutOfMemory(); - } - return result; -} - -// Helper to delete memory used with the IDacDbiInterface::IAllocator interface. -template<class T> inline -void DeleteDbiMemory(T *p) -{ - delete p; -} - - -// Header for unpacking -// -class DDUnpack - { - protected: - IDacDbiInterface * m_pReal; - IDacDbiInterface::IAllocator * m_pAllocator; - public: - DDUnpack(IDacDbiInterface * pReal, IDacDbiInterface::IAllocator * pAllocator) - { - m_pReal = pReal; - m_pAllocator = pAllocator; - } - - // Main entry point - // This will then delegate to the proper unpacking stubs. - void HandleDDMessage(ReadBuffer * pSend, WriteBuffer * pResult); - - - // - // Stubs - // - -//--------------------------------------------------------------------- -// Unpacking stubs - // HRESULT CheckDbiVersion(const DbiVersion * pVersion) - void Unpack_CheckDbiVersion(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetLocalInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2) - void Unpack_GetLocalInterfaceHashAndTimestamp(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetRemoteInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2) - void Unpack_GetRemoteInterfaceHashAndTimestamp(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT FlushCache() - void Unpack_FlushCache(ReadBuffer * pSend, WriteBuffer * pResult); - - // void DacSetTargetConsistencyChecks(bool fEnableAsserts) - void Unpack_DacSetTargetConsistencyChecks(ReadBuffer * pSend, WriteBuffer * pResult); - - // void Destroy() - void Unpack_Destroy(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsLeftSideInitialized() - void Unpack_IsLeftSideInitialized(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_AppDomain GetAppDomainFromId(ULONG appdomainId) - void Unpack_GetAppDomainFromId(ReadBuffer * pSend, WriteBuffer * pResult); - - // ULONG GetAppDomainId(VMPTR_AppDomain vmAppDomain) - void Unpack_GetAppDomainId(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetAppDomainObject(VMPTR_AppDomain vmAppDomain) - void Unpack_GetAppDomainObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsDefaultDomain(VMPTR_AppDomain vmAppDomain) - void Unpack_IsDefaultDomain(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetAssemblyFromDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, VMPTR_Assembly * vmAssembly) - void Unpack_GetAssemblyFromDomainAssembly(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsAssemblyFullyTrusted(VMPTR_DomainAssembly vmDomainAssembly) - void Unpack_IsAssemblyFullyTrusted(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName) - void Unpack_GetAppDomainFullName(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetModuleSimpleName(VMPTR_Module vmModule, IStringHolder * pStrFilename) - void Unpack_GetModuleSimpleName(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL GetAssemblyPath(VMPTR_Assembly vmAssembly, IStringHolder * pStrFilename) - void Unpack_GetAssemblyPath(ReadBuffer * pSend, WriteBuffer * pResult); - - // void ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) - void Unpack_ResolveTypeReference(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL GetModulePath(VMPTR_Module vmModule, IStringHolder * pStrFilename) - void Unpack_GetModulePath(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL GetModuleNGenPath(VMPTR_Module vmModule, IStringHolder * pStrFilename) - void Unpack_GetModuleNGenPath(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetMetadata(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer) - void Unpack_GetMetadata(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer, IDacDbiInterface::SymbolFormat * pSymbolFormat) - void Unpack_GetSymbolsBuffer(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData) - void Unpack_GetModuleData(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData) - void Unpack_GetDomainFileData(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, VMPTR_Module * pModule) - void Unpack_GetModuleForDomainFile(ReadBuffer * pSend, WriteBuffer * pResult); - - // IDacDbiInterface::AddressType GetAddressType(CORDB_ADDRESS address) - void Unpack_GetAddressType(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsTransitionStub(CORDB_ADDRESS address) - void Unpack_IsTransitionStub(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL * pfAllowJITOpts, BOOL * pfEnableEnC) - void Unpack_GetCompilerFlags(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT SetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL fAllowJitOpts, BOOL fEnableEnC) - void Unpack_SetCompilerFlags(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateAppDomains(IDacDbiInterface::FP_APPDOMAIN_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateAppDomains(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateAssembliesInAppDomain(VMPTR_AppDomain vmAppDomain, IDacDbiInterface::FP_ASSEMBLY_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateAssembliesInAppDomain(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateModulesInAssembly(VMPTR_DomainAssembly vmAssembly, IDacDbiInterface::FP_MODULE_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateModulesInAssembly(ReadBuffer * pSend, WriteBuffer * pResult); - - // void RequestSyncAtEvent() - void Unpack_RequestSyncAtEvent(ReadBuffer * pSend, WriteBuffer * pResult); - - // void MarkDebuggerAttachPending() - void Unpack_MarkDebuggerAttachPending(ReadBuffer * pSend, WriteBuffer * pResult); - - // void MarkDebuggerAttached(BOOL fAttached) - void Unpack_MarkDebuggerAttached(ReadBuffer * pSend, WriteBuffer * pResult); - - // void Hijack(VMPTR_Thread vmThread, ULONG32 dwThreadId, const EXCEPTION_RECORD * pRecord, T_CONTEXT * pOriginalContext, ULONG32 cbSizeContext, EHijackReason::EHijackReason reason, void * pUserData, CORDB_ADDRESS * pRemoteContextAddr) - void Unpack_Hijack(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateConnections(IDacDbiInterface::FP_CONNECTION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateConnections(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateThreads(IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateThreads(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool IsThreadMarkedDead(VMPTR_Thread vmThread) - void Unpack_IsThreadMarkedDead(ReadBuffer * pSend, WriteBuffer * pResult); - - // HANDLE GetThreadHandle(VMPTR_Thread vmThread) - void Unpack_GetThreadHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetThreadObject(VMPTR_Thread vmThread) - void Unpack_GetThreadObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // void SetDebugState(VMPTR_Thread vmThread, CorDebugThreadState debugState) - void Unpack_SetDebugState(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL HasUnhandledException(VMPTR_Thread vmThread) - void Unpack_HasUnhandledException(ReadBuffer * pSend, WriteBuffer * pResult); - - // CorDebugUserState GetUserState(VMPTR_Thread vmThread) - void Unpack_GetUserState(ReadBuffer * pSend, WriteBuffer * pResult); - - // CONNID GetConnectionID(VMPTR_Thread vmThread) - void Unpack_GetConnectionID(ReadBuffer * pSend, WriteBuffer * pResult); - - // TASKID GetTaskID(VMPTR_Thread vmThread) - void Unpack_GetTaskID(ReadBuffer * pSend, WriteBuffer * pResult); - - // DWORD TryGetVolatileOSThreadID(VMPTR_Thread vmThread) - void Unpack_TryGetVolatileOSThreadID(ReadBuffer * pSend, WriteBuffer * pResult); - - // DWORD GetUniqueThreadID(VMPTR_Thread vmThread) - void Unpack_GetUniqueThreadID(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetCurrentException(VMPTR_Thread vmThread) - void Unpack_GetCurrentException(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetCurrentCustomDebuggerNotification(VMPTR_Thread vmThread) - void Unpack_GetCurrentCustomDebuggerNotification(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread) - void Unpack_GetCurrentAppDomain(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef) - void Unpack_ResolveAssembly(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetNativeCodeSequencePointsAndVarInfo(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS startAddress, BOOL fCodeAvailabe, NativeVarData * pNativeVarData, SequencePoints * pSequencePoints) - void Unpack_GetNativeCodeSequencePointsAndVarInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_CONTEXT GetManagedStoppedContext(VMPTR_Thread vmThread) - void Unpack_GetManagedStoppedContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // void CreateStackWalk(VMPTR_Thread vmThread, DT_CONTEXT * pInternalContextBuffer, StackWalkHandle * ppSFIHandle) - void Unpack_CreateStackWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // void DeleteStackWalk(StackWalkHandle ppSFIHandle) - void Unpack_DeleteStackWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetStackWalkCurrentContext(StackWalkHandle pSFIHandle, DT_CONTEXT * pContext) - void Unpack_GetStackWalkCurrentContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // void SetStackWalkCurrentContext(VMPTR_Thread vmThread, StackWalkHandle pSFIHandle, CorDebugSetContextFlag flag, DT_CONTEXT * pContext) - void Unpack_SetStackWalkCurrentContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL UnwindStackWalkFrame(StackWalkHandle pSFIHandle) - void Unpack_UnwindStackWalkFrame(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT CheckContext(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) - void Unpack_CheckContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // IDacDbiInterface::FrameType GetStackWalkCurrentFrameInfo(StackWalkHandle pSFIHandle, DebuggerIPCE_STRData * pFrameData) - void Unpack_GetStackWalkCurrentFrameInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // ULONG32 GetCountOfInternalFrames(VMPTR_Thread vmThread) - void Unpack_GetCountOfInternalFrames(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateInternalFrames(VMPTR_Thread vmThread, IDacDbiInterface::FP_INTERNAL_FRAME_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateInternalFrames(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsMatchingParentFrame(FramePointer fpToCheck, FramePointer fpParent) - void Unpack_IsMatchingParentFrame(ReadBuffer * pSend, WriteBuffer * pResult); - - // ULONG32 GetStackParameterSize(CORDB_ADDRESS controlPC) - void Unpack_GetStackParameterSize(ReadBuffer * pSend, WriteBuffer * pResult); - - // FramePointer GetFramePointer(StackWalkHandle pSFIHandle) - void Unpack_GetFramePointer(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsLeafFrame(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) - void Unpack_IsLeafFrame(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetContext(VMPTR_Thread vmThread, DT_CONTEXT * pContextBuffer) - void Unpack_GetContext(ReadBuffer * pSend, WriteBuffer * pResult); - - // void ConvertContextToDebuggerRegDisplay(const DT_CONTEXT * pInContext, DebuggerREGDISPLAY * pOutDRD, BOOL fActive) - void Unpack_ConvertContextToDebuggerRegDisplay(ReadBuffer * pSend, WriteBuffer * pResult); - - // IDacDbiInterface::DynamicMethodType IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc) - void Unpack_IsILStubOrLCGMethod(ReadBuffer * pSend, WriteBuffer * pResult); - - // TargetBuffer GetVarArgSig(CORDB_ADDRESS VASigCookieAddr, CORDB_ADDRESS * pArgBase) - void Unpack_GetVarArgSig(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL RequiresAlign8(VMPTR_TypeHandle thExact) - void Unpack_RequiresAlign8(ReadBuffer * pSend, WriteBuffer * pResult); - - // GENERICS_TYPE_TOKEN ResolveExactGenericArgsToken(DWORD dwExactGenericArgsTokenIndex, GENERICS_TYPE_TOKEN rawToken) - void Unpack_ResolveExactGenericArgsToken(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken) - void Unpack_GetILCodeAndSig(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, mdToken functionToken, NativeCodeFunctionData * pCodeInfo) - void Unpack_GetNativeCodeInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetNativeCodeInfoForAddr(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS hotCodeStartAddr, NativeCodeFunctionData * pCodeInfo) - void Unpack_GetNativeCodeInfoForAddr(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetClassInfo(VMPTR_AppDomain vmAppDomain, VMPTR_Module vmModule, mdTypeDef metadataToken, VMPTR_TypeHandle thExact, VMPTR_TypeHandle thApprox, ClassInfo * pData) - void Unpack_GetClassInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetInstantiationFieldInfo(VMPTR_DomainFile vmDomainFile, mdTypeDef metadataToken, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList<FieldData> * pFieldList, SIZE_T * pObjectSize) - void Unpack_GetInstantiationFieldInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, DebuggerIPCE_ExpandedTypeData * pTypeInfo) - void Unpack_TypeHandleToExpandedTypeInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetObjectExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, CORDB_ADDRESS addr, DebuggerIPCE_ExpandedTypeData * pTypeInfo) - void Unpack_GetObjectExpandedTypeInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetObjectExpandedTypeInfoFromID(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, COR_TYPEID id, DebuggerIPCE_ExpandedTypeData * pTypeInfo) - void Unpack_GetObjectExpandedTypeInfoFromID(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_TypeHandle GetApproxTypeHandle(TypeInfoList * pTypeData) - void Unpack_GetApproxTypeHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT GetExactTypeHandle(DebuggerIPCE_ExpandedTypeData * pTypeData, ArgInfoList * pArgInfo, VMPTR_TypeHandle & vmTypeHandle) - void Unpack_GetExactTypeHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetMethodDescParams(VMPTR_AppDomain vmAppDomain, VMPTR_MethodDesc vmMethodDesc, GENERICS_TYPE_TOKEN genericsToken, UINT32 * pcGenericClassTypeParams, TypeParamsList * pGenericTypeParams) - void Unpack_GetMethodDescParams(ReadBuffer * pSend, WriteBuffer * pResult); - - // CORDB_ADDRESS GetThreadOrContextStaticAddress(VMPTR_FieldDesc vmField, VMPTR_Thread vmRuntimeThread) - void Unpack_GetThreadOrContextStaticAddress(ReadBuffer * pSend, WriteBuffer * pResult); - - // CORDB_ADDRESS GetCollectibleTypeStaticAddress(VMPTR_FieldDesc vmField, VMPTR_AppDomain vmAppDomain) - void Unpack_GetCollectibleTypeStaticAddress(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetEnCHangingFieldInfo(const EnCHangingFieldInfo * pEnCFieldInfo, FieldData * pFieldData, BOOL * pfStatic) - void Unpack_GetEnCHangingFieldInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetTypeHandleParams(VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, TypeParamsList * pParams) - void Unpack_GetTypeHandleParams(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetSimpleType(VMPTR_AppDomain vmAppDomain, CorElementType simpleType, mdTypeDef * pMetadataToken, VMPTR_Module * pVmModule, VMPTR_DomainFile * pVmDomainFile) - void Unpack_GetSimpleType(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsExceptionObject(VMPTR_Object vmObject) - void Unpack_IsExceptionObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetStackFramesFromException(VMPTR_Object vmObject, DacDbiArrayList<DacExceptionCallStackData> & dacStackFrames) - void Unpack_GetStackFramesFromException(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsRcw(VMPTR_Object vmObject) - void Unpack_IsRcw(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetRcwCachedInterfaceTypes(VMPTR_Object vmObject, VMPTR_AppDomain vmAppDomain, BOOL bIInspectableOnly, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pDacInterfaces) - void Unpack_GetRcwCachedInterfaceTypes(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetRcwCachedInterfacePointers(VMPTR_Object vmObject, BOOL bIInspectableOnly, DacDbiArrayList<CORDB_ADDRESS> * pDacItfPtrs) - void Unpack_GetRcwCachedInterfacePointers(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetCachedWinRTTypesForIIDs(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> & iids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes) - void Unpack_GetCachedWinRTTypesForIIDs(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetCachedWinRTTypes(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> * piids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes) - void Unpack_GetCachedWinRTTypes(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetTypedByRefInfo(CORDB_ADDRESS pTypedByRef, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) - void Unpack_GetTypedByRefInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetStringData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) - void Unpack_GetStringData(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetArrayData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) - void Unpack_GetArrayData(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetBasicObjectInfo(CORDB_ADDRESS objectAddress, CorElementType type, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) - void Unpack_GetBasicObjectInfo(ReadBuffer * pSend, WriteBuffer * pResult); - - // void TestCrst(VMPTR_Crst vmCrst) - void Unpack_TestCrst(ReadBuffer * pSend, WriteBuffer * pResult); - - // void TestRWLock(VMPTR_SimpleRWLock vmRWLock) - void Unpack_TestRWLock(ReadBuffer * pSend, WriteBuffer * pResult); - - // CORDB_ADDRESS GetDebuggerControlBlockAddress() - void Unpack_GetDebuggerControlBlockAddress(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_Object GetObjectFromRefPtr(CORDB_ADDRESS ptr) - void Unpack_GetObjectFromRefPtr(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_Object GetObject(CORDB_ADDRESS ptr) - void Unpack_GetObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT EnableNGENPolicy(CorDebugNGENPolicy ePolicy) - void Unpack_EnableNGENPolicy(ReadBuffer * pSend, WriteBuffer * pResult); - - // VMPTR_OBJECTHANDLE GetVmObjectHandle(CORDB_ADDRESS handleAddress) - void Unpack_GetVmObjectHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // BOOL IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle) - void Unpack_IsVmObjectHandleValid(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT IsWinRTModule(VMPTR_Module vmModule, BOOL & isWinRT) - void Unpack_IsWinRTModule(ReadBuffer * pSend, WriteBuffer * pResult); - - // ULONG GetAppDomainIdFromVmObjectHandle(VMPTR_OBJECTHANDLE vmHandle) - void Unpack_GetAppDomainIdFromVmObjectHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // CORDB_ADDRESS GetHandleAddressFromVmHandle(VMPTR_OBJECTHANDLE vmHandle) - void Unpack_GetHandleAddressFromVmHandle(ReadBuffer * pSend, WriteBuffer * pResult); - - // TargetBuffer GetObjectContents(VMPTR_Object obj) - void Unpack_GetObjectContents(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateBlockingObjects(VMPTR_Thread vmThread, IDacDbiInterface::FP_BLOCKINGOBJECT_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateBlockingObjects(ReadBuffer * pSend, WriteBuffer * pResult); - - // MonitorLockInfo GetThreadOwningMonitorLock(VMPTR_Object vmObject) - void Unpack_GetThreadOwningMonitorLock(ReadBuffer * pSend, WriteBuffer * pResult); - - // void EnumerateMonitorEventWaitList(VMPTR_Object vmObject, IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - void Unpack_EnumerateMonitorEventWaitList(ReadBuffer * pSend, WriteBuffer * pResult); - - // CLR_DEBUGGING_PROCESS_FLAGS GetAttachStateFlags() - void Unpack_GetAttachStateFlags(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool GetMetaDataFileInfoFromPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwImageSize, bool & isNGEN, IStringHolder * pStrFilename) - void Unpack_GetMetaDataFileInfoFromPEFile(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool GetILImageInfoFromNgenPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwSize, IStringHolder * pStrFilename) - void Unpack_GetILImageInfoFromNgenPEFile(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool IsThreadSuspendedOrHijacked(VMPTR_Thread vmThread) - void Unpack_IsThreadSuspendedOrHijacked(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool AreGCStructuresValid() - void Unpack_AreGCStructuresValid(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT CreateHeapWalk(HeapWalkHandle * pHandle) - void Unpack_CreateHeapWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // void DeleteHeapWalk(HeapWalkHandle handle) - void Unpack_DeleteHeapWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT WalkHeap(HeapWalkHandle handle, ULONG count, COR_HEAPOBJECT * objects, ULONG * pFetched) - void Unpack_WalkHeap(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT GetHeapSegments(DacDbiArrayList<COR_SEGMENT> * pSegments) - void Unpack_GetHeapSegments(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool IsValidObject(CORDB_ADDRESS obj) - void Unpack_IsValidObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // bool GetAppDomainForObject(CORDB_ADDRESS obj, VMPTR_AppDomain * pApp, VMPTR_Module * pModule, VMPTR_DomainFile * pDomainFile) - void Unpack_GetAppDomainForObject(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT CreateRefWalk(RefWalkHandle * pHandle, BOOL walkStacks, BOOL walkFQ, UINT32 handleWalkMask) - void Unpack_CreateRefWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // void DeleteRefWalk(RefWalkHandle handle) - void Unpack_DeleteRefWalk(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT WalkRefs(RefWalkHandle handle, ULONG count, DacGcReference * refs, ULONG * pFetched) - void Unpack_WalkRefs(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT GetTypeID(CORDB_ADDRESS obj, COR_TYPEID * pType) - void Unpack_GetTypeID(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT GetObjectFields(COR_TYPEID id, ULONG32 celt, COR_FIELD * layout, ULONG32 * pceltFetched) - void Unpack_GetObjectFields(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT * pLayout) - void Unpack_GetTypeLayout(ReadBuffer * pSend, WriteBuffer * pResult); - - // HRESULT GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT * pLayout) - void Unpack_GetArrayLayout(ReadBuffer * pSend, WriteBuffer * pResult); - - // void GetGCHeapInformation(COR_HEAPINFO * pHeapInfo) - void Unpack_GetGCHeapInformation(ReadBuffer * pSend, WriteBuffer * pResult); - - }; - -#endif // _DDUNPACK_H_ - -#endif //FEATURE_DBGIPC_TRANSPORT_VM - -// end of file diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index f95e49b3f0..582a3954a9 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -38,8 +38,6 @@ #include "../../vm/excep.h" #if defined(FEATURE_DBGIPC_TRANSPORT_VM) #include "dbgtransportsession.h" -#include "dbgtransportproxy.h" -#include "dbgsecureconnection.h" #endif // FEATURE_DBGIPC_TRANSPORT_VM @@ -1729,11 +1727,7 @@ void Debugger::RaiseStartupNotification() // listening, and we will fail. However, we still want to initialize the variable above. BOOL fRaiseStartupNotification = TRUE; #if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(useTransport) - { - fRaiseStartupNotification = (CORDebuggerAttached() ? TRUE : FALSE); - } + fRaiseStartupNotification = (CORDebuggerAttached() ? TRUE : FALSE); #endif if (fRaiseStartupNotification) { @@ -1766,67 +1760,58 @@ void Debugger::RaiseStartupNotification() void Debugger::SendRawEvent(const DebuggerIPCEvent * pManagedEvent) { #if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(useTransport) - { - HRESULT hr = g_pDbgTransport->SendDebugEvent(const_cast<DebuggerIPCEvent *>(pManagedEvent)); + HRESULT hr = g_pDbgTransport->SendDebugEvent(const_cast<DebuggerIPCEvent *>(pManagedEvent)); - if (FAILED(hr)) - { - _ASSERTE(!"Failed to send debugger event"); + if (FAILED(hr)) + { + _ASSERTE(!"Failed to send debugger event"); - STRESS_LOG1(LF_CORDB, LL_INFO1000, "D::SendIPCEvent Error on Send with 0x%x\n", hr); - UnrecoverableError(hr, - 0, - FILE_DEBUG, - LINE_DEBUG, - false); + STRESS_LOG1(LF_CORDB, LL_INFO1000, "D::SendIPCEvent Error on Send with 0x%x\n", hr); + UnrecoverableError(hr, + 0, + FILE_DEBUG, + LINE_DEBUG, + false); - // @dbgtodo Mac - what can we do here? - } + // @dbgtodo Mac - what can we do here? } - else +#else + // We get to send an array of ULONG_PTRs as data with the notification. + // The debugger can then use ReadProcessMemory to read through this array. + ULONG_PTR rgData [] = { + CLRDBG_EXCEPTION_DATA_CHECKSUM, + (ULONG_PTR) g_pMSCorEE, + (ULONG_PTR) pManagedEvent + }; + + // If no debugger attached, then don't bother raising a 1st-chance exception because nobody will sniff it. + // @dbgtodo iDNA: in iDNA case, the recorder may sniff it. + if (!IsDebuggerPresent()) { -#endif - // We get to send an array of ULONG_PTRs as data with the notification. - // The debugger can then use ReadProcessMemory to read through this array. - ULONG_PTR rgData [] = { - CLRDBG_EXCEPTION_DATA_CHECKSUM, - (ULONG_PTR) g_pMSCorEE, - (ULONG_PTR) pManagedEvent - }; - - // If no debugger attached, then don't bother raising a 1st-chance exception because nobody will sniff it. - // @dbgtodo iDNA: in iDNA case, the recorder may sniff it. - if (!IsDebuggerPresent()) - { - return; - } - - // - // Physically send the event via an OS Exception. We're using exceptions as a notification - // mechanism on top of the OS native debugging pipeline. - // @dbgtodo cross-plat - this needs to be cross-plat. - // - EX_TRY - { - const DWORD dwFlags = 0; // continuable (eg, Debugger can continue GH) - RaiseException(CLRDBG_NOTIFICATION_EXCEPTION_CODE, dwFlags, NumItems(rgData), rgData); + return; + } - // If debugger continues "GH" (DBG_CONTINUE), then we land here. - // This is the expected path for a well-behaved ICorDebug debugger. - } - EX_CATCH - { - // If no debugger is attached, or if the debugger continues "GN" (DBG_EXCEPTION_NOT_HANDLED), then we land here. - // A naive (not-ICorDebug aware) native-debugger won't handle the exception and so land us here. - // We may also get here if a debugger detaches at the Exception notification - // (and thus implicitly continues GN). - } - EX_END_CATCH(SwallowAllExceptions); + // + // Physically send the event via an OS Exception. We're using exceptions as a notification + // mechanism on top of the OS native debugging pipeline. + // @dbgtodo cross-plat - this needs to be cross-plat. + // + EX_TRY + { + const DWORD dwFlags = 0; // continuable (eg, Debugger can continue GH) + RaiseException(CLRDBG_NOTIFICATION_EXCEPTION_CODE, dwFlags, NumItems(rgData), rgData); -#ifdef FEATURE_DBGIPC_TRANSPORT_VM + // If debugger continues "GH" (DBG_CONTINUE), then we land here. + // This is the expected path for a well-behaved ICorDebug debugger. + } + EX_CATCH + { + // If no debugger is attached, or if the debugger continues "GN" (DBG_EXCEPTION_NOT_HANDLED), then we land here. + // A naive (not-ICorDebug aware) native-debugger won't handle the exception and so land us here. + // We may also get here if a debugger detaches at the Exception notification + // (and thus implicitly continues GN). } + EX_END_CATCH(SwallowAllExceptions); #endif // FEATURE_DBGIPC_TRANSPORT_VM } @@ -1992,15 +1977,9 @@ HRESULT Debugger::Startup(void) // Iff the debug pack is installed, then go through the telesto debugging pipeline. LOG((LF_CORDB, LL_INFO10, "Debugging service is enabled because debug pack is installed or Watson support is enabled)\n")); -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) - { -#endif - // This may block while an attach occurs. - NotifyDebuggerOfTelestoStartup(); -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + // This may block while an attach occurs. + NotifyDebuggerOfTelestoStartup(); #endif } else @@ -2102,86 +2081,32 @@ HRESULT Debugger::Startup(void) _ASSERTE(SUCCEEDED(hr)); // throws on error #if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(useTransport) - { - // The in-process DAC for Mac is lazily initialized when we get the first DDMessage. - // We check whether the DAC and the runtime has matching versions when we do the initialization, and - // we'll fail if the versions don't match. That's why we don't want to do the initialization here because - // even if we have the wrong version of DAC, managed apps can still run. We just can't debug it. - - // Create transport control block and initialize it. - g_pDbgTransport = new DbgTransportSession(); - hr = g_pDbgTransport->Init(m_pRCThread->GetDCB(), m_pAppDomainCB, &m_inProcDac); - if (FAILED(hr)) - ThrowHR(hr); - - // Create interface to talk to debugger proxy and initialize it. - DbgTransportProxy *pProxy = new DbgTransportProxy(); - hr = pProxy->Init(g_pDbgTransport->GetPort()); - if (FAILED(hr)) - ThrowHR(hr); - - // Contact the debugger proxy process for this machine. This has several purposes: - // 1) Register this runtime instance as available for debugging. - // 2) Check whether a debugger is already waiting to attach to us. - // 3) Publish the port number we expect debugging requests to target. - // The following call blocks until we receive a reply from the proxy or time out. - DbgProxyResult result = pProxy->RegisterWithProxy(); - switch (result) - { - case RequestTimedOut: - // The proxy doesn't appear to be there, we're not debuggable as a result. - // To be careful (and avoid malicious types trying to connect to us even when the proxy is not up) - // neuter the transport so that it won't accept any connections. Ideally we'd just shutdown the - // debugger subsystem entirely, but this appears to be somewhat complex at this late stage. - g_pDbgTransport->Neuter(); - break; - case RequestSuccessful: - // We registered with the proxy successfully. No debugger was interested in - // us just yet. - break; - case PendingDebuggerAttach: - // We registered with the proxy and found that a debugger was registered for - // an early attach. - - // Mark this process as launched by the debugger and the debugger as attached. - g_CORDebuggerControlFlags |= DBCF_GENERATE_DEBUG_CODE; - MarkDebuggerAttachedInternal(); - - LazyInit(); - DebuggerController::Initialize(); - break; - default: - _ASSERTE(!"Unknown result code from DbgTransportSession::RegisterWithProxy()"); - } - - // The debugger no longer needs to talk with the proxy. - pProxy->Shutdown(); - delete pProxy; - } + // Create transport session and initialize it. + g_pDbgTransport = new DbgTransportSession(); + hr = g_pDbgTransport->Init(m_pRCThread->GetDCB(), m_pAppDomainCB); + if (FAILED(hr)) + ThrowHR(hr); + + bool waitForAttach = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgWaitForDebuggerAttach) != 0; + if (waitForAttach) + { + // Mark this process as launched by the debugger and the debugger as attached. + g_CORDebuggerControlFlags |= DBCF_GENERATE_DEBUG_CODE; + MarkDebuggerAttachedInternal(); + + LazyInit(); + DebuggerController::Initialize(); + } #endif // FEATURE_DBGIPC_TRANSPORT_VM RaiseStartupNotification(); // Also initialize the AppDomainEnumerationIPCBlock -#if defined(FEATURE_IPCMAN) -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(useTransport) - { - m_pAppDomainCB = new (nothrow) AppDomainEnumerationIPCBlock(); - } - else - { -#endif - m_pAppDomainCB = g_pIPCManagerInterface->GetAppDomainBlock(); -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - } -#endif -#else // FEATURE_IPCMAN +#if !defined(FEATURE_IPCMAN) || defined(FEATURE_DBGIPC_TRANSPORT_VM) m_pAppDomainCB = new (nothrow) AppDomainEnumerationIPCBlock(); -#endif // FEATURE_IPCMAN +#else + m_pAppDomainCB = g_pIPCManagerInterface->GetAppDomainBlock(); +#endif if (m_pAppDomainCB == NULL) { @@ -5551,19 +5476,13 @@ void Debugger::TrapAllRuntimeThreads() } CONTRACTL_END; -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + // Only sync if RS requested it. + if (!m_RSRequestedSync) { -#endif - // Only sync if RS requested it. - if (!m_RSRequestedSync) - { - return; - } - m_RSRequestedSync = FALSE; -#ifdef FEATURE_DBGIPC_TRANSPORT_VM + return; } + m_RSRequestedSync = FALSE; #endif // If we're doing shutdown, then don't bother trying to communicate w/ the RS. diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h index 41ff93d16f..6f71b5c74a 100644 --- a/src/debug/ee/debugger.h +++ b/src/debug/ee/debugger.h @@ -49,7 +49,6 @@ #include "dllimportcallback.h" #include "canary.h" -#include "inprocdac.h" #undef ASSERT #define CRASH(x) _ASSERTE(!x) @@ -836,17 +835,9 @@ private: DebuggerIPCEvent * GetRCThreadReceiveBuffer() { #if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(useTransport) - { - return reinterpret_cast<DebuggerIPCEvent *>(&m_receiveBuffer[0]); - } - else - { -#endif // FEATURE_DBGIPC_TRANSPORT_VM - return reinterpret_cast<DebuggerIPCEvent *>(&m_pDCB->m_receiveBuffer[0]); -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } + return reinterpret_cast<DebuggerIPCEvent *>(&m_receiveBuffer[0]); +#else + return reinterpret_cast<DebuggerIPCEvent *>(&m_pDCB->m_receiveBuffer[0]); #endif } @@ -855,17 +846,9 @@ private: DebuggerIPCEvent * GetRCThreadSendBuffer() { #if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(useTransport) - { - return reinterpret_cast<DebuggerIPCEvent *>(&m_sendBuffer[0]); - } - else - { -#endif // FEATURE_DBGIPC_TRANSPORT_VM - return reinterpret_cast<DebuggerIPCEvent *>(&m_pDCB->m_sendBuffer[0]); -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } + return reinterpret_cast<DebuggerIPCEvent *>(&m_sendBuffer[0]); +#else // FEATURE_DBGIPC_TRANSPORT_VM + return reinterpret_cast<DebuggerIPCEvent *>(&m_pDCB->m_sendBuffer[0]); #endif // FEATURE_DBGIPC_TRANSPORT_VM } @@ -2805,11 +2788,6 @@ private: PTR_DebuggerLazyInit m_pLazyData; -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - InProcDac m_inProcDac; -#endif // FEATURE_DBGIPC_TRANSPORT_VM - - // A list of all defines that affect layout of MD types typedef enum _Target_Defines diff --git a/src/debug/ee/inprocdac.cpp b/src/debug/ee/inprocdac.cpp deleted file mode 100644 index e451cf08bb..0000000000 --- a/src/debug/ee/inprocdac.cpp +++ /dev/null @@ -1,432 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// -//***************************************************************************** -// File: InProcDac.cpp -// - -// -// -// -//***************************************************************************** - -#include "stdafx.h" - -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - -#include "inprocdac.h" -#include "dacdbiinterface.h" -#include "cordebug.h" -#include "metadata.h" - -InProcDac::InProcDac() : - m_pDacDbi(NULL), - m_pUnpacker(NULL) -{ -} - -InProcDac::~InProcDac() -{ - Cleanup(); -} - -// -// Debugger::InitializeDAC -// -// DAC is used in-process on the Mac and ARM devices. -// This is similar to CordbProcess::CreateDacDbiInterface on Windows. -// @dbgtodo : try and share some of this code with the RS equivalent? -// -void InProcDac::Initialize() -{ - CONTRACTL - { - THROWS; - } - CONTRACTL_END; - - // don't double-init - _ASSERTE(m_pDataTarget == NULL); - _ASSERTE(m_pDacDbi == NULL); - _ASSERTE(m_pUnpacker == NULL); - - HRESULT hrStatus = S_OK; - HModuleHolder hDacDll; - - // - // Load the access DLL from the same directory as the the current CLR DLL. - // - WCHAR wszRuntimePath[MAX_PATH]; // base directory of the runtime (including trailing /) - WCHAR wszAccessDllPath[MAX_PATH]; // full path to the DAC Dll - - if (!WszGetModuleFileName(GetCLRModule(), wszRuntimePath, NumItems(wszRuntimePath))) - { - ThrowLastError(); - } - - const char pathSep = '\\'; - - // remove CLR filename - PWSTR pPathTail = wcsrchr(wszRuntimePath, pathSep); - if (!pPathTail) - { - ThrowHR(E_INVALIDARG); - } - pPathTail[1] = '\0'; - - // In the case where this function is called multiple times, save the module handle to the DAC shared - // library so that we won't try to free and load it multiple times. - if (m_hDacModule == NULL) - { - if (wcscpy_s(wszAccessDllPath, _countof(wszAccessDllPath), wszRuntimePath) || - wcscat_s(wszAccessDllPath, _countof(wszAccessDllPath), MAKEDLLNAME_W(MAIN_DAC_MODULE_NAME_W))) - { - ThrowHR(E_INVALIDARG); - } - - hDacDll.Assign(WszLoadLibrary(wszAccessDllPath)); - if (!hDacDll) - { - CONSISTENCY_CHECK_MSGF(false,("Unable to find DAC dll: %s", wszAccessDllPath)); - - DWORD dwLastError = GetLastError(); - if (dwLastError == ERROR_MOD_NOT_FOUND) - { - // Give a more specific error in the case where we can't find the DAC dll. - ThrowHR(CORDBG_E_DEBUG_COMPONENT_MISSING); - } - else - { - ThrowWin32(dwLastError); - } - } - - // Succeeded. Now copy out. - m_hDacModule.Assign(hDacDll); - hDacDll.SuppressRelease(); - } - - // Create the data target - ReleaseHolder<InProcDataTarget> pDataTarget = new InProcDataTarget(); - - // - // Get the access interface, passing our callback interfaces (data target, and metadata lookup) - // - - IDacDbiInterface::IMetaDataLookup * pMetaDataLookup = this; - IDacDbiInterface::IAllocator * pAllocator = this; - - // Get the CLR instance ID - the base address of the CLR module - CORDB_ADDRESS clrInstanceId = reinterpret_cast<CORDB_ADDRESS>(GetCLRModule()); - - typedef HRESULT (STDAPICALLTYPE * PFN_DacDbiInterfaceInstance)( - ICorDebugDataTarget *, - CORDB_ADDRESS, - IDacDbiInterface::IAllocator *, - IDacDbiInterface::IMetaDataLookup *, - IDacDbiInterface **); - - IDacDbiInterface* pInterfacePtr = NULL; - PFN_DacDbiInterfaceInstance pfnEntry = (PFN_DacDbiInterfaceInstance) - GetProcAddress(m_hDacModule, "DacDbiInterfaceInstance"); - - if (!pfnEntry) - { - ThrowLastError(); - } - - hrStatus = pfnEntry(pDataTarget, clrInstanceId, - pAllocator, pMetaDataLookup, &pInterfacePtr); - IfFailThrow(hrStatus); - - // We now have a resource, pInterfacePtr, that needs to be freed. - - m_pDacDbi = pInterfacePtr; - m_pDataTarget = pDataTarget.Extract(); - - // Enable DAC target consistency checking - we're in-proc and so better always be consistent - m_pDacDbi->DacSetTargetConsistencyChecks( true ); - m_pUnpacker = new DDUnpack(pInterfacePtr, pAllocator); // throws -} - -void InProcDac::Cleanup() -{ - CONTRACTL - { - NOTHROW; // backout code. - } - CONTRACTL_END; - - if (m_pDacDbi != NULL) - { - m_pDacDbi->Destroy(); - m_pDacDbi = NULL; - } - - if(m_pUnpacker != NULL) - { - delete m_pUnpacker; - m_pUnpacker = NULL; - } - - if (m_pDataTarget != NULL) - { - m_pDataTarget.Clear(); - } - - // Note that once we release this handle, the DAC module can be unloaded and all calls - // into DAC could be invalid. - if (m_hDacModule != NULL) - { - m_hDacModule.Clear(); - } -} - -HRESULT InProcDac::DoRequest(ReadBuffer * pSend, WriteBuffer * pResult) -{ - HRESULT hr = S_OK; - - // Lazily initialize the DacDbiMarshalStub. - if (m_pDacDbi == NULL) - { - EX_TRY - { - Initialize(); - } - EX_CATCH_HRESULT(hr); - IfFailRet(hr); - } - - _ASSERTE(m_pDacDbi != NULL); - - /* - * @dbgtodo : We have to make sure to call Flush whenever runtime data structures may have changed. - * Eg: - * - after every IPC event - * - whenever we suspend the process - * For now we rely on the RS to tell us when to flush, just like the Windows runtime. It's a little riskier - * in this case because the target is actually running code. Since the cost of copying locally is fairly - * low, it is probably best to just flush at the beginning and/or end of all DD requests (i.e. here). - * Flushing more that necessary may be best for performance. - * Note however that this could in theory expose lateng bugs where we've been getting away with bleeding - * DAC state across DD calls on Windows. - */ - EX_TRY - { - m_pUnpacker->HandleDDMessage(pSend, pResult); - } - EX_CATCH_HRESULT(hr); - return hr; -} - -#ifndef DACCESS_COMPILE -IMDInternalImport * InProcDac::LookupMetaData(VMPTR_PEFile addressPEFile, bool &isILMetaDataForNGENImage) -{ - isILMetaDataForNGENImage = false; - PEFile* peFile = addressPEFile.GetRawPtr(); - return peFile->GetPersistentMDImport(); -} -#endif -//*************************************************************** -// InProcDataTarget implementation -//*************************************************************** - -// -// InProcDataTarget ctor -// -// Instantiate an InProcDataTarget -// -InProcDac::InProcDataTarget::InProcDataTarget() : - m_ref(0) -{ -} - -// -// InProcDataTarget dtor -// -// -InProcDac::InProcDataTarget::~InProcDataTarget() -{ -} - -// Standard impl of IUnknown::QueryInterface -HRESULT STDMETHODCALLTYPE -InProcDac::InProcDataTarget::QueryInterface( - REFIID InterfaceId, - PVOID* pInterface) -{ - if (InterfaceId == IID_IUnknown) - { - *pInterface = static_cast<IUnknown *>(static_cast<ICorDebugDataTarget *>(this)); - } - else if (InterfaceId == IID_ICorDebugDataTarget) - { - *pInterface = static_cast<ICorDebugDataTarget *>(this); - } - else if (InterfaceId == IID_ICorDebugMutableDataTarget) - { - *pInterface = static_cast<ICorDebugMutableDataTarget *>(this); - } - else - { - *pInterface = NULL; - return E_NOINTERFACE; - } - - AddRef(); - return S_OK; -} - -// Standard impl of IUnknown::AddRef -ULONG STDMETHODCALLTYPE -InProcDac::InProcDataTarget::AddRef() -{ - LONG ref = InterlockedIncrement(&m_ref); - return ref; -} - -// Standard impl of IUnknown::Release -ULONG STDMETHODCALLTYPE -InProcDac::InProcDataTarget::Release() -{ - LONG ref = InterlockedDecrement(&m_ref); - if (ref == 0) - { - delete this; - } - return ref; -} - -// impl of interface method ICorDebugDataTarget::GetPlatform -HRESULT STDMETHODCALLTYPE -InProcDac::InProcDataTarget::GetPlatform( - CorDebugPlatform * pPlatform) -{ -#if defined(_TARGET_X86_) - *pPlatform = CORDB_PLATFORM_WINDOWS_X86; -#elif defined(_TARGET_AMD64_) - *pPlatform = CORDB_PLATFORM_WINDOWS_AMD64; -#elif defined(_TARGET_ARM_) - *pPlatform = CORDB_PLATFORM_WINDOWS_ARM; -#else -#error Unknown Processor. -#endif // platform - - return S_OK; -} - -// impl of interface method ICorDebugDataTarget::ReadVirtual -HRESULT STDMETHODCALLTYPE -InProcDac::InProcDataTarget::ReadVirtual( - CORDB_ADDRESS address, - PBYTE pBuffer, - ULONG32 cbRequestSize, - ULONG32 * pcbRead) -{ - void * pSrc = reinterpret_cast<void*>(address); - memcpy(pBuffer, pSrc, cbRequestSize); - if (pcbRead != NULL) - { - *pcbRead = cbRequestSize; - } - return S_OK; -} - -// impl of interface method ICorDebugMutableDataTarget::WriteVirtual -HRESULT STDMETHODCALLTYPE -InProcDac::InProcDataTarget::WriteVirtual( - CORDB_ADDRESS address, - const BYTE * pBuffer, - ULONG32 cbRequestSize) -{ - void * pDst = reinterpret_cast<void*>(address); - memcpy(pDst, pBuffer, cbRequestSize); - return S_OK; -} - - -// impl of interface method ICorDebugDataTarget::GetThreadContext -HRESULT STDMETHODCALLTYPE -InProcDac::InProcDataTarget::GetThreadContext( - DWORD dwThreadID, - ULONG32 contextFlags, - ULONG32 contextSize, - PBYTE pContext) -{ - if (contextSize < sizeof(CONTEXT)) - { - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - - HandleHolder hThread = ::OpenThread(THREAD_GET_CONTEXT, FALSE, dwThreadID); - if (hThread == NULL) - { - return HRESULT_FROM_GetLastError(); - } - - // This assumes pContext is appropriately aligned. - CONTEXT * pCtx = reinterpret_cast<CONTEXT*>(pContext); - pCtx->ContextFlags = contextFlags; - if (!::GetThreadContext(hThread, pCtx)) - { - return HRESULT_FROM_GetLastError(); - } - - return S_OK; -} - -// impl of interface method ICorDebugMutableDataTarget::SetThreadContext -HRESULT STDMETHODCALLTYPE -InProcDac::InProcDataTarget::SetThreadContext( - DWORD dwThreadID, - ULONG32 contextSize, - const BYTE * pContext) -{ - if (contextSize < sizeof(CONTEXT)) - { - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - - HandleHolder hThread = ::OpenThread(THREAD_SET_CONTEXT, FALSE, dwThreadID); - if (hThread == NULL) - { - return HRESULT_FROM_GetLastError(); - } - - // This assumes pContext is appropriately aligned. - const CONTEXT * pCtx = reinterpret_cast<const CONTEXT*>(pContext); - if (!::SetThreadContext(hThread,pCtx)) - { - return HRESULT_FROM_GetLastError(); - } - - return S_OK; -} - -// implementation of ICorDebugMutableDataTarget::ContinueStatusChanged -HRESULT STDMETHODCALLTYPE -InProcDac::InProcDataTarget::ContinueStatusChanged( - DWORD dwThreadId, - CORDB_CONTINUE_STATUS continueStatus) -{ - return E_NOTIMPL; -} - -#ifndef DACCESS_COMPILE - -// Trivial implementation for IDacDbiInterface::IAllocator methods -void * InProcDac::Alloc(SIZE_T lenBytes) -{ - return new BYTE[lenBytes]; -} - -void InProcDac::Free(void * p) -{ - BYTE* pB = static_cast<BYTE*>(p); - delete[] pB; -} - -#endif //!DACCESS_COMPILE - -#endif //FEATURE_DBGIPC_TRANSPORT_VM diff --git a/src/debug/ee/inprocdac.h b/src/debug/ee/inprocdac.h deleted file mode 100644 index 408159d12a..0000000000 --- a/src/debug/ee/inprocdac.h +++ /dev/null @@ -1,157 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// -//***************************************************************************** -// File: InProcDac.h -// - -// -//***************************************************************************** - -#ifndef _INPROCDAC_H -#define _INPROCDAC_H - -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) -#include "dacdbiinterface.h" -#include "cordebug.h" -#include "xcordebug.h" - -#ifndef DACCESS_COMPILE -#include "ddunpack.h" -#endif - -class IDacDbiMarshalStub; -class ReadBuffer; -class WriteBuffer; - -// -// InProcDac is a helper class used by the Debugger class to make DAC and -// the IDacDbiInterface available from within process. -// This is done on the Macintosh because we don't have OS support for our -// normal out-of-process access (eg. VM read as non-root user). -// -// Note that we don't ever actually use this in DACCESS_COMPILE builds - it's -// implementation is compiled into just mscorwks, but the callbacks (data target -// and IMetaDataLookup) are called from mscordacwks. We need the declaration -// visible in DACCESS_COMPILE builds because a field of this type is contained -// by-value in the Debugger class, and so we need the correct size for field -// layout. -// -class InProcDac - : private IDacDbiInterface::IMetaDataLookup, - private IDacDbiInterface::IAllocator -{ -public: - InProcDac() DAC_EMPTY(); - ~InProcDac() DAC_EMPTY(); - - void Initialize(); - void Cleanup(); - - // This takes a marshalled version of a DD interface request - HRESULT DoRequest(ReadBuffer * pSend, WriteBuffer * pResult); - -private: - - // IMetaDataLookup methods - virtual IMDInternalImport * LookupMetaData(VMPTR_PEFile addressPEFile, bool &isILMetaDataForNGENImage); - - // - // IAllocator interfaces - // - virtual void * Alloc(SIZE_T lenBytes) DAC_EMPTY_RET(NULL); - - virtual void Free(void * p) DAC_EMPTY(); - - class InProcDataTarget : - public ICorDebugMutableDataTarget - { - public: - InProcDataTarget(); - virtual ~InProcDataTarget(); - - // IUnknown. - virtual HRESULT STDMETHODCALLTYPE QueryInterface( - REFIID riid, - void** ppInterface); - - virtual ULONG STDMETHODCALLTYPE AddRef(); - - virtual ULONG STDMETHODCALLTYPE Release(); - - // ICorDebugMutableDataTarget. - virtual HRESULT STDMETHODCALLTYPE GetPlatform( - CorDebugPlatform *pPlatform); - - virtual HRESULT STDMETHODCALLTYPE ReadVirtual( - CORDB_ADDRESS address, - PBYTE pBuffer, - ULONG32 request, - ULONG32 *pcbRead); - - virtual HRESULT STDMETHODCALLTYPE WriteVirtual( - CORDB_ADDRESS address, - const BYTE * pBuffer, - ULONG32 request); - - virtual HRESULT STDMETHODCALLTYPE GetThreadContext( - DWORD dwThreadID, - ULONG32 contextFlags, - ULONG32 contextSize, - PBYTE context); - - virtual HRESULT STDMETHODCALLTYPE SetThreadContext( - DWORD dwThreadID, - ULONG32 contextSize, - const BYTE * context); - - virtual HRESULT STDMETHODCALLTYPE ContinueStatusChanged( - DWORD dwThreadId, - CORDB_CONTINUE_STATUS continueStatus); - - private: - LONG m_ref; // Reference count. - }; - - - -private: - // - // InProcDac Fields - // - ReleaseHolder<InProcDataTarget> m_pDataTarget; - HModuleHolder m_hDacModule; -#ifndef DACCESS_COMPILE - IDacDbiInterface * m_pDacDbi; - DDUnpack * m_pUnpacker; -#else - VOID * m_pDacDbi; - VOID * m_pUnpacker; -#endif -}; - - -#ifdef DACCESS_COMPILE -// This method is a funny case for DAC and DacCop. InProcDac isn't used in DACCESS_COMPILE builds at all -// (inprocdac.cpp isn't compiled in DAC builds), but we need the declaration since an instance -// of it is contained by-value in the Debugger class (need to know the right size so field layout -// matches the target). The LookupMetadata function is called from DAC, and so DacCop searches -// for all implementations of it in mscordacwks.dll and find this one (the real one is either in -// mscordbi.dll or coreclr which DacCop doesn't analyze). We need an implementation of virtual -// methods for the DACCESS_COMPILE build, but rather than use the usual DAC_EMPTY macros we'll -// use this explicit implementation here to avoid a DacCop violation. -inline IMDInternalImport * InProcDac::LookupMetaData(VMPTR_PEFile addressPEFile, bool &isILMetaDataForNGENImage) -{ - SUPPORTS_DAC; // not really - but we should never be called - _ASSERTE_MSG(false, "This implementation should never be called in DAC builds"); - DacError(E_UNEXPECTED); - return NULL; -} -#endif // DACCESS_COMPILE - - - -#endif // FEATURE_DBGIPC_TRANSPORT_VM - -#endif //_INPROCDAC_H diff --git a/src/debug/ee/rcthread.cpp b/src/debug/ee/rcthread.cpp index 7e6f1ae304..896db99884 100644 --- a/src/debug/ee/rcthread.cpp +++ b/src/debug/ee/rcthread.cpp @@ -305,27 +305,21 @@ HRESULT DebuggerIPCControlBlock::Init( m_bHostingInFiber = true; } -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + // Copy RSEA and RSER into the control block. + if (!m_rightSideEventAvailable.SetLocal(hRsea)) { -#endif - // Copy RSEA and RSER into the control block. - if (!m_rightSideEventAvailable.SetLocal(hRsea)) - { - ThrowLastError(); - } + ThrowLastError(); + } - if (!m_rightSideEventRead.SetLocal(hRser)) - { - ThrowLastError(); - } + if (!m_rightSideEventRead.SetLocal(hRser)) + { + ThrowLastError(); + } - if (!m_leftSideUnmanagedWaitEvent.SetLocal(hLsuwe)) - { - ThrowLastError(); - } -#ifdef FEATURE_DBGIPC_TRANSPORT_VM + if (!m_leftSideUnmanagedWaitEvent.SetLocal(hLsuwe)) + { + ThrowLastError(); } #endif // !FEATURE_DBGIPC_TRANSPORT_VM @@ -420,78 +414,71 @@ HRESULT DebuggerRCThread::Init(void) HRESULT hr; #if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) + + if (m_pDCB) { -#endif - IPCHostSecurityAttributeHolder sa(GetCurrentProcessId()); + hr = m_pDCB->Init(NULL, NULL, NULL, NULL, NULL); + _ASSERTE(SUCCEEDED(hr)); // throws on error. + } +#else //FEATURE_DBGIPC_TRANSPORT_VM - // Create the events that the thread will need to receive events - // from the out of process piece on the right side. - // We will not fail out if CreateEvent fails for RSEA or RSER. Because - // the worst case is that debugger cannot attach to debuggee. - // - HandleHolder rightSideEventAvailable(WszCreateEvent(sa.GetHostSA(), (BOOL) kAutoResetEvent, FALSE, NULL)); + IPCHostSecurityAttributeHolder sa(GetCurrentProcessId()); - // Security fix: - // We need to check the last error to see if the event was precreated or not - // If so, we need to release the handle right now. - // - dwStatus = GetLastError(); - if (dwStatus == ERROR_ALREADY_EXISTS) - { - // clean up the handle now - rightSideEventAvailable.Clear(); - } + // Create the events that the thread will need to receive events + // from the out of process piece on the right side. + // We will not fail out if CreateEvent fails for RSEA or RSER. Because + // the worst case is that debugger cannot attach to debuggee. + // + HandleHolder rightSideEventAvailable(WszCreateEvent(sa.GetHostSA(), (BOOL) kAutoResetEvent, FALSE, NULL)); - HandleHolder rightSideEventRead(WszCreateEvent(sa.GetHostSA(), (BOOL) kAutoResetEvent, FALSE, NULL)); + // Security fix: + // We need to check the last error to see if the event was precreated or not + // If so, we need to release the handle right now. + // + dwStatus = GetLastError(); + if (dwStatus == ERROR_ALREADY_EXISTS) + { + // clean up the handle now + rightSideEventAvailable.Clear(); + } - // Security fix: - // We need to check the last error to see if the event was precreated or not - // If so, we need to release the handle right now. - // - dwStatus = GetLastError(); - if (dwStatus == ERROR_ALREADY_EXISTS) - { - // clean up the handle now - rightSideEventRead.Clear(); - } + HandleHolder rightSideEventRead(WszCreateEvent(sa.GetHostSA(), (BOOL) kAutoResetEvent, FALSE, NULL)); + // Security fix: + // We need to check the last error to see if the event was precreated or not + // If so, we need to release the handle right now. + // + dwStatus = GetLastError(); + if (dwStatus == ERROR_ALREADY_EXISTS) + { + // clean up the handle now + rightSideEventRead.Clear(); + } - HandleHolder leftSideUnmanagedWaitEvent(CreateWin32EventOrThrow(NULL, kManualResetEvent, FALSE)); - // Copy RSEA and RSER into the control block only if shared memory is created without error. - if (m_pDCB) - { - // Since Init() gets ownership of handles as soon as it's called, we can - // release our ownership now. - rightSideEventAvailable.SuppressRelease(); - rightSideEventRead.SuppressRelease(); - leftSideUnmanagedWaitEvent.SuppressRelease(); - - // NOTE: initialization of the debugger control block occurs partly on the left side and partly on - // the right side. This initialization occurs in parallel, so it's unsafe to make assumptions about - // the order in which the fields will be initialized. - hr = m_pDCB->Init(rightSideEventAvailable, - rightSideEventRead, - NULL, - NULL, - leftSideUnmanagedWaitEvent); - - _ASSERTE(SUCCEEDED(hr)); // throws on error. - } + HandleHolder leftSideUnmanagedWaitEvent(CreateWin32EventOrThrow(NULL, kManualResetEvent, FALSE)); -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } - else + // Copy RSEA and RSER into the control block only if shared memory is created without error. + if (m_pDCB) { - if (m_pDCB) - { - hr = m_pDCB->Init(NULL, NULL, NULL, NULL, NULL); - _ASSERTE(SUCCEEDED(hr)); // throws on error. - } + // Since Init() gets ownership of handles as soon as it's called, we can + // release our ownership now. + rightSideEventAvailable.SuppressRelease(); + rightSideEventRead.SuppressRelease(); + leftSideUnmanagedWaitEvent.SuppressRelease(); + + // NOTE: initialization of the debugger control block occurs partly on the left side and partly on + // the right side. This initialization occurs in parallel, so it's unsafe to make assumptions about + // the order in which the fields will be initialized. + hr = m_pDCB->Init(rightSideEventAvailable, + rightSideEventRead, + NULL, + NULL, + leftSideUnmanagedWaitEvent); + + _ASSERTE(SUCCEEDED(hr)); // throws on error. } -#endif +#endif //FEATURE_DBGIPC_TRANSPORT_VM if(m_pDCB) { @@ -751,7 +738,7 @@ HRESULT DebuggerRCThread::SetupRuntimeOffsets(DebuggerIPCControlBlock * pDebugge #if !defined(FEATURE_CORESYSTEM) // Grab the address of RaiseException in kernel32 because we have to play some games with exceptions // that are generated there (just another reason why mixed mode debugging is shady). See bug 476768. - HMODULE hModule = WszGetModuleHandle(W("kernel32.dll")); + HMODULE hModule = WszGetModuleHandle(W("kernel32.dll")); _ASSERTE(hModule != NULL); PREFAST_ASSUME(hModule != NULL); pDebuggerRuntimeOffsets->m_raiseExceptionAddr = GetProcAddress(hModule, "RaiseException"); @@ -1060,14 +1047,8 @@ void DebuggerRCThread::RightSideDetach(void) { _ASSERTE( m_fDetachRightSide == false ); m_fDetachRightSide = true; -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) - { -#endif - CloseIPCHandles(); -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + CloseIPCHandles(); #endif // !FEATURE_DBGIPC_TRANSPORT_VM } @@ -1127,53 +1108,40 @@ bool DebuggerRCThread::HandleRSEA() LOG((LF_CORDB,LL_INFO10000, "RSEA from out of process (right side)\n")); DebuggerIPCEvent * e; -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) - { -#endif - // Make room for any Right Side event on the stack. - BYTE buffer[CorDBIPC_BUFFER_SIZE]; - e = (DebuggerIPCEvent *) buffer; +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + // Make room for any Right Side event on the stack. + BYTE buffer[CorDBIPC_BUFFER_SIZE]; + e = (DebuggerIPCEvent *) buffer; - // If the RSEA is signaled, then handle the event from the Right Side. - memcpy(e, GetIPCEventReceiveBuffer(), CorDBIPC_BUFFER_SIZE); -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } - else - { - // Be sure to fetch the event into the official receive buffer since some event handlers assume it's there - // regardless of the the event buffer pointer passed to them. - e = GetIPCEventReceiveBuffer(); - g_pDbgTransport->GetNextEvent(e, CorDBIPC_BUFFER_SIZE); - } + // If the RSEA is signaled, then handle the event from the Right Side. + memcpy(e, GetIPCEventReceiveBuffer(), CorDBIPC_BUFFER_SIZE); +#else + // Be sure to fetch the event into the official receive buffer since some event handlers assume it's there + // regardless of the the event buffer pointer passed to them. + e = GetIPCEventReceiveBuffer(); + g_pDbgTransport->GetNextEvent(e, CorDBIPC_BUFFER_SIZE); #endif // !FEATURE_DBGIPC_TRANSPOPRT -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - if(!useTransport) - { -#endif - // If no reply is required, then let the Right Side go since we've got a copy of the event now. - _ASSERTE(!e->asyncSend || !e->replyRequired); +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + // If no reply is required, then let the Right Side go since we've got a copy of the event now. + _ASSERTE(!e->asyncSend || !e->replyRequired); - if (!e->replyRequired && !e->asyncSend) - { - LOG((LF_CORDB, LL_INFO1000, "DRCT::ML: no reply required, letting Right Side go.\n")); + if (!e->replyRequired && !e->asyncSend) + { + LOG((LF_CORDB, LL_INFO1000, "DRCT::ML: no reply required, letting Right Side go.\n")); - BOOL succ = SetEvent(m_pDCB->m_rightSideEventRead); + BOOL succ = SetEvent(m_pDCB->m_rightSideEventRead); - if (!succ) - CORDBDebuggerSetUnrecoverableWin32Error(m_debugger, 0, true); - } + if (!succ) + CORDBDebuggerSetUnrecoverableWin32Error(m_debugger, 0, true); + } #ifdef LOGGING - else if (e->asyncSend) - LOG((LF_CORDB, LL_INFO1000, "DRCT::ML: async send.\n")); - else - LOG((LF_CORDB, LL_INFO1000, "DRCT::ML: reply required, holding Right Side...\n")); + else if (e->asyncSend) + LOG((LF_CORDB, LL_INFO1000, "DRCT::ML: async send.\n")); + else + LOG((LF_CORDB, LL_INFO1000, "DRCT::ML: reply required, holding Right Side...\n")); #endif -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } -#endif // FEATURE_DBGIPC_TRANSPORT_VM +#endif // !FEATURE_DBGIPC_TRANSPORT_VM // Pass the event to the debugger for handling. Returns true if the event was a Continue event and we can // stop looking for stragglers. We wrap this whole thing in an exception handler to help us debug faults. @@ -1227,18 +1195,10 @@ void DebuggerRCThread::MainLoop() DWORD dwWaitTimeout = INFINITE; rghWaitSet[DRCT_CONTROL_EVENT] = m_threadControlEvent; rghWaitSet[DRCT_FAVORAVAIL] = GetFavorAvailableEvent(); -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) - { -#endif // !FEATURE_DBGIPC_TRANSPORT_VM - rghWaitSet[DRCT_RSEA] = m_pDCB->m_rightSideEventAvailable; -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } - else - { - rghWaitSet[DRCT_RSEA] = g_pDbgTransport->GetIPCEventReadyEvent(); - } +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + rghWaitSet[DRCT_RSEA] = m_pDCB->m_rightSideEventAvailable; +#else + rghWaitSet[DRCT_RSEA] = g_pDbgTransport->GetIPCEventReadyEvent(); #endif // !FEATURE_DBGIPC_TRANSPORT_VM CONTRACT_VIOLATION(ThrowsViolation);// HndCreateHandle throws, and this loop is not backstopped by any EH @@ -1251,38 +1211,28 @@ void DebuggerRCThread::MainLoop() { LOG((LF_CORDB, LL_INFO1000, "DRCT::ML: waiting for event.\n")); -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + // If there is a debugger attached, wait on its handle, too... + if ((cWaitCount == DRCT_COUNT_INITIAL) && + m_pDCB->m_rightSideProcessHandle.ImportToLocalProcess() != NULL) { -#endif // FEATURE_DBGIPC_TRANSPORT_VM - // If there is a debugger attached, wait on its handle, too... - if ((cWaitCount == DRCT_COUNT_INITIAL) && - m_pDCB->m_rightSideProcessHandle.ImportToLocalProcess() != NULL) - { - _ASSERTE((cWaitCount + 1) == DRCT_COUNT_FINAL); - rghWaitSet[DRCT_DEBUGGER_EVENT] = m_pDCB->m_rightSideProcessHandle; - cWaitCount = DRCT_COUNT_FINAL; - } -#ifdef FEATURE_DBGIPC_TRANSPORT_VM + _ASSERTE((cWaitCount + 1) == DRCT_COUNT_FINAL); + rghWaitSet[DRCT_DEBUGGER_EVENT] = m_pDCB->m_rightSideProcessHandle; + cWaitCount = DRCT_COUNT_FINAL; } -#endif // FEATURE_DBGIPC_TRANSPORT_VM +#endif // !FEATURE_DBGIPC_TRANSPORT_VM + if (m_fDetachRightSide) { m_fDetachRightSide = false; -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - if(!useTransport) - { -#endif - _ASSERTE(cWaitCount == DRCT_COUNT_FINAL); - _ASSERTE((cWaitCount - 1) == DRCT_COUNT_INITIAL); +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + _ASSERTE(cWaitCount == DRCT_COUNT_FINAL); + _ASSERTE((cWaitCount - 1) == DRCT_COUNT_INITIAL); - rghWaitSet[DRCT_DEBUGGER_EVENT] = NULL; - cWaitCount = DRCT_COUNT_INITIAL; -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - } + rghWaitSet[DRCT_DEBUGGER_EVENT] = NULL; + cWaitCount = DRCT_COUNT_INITIAL; #endif // !FEATURE_DBGIPC_TRANSPORT_VM } @@ -1491,18 +1441,10 @@ void DebuggerRCThread::TemporaryHelperThreadMainLoop() DWORD dwWaitTimeout = INFINITE; rghWaitSet[DRCT_CONTROL_EVENT] = m_threadControlEvent; rghWaitSet[DRCT_FAVORAVAIL] = GetFavorAvailableEvent(); -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) - { -#endif - rghWaitSet[DRCT_RSEA] = m_pDCB->m_rightSideEventAvailable; -#ifdef FEATURE_DBGIPC_TRANSPORT_VM - } - else - { - rghWaitSet[DRCT_RSEA] = g_pDbgTransport->GetIPCEventReadyEvent(); - } +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + rghWaitSet[DRCT_RSEA] = m_pDCB->m_rightSideEventAvailable; +#else //FEATURE_DBGIPC_TRANSPORT_VM + rghWaitSet[DRCT_RSEA] = g_pDbgTransport->GetIPCEventReadyEvent(); #endif // !FEATURE_DBGIPC_TRANSPORT_VM CONTRACT_VIOLATION(ThrowsViolation);// HndCreateHandle throws, and this loop is not backstopped by any EH @@ -2153,31 +2095,23 @@ HRESULT DebuggerRCThread::SendIPCReply() IPCENames::GetName(event->type))); #endif -#if defined(FEATURE_DBGIPC_TRANSPORT_VM) - DWORD useTransport = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgUseTransport); - if(!useTransport) +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) + BOOL succ = SetEvent(m_pDCB->m_rightSideEventRead); + if (!succ) { -#endif - BOOL succ = SetEvent(m_pDCB->m_rightSideEventRead); - if (!succ) - { - hr = CORDBDebuggerSetUnrecoverableWin32Error(m_debugger, 0, false); - } -#ifdef FEATURE_DBGIPC_TRANSPORT_VM + hr = CORDBDebuggerSetUnrecoverableWin32Error(m_debugger, 0, false); } - else +#else // !FEATURE_DBGIPC_TRANSPORT_VM + hr = g_pDbgTransport->SendEvent(GetIPCEventReceiveBuffer()); + if (FAILED(hr)) { - hr = g_pDbgTransport->SendEvent(GetIPCEventReceiveBuffer()); - if (FAILED(hr)) - { - m_debugger->UnrecoverableError(hr, - 0, - __FILE__, - __LINE__, - false); - } + m_debugger->UnrecoverableError(hr, + 0, + __FILE__, + __LINE__, + false); } -#endif // FEATURE_DBGIPC_TRANSPORT_VM +#endif // !FEATURE_DBGIPC_TRANSPORT_VM return hr; } diff --git a/src/debug/inc/coreclrremotedebugginginterfaces.h b/src/debug/inc/coreclrremotedebugginginterfaces.h index 59c8399354..160c40d52b 100644 --- a/src/debug/inc/coreclrremotedebugginginterfaces.h +++ b/src/debug/inc/coreclrremotedebugginginterfaces.h @@ -13,52 +13,9 @@ #define __PORT_SUPPLIER_INTERFACES_INCLUDED -#include <dbgproxy.h> class ICoreClrDebugTarget; -// Mscordbi exports a number of C functions to aid in starting up and shutting down the transport manager -// (which owns communication with remote machines) and getting a connection to a particular machine's proxy -// (known as a target). -extern "C" HRESULT __stdcall InitDbgTransportManager(); -extern "C" void __stdcall ShutdownDbgTransportManager(); -extern "C" HRESULT __stdcall CreateCoreClrDebugTarget(DWORD dwAddress, ICoreClrDebugTarget **ppTarget); - - -// Definition of the data that ICoreClrDebugTarget will return about a remote process. -struct CoreClrDebugProcInfo -{ - DWORD m_dwPID; // OS assigned process ID - DWORD m_dwInternalID; // Proxy assigned process ID (recycles less often) - WCHAR m_wszName[kMaxCommandLine]; // Command and args process is running (possibly truncated) -}; - - -// Definition of the data that ICoreClrDebugTarget will return about a remote runtime instance. -struct CoreClrDebugRuntimeInfo -{ - DWORD m_dwInternalID; // Proxy assigned runtime instance ID -}; - - -// This pseudo-COM interface is provided by mscordbi and called by the port supplier to query details of a -// remote target. -class ICoreClrDebugTarget -{ -public: - STDMETHOD_(void, AddRef)() PURE; - STDMETHOD_(void, Release)() PURE; - - // Enumerate all user's processes on the target machine (whether they are running managed code or not). - STDMETHOD(EnumProcesses)(DWORD *pcProcs, CoreClrDebugProcInfo **ppProcs) PURE; - - // Enumerate all runtimes running within the process indicated via the internal process ID. - STDMETHOD(EnumRuntimes)(DWORD dwInternalProcessID, DWORD *pcRuntimes, CoreClrDebugRuntimeInfo **ppRuntimes) PURE; - - // Free memory returned by Enum* methods. - STDMETHOD_(void, FreeMemory)(void *pMemory) PURE; -}; - #endif // __PORT_SUPPLIER_INTERFACES_INCLUDED diff --git a/src/debug/inc/dbgtransportsession.h b/src/debug/inc/dbgtransportsession.h index f028c0bbae..4f844ba984 100644 --- a/src/debug/inc/dbgtransportsession.h +++ b/src/debug/inc/dbgtransportsession.h @@ -11,33 +11,24 @@ #include <utilcode.h> #include <crst.h> -class InProcDac; #endif // !RIGHT_SIDE_COMPILE #if defined(FEATURE_DBGIPC_TRANSPORT_VM) || defined(FEATURE_DBGIPC_TRANSPORT_DI) -#include <dbgsecureconnection.h> +#include <twowaypipe.h> + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + DbgTransportSession was originally designed around cross-machine debugging via sockets and it is supposed to + handle network interruptions. Right now we use pipes (see TwoWaypipe) and don't expect to have connection issues. + But there seem to be no good reason to try hard to get rid of existing working protocol even if it's a bit + cautious about connection quality. So please KEEP IN MIND THAT SOME COMMENTS REFERING TO NETWORK AND SOCKETS + CAN BE OUTDATED. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ // // Provides a robust and secure transport session between a debugger and a debuggee that are potentially on // different machines. // -// The current implementation utilizes a single SSL/TCP connection down which all traffic is multi-plexed -// (session management, debugger events and event acknowledgements and miscellaneous debugger requests and -// responses). Robustness to transitory network failures is dealt with by automatically reforming the -// connection and resending unacknowledged messages. -// -// Each session adds one thread to the process. This transport thread is responsible for the setting up and -// tearing down of the low level TCP thread and all receive operations on that connection while it is active. -// This organization simplifies a lot of synchronization and allows us to avoid any async connection -// operations (keeping the code a lot simpler in general). Sends, on the other hand, can be made from -// aribtrary thread contexts (including the transport thread) and must use a lock to serialize access to the -// connection (as well as synchronize themselves with session state changes). This is all handled internally -// and is not visible to the session client (the debugger or the debugger code in the runtime). -// -// Access to the underlying SSL (Secure Socket Layer) connection is abstracted since the SSL API varies -// significantly between Windows and Mac. The abstraction is described in clr/inc/DbgSecureConnection.h. -// // The following terminology is used for the wire protocol. The smallest meaningful entity written to or read // from the connection is a "message". This consists of one or maybe two "blocks" where a block is a // contiguous region of memory in the host machine. The first block is always a "message header" which is @@ -95,6 +86,25 @@ enum DbgTransportLogClass LC_Always = 0xffffffff, // Always log, regardless of class setting }; +// Status codes that can be returned by various APIs that indicate some conditions of the error that a caller +// might usefully pass on to a user (environmental factors that the user might have some control over). +enum ConnStatus +{ + SCS_Success, // The request succeeded + SCS_OutOfMemory, // The request failed due to a low memory situation + SCS_InvalidConfiguration, // Initialize() failed because the debugger settings were not configured or + // have become corrupt + SCS_UnknownTarget, // Connect() failed because the remote machine at the given address could not + // be found + SCS_NoListener, // Connect() failed because the remote machine was not listening for requests + // on the given port (most likely the remote machine is not configured for + // debugging) + SCS_NetworkFailure, // Connect() failed due to miscellaneous network error + SCS_MismatchedCerts, // Connect()/Accept() failed because the remote party was using a different + // cert +}; + + // Multiple clients can use a single DbgTransportSession, but only one can act as the debugger. // A valid DebugTicket is given to the client who is acting as the debugger. struct DebugTicket @@ -307,9 +317,9 @@ public: // requires the addresses of a couple of runtime data structures to service certain debugger requests that // may be delivered once the session is established. #ifdef RIGHT_SIDE_COMPILE - HRESULT Init(DWORD dwAddress, USHORT usPort, HANDLE hProcessExited); + HRESULT Init(DWORD pid, HANDLE hProcessExited); #else // RIGHT_SIDE_COMPILE - HRESULT Init(DebuggerIPCControlBlock * pDCB, AppDomainEnumerationIPCBlock * pADB, InProcDac * pInProcDac); + HRESULT Init(DebuggerIPCControlBlock * pDCB, AppDomainEnumerationIPCBlock * pADB); #endif // RIGHT_SIDE_COMPILE // Drive the session to the SS_Closed state, which will deallocate all remaining transport resources @@ -342,10 +352,6 @@ public: // A valid ticket is required in order for this function to succeed. After this function succeeds, // another client can request to be the debugger. bool StopUsingAsDebugger(DebugTicket * pTicket); -#else // RIGHT_SIDE_COMPILE - // The LS needs to be able to tell the code that registers with the debugger proxy which port it will wait - // on for debugger connections. Returns the port number in host byte order. - USHORT GetPort(); #endif // RIGHT_SIDE_COMPILE // Sends a pre-initialized event to the other side. @@ -373,10 +379,6 @@ public: // Read the AppDomain control block on the LS from the RS. HRESULT GetAppDomainCB(AppDomainEnumerationIPCBlock *pADB); - // Send a DD message to the LS and wait for a reply before returning. - // This is the low level function which DDMarshal and DDUnmarshal build on. - // This is for the remoted IDacDbiInterface. See code:IEventChannel for more information. - HRESULT SendDDMessage(PBYTE pbSendBuffer, DWORD cbSendBuffer, PBYTE * ppbReceiveBuffer, DWORD * pcbReceiveBuffer); #endif // RIGHT_SIDE_COMPILE private: @@ -418,7 +420,6 @@ private: MT_GetDCB, // RS <-> LS : RS wants to read LS DCB (or LS is replying to such a request) MT_SetDCB, // RS <-> LS : RS wants to write LS DCB (or LS is replying to such a request) MT_GetAppDomainCB, // RS <-> LS : RS wants to read LS AppDomainCB (or LS is replying to such a request) - MT_DDMessage, // RS <-> LS : RS wants to call into the in-proc DAC on the LS (or LS is replying to such a request) }; // Reasons the LS can give for rejecting a session. These codes should *not* be changed other than by @@ -480,12 +481,6 @@ private: Portable<DWORD> m_eType; // Event type (useful for debugging) } Event; - // Used by MT_DDMessage. - struct - { - Portable<HRESULT> m_hrResult; - Portable<DWORD> m_eType; // DDMessage type (useful for debugging) - } DDMessage; } TypeSpecificData; BYTE m_sMustBeZero[8]; // Set this to zero when initializing and never read the contents @@ -682,30 +677,16 @@ private: // back into the Connect()/Accept() phase (along with the resulting session state change). HANDLE m_hTransportThread; - // Low level connection manager. This object provides the transport with secure connections on request. - SecConnMgr *m_pConnectionManager; - - // Low level connection. This is updated only on the transport thread (while the connection is being - // formed no other thread can peform a SendMessage() since the session state will never be Open, when the - // connection is deallocated this must be done under m_sStateLock along with the associated state change - // to ensure that no other thread can successfully SendMessage() on the connection). - SecConn *m_pConnection; + TwoWayPipe m_pipe; #ifdef RIGHT_SIDE_COMPILE // On the RS the transport thread needs to know the IP address and port number to Connect() to. - DWORD m_dwLeftSideAddress; // IPv4 address in host byte order - USHORT m_usLeftSidePort; // TCP port number in host byte order + DWORD m_pid; // Id of a process we're talking to. HANDLE m_hProcessExited; // event which will be signaled when the debuggee is terminated bool m_fDebuggerAttached; -#else // RIGHT_SIDE_COMPILE - // On the LS we always listen for low level transport connect requests. This is done on a special listen - // socket on which we call accept() followed by Accept(). If Accept() completes successfully it returns a - // SecConn instance; that's the m_pConnection above. - SOCKET m_hListenSocket; - USHORT m_usListenPort; // TCP port number in host byte order -#endif // RIGHT_SIDE_COMPILE +#endif // Debugger event handling. To improve performance we allow the debugger to send as many events as it // likes without acknowledgement from its peer. While not strictly adhering to the semantic provided by @@ -734,7 +715,6 @@ private: // These are provided by the runtime at intialization time. DebuggerIPCControlBlock *m_pDCB; AppDomainEnumerationIPCBlock *m_pADB; - InProcDac * m_pInProcDac; #endif // !RIGHT_SIDE_COMPILE HRESULT SendEventWorker(DebuggerIPCEvent * pEvent, IPCEventType type); diff --git a/src/debug/inc/ddmarshalutil.h b/src/debug/inc/ddmarshalutil.h index e3237da800..458477777f 100644 --- a/src/debug/inc/ddmarshalutil.h +++ b/src/debug/inc/ddmarshalutil.h @@ -15,7 +15,6 @@ typedef IDacDbiInterface::HeapWalkHandle HeapWalkHandle; typedef IDacDbiInterface::IStringHolder IStringHolder; #include "stringcopyholder.h" -#include "ddshared.h" // @dbgtodo Mac - cleanup the buffer classes here. (are there pre-existing classes we could use instead?) // These ultimately get included in the signature for IDacDbiMarshalStub::DoRequest. @@ -226,12 +225,6 @@ void WriteToBuffer(WriteBuffer * p, T * pData) } inline -void WriteToBuffer(WriteBuffer * p, enum DD_MessageId data) -{ - p->WriteBlob(&data, sizeof(data)); -} - -inline void WriteToBuffer(WriteBuffer * p, StringCopyHolder * pString) { const WCHAR * pData = NULL; @@ -327,13 +320,6 @@ void ReadFromBuffer(ReadBuffer * p, T * pData) } inline -void ReadFromBuffer(ReadBuffer * p, enum DD_MessageId & data) -{ - p->ReadBlob(&data, sizeof(DD_MessageId)); -} - - -inline void ReadFromBuffer(ReadBuffer * p, IStringHolder * pString) { const WCHAR *pData = p->ReadString(); diff --git a/src/debug/inc/ddshared.h b/src/debug/inc/ddshared.h deleted file mode 100644 index 36a034cd01..0000000000 --- a/src/debug/inc/ddshared.h +++ /dev/null @@ -1,155 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -// Common auto-generated header between Packer + Unpacker -// Shared template - -// This would be the place to define structs taht get passed back and forth. - -#ifndef _DD_SHARED_H_ -#define _DD_SHARED_H_ - -// Header? -// Define unique message ID for each DD interface -enum DD_MessageId { - DDID_CheckDbiVersion, // HRESULT CheckDbiVersion(const DbiVersion * pVersion) - DDID_GetLocalInterfaceHashAndTimestamp, // void GetLocalInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2) - DDID_GetRemoteInterfaceHashAndTimestamp, // void GetRemoteInterfaceHashAndTimestamp(DWORD & hash1, DWORD & hash2, DWORD & hash3, DWORD & hash4, DWORD & timestamp1, DWORD & timestamp2) - DDID_FlushCache, // HRESULT FlushCache() - DDID_DacSetTargetConsistencyChecks, // void DacSetTargetConsistencyChecks(bool fEnableAsserts) - DDID_Destroy, // void Destroy() - DDID_IsLeftSideInitialized, // BOOL IsLeftSideInitialized() - DDID_GetAppDomainFromId, // VMPTR_AppDomain GetAppDomainFromId(ULONG appdomainId) - DDID_GetAppDomainId, // ULONG GetAppDomainId(VMPTR_AppDomain vmAppDomain) - DDID_GetAppDomainObject, // VMPTR_OBJECTHANDLE GetAppDomainObject(VMPTR_AppDomain vmAppDomain) - DDID_IsDefaultDomain, // BOOL IsDefaultDomain(VMPTR_AppDomain vmAppDomain) - DDID_GetAssemblyFromDomainAssembly, // void GetAssemblyFromDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, VMPTR_Assembly * vmAssembly) - DDID_IsAssemblyFullyTrusted, // BOOL IsAssemblyFullyTrusted(VMPTR_DomainAssembly vmDomainAssembly) - DDID_GetAppDomainFullName, // void GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName) - DDID_GetModuleSimpleName, // void GetModuleSimpleName(VMPTR_Module vmModule, IStringHolder * pStrFilename) - DDID_GetAssemblyPath, // BOOL GetAssemblyPath(VMPTR_Assembly vmAssembly, IStringHolder * pStrFilename) - DDID_ResolveTypeReference, // void ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) - DDID_GetModulePath, // BOOL GetModulePath(VMPTR_Module vmModule, IStringHolder * pStrFilename) - DDID_GetModuleNGenPath, // BOOL GetModuleNGenPath(VMPTR_Module vmModule, IStringHolder * pStrFilename) - DDID_GetMetadata, // void GetMetadata(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer) - DDID_GetSymbolsBuffer, // void GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * pTargetBuffer, IDacDbiInterface::SymbolFormat * pSymbolFormat) - DDID_GetModuleData, // void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData) - DDID_GetDomainFileData, // void GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData) - DDID_GetModuleForDomainFile, // void GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, VMPTR_Module * pModule) - DDID_GetAddressType, // IDacDbiInterface::AddressType GetAddressType(CORDB_ADDRESS address) - DDID_IsTransitionStub, // BOOL IsTransitionStub(CORDB_ADDRESS address) - DDID_GetCompilerFlags, // void GetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL * pfAllowJITOpts, BOOL * pfEnableEnC) - DDID_SetCompilerFlags, // HRESULT SetCompilerFlags(VMPTR_DomainFile vmDomainFile, BOOL fAllowJitOpts, BOOL fEnableEnC) - DDID_EnumerateAppDomains, // void EnumerateAppDomains(IDacDbiInterface::FP_APPDOMAIN_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - DDID_EnumerateAssembliesInAppDomain, // void EnumerateAssembliesInAppDomain(VMPTR_AppDomain vmAppDomain, IDacDbiInterface::FP_ASSEMBLY_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - DDID_EnumerateModulesInAssembly, // void EnumerateModulesInAssembly(VMPTR_DomainAssembly vmAssembly, IDacDbiInterface::FP_MODULE_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - DDID_RequestSyncAtEvent, // void RequestSyncAtEvent() - DDID_MarkDebuggerAttachPending, // void MarkDebuggerAttachPending() - DDID_MarkDebuggerAttached, // void MarkDebuggerAttached(BOOL fAttached) - DDID_Hijack, // void Hijack(VMPTR_Thread vmThread, ULONG32 dwThreadId, const EXCEPTION_RECORD * pRecord, T_CONTEXT * pOriginalContext, ULONG32 cbSizeContext, EHijackReason::EHijackReason reason, void * pUserData, CORDB_ADDRESS * pRemoteContextAddr) - DDID_EnumerateConnections, // void EnumerateConnections(IDacDbiInterface::FP_CONNECTION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - DDID_EnumerateThreads, // void EnumerateThreads(IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - DDID_IsThreadMarkedDead, // bool IsThreadMarkedDead(VMPTR_Thread vmThread) - DDID_GetThreadHandle, // HANDLE GetThreadHandle(VMPTR_Thread vmThread) - DDID_GetThreadObject, // VMPTR_OBJECTHANDLE GetThreadObject(VMPTR_Thread vmThread) - DDID_SetDebugState, // void SetDebugState(VMPTR_Thread vmThread, CorDebugThreadState debugState) - DDID_HasUnhandledException, // BOOL HasUnhandledException(VMPTR_Thread vmThread) - DDID_GetUserState, // CorDebugUserState GetUserState(VMPTR_Thread vmThread) - DDID_GetConnectionID, // CONNID GetConnectionID(VMPTR_Thread vmThread) - DDID_GetTaskID, // TASKID GetTaskID(VMPTR_Thread vmThread) - DDID_TryGetVolatileOSThreadID, // DWORD TryGetVolatileOSThreadID(VMPTR_Thread vmThread) - DDID_GetUniqueThreadID, // DWORD GetUniqueThreadID(VMPTR_Thread vmThread) - DDID_GetCurrentException, // VMPTR_OBJECTHANDLE GetCurrentException(VMPTR_Thread vmThread) - DDID_GetCurrentCustomDebuggerNotification, // VMPTR_OBJECTHANDLE GetCurrentCustomDebuggerNotification(VMPTR_Thread vmThread) - DDID_GetCurrentAppDomain, // VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread) - DDID_ResolveAssembly, // VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef) - DDID_GetNativeCodeSequencePointsAndVarInfo, // void GetNativeCodeSequencePointsAndVarInfo(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS startAddress, BOOL fCodeAvailabe, NativeVarData * pNativeVarData, SequencePoints * pSequencePoints) - DDID_GetManagedStoppedContext, // VMPTR_CONTEXT GetManagedStoppedContext(VMPTR_Thread vmThread) - DDID_CreateStackWalk, // void CreateStackWalk(VMPTR_Thread vmThread, DT_CONTEXT * pInternalContextBuffer, StackWalkHandle * ppSFIHandle) - DDID_DeleteStackWalk, // void DeleteStackWalk(StackWalkHandle ppSFIHandle) - DDID_GetStackWalkCurrentContext, // void GetStackWalkCurrentContext(StackWalkHandle pSFIHandle, DT_CONTEXT * pContext) - DDID_SetStackWalkCurrentContext, // void SetStackWalkCurrentContext(VMPTR_Thread vmThread, StackWalkHandle pSFIHandle, CorDebugSetContextFlag flag, DT_CONTEXT * pContext) - DDID_UnwindStackWalkFrame, // BOOL UnwindStackWalkFrame(StackWalkHandle pSFIHandle) - DDID_CheckContext, // HRESULT CheckContext(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) - DDID_GetStackWalkCurrentFrameInfo, // IDacDbiInterface::FrameType GetStackWalkCurrentFrameInfo(StackWalkHandle pSFIHandle, DebuggerIPCE_STRData * pFrameData) - DDID_GetCountOfInternalFrames, // ULONG32 GetCountOfInternalFrames(VMPTR_Thread vmThread) - DDID_EnumerateInternalFrames, // void EnumerateInternalFrames(VMPTR_Thread vmThread, IDacDbiInterface::FP_INTERNAL_FRAME_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - DDID_IsMatchingParentFrame, // BOOL IsMatchingParentFrame(FramePointer fpToCheck, FramePointer fpParent) - DDID_GetStackParameterSize, // ULONG32 GetStackParameterSize(CORDB_ADDRESS controlPC) - DDID_GetFramePointer, // FramePointer GetFramePointer(StackWalkHandle pSFIHandle) - DDID_IsLeafFrame, // BOOL IsLeafFrame(VMPTR_Thread vmThread, const DT_CONTEXT * pContext) - DDID_GetContext, // void GetContext(VMPTR_Thread vmThread, DT_CONTEXT * pContextBuffer) - DDID_ConvertContextToDebuggerRegDisplay, // void ConvertContextToDebuggerRegDisplay(const DT_CONTEXT * pInContext, DebuggerREGDISPLAY * pOutDRD, BOOL fActive) - DDID_IsILStubOrLCGMethod, // IDacDbiInterface::DynamicMethodType IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc) - DDID_GetVarArgSig, // TargetBuffer GetVarArgSig(CORDB_ADDRESS VASigCookieAddr, CORDB_ADDRESS * pArgBase) - DDID_RequiresAlign8, // BOOL RequiresAlign8(VMPTR_TypeHandle thExact) - DDID_ResolveExactGenericArgsToken, // GENERICS_TYPE_TOKEN ResolveExactGenericArgsToken(DWORD dwExactGenericArgsTokenIndex, GENERICS_TYPE_TOKEN rawToken) - DDID_GetILCodeAndSig, // void GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken) - DDID_GetNativeCodeInfo, // void GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, mdToken functionToken, NativeCodeFunctionData * pCodeInfo) - DDID_GetNativeCodeInfoForAddr, // void GetNativeCodeInfoForAddr(VMPTR_MethodDesc vmMethodDesc, CORDB_ADDRESS hotCodeStartAddr, NativeCodeFunctionData * pCodeInfo) - DDID_GetClassInfo, // void GetClassInfo(VMPTR_AppDomain vmAppDomain, VMPTR_Module vmModule, mdTypeDef metadataToken, VMPTR_TypeHandle thExact, VMPTR_TypeHandle thApprox, ClassInfo * pData) - DDID_GetInstantiationFieldInfo, // void GetInstantiationFieldInfo(VMPTR_DomainFile vmDomainFile, mdTypeDef metadataToken, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList<FieldData> * pFieldList, SIZE_T * pObjectSize) - DDID_TypeHandleToExpandedTypeInfo, // void TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, DebuggerIPCE_ExpandedTypeData * pTypeInfo) - DDID_GetObjectExpandedTypeInfo, // void GetObjectExpandedTypeInfo(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, CORDB_ADDRESS addr, DebuggerIPCE_ExpandedTypeData * pTypeInfo) - DDID_GetObjectExpandedTypeInfoFromID, // void GetObjectExpandedTypeInfoFromID(AreValueTypesBoxed boxed, VMPTR_AppDomain vmAppDomain, COR_TYPEID id, DebuggerIPCE_ExpandedTypeData * pTypeInfo) - DDID_GetApproxTypeHandle, // VMPTR_TypeHandle GetApproxTypeHandle(TypeInfoList * pTypeData) - DDID_GetExactTypeHandle, // HRESULT GetExactTypeHandle(DebuggerIPCE_ExpandedTypeData * pTypeData, ArgInfoList * pArgInfo, VMPTR_TypeHandle & vmTypeHandle) - DDID_GetMethodDescParams, // void GetMethodDescParams(VMPTR_AppDomain vmAppDomain, VMPTR_MethodDesc vmMethodDesc, GENERICS_TYPE_TOKEN genericsToken, UINT32 * pcGenericClassTypeParams, TypeParamsList * pGenericTypeParams) - DDID_GetThreadOrContextStaticAddress, // CORDB_ADDRESS GetThreadOrContextStaticAddress(VMPTR_FieldDesc vmField, VMPTR_Thread vmRuntimeThread) - DDID_GetCollectibleTypeStaticAddress, // CORDB_ADDRESS GetCollectibleTypeStaticAddress(VMPTR_FieldDesc vmField, VMPTR_AppDomain vmAppDomain) - DDID_GetEnCHangingFieldInfo, // void GetEnCHangingFieldInfo(const EnCHangingFieldInfo * pEnCFieldInfo, FieldData * pFieldData, BOOL * pfStatic) - DDID_GetTypeHandleParams, // void GetTypeHandleParams(VMPTR_AppDomain vmAppDomain, VMPTR_TypeHandle vmTypeHandle, TypeParamsList * pParams) - DDID_GetSimpleType, // void GetSimpleType(VMPTR_AppDomain vmAppDomain, CorElementType simpleType, mdTypeDef * pMetadataToken, VMPTR_Module * pVmModule, VMPTR_DomainFile * pVmDomainFile) - DDID_IsExceptionObject, // BOOL IsExceptionObject(VMPTR_Object vmObject) - DDID_GetStackFramesFromException, // void GetStackFramesFromException(VMPTR_Object vmObject, DacDbiArrayList<DacExceptionCallStackData> & dacStackFrames) - DDID_IsRcw, // BOOL IsRcw(VMPTR_Object vmObject) - DDID_GetRcwCachedInterfaceTypes, // void GetRcwCachedInterfaceTypes(VMPTR_Object vmObject, VMPTR_AppDomain vmAppDomain, BOOL bIInspectableOnly, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pDacInterfaces) - DDID_GetRcwCachedInterfacePointers, // void GetRcwCachedInterfacePointers(VMPTR_Object vmObject, BOOL bIInspectableOnly, DacDbiArrayList<CORDB_ADDRESS> * pDacItfPtrs) - DDID_GetCachedWinRTTypesForIIDs, // void GetCachedWinRTTypesForIIDs(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> & iids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes) - DDID_GetCachedWinRTTypes, // void GetCachedWinRTTypes(VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> * piids, DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes) - DDID_GetTypedByRefInfo, // void GetTypedByRefInfo(CORDB_ADDRESS pTypedByRef, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) - DDID_GetStringData, // void GetStringData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) - DDID_GetArrayData, // void GetArrayData(CORDB_ADDRESS objectAddress, DebuggerIPCE_ObjectData * pObjectData) - DDID_GetBasicObjectInfo, // void GetBasicObjectInfo(CORDB_ADDRESS objectAddress, CorElementType type, VMPTR_AppDomain vmAppDomain, DebuggerIPCE_ObjectData * pObjectData) - DDID_TestCrst, // void TestCrst(VMPTR_Crst vmCrst) - DDID_TestRWLock, // void TestRWLock(VMPTR_SimpleRWLock vmRWLock) - DDID_GetDebuggerControlBlockAddress, // CORDB_ADDRESS GetDebuggerControlBlockAddress() - DDID_GetObjectFromRefPtr, // VMPTR_Object GetObjectFromRefPtr(CORDB_ADDRESS ptr) - DDID_GetObject, // VMPTR_Object GetObject(CORDB_ADDRESS ptr) - DDID_EnableNGENPolicy, // HRESULT EnableNGENPolicy(CorDebugNGENPolicy ePolicy) - DDID_GetVmObjectHandle, // VMPTR_OBJECTHANDLE GetVmObjectHandle(CORDB_ADDRESS handleAddress) - DDID_IsVmObjectHandleValid, // BOOL IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle) - DDID_IsWinRTModule, // HRESULT IsWinRTModule(VMPTR_Module vmModule, BOOL & isWinRT) - DDID_GetAppDomainIdFromVmObjectHandle, // ULONG GetAppDomainIdFromVmObjectHandle(VMPTR_OBJECTHANDLE vmHandle) - DDID_GetHandleAddressFromVmHandle, // CORDB_ADDRESS GetHandleAddressFromVmHandle(VMPTR_OBJECTHANDLE vmHandle) - DDID_GetObjectContents, // TargetBuffer GetObjectContents(VMPTR_Object obj) - DDID_EnumerateBlockingObjects, // void EnumerateBlockingObjects(VMPTR_Thread vmThread, IDacDbiInterface::FP_BLOCKINGOBJECT_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - DDID_GetThreadOwningMonitorLock, // MonitorLockInfo GetThreadOwningMonitorLock(VMPTR_Object vmObject) - DDID_EnumerateMonitorEventWaitList, // void EnumerateMonitorEventWaitList(VMPTR_Object vmObject, IDacDbiInterface::FP_THREAD_ENUMERATION_CALLBACK fpCallback, CALLBACK_DATA pUserData) - DDID_GetAttachStateFlags, // CLR_DEBUGGING_PROCESS_FLAGS GetAttachStateFlags() - DDID_GetMetaDataFileInfoFromPEFile, // bool GetMetaDataFileInfoFromPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwImageSize, bool & isNGEN, IStringHolder * pStrFilename) - DDID_GetILImageInfoFromNgenPEFile, // bool GetILImageInfoFromNgenPEFile(VMPTR_PEFile vmPEFile, DWORD & dwTimeStamp, DWORD & dwSize, IStringHolder * pStrFilename) - DDID_IsThreadSuspendedOrHijacked, // bool IsThreadSuspendedOrHijacked(VMPTR_Thread vmThread) - DDID_AreGCStructuresValid, // bool AreGCStructuresValid() - DDID_CreateHeapWalk, // HRESULT CreateHeapWalk(HeapWalkHandle * pHandle) - DDID_DeleteHeapWalk, // void DeleteHeapWalk(HeapWalkHandle handle) - DDID_WalkHeap, // HRESULT WalkHeap(HeapWalkHandle handle, ULONG count, COR_HEAPOBJECT * objects, ULONG * pFetched) - DDID_GetHeapSegments, // HRESULT GetHeapSegments(DacDbiArrayList<COR_SEGMENT> * pSegments) - DDID_IsValidObject, // bool IsValidObject(CORDB_ADDRESS obj) - DDID_GetAppDomainForObject, // bool GetAppDomainForObject(CORDB_ADDRESS obj, VMPTR_AppDomain * pApp, VMPTR_Module * pModule, VMPTR_DomainFile * pDomainFile) - DDID_CreateRefWalk, // HRESULT CreateRefWalk(RefWalkHandle * pHandle, BOOL walkStacks, BOOL walkFQ, UINT32 handleWalkMask) - DDID_DeleteRefWalk, // void DeleteRefWalk(RefWalkHandle handle) - DDID_WalkRefs, // HRESULT WalkRefs(RefWalkHandle handle, ULONG count, DacGcReference * refs, ULONG * pFetched) - DDID_GetTypeID, // HRESULT GetTypeID(CORDB_ADDRESS obj, COR_TYPEID * pType) - DDID_GetObjectFields, // HRESULT GetObjectFields(COR_TYPEID id, ULONG32 celt, COR_FIELD * layout, ULONG32 * pceltFetched) - DDID_GetTypeLayout, // HRESULT GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT * pLayout) - DDID_GetArrayLayout, // HRESULT GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT * pLayout) - DDID_GetGCHeapInformation, // void GetGCHeapInformation(COR_HEAPINFO * pHeapInfo) -}; // end enum MessageIds - - -#endif // _DD_SHARED_H_ - -// End of file diff --git a/src/debug/inc/debug-pal.h b/src/debug/inc/debug-pal.h new file mode 100644 index 0000000000..90cf0c822e --- /dev/null +++ b/src/debug/inc/debug-pal.h @@ -0,0 +1,16 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + + +#ifndef Debug_PAL_H +#define Debug_PAL_H + +#if defined(FEATURE_PAL) +// This function looks for a dynamic module (libraryName) loaded into the process specified (pId) +// and returns its load address. NULL is module is not loaded. +void *GetDynamicLibraryAddressInProcess(DWORD pid, const char *libraryName); +#endif + +#endif //Debug_PAL_H
\ No newline at end of file diff --git a/src/debug/inc/twowaypipe.h b/src/debug/inc/twowaypipe.h new file mode 100644 index 0000000000..83dc28caf4 --- /dev/null +++ b/src/debug/inc/twowaypipe.h @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + + +#ifndef TwoWayPipe_H +#define TwoWayPipe_H + +#ifdef FEATURE_PAL +#define INVALID_PIPE -1 +#else +#define INVALID_PIPE INVALID_HANDLE_VALUE +#endif + +// This file contains definition of a simple IPC mechanism - bidirectional named pipe. +// It is implemented on top of two one-directional names pipes (fifos on UNIX) + +// One Windows it is possible to ask OS to create a bidirectional pipe, but it is not the case on UNIX. +// In order to unify implementation we use two pipes on all systems. + +// This all methods of this class are *NOT* thread safe: it is assumed the caller provides synchronization at a higher level. +class TwoWayPipe +{ +public: + enum State + { + NotInitialized, // Object didn't create or connect to any pipes. + Created, // Server side of the pipe has been created, but didn't bind it to a client. + ServerConnected, // Server side of the pipe is connected to a client + ClientConnected, // Client side of the pipe is connected to a server. + }; + + TwoWayPipe() + :m_state(NotInitialized), + m_inboundPipe(INVALID_PIPE), + m_outboundPipe(INVALID_PIPE) + {} + + + ~TwoWayPipe() + { + Disconnect(); + } + + // Creates a server side of the pipe. + // Id is used to create pipes names and uniquely identify the pipe on the machine. + // true - success, false - failure (use GetLastError() for more details) + bool CreateServer(DWORD id); + + // Connects to a previously opened server side of the pipe. + // Id is used to locate the pipe on the machine. + // true - success, false - failure (use GetLastError() for more details) + bool Connect(DWORD id); + + // Waits for incoming client connections, assumes GetState() == Created + // true - success, false - failure (use GetLastError() for more details) + bool WaitForConnection(); + + // Reads data from pipe. Returns number of bytes read or a negative number in case of an error. + // use GetLastError() for more details + int Read(void *buffer, DWORD bufferSize); + + // Writes data to pipe. Returns number of bytes written or a negative number in case of an error. + // use GetLastError() for more details + int Write(const void *data, DWORD dataSize); + + // Disconnects server or client side of the pipe. + // true - success, false - failure (use GetLastError() for more details) + bool Disconnect(); + + State GetState() + { + return m_state; + } + +private: + + State m_state; + + +#ifdef FEATURE_PAL + int m_id; //id that was passed to CreateServer() or Connect() + int m_inboundPipe, m_outboundPipe; //two one sided pipes used for communication + +#else + // Connects to a one sided pipe previously created by CreateOneWayPipe. + // In order to successfully connect id and inbound flag should be the same. + HANDLE OpenOneWayPipe(DWORD id, bool inbound); + + // Creates a one way pipe, id and inboud flag are used for naming. + // Created pipe is supposed to be connected to by OpenOneWayPipe. + HANDLE CreateOneWayPipe(DWORD id, bool inbound); + + HANDLE m_inboundPipe, m_outboundPipe; //two one sided pipes used for communication +#endif //FEATURE_PAL +}; + +#endif //TwoWayPipe_H
\ No newline at end of file diff --git a/src/debug/shared/dbgtransportsession.cpp b/src/debug/shared/dbgtransportsession.cpp index 8182a3ed9e..76c582a477 100644 --- a/src/debug/shared/dbgtransportsession.cpp +++ b/src/debug/shared/dbgtransportsession.cpp @@ -8,215 +8,6 @@ #if (!defined(RIGHT_SIDE_COMPILE) && defined(FEATURE_DBGIPC_TRANSPORT_VM)) || (defined(RIGHT_SIDE_COMPILE) && defined(FEATURE_DBGIPC_TRANSPORT_DI)) -#include <ddshared.h> - -#ifdef RIGHT_SIDE_COMPILE -static const char *DDDescribe(DWORD dwCode) // @ARMTODO: remove this; brittle temporary logging -{ - switch (dwCode) - { - case DDID_CheckDbiVersion: - return "CheckDbiVersion"; - case DDID_FlushCache: - return "FlushCache"; - case DDID_DacSetTargetConsistencyChecks: - return "DacSetTargetConsistencyChecks"; - case DDID_Destroy: - return "Destroy"; - case DDID_IsLeftSideInitialized: - return "IsLeftSideInitialized"; - case DDID_GetAppDomainFromId: - return "GetAppDomainFromId"; - case DDID_GetAppDomainId: - return "GetAppDomainId"; - case DDID_IsDefaultDomain: - return "IsDefaultDomain"; - case DDID_IsAssemblyFullyTrusted: - return "IsAssemblyFullyTrusted"; - case DDID_GetAppDomainFullName: - return "GetAppDomainFullName"; - case DDID_GetModuleSimpleName: - return "GetModuleSimpleName"; - case DDID_GetAssemblyPath: - return "GetAssemblyPath"; - case DDID_ResolveTypeReference: - return "ResolveTypeReference"; - case DDID_GetModulePath: - return "GetModulePath"; - case DDID_GetModuleNGenPath: - return "GetModuleNGenPath"; - case DDID_GetMetadata: - return "GetMetadata"; - case DDID_GetSymbolsBuffer: - return "GetSymbolsBuffer"; - case DDID_GetModuleData: - return "GetModuleData"; - case DDID_GetAddressType: - return "GetAddressType"; - case DDID_IsTransitionStub: - return "IsTransitionStub"; - case DDID_GetCompilerFlags: - return "GetCompilerFlags"; - case DDID_SetCompilerFlags: - return "SetCompilerFlags"; - case DDID_EnumerateAppDomains: - return "EnumerateAppDomains"; - case DDID_EnumerateAssembliesInAppDomain: - return "EnumerateAssembliesInAppDomain"; - case DDID_EnumerateModulesInAssembly: - return "EnumerateModulesInAssembly"; - case DDID_RequestSyncAtEvent: - return "RequestSyncAtEvent"; - case DDID_MarkDebuggerAttachPending: - return "MarkDebuggerAttachPending"; - case DDID_MarkDebuggerAttached: - return "MarkDebuggerAttached"; - case DDID_Hijack: - return "Hijack"; - case DDID_EnumerateConnections: - return "EnumerateConnections"; - case DDID_EnumerateThreads: - return "EnumerateThreads"; - case DDID_IsThreadMarkedDead: - return "IsThreadMarkedDead"; - case DDID_GetThreadHandle: - return "GetThreadHandle"; - case DDID_GetThreadObject: - return "GetThreadObject"; - case DDID_SetDebugState: - return "SetDebugState"; - case DDID_HasUnhandledException: - return "HasUnhandledException"; - case DDID_GetUserState: - return "GetUserState"; - case DDID_GetConnectionID: - return "GetConnectionID"; - case DDID_GetTaskID: - return "GetTaskID"; - case DDID_TryGetVolatileOSThreadID: - return "TryGetVolatileOSThreadID"; - case DDID_GetUniqueThreadID: - return "GetUniqueThreadID"; - case DDID_GetCurrentException: - return "GetCurrentException"; - case DDID_GetCurrentCustomDebuggerNotification: - return "GetCurrentCustomDebuggerNotification"; - case DDID_GetCurrentAppDomain: - return "GetCurrentAppDomain"; - case DDID_ResolveAssembly: - return "ResolveAssembly"; - case DDID_GetNativeCodeSequencePointsAndVarInfo: - return "GetNativeCodeSequencePointsAndVarInfo"; - case DDID_GetManagedStoppedContext: - return "GetManagedStoppedContext"; - case DDID_CreateStackWalk: - return "CreateStackWalk"; - case DDID_DeleteStackWalk: - return "DeleteStackWalk"; - case DDID_GetStackWalkCurrentContext: - return "GetStackWalkCurrentContext"; - case DDID_SetStackWalkCurrentContext: - return "SetStackWalkCurrentContext"; - case DDID_UnwindStackWalkFrame: - return "UnwindStackWalkFrame"; - case DDID_CheckContext: - return "CheckContext"; - case DDID_GetStackWalkCurrentFrameInfo: - return "GetStackWalkCurrentFrameInfo"; - case DDID_GetCountOfInternalFrames: - return "GetCountOfInternalFrames"; - case DDID_EnumerateInternalFrames: - return "EnumerateInternalFrames"; - case DDID_IsMatchingParentFrame: - return "IsMatchingParentFrame"; - case DDID_GetStackParameterSize: - return "GetStackParameterSize"; - case DDID_GetFramePointer: - return "GetFramePointer"; - case DDID_IsLeafFrame: - return "IsLeafFrame"; - case DDID_GetContext: - return "GetContext"; - case DDID_ConvertContextToDebuggerRegDisplay: - return "ConvertContextToDebuggerRegDisplay"; - case DDID_IsILStubOrLCGMethod: - return "IsILStubOrLCGMethod"; - case DDID_GetVarArgSig: - return "GetVarArgSig"; - case DDID_ResolveExactGenericArgsToken: - return "ResolveExactGenericArgsToken"; - case DDID_GetILCodeAndSig: - return "GetILCodeAndSig"; - case DDID_GetNativeCodeInfo: - return "GetNativeCodeInfo"; - case DDID_GetClassInfo: - return "GetClassInfo"; - case DDID_GetInstantiationFieldInfo: - return "GetInstantiationFieldInfo"; - case DDID_TypeHandleToExpandedTypeInfo: - return "TypeHandleToExpandedTypeInfo"; - case DDID_GetApproxTypeHandle: - return "GetApproxTypeHandle"; - case DDID_GetExactTypeHandle: - return "GetExactTypeHandle"; - case DDID_GetMethodDescParams: - return "GetMethodDescParams"; - case DDID_GetThreadOrContextStaticAddress: - return "GetThreadOrContextStaticAddress"; - case DDID_GetCollectibleTypeStaticAddress: - return "GetCollectibleTypeStaticAddress"; - case DDID_GetEnCHangingFieldInfo: - return "GetEnCHangingFieldInfo"; - case DDID_GetTypeHandleParams: - return "GetTypeHandleParams"; - case DDID_GetSimpleType: - return "GetSimpleType"; - case DDID_GetTypedByRefInfo: - return "GetTypedByRefInfo"; - case DDID_GetStringData: - return "GetStringData"; - case DDID_GetArrayData: - return "GetArrayData"; - case DDID_GetBasicObjectInfo: - return "GetBasicObjectInfo"; - case DDID_TestCrst: - return "TestCrst"; - case DDID_TestRWLock: - return "TestRWLock"; - case DDID_GetDebuggerControlBlockAddress: - return "GetDebuggerControlBlockAddress"; - case DDID_GetObjectFromRefPtr: - return "GetObjectFromRefPtr"; - case DDID_GetObject: - return "GetObject"; - case DDID_GetVmObjectHandle: - return "GetVmObjectHandle"; - case DDID_GetHandleAddressFromVmHandle: - return "GetHandleAddressFromVmHandle"; - case DDID_GetObjectContents: - return "GetObjectContents"; - case DDID_EnumerateBlockingObjects: - return "EnumerateBlockingObjects"; - case DDID_GetThreadOwningMonitorLock: - return "GetThreadOwningMonitorLock"; - case DDID_EnumerateMonitorEventWaitList: - return "EnumerateMonitorEventWaitList"; - case DDID_GetAttachStateFlags: - return "GetAttachStateFlags"; - case DDID_GetMetaDataFileInfoFromPEFile: - return "GetMetaDataFileInfoFromPEFile"; - case DDID_GetILImageInfoFromNgenPEFile: - return "GetILImageInfoFromNgenPEFile"; - default: - { - static char szBuffer[256]; - sprintf_s(szBuffer, sizeof(szBuffer), "<invalid type %u>", dwCode); - return szBuffer; - } - } -} -#endif // RIGHT_SIDE_COMPILE - // This is the entry type for the IPC event queue owned by the transport. // Each entry contains the multiplexing type of the IPC event plus the // IPC event itself. @@ -239,7 +30,6 @@ public: // Debugger::Startup() in debugger.cpp). DbgTransportSession *g_pDbgTransport = NULL; -#include "inprocdac.h" #include "ddmarshalutil.h" #endif // !RIGHT_SIDE_COMPILE @@ -256,9 +46,9 @@ DbgTransportSession::DbgTransportSession() // addresses of a couple of runtime data structures to service certain debugger requests that may be delivered // once the session is established. #ifdef RIGHT_SIDE_COMPILE -HRESULT DbgTransportSession::Init(DWORD dwAddress, USHORT usPort, HANDLE hProcessExited) +HRESULT DbgTransportSession::Init(DWORD pid, HANDLE hProcessExited) #else // RIGHT_SIDE_COMPILE -HRESULT DbgTransportSession::Init(DebuggerIPCControlBlock *pDCB, AppDomainEnumerationIPCBlock *pADB, InProcDac * pInProcDac) +HRESULT DbgTransportSession::Init(DebuggerIPCControlBlock *pDCB, AppDomainEnumerationIPCBlock *pADB) #endif // RIGHT_SIDE_COMPILE { _ASSERTE(m_eState == SS_Closed); @@ -266,9 +56,6 @@ HRESULT DbgTransportSession::Init(DebuggerIPCControlBlock *pDCB, AppDomainEnumer // Start with a blank slate so that Shutdown() on a partially initialized instance will only do the // cleanup necessary. memset(this, 0, sizeof(*this)); -#ifndef RIGHT_SIDE_COMPILE - m_hListenSocket = INVALID_SOCKET; -#endif // !RIGHT_SIDE_COMPILE // Initialize all per-session state variables. InitSessionState(); @@ -280,49 +67,11 @@ HRESULT DbgTransportSession::Init(DebuggerIPCControlBlock *pDCB, AppDomainEnumer HRESULT hr = CoCreateGuid(&m_sSessionID); if (FAILED(hr)) return hr; -#else // RIGHT_SIDE_COMPILE - // The left-side still requires WinSock since it's our responsibility to allocate a socket on which to - // listen for raw TCP connection requests. - - // Initialize WinSock and check that it supports version 2.2. - WSADATA wsaData; - int err = WSAStartup(MAKEWORD(2, 2), &wsaData); - if (err) - { - _ASSERTE(!"WinSock failed to initialize"); - return HRESULT_FROM_WIN32(DBG_GET_LAST_WSA_ERROR()); - } - m_fInitWSA = true; - - if (LOBYTE(wsaData.wVersion) != 2 || - HIBYTE(wsaData.wVersion) != 2) - { - _ASSERTE(!"WinSock doesn't support version 2.2"); - return E_FAIL; - } #endif // RIGHT_SIDE_COMPILE - // Allocate and initialize the manager object from which we obtain secure connections. - m_pConnectionManager = AllocateSecConnMgr(); - if (m_pConnectionManager == NULL) - return E_OUTOFMEMORY; - SecConnStatus eStatus = m_pConnectionManager->Initialize(); - if (eStatus != SCS_Success) - { - switch (eStatus) - { - case SCS_OutOfMemory: - return E_OUTOFMEMORY; - case SCS_InvalidConfiguration: - return E_INVALIDARG; - default: - return E_FAIL; - } - } #ifdef RIGHT_SIDE_COMPILE - m_dwLeftSideAddress = dwAddress; - m_usLeftSidePort = usPort; + m_pid = pid; if (!DuplicateHandle(GetCurrentProcess(), hProcessExited, @@ -339,7 +88,6 @@ HRESULT DbgTransportSession::Init(DebuggerIPCControlBlock *pDCB, AppDomainEnumer #else // RIGHT_SIDE_COMPILE m_pDCB = pDCB; m_pADB = pADB; - m_pInProcDac = pInProcDac; #endif // RIGHT_SIDE_COMPILE m_sStateLock.Init(); @@ -351,43 +99,6 @@ HRESULT DbgTransportSession::Init(DebuggerIPCControlBlock *pDCB, AppDomainEnumer return E_OUTOFMEMORY; #endif // RIGHT_SIDE_COMPILE -#ifndef RIGHT_SIDE_COMPILE - // Socket used to listen for connection attempts. - m_hListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (m_hListenSocket == INVALID_SOCKET) - return E_OUTOFMEMORY; - - // Setup local endpoint information for bind. - sockaddr_in listenEndpointAddress; - listenEndpointAddress.sin_family = AF_INET; - listenEndpointAddress.sin_port = 0; // Dynamically assigned port - listenEndpointAddress.sin_addr.S_un.S_addr = INADDR_ANY; - memset(&(listenEndpointAddress.sin_zero), 0, 8); - - // Bind endpoint address to listening socket. - err = bind(m_hListenSocket, - (sockaddr*)&listenEndpointAddress, - sizeof(sockaddr_in)); - if (err == SOCKET_ERROR) - return E_FAIL; - - // Find out which port we were assigned, we'll need to supply this information to the debugger proxy soon. - int cbAddress = sizeof(sockaddr_in); - err = getsockname(m_hListenSocket, - (sockaddr*)&listenEndpointAddress, - &cbAddress); - if (err == SOCKET_ERROR) - return E_FAIL; - m_usListenPort = DBGIPC_NTOHS(listenEndpointAddress.sin_port); - - // Set up socket for listening. A depth of 1 is fine here, we don't expect more than one debugger - // connection at once (and even if we get more we can't support it so we'd have to fail the extra - // connection attempt anyway). - err = listen(m_hListenSocket, 1); - if (err == SOCKET_ERROR) - return E_FAIL; -#endif // !RIGHT_SIDE_COMPILE - // Allocate some buffers to receive incoming events. The initial number is chosen arbitrarily, tune as // necessary. This array will need to grow if it fills with unread events (it takes our client a little // time to process each incoming receive). In general, however, one side will not send an unbounded stream @@ -449,39 +160,11 @@ void DbgTransportSession::Shutdown() SessionState ePreviousState = m_eState; m_eState = SS_Closed; - // We want to shutdown the transport thread but it might be stuck in a blocking transport call - // (accept() or Receive()). Perform a closesocket() or CancelReceive() if the state indicates this - // is a valid thing to do. This will cancel any operation in progress and give the thread a chance - // to notice the state transition we just made. The thread will clean up the socket resources for - // us before exiting. - - // Unblock Receive() when we know m_hConnectionSocket is valid. - // The session may already be in a closed state if there is a critical error on the session thread - // (e.g. unexpected message while setting up the connection with the debuggee). if ((ePreviousState != SS_Opening_NC) && (ePreviousState != SS_Resync_NC) && (ePreviousState != SS_Closed)) { - _ASSERTE(m_pConnection != NULL); - m_pConnection->CancelReceive(); + m_pipe.Disconnect(); } -#ifndef RIGHT_SIDE_COMPILE - // On the LS we might be stuck in a accept() if our state was SS_Opening_NC or SS_Resync_NC (the RS - // doesn't get stuck because Connect() won't block for an unbounded amount of time). - if (ePreviousState == SS_Opening_NC || ePreviousState == SS_Resync_NC) - { - //We can't assert this... this code doesn't run atomically with respect to the connection setup - //code. When we entered the NC state we didn't have a connection, but at some point before exiting - //that state we do have a connection. - //_ASSERTE(m_pConnection == NULL); - _ASSERTE(m_hListenSocket != INVALID_SOCKET); - // Shutdown() doesn't appear to be enough to budge an accept(). Use closesocket() instead - // (there's a tiny race here, but it's very, very unlikely the haven't hit the accept() call - // yet in this state). - closesocket(m_hListenSocket); - m_hListenSocket = INVALID_SOCKET; - } -#endif // !RIGHT_SIDE_COMPILE - } // Leave m_sStateLock #ifdef RIGHT_SIDE_COMPILE @@ -513,23 +196,11 @@ void DbgTransportSession::Shutdown() { CloseHandle(m_hProcessExited); } -#else - if (m_hListenSocket != INVALID_SOCKET) - closesocket(m_hListenSocket); #endif // RIGHT_SIDE_COMPILE if (m_fInitStateLock) m_sStateLock.Destroy(); - // No further connection operations. - if (m_pConnectionManager) - m_pConnectionManager->Destroy(); - -#ifndef RIGHT_SIDE_COMPILE - // No further socket operations. - if (m_fInitWSA) - WSACleanup(); -#endif // !RIGHT_SIDE_COMPILE } #ifndef RIGHT_SIDE_COMPILE @@ -628,13 +299,6 @@ bool DbgTransportSession::StopUsingAsDebugger(DebugTicket * pTicket) return false; } } -#else // RIGHT_SIDE_COMPILE -// The LS needs to be able to tell the code that registers with the debugger proxy which port it will wait -// on for debugger connections. Returns the port number in host byte order. -USHORT DbgTransportSession::GetPort() -{ - return m_usListenPort; -} #endif // RIGHT_SIDE_COMPILE // Sends a pre-initialized event to the other side. @@ -808,9 +472,9 @@ HRESULT DbgTransportSession::ReadMemory(PBYTE pbRemoteAddress, PBYTE pbBuffer, S DBG_TRANSPORT_INC_STAT(SentReadMemory); Message sMessage; - sMessage.Init(MT_ReadMemory, NULL, 0, pbBuffer, cbBuffer); + sMessage.Init(MT_ReadMemory, NULL, 0, pbBuffer, (DWORD)cbBuffer); sMessage.m_sHeader.TypeSpecificData.MemoryAccess.m_pbLeftSideBuffer = pbRemoteAddress; - sMessage.m_sHeader.TypeSpecificData.MemoryAccess.m_cbLeftSideBuffer = cbBuffer; + sMessage.m_sHeader.TypeSpecificData.MemoryAccess.m_cbLeftSideBuffer = (DWORD)cbBuffer; HRESULT hr = SendRequestMessageAndWait(&sMessage); if (FAILED(hr)) @@ -827,9 +491,9 @@ HRESULT DbgTransportSession::WriteMemory(PBYTE pbRemoteAddress, PBYTE pbBuffer, DBG_TRANSPORT_INC_STAT(SentWriteMemory); Message sMessage; - sMessage.Init(MT_WriteMemory, pbBuffer, cbBuffer); + sMessage.Init(MT_WriteMemory, pbBuffer, (DWORD)cbBuffer); sMessage.m_sHeader.TypeSpecificData.MemoryAccess.m_pbLeftSideBuffer = pbRemoteAddress; - sMessage.m_sHeader.TypeSpecificData.MemoryAccess.m_cbLeftSideBuffer = cbBuffer; + sMessage.m_sHeader.TypeSpecificData.MemoryAccess.m_cbLeftSideBuffer = (DWORD)cbBuffer; HRESULT hr = SendRequestMessageAndWait(&sMessage); if (FAILED(hr)) @@ -880,56 +544,6 @@ HRESULT DbgTransportSession::GetAppDomainCB(AppDomainEnumerationIPCBlock *pADB) return SendRequestMessageAndWait(&sMessage); } -//----------------------------------------------------------------------------- -// -// Send a DDMessage to the LS. -// -// Arguments: -// pbSendBuffer - byte array to be sent to the LS -// cbSendBuffer - number of bytes in pbSendBuffer -// ppbReceiveBuffer - out parameter; return the byte array sent back by the LS; caller owns the returned memory -// pcbReceiveBuffer - out parameter; number of bytes in *ppbReceiveBuffer -// -// Return Value: -// S_OK if successful -// -// Notes: -// This function blocks until a reply is received. -// - -HRESULT DbgTransportSession::SendDDMessage(PBYTE pbSendBuffer, DWORD cbSendBuffer, PBYTE * ppbReceiveBuffer, DWORD * pcbReceiveBuffer) -{ - DbgTransportLog(LC_Requests, "Sending 'DDMessage(0x%08X, %u) [%s]'", pbSendBuffer, cbSendBuffer, DDDescribe(*(DWORD*)pbSendBuffer)); - DBG_TRANSPORT_INC_STAT(SentDDMessage); - - // Passing NULL as the reply block will cause the transport to allocate memory for the reply block for us. - // The problem here is that we have no idea how big the reply block is going to be. - Message sMessage; - sMessage.Init(MT_DDMessage, pbSendBuffer, cbSendBuffer, NULL, 0); - -#if defined(_DEBUG) - _ASSERTE(cbSendBuffer >= 4); - sMessage.m_sHeader.TypeSpecificData.DDMessage.m_eType = *reinterpret_cast<DWORD *>(pbSendBuffer); -#endif - - HRESULT hr = SendRequestMessageAndWait(&sMessage); - if (FAILED(hr)) - { - if (sMessage.m_pbReplyBlock) - { - delete [] sMessage.m_pbReplyBlock; - } - return hr; - } - - // Transfer ownership of the reply block to the caller - *ppbReceiveBuffer = sMessage.m_pbReplyBlock; - *pcbReceiveBuffer = sMessage.m_cbReplyBlock; - - // If we reached here but m_hrResult is a failure HR, then the IDacDbiInterface call on the LS was - // sucessful, but there were somoe other problems at the DDUnpack level on the LS. - return sMessage.m_sHeader.TypeSpecificData.DDMessage.m_hrResult; -} #endif // RIGHT_SIDE_COMPILE // Worker function for code:DbgTransportSession::SendEvent and code:DbgTransportSession::SendDebugEvent. @@ -1170,7 +784,7 @@ HRESULT DbgTransportSession::SendRequestMessageAndWait(Message *pMessage) bool DbgTransportSession::SendBlock(PBYTE pbBuffer, DWORD cbBuffer) { _ASSERTE(m_eState == SS_Opening || m_eState == SS_Resync || m_eState == SS_Open); - _ASSERTE(m_pConnectionManager != NULL); + _ASSERTE(m_pipe.GetState() == TwoWayPipe::ServerConnected || m_pipe.GetState() == TwoWayPipe::ClientConnected); _ASSERTE(cbBuffer > 0); DBG_TRANSPORT_INC_STAT(SentBlocks); @@ -1181,7 +795,7 @@ bool DbgTransportSession::SendBlock(PBYTE pbBuffer, DWORD cbBuffer) if (DBG_TRANSPORT_SHOULD_INJECT_FAULT(Send)) fSuccess = false; else - fSuccess = m_pConnection->Send(pbBuffer, cbBuffer); + fSuccess = (m_pipe.Write(pbBuffer, cbBuffer) == cbBuffer); if (!fSuccess) { @@ -1200,7 +814,7 @@ bool DbgTransportSession::SendBlock(PBYTE pbBuffer, DWORD cbBuffer) // state). bool DbgTransportSession::ReceiveBlock(PBYTE pbBuffer, DWORD cbBuffer) { - _ASSERTE(m_pConnection != NULL); + _ASSERTE(m_pipe.GetState() == TwoWayPipe::ServerConnected || m_pipe.GetState() == TwoWayPipe::ClientConnected); _ASSERTE(cbBuffer > 0); DBG_TRANSPORT_INC_STAT(ReceivedBlocks); @@ -1212,7 +826,7 @@ bool DbgTransportSession::ReceiveBlock(PBYTE pbBuffer, DWORD cbBuffer) if (DBG_TRANSPORT_SHOULD_INJECT_FAULT(Receive)) fSuccess = false; else - fSuccess = m_pConnection->Receive(pbBuffer, cbBuffer); + fSuccess = (m_pipe.Read(pbBuffer, cbBuffer) == cbBuffer); if (!fSuccess) { @@ -1274,8 +888,7 @@ void DbgTransportSession::HandleNetworkError(bool fCallerHoldsStateLock) // we'll call CancelReceive() to abort the operation. The transport thread itself will handle the // actual Destroy() (having one thread do this management greatly simplifies things). m_eState = SS_Resync_NC; - _ASSERTE(m_pConnection != NULL); - m_pConnection->CancelReceive(); + m_pipe.Disconnect(); break; default: @@ -1312,8 +925,7 @@ void DbgTransportSession::FlushSendQueue(DWORD dwLastProcessedId) eType != MT_WriteMemory && eType != MT_GetDCB && eType != MT_SetDCB && - eType != MT_GetAppDomainCB && - eType != MT_DDMessage) + eType != MT_GetAppDomainCB) #endif // RIGHT_SIDE_COMPILE { #ifdef RIGHT_SIDE_COMPILE @@ -1366,21 +978,9 @@ bool DbgTransportSession::ProcessReply(MessageHeader *pHeader) return true; } - // If there is a reply block but the caller hasn't specified a reply buffer, then allocate a buffer for - // the caller. This is used if the caller doesn't know ahead of time how much memory is needed for the - // reply. Currently this is only used for sending DDMessages from the RS to the LS. The caller is - // responsible for freeing the buffer. - if ((pHeader->m_cbDataBlock != (DWORD)0) && (pMsg->m_pbReplyBlock == (PBYTE)NULL)) - { - _ASSERTE(pHeader->m_eType == MT_DDMessage); - - pMsg->m_pbReplyBlock = new (nothrow) BYTE[pHeader->m_cbDataBlock]; - if (pMsg->m_pbReplyBlock == NULL) - { - return false; - } - pMsg->m_cbReplyBlock = pHeader->m_cbDataBlock; - } + // If there is a reply block but the caller hasn't specified a reply buffer. + // This combination is not used any more. + _ASSERTE(! ((pHeader->m_cbDataBlock != (DWORD)0) && (pMsg->m_pbReplyBlock == (PBYTE)NULL)) ); // If there was an output buffer provided then we copy the data block in the reply into it (perhaps // decrypting it first). If the reply header indicates there is no data block then presumably the request @@ -1536,7 +1136,7 @@ HRESULT DbgTransportSession::CheckBufferAccess(__in_ecount(cbBuffer) PBYTE pbBuf if ((pbBuffer + cbBuffer) > ((PBYTE)sMemInfo.BaseAddress + sMemInfo.RegionSize)) { PBYTE pbRegionEnd = reinterpret_cast<PBYTE>(sMemInfo.BaseAddress) + sMemInfo.RegionSize; - cbBuffer = (pbBuffer + cbBuffer) - pbRegionEnd; + cbBuffer = (DWORD)((pbBuffer + cbBuffer) - pbRegionEnd); pbBuffer = pbRegionEnd; } else @@ -1594,8 +1194,7 @@ DWORD WINAPI DbgTransportSession::TransportWorkerStatic(LPVOID pvContext) // origin. #define HANDLE_TRANSIENT_ERROR() do { \ HandleNetworkError(false); \ - m_pConnection->Destroy(); \ - m_pConnection = NULL; \ + m_pipe.Disconnect(); \ goto ResetConnection; \ } while (false) @@ -1621,7 +1220,6 @@ void DbgTransportSession::TransportWorker() while (m_eState != SS_Closed) { _ASSERTE(m_eState == SS_Opening_NC || m_eState == SS_Resync_NC || m_eState == SS_Closed); - _ASSERTE(m_pConnection == NULL); DbgTransportLog(LC_Proxy, "Forming new connection"); @@ -1633,54 +1231,55 @@ void DbgTransportSession::TransportWorker() // little while and retrying (the LS may take a little while to set up). If there's nobody listening // the debugger will eventually get bored waiting for us and shutdown the session, which will // terminate this loop. - SecConnStatus eStatus; + ConnStatus eStatus; if (DBG_TRANSPORT_SHOULD_INJECT_FAULT(Connect)) eStatus = SCS_NetworkFailure; else - eStatus = m_pConnectionManager->AllocateConnection(m_dwLeftSideAddress, - m_usLeftSidePort, - &m_pConnection); + { + if (m_pipe.Connect(m_pid)) + { + eStatus = SCS_Success; + } + else + { + //not really sure that this is the real failure + //TODO: we probably need to analyse GetErrorCode() here + eStatus = SCS_NoListener; + } + } + if (eStatus != SCS_Success) { DbgTransportLog(LC_Proxy, "AllocateConnection() failed with %u\n", eStatus); DBG_TRANSPORT_INC_STAT(MiscErrors); - _ASSERTE(m_pConnection == NULL); + _ASSERTE(m_pipe.GetState() != TwoWayPipe::ClientConnected); Sleep(1000); continue; } #else // RIGHT_SIDE_COMPILE - // On the left side we always listen for a connection request from the right side. Init() has already - // allocated a listen socket for us, bound it to our local endpoint and set the listen depth. All we - // have to do is a (blocking) accept() call to finalize the TCP connection followed by a - // (non-blocking) Accept() call to create the SSL connection. This can be aborted by a Shutdown() (in - // which case we'll see the SS_Closed state and exit). On network failure we'll wait a little while - // and try again, much like the right side. - sockaddr_in acceptEndpointAddress; - int acceptAddressLen = sizeof(sockaddr_in); - SOCKET hConnectionSocket = accept(m_hListenSocket, - (sockaddr*)&acceptEndpointAddress, - &acceptAddressLen); - if (hConnectionSocket == INVALID_SOCKET) - { - DbgTransportLog(LC_NetErrors, "Network error %08X on accept()", - HRESULT_FROM_WIN32(DBG_GET_LAST_WSA_ERROR())); - DBG_TRANSPORT_INC_STAT(MiscErrors); - Sleep(1000); - continue; - } - - SecConnStatus eStatus; + ConnStatus eStatus; if (DBG_TRANSPORT_SHOULD_INJECT_FAULT(Accept)) eStatus = SCS_NetworkFailure; else - eStatus = m_pConnectionManager->Accept(hConnectionSocket, &m_pConnection); + { + DWORD pid = GetCurrentProcessId(); + if (m_pipe.CreateServer(pid) && m_pipe.WaitForConnection()) + { + eStatus = SCS_Success; + } + else + { + //not really sure that this is the real failure + //TODO: we probably need to analyse GetErrorCode() here + eStatus = SCS_NoListener; + } + } if (eStatus != SCS_Success) { DbgTransportLog(LC_Proxy, "Accept() failed with %u\n", eStatus); DBG_TRANSPORT_INC_STAT(MiscErrors); - _ASSERTE(m_pConnection == NULL); - closesocket(hConnectionSocket); + _ASSERTE(m_pipe.GetState() != TwoWayPipe::ServerConnected); Sleep(1000); continue; } @@ -1708,24 +1307,6 @@ void DbgTransportSession::TransportWorker() _ASSERTE(!"Bad session state"); } // Leave m_sStateLock -#ifdef RIGHT_SIDE_COMPILE - // On the RS we still need to establish a SSL connection. We do this by calling Connect(). - // Surprisingly, the call to connect() doesn't fail even if the LS is not accepting any more - // connection request. This means that we may block forever in Connect() when we try to receive - // data from the LS for setting up a SSL connection. We need some way for another thread to unblock - // us by calling CancelReceive(). This is why we need to allocate the SecConn above before we - // actually try to establish a SSL connection. - eStatus = m_pConnection->Connect(); - if (eStatus != SCS_Success) - { - DbgTransportLog(LC_Proxy, "Connect() failed with %u\n", eStatus); - DBG_TRANSPORT_INC_STAT(MiscErrors); - m_pConnection->Destroy(); - m_pConnection = NULL; - Sleep(1000); - continue; - } -#endif // RIGHT_SIDE_COMPILE // Now we have a connection in place. Start reading messages and processing them. Which messages are // valid depends on whether we're in SS_Opening or SS_Resync (the state can change at any time @@ -1867,8 +1448,7 @@ void DbgTransportSession::TransportWorker() // Check none of the sends failed. if (m_eState != SS_Opening) { - m_pConnection->Destroy(); - m_pConnection = NULL; + m_pipe.Disconnect(); continue; } } // Leave m_sStateLock @@ -2015,8 +1595,7 @@ void DbgTransportSession::TransportWorker() break; else if (m_eState == SS_Resync_NC) { - m_pConnection->Destroy(); - m_pConnection = NULL; + m_pipe.Disconnect(); continue; } else @@ -2040,7 +1619,7 @@ void DbgTransportSession::TransportWorker() // Since we care about security here, perform some additional validation checks that make it // harder for a malicious sender to attack with random message data. - if (sReceiveHeader.m_eType > MT_DDMessage || + if (sReceiveHeader.m_eType > MT_GetAppDomainCB || (sReceiveHeader.m_dwId <= m_dwLastMessageIdSeen && sReceiveHeader.m_dwId != (DWORD)0) || (sReceiveHeader.m_dwReplyId >= m_dwNextMessageId && @@ -2146,8 +1725,7 @@ void DbgTransportSession::TransportWorker() break; } - m_pConnection->Destroy(); - m_pConnection = NULL; + m_pipe.Disconnect(); // We could add code to drain the send queue here (like we have for SS_Closed at the end of // this method) but I'm pretty sure we can only get a graceful session close with no @@ -2368,47 +1946,6 @@ void DbgTransportSession::TransportWorker() #endif // RIGHT_SIDE_COMPILE break; - case MT_DDMessage: -#ifdef RIGHT_SIDE_COMPILE - if (!ProcessReply(&sReceiveHeader)) - HANDLE_TRANSIENT_ERROR(); -#else // RIGHT_SIDE_COMPILE - fReplyRequired = true; - - // Allocate memory for the pay load. - BYTE * pbReceiveBuffer; - pbReceiveBuffer = new (nothrow) BYTE[sReceiveHeader.m_cbDataBlock]; - if (pbReceiveBuffer == NULL) - { - HANDLE_TRANSIENT_ERROR(); - } - - // Receive the pay load. - if (!ReceiveBlock(pbReceiveBuffer, sReceiveHeader.m_cbDataBlock)) - { - delete [] pbReceiveBuffer; - HANDLE_TRANSIENT_ERROR(); - } - - // Initialize a ReadBuffer. It takes ownership of the memory and will free it - // in its destructor. - receiveBuffer.OpenAndOwn(pbReceiveBuffer, sReceiveHeader.m_cbDataBlock); - - // Call the InProcDac which will utlimately call into the DacDbiInterfaceImpl. - // Note that this is called on the transport thread. - hr = m_pInProcDac->DoRequest(&receiveBuffer, &resultBuffer); - sReceiveHeader.TypeSpecificData.DDMessage.m_hrResult = hr; - - // Getting the raw ptr - resultBuffer still owns the memory - // make sure pbOptReplyData does not outlive resultBuffer or - // the pointer will dangle. - if (SUCCEEDED(hr)) - { - resultBuffer.GetRawPtr(&pbOptReplyData, &cbOptReplyData); - } -#endif // RIGHT_SIDE_COMPILE - break; - default: _ASSERTE(!"Unknown message type"); HANDLE_CRITICAL_ERROR(); @@ -2472,13 +2009,8 @@ void DbgTransportSession::TransportWorker() ResetEvent(m_hSessionOpenEvent); #endif // RIGHT_SIDE_COMPILE - // Close the connection socket if we haven't done so already. No race here, only the transport thread ever - // closes the connection socket. - if (m_pConnection) - { - m_pConnection->Destroy(); - m_pConnection = NULL; - } + // Close the connection if we haven't done so already. + m_pipe.Disconnect(); // Drain any remaining entries in the send queue (aborting them when they need completions). { @@ -2519,7 +2051,6 @@ void DbgTransportSession::TransportWorker() case MT_GetDCB: case MT_SetDCB: case MT_GetAppDomainCB: - case MT_DDMessage: // On the RS these are the original requests. Signal the completion event. SignalReplyEvent(pMsg); break; @@ -2529,7 +2060,6 @@ void DbgTransportSession::TransportWorker() case MT_GetDCB: case MT_SetDCB: case MT_GetAppDomainCB: - case MT_DDMessage: // On the LS these are replies to the original request. Nobody's waiting on these. break; #endif // RIGHT_SIDE_COMPILE @@ -2908,8 +2438,6 @@ const char *DbgTransportSession::MessageName(MessageType eType) return "SetDCB"; case MT_GetAppDomainCB: return "GetAppDomainCB"; - case MT_DDMessage: - return "DDMessage"; default: _ASSERTE(!"Unknown message type"); return NULL; @@ -2972,12 +2500,6 @@ void DbgTransportSession::DbgTransportLogMessageReceived(MessageHeader *pHeader) DbgTransportLog(LC_Requests, "Received 'GetAppDomainCB' reply"); DBG_TRANSPORT_INC_STAT(ReceivedGetAppDomainCB); return; - case MT_DDMessage: - DbgTransportLog(LC_Requests, "Received 'DDMessage(%u) [%s]' reply", - (DWORD)pHeader->TypeSpecificData.DDMessage.m_eType, - DDDescribe(pHeader->TypeSpecificData.DDMessage.m_eType)); - DBG_TRANSPORT_INC_STAT(ReceivedDDMessage); - return; #else // RIGHT_SIDE_COMPILE case MT_ReadMemory: DbgTransportLog(LC_Requests, "Received 'ReadMemory(0x%08X, %u)'", @@ -3003,11 +2525,6 @@ void DbgTransportSession::DbgTransportLogMessageReceived(MessageHeader *pHeader) DbgTransportLog(LC_Requests, "Received 'GetAppDomainCB'"); DBG_TRANSPORT_INC_STAT(ReceivedGetAppDomainCB); return; - case MT_DDMessage: - DbgTransportLog(LC_Requests, "Received 'DDMessage(%u)'", - (DWORD)pHeader->TypeSpecificData.DDMessage.m_eType); - DBG_TRANSPORT_INC_STAT(ReceivedDDMessage); - return; #endif // RIGHT_SIDE_COMPILE default: _ASSERTE(!"Unknown message type"); diff --git a/src/debug/shared/utils.cpp b/src/debug/shared/utils.cpp index 78e680d4ec..f67d6073be 100644 --- a/src/debug/shared/utils.cpp +++ b/src/debug/shared/utils.cpp @@ -71,6 +71,9 @@ CORDB_ADDRESS IsEventDebuggerNotification( return NULL; } + // TODO: We don't do this check in case of non-windows debugging now, because we don't support + // multi-instance debugging. +#if !defined(FEATURE_DBGIPC_TRANSPORT_VM) && !defined(FEATURE_DBGIPC_TRANSPORT_DI) // If base-address doesn't match, then it's likely an event from another version of the CLR // in the target. // We need to be careful here. CORDB_ADDRESS is a ULONG64, whereas ExceptionInformation[1] @@ -80,6 +83,7 @@ CORDB_ADDRESS IsEventDebuggerNotification( { return NULL; } +#endif // It passes all the format checks. So now get the payload. CORDB_ADDRESS ptrRemoteManagedEvent = GetExceptionInfoAsAddress(pRecord, 2); diff --git a/src/dlls/mscordbi/CMakeLists.txt b/src/dlls/mscordbi/CMakeLists.txt index 5d1cf42e50..09e20e87d3 100644 --- a/src/dlls/mscordbi/CMakeLists.txt +++ b/src/dlls/mscordbi/CMakeLists.txt @@ -26,6 +26,7 @@ add_library(mscordbi SHARED ) set(COREDBI_LIBRARIES + debug-pal cordbdi utilcodestaticnohost ildbsymlib diff --git a/src/dlls/mscordbi/mscordbi.src b/src/dlls/mscordbi/mscordbi.src index 747ec0c98c..fb8d8b0ef0 100644 --- a/src/dlls/mscordbi/mscordbi.src +++ b/src/dlls/mscordbi/mscordbi.src @@ -25,9 +25,6 @@ EXPORTS #endif // FEATURE_CORECLR #if defined(FEATURE_DBGIPC_TRANSPORT_DI) - InitDbgTransportManager - ShutdownDbgTransportManager - CreateCoreClrDebugTarget DllGetClassObject private #endif // FEATURE_DBGIPC_TRANSPORT_DI diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt index f1a0270ca0..c49193d3c2 100644 --- a/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -44,6 +44,7 @@ set(CORECLR_LIBRARIES utilcode ${START_LIBRARY_GROUP} # Start group of libraries that have circular references cordbee_wks + debug-pal ${LIB_UNWINDER} cee_wks ${END_LIBRARY_GROUP} # End group of libraries that have circular references diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index e2fd665c01..6bfa645af4 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -242,7 +242,7 @@ CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_DbgTransportLog, W("DbgTransportLog"), CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_DbgTransportLogClass, W("DbgTransportLogClass"), "mask to control what is logged in DbgTransportLog") RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_DbgTransportProxyAddress, W("DbgTransportProxyAddress"), "allows specifying the transport proxy address", CLRConfig::REGUTIL_default) CONFIG_DWORD_INFO_EX(INTERNAL_DbgTrapOnSkip, W("DbgTrapOnSkip"), 0, "allows breaking when we skip a breakpoint", CLRConfig::REGUTIL_default) -RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_DbgUseTransport, W("DbgUseTransport"), 0, "Allows using the debug transport (1) or regular mscordbi debugging (0)") +RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_DbgWaitForDebuggerAttach, W("DbgWaitForDebuggerAttach"), 0, "Makes CoreCLR wait for a managed debugger to attach on process start (1) or regular process start (0)") CONFIG_DWORD_INFO_EX(INTERNAL_DbgWaitTimeout, W("DbgWaitTimeout"), 1, "specifies the timeout value for waits", CLRConfig::REGUTIL_default) RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_DbgWFDETimeout, W("DbgWFDETimeout"), 25, "specifies the timeout value for wait when waiting for a debug event", CLRConfig::REGUTIL_default) CONFIG_DWORD_INFO_EX(INTERNAL_RaiseExceptionOnAssert, W("RaiseExceptionOnAssert"), 0, "Raise a first chance (if set to 1) or second chance (if set to 2) exception on asserts.", CLRConfig::REGUTIL_default) diff --git a/src/inc/dbgproxy.h b/src/inc/dbgproxy.h deleted file mode 100644 index 8a4cf67e38..0000000000 --- a/src/inc/dbgproxy.h +++ /dev/null @@ -1,389 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -#ifndef __DBG_PROXY_INCLUDED -#define __DBG_PROXY_INCLUDED - -// -// This header is used when managed debugging is performed over a network connection rather than via a shared -// IPC memory block. It describes the format of the communication between a debugger or debuggee and the proxy -// service that sits in the middle between the two. -// -// The proxy has its own process on the same machine as the debuggee. It is involved at the start of debugging -// (where it launches processes, enumerates and detects runtime startups for the debugger) and at the end -// (where it handles process termination commands from the debugger or sends process termination events back). -// The interaction with the debuggee is limited to a single message exchange where the debuggee registers its -// runtime with the proxy and the proxy responds with whether or not a debugger is currently waiting to -// attach. -// -// The communication transport is SSL over TCP/IP. -// -// Note that this header uses very basic data types only as it is included from both Win32/PAL code and native -// Mac code. -// - -#include <dbgportable.h> - -// Constants describing the different platforms the debugger proxy can provide service for. -enum DbgTargetPlatform -{ - DTP_Unknown, // Not set yet - DTP_MacPPC, // Macintosh, PPC 32-bit - DTP_MacX86, // Macintosh, X86 32-bit - DTP_WinARM, // Windows, ARM 32-bit - DTP_MacX86_64, // Macintosh, X86 64-bit -}; - -// The proxy uses its own ID to track both processes and CoreCLR runtimes within those processes. Both come -// from the same namespace (i.e. a given PRUID uniquely identifies either a process or a runtime). -typedef unsigned int PRUID; - -// Codes for the different types of messages the proxy can send or receive. Each message is tagged with one -// of these codes. -enum DbgProxyMessageType -{ - // Messages sent to the proxy from the debugger. - DPMT_GetSystemInfo, // Query the remote system type and proxy version, must be first message sent - DPMT_EnumProcesses, // List processes and runtimes on the target machine - DPMT_LaunchProcess, // Run the given command line on the target machine - DPMT_EarlyAttach, // Notify the proxy that the next runtime started on a process is to be debugged - DPMT_TerminateProcess, // Terminate the specified process - - // Messages sent to the debugger from the proxy. Some are responses to requests from above and some are - // asynchronous events. - DPMT_SystemInfo, // Reply to GetSystemInfo - DPMT_ProcessList, // Reply to EnumProcesses - DPMT_ProcessLaunched, // Reply to LaunchProcess, indicates success status and PID/PRUID of new process - DPMT_RuntimeStarted, // Event delivered every time a runtime registers for startup with the proxy - DPMT_ProcessTerminated, // Event delivered every time a process terminates - DPMT_EarlyAttachDone, // Reply to EarlyAttach - - // The only message sent from the debuggee to the proxy. The debuggee expects a RuntimeRegistered in - // reply. - DPMT_RegisterRuntime, // Tell the proxy a new runtime has started and provide useful info (port etc.) - - // The only message sent from the proxy to the debugee. - DPMT_RuntimeRegistered, // Acknowledge registration, inform debuggee whether it should wait for debugger attach -}; - -// Status code returned in ProcessLaunched messages. Indicates whether the process creation succeeded or not. -enum DbgProxyLaunchResult -{ - DPLR_Success, // The process was launched successfully - DPLR_OutOfMemory, // The request failed due to lack of resources - DPLR_Denied, // The request failed for security reasons - DPLR_NotFound, // The specified application cannot be found. - DPLR_UnspecifiedError, // The request failed for unspecified reasons (catchall) -}; - -// The current protocol used by the proxy. Major versions increment for incompatible protocol updates, minor -// versions for any other changes. Proxies (or their clients) will discard messages with a major protocol they -// don't handle, but must handle any minor version within a supported major protocol version. -#define kCurrentMajorVersion 2 -#define kCurrentMinorVersion 0 - -// To enable a more flexible protocol we define the concept of an attribute block. This is a variable sized -// record consisting of a header containing the overall length followed by zero or more records. Each record -// has a tag (an enum value) and a variable sized binary blob value. The attribute block does not assign any -// semantic to this value. Each record is padded to ensure that the next record (or the overall size of the -// attribute block) is aligned on a 4 byte boundary. Value sizes are limited to 16-bit values (i.e. <= 65535 -// bytes). - -// Valid tag values for attribute blocks. More may be defined in the future with minimal impact on current -// clients. Only one instance of a given tag should be present in a single block (the behavior is undefined -// otherwise). -enum DbgAttributeTag -{ - DAT_CommandLine, // Value is a UTF8 string containing a shell command and its arguments (whitespace separated) - DAT_DefaultDirectory, // Value is a UTF8 string containing the default directory to lauch a process under - DAT_Environment // Value is a sequence of UTF8 strings containing an environment block -}; - -// The header present at the start of every attribute block. -struct DbgAttributeBlockHeader -{ - unsigned int m_cbBlockSize; // Count of bytes in the block (including this header) -}; - -// Helper class used to calculate the size of and then format an attribute block. First tell it the sizes of -// all the values that will be stored, then ask for the total space needed, allocate a buffer large enough and -// go back and fill in all the details. -class DbgAttributeBlockWriter -{ -public: - DbgAttributeBlockWriter() - { - m_cbBuffer = sizeof(DbgAttributeBlockHeader); - m_pbBuffer = NULL; - m_pbNextEntry = NULL; - } - - // Plan for adding a specific string value to the block. - void ScheduleStringValue(LPCSTR szValue) - { - ScheduleValue((unsigned int)(strlen(szValue) + 1)); - } - - // Plan for adding a specific binary blob value to the block. - void ScheduleValue(unsigned int cbValue) - { - _PASSERT(cbValue <= 0xffff); - _PASSERT(m_pbBuffer == NULL); - - m_cbBuffer += sizeof(unsigned short); // Space for the record tag - m_cbBuffer += sizeof(unsigned short); // Space for the value length - m_cbBuffer += (cbValue + 3) & ~3; // Account for value size rounded up to nearest multiple of 4 - } - - // Get the total size of buffer required to hold a block with the values planned so far. - unsigned int GetRequiredBufferSize() - { - return m_cbBuffer; - } - - // Tell the writer where the buffer space for the block has been allocated and prepare to start - // initializing records. - void BeginFormatting(__inout_bcount(m_cbBuffer) char *pbBuffer) - { - _PASSERT(m_pbBuffer == NULL); - m_pbBuffer = pbBuffer; - m_pbNextEntry = m_pbBuffer; - - // Write the block header (just contains the total size of the block). - *(unsigned int*)m_pbNextEntry = m_cbBuffer; - m_pbNextEntry += sizeof(unsigned int); - } - - // Add a string value to the block. - void AddStringValue(DbgAttributeTag eTag, LPCSTR szValue) - { - AddValue(eTag, szValue, (unsigned int)(strlen(szValue) + 1)); - } - - // Add a binary blob value to the block. - void AddValue(DbgAttributeTag eTag, __in_bcount(cbValue) const char *pbValue, unsigned int cbValue) - { - _PASSERT(cbValue <= 0xffff); - _PASSERT(m_pbBuffer != NULL); - _PASSERT(((unsigned int)(size_t)m_pbNextEntry & 3) == 0); - - // Write the record tag. - *(unsigned short*)m_pbNextEntry = eTag; - m_pbNextEntry += sizeof(unsigned short); - - // Write the value size. - *(unsigned short*)m_pbNextEntry = cbValue; - m_pbNextEntry += sizeof(unsigned short); - - // Copy the value over. - memcpy(m_pbNextEntry, pbValue, cbValue); - m_pbNextEntry += cbValue; - - // Calculate whether we need any padding to make the record a multiple of 4 bytes long. - unsigned int cbPadding = 3 - ((cbValue + 3) & 3); - if (cbPadding) - { - // We need padding, fill with zeroes. - memset(m_pbNextEntry, 0, cbPadding); - m_pbNextEntry += cbPadding; - } - - _PASSERT(m_pbNextEntry <= (m_pbBuffer + m_cbBuffer)); - } - -private: - unsigned int m_cbBuffer; // The bytes needed to represent the block so far - char *m_pbBuffer; // The buffer allocated by the caller to hold the block (NULL during planning) - char *m_pbNextEntry; // Current location as we format the block (NULL during planning) -}; - -// Helper class to interpret an initialized attribute block. -class DbgAttributeBlockReader -{ -public: - DbgAttributeBlockReader(__in_bcount(*(unsigned int*)pbBuffer) char *pbBuffer) - { - m_pbBuffer = pbBuffer; - } - - // Get the total size of the block in bytes. - unsigned int GetBlockSize() - { - _PASSERT(*(unsigned int*)m_pbBuffer >= sizeof(unsigned int)); - - return *(unsigned int*)m_pbBuffer; - } - - // Locate a value with the given tag. If none exists NULL is returned. Otherwise a pointer to the start of - // the value in the block is returned (along with, optionally, the length of the value). - char *FindValue(DbgAttributeTag eTag, unsigned int *pcbValue = NULL) - { - unsigned int cbBuffer = GetBlockSize() - sizeof(unsigned int); - char *pbEntry = m_pbBuffer + sizeof(unsigned int); - - // Step through the block while there are still records to parse. - while (cbBuffer) - { - // Read the tag from the record and step over it. - DbgAttributeTag eEntryTag = (DbgAttributeTag)*(unsigned short*)pbEntry; - pbEntry += sizeof(unsigned short); - - // Read the value size from the record and step over it. - unsigned int cbValue = *(unsigned short*)pbEntry; - pbEntry += sizeof(unsigned short); - - // If the tags match then return the pointer (which is currently at the start of the value in the - // record). - if (eEntryTag == eTag) - { - if (pcbValue) - *pcbValue = cbValue; - return pbEntry; - } - - // Calculate the size of any padding this record has. - unsigned int cbPadding = 3 - ((cbValue + 3) & 3); - - // Step over the value and padding to the start of the next record. - pbEntry += cbValue + cbPadding; - - _PASSERT(cbBuffer >= (sizeof(unsigned short) + sizeof(unsigned short) + cbValue + cbPadding)); - cbBuffer -= sizeof(unsigned short) + sizeof(unsigned short) + cbValue + cbPadding; - } - - // If we get here we ran out of records, so no record with the given tag is present. - if (pcbValue) - *pcbValue = 0; - return NULL; - } - -private: - char *m_pbBuffer; -}; - -// Maximum number of bytes of process command line that will be returned in a DbgProxyProcessInfo. -#define kMaxCommandLine 256 - -// Structure reported in ProcessList messages that describes a single process on the target machine. -struct DbgProxyProcessInfo -{ - Portable<unsigned> m_uiPID; // Host system PID of the process - Portable<PRUID> m_pruidProcess; // Proxy allocated PRUID for the process - char m_szCommandLine[kMaxCommandLine]; // Command and arguments the process is running -}; - -// Structure reported in ProcessList messages that describes a single CoreCLR runtime on the target machine. -struct DbgProxyRuntimeInfo -{ - Portable<PRUID> m_pruidProcess; // PRUID of the host process - Portable<PRUID> m_pruidRuntime; // PRUID assigned by the proxy to this runtime - Portable<unsigned short> m_usPort; // Port number the runtime listens for debuggers on (in network byte order) -}; - -// This structure describes the message header common to every proxy message. -struct DbgProxyMessageHeader -{ - Portable<DbgProxyMessageType> m_eType; // Describes the type of this message - Portable<unsigned> m_uiRequestID; // Unique ID that links request/reply message pair - Portable<unsigned> m_uiMagic; // Redundant field used to make random data attacks harder, - // contains ~(m_eType + m_uiRequestID) - Portable<unsigned> m_uiReserved; // Reserved for future expansion (must be initialized to zero and - // never read) - - // Some message types require little or no additional data. For such types the extra fields are defined - // inline in the header in the union below. More substantial data is sent as a seperate buffer. - union _VariantData - { - struct _GetSystemInfo - { - Portable<unsigned> m_uiMajorVersion; // Major protocol being employed by the debugger - Portable<unsigned> m_uiMinorVersion; // Minor version of the protocol above - } GetSystemInfo; - - struct _LaunchProcess - { - Portable<unsigned> m_cbAttributeBlock; // Count of bytes in following attribute block - } LaunchProcess; - - struct _EarlyAttach - { - Portable<PRUID> m_pruidProcess; // PRUID of process whose next runtime will be debugged - } EarlyAttach; - - struct _TerminateProcess - { - Portable<PRUID> m_pruidProcess; // PRUID of process to terminate - } TerminateProcess; - - struct _SystemInfo - { - Portable<unsigned> m_uiMajorVersion; // Major protocol being employed by the proxy - Portable<unsigned> m_uiMinorVersion; // Minor version of the protocol above - Portable<DbgTargetPlatform> m_ePlatform;// Platform code of target machine - } SystemInfo; - - struct _ProcessList - { - Portable<unsigned> m_uiProcessRecords; // Total number of process records following - Portable<unsigned> m_uiRuntimeRecords; // Total number of runtime records following - } ProcessList; - - struct _ProcessLaunched - { - Portable<DbgProxyLaunchResult> m_eResult;// Whether the launch succeeded and if not, why not - Portable<unsigned> m_uiPID; // PID of new process - Portable<PRUID> m_pruidProcess; // PRUID of new process - } ProcessLaunched; - - struct _ProcessTerminated - { - Portable<PRUID> m_pruidProcess; // PRUID of process which has exited - } ProcessTerminated; - - struct _EarlyAttachDone - { - Portable<bool> m_fProcessExited; // True if the early attach was on a process which terminated - } EarlyAttachDone; - - struct _RuntimeRegistered - { - Portable<unsigned> m_uiMajorVersion; // Major protocol being employed by the proxy - Portable<unsigned> m_uiMinorVersion; // Minor version of the protocol above - Portable<bool> m_fWaitForDebuggerAttach; // True if the debuggee should suspend startup and wait - // for debugger attach - } RuntimeRegistered; - } VariantData; -}; - -// Calculate the expected value of the m_uiMagic field given a message header. -#define DBGPROXY_MAGIC_VALUE(_header) (~(((unsigned int)(_header)->m_eType) + (_header)->m_uiRequestID)) - -// Some messages require more data than will comfortably fit in a message header. Define aggregate structures -// for these. - -struct DbgProxyLaunchProcessMessage -{ - DbgProxyMessageHeader m_sHeader; - DbgAttributeBlockHeader m_sLaunchAttributes; // Variable sized attribute block with launch - // arguments -}; - -struct DbgProxyRuntimeStartedMessage -{ - DbgProxyMessageHeader m_sHeader; - DbgProxyProcessInfo m_sProcessInfo; // In case the process is new as well - DbgProxyRuntimeInfo m_sRuntimeInfo; -}; - -struct DbgProxyRegisterRuntimeMessage -{ - DbgProxyMessageHeader m_sHeader; - Portable<unsigned> m_uiMajorVersion; // Major protocol being employed by the debuggee - Portable<unsigned> m_uiMinorVersion; // Minor version of the protocol above - Portable<unsigned> m_uiPID; // PID of process hosting this runtime - Portable<unsigned short> m_usPort; // Port that runtime waits for debugger on (host byte order) -}; - -#endif // !__DBG_PROXY_INCLUDED diff --git a/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs b/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs index 38b10dacb7..94b64a4e90 100644 --- a/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs +++ b/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs @@ -31,7 +31,7 @@ namespace System.Globalization for (int i = 0; i < source.Length; i++) { for (int j = 0; j < value.Length; j++) { - if (source[i + j] != value[i]) { + if (source[i + j] != value[j]) { break; } diff --git a/src/pal/src/include/pal/thread.hpp b/src/pal/src/include/pal/thread.hpp index 1d336c09d4..b2476a217f 100644 --- a/src/pal/src/include/pal/thread.hpp +++ b/src/pal/src/include/pal/thread.hpp @@ -33,6 +33,7 @@ Abstract: #include "threadsusp.hpp" #include "tls.hpp" #include "synchobjects.hpp" +#include <errno.h> namespace CorUnix { @@ -283,7 +284,6 @@ namespace CorUnix friend CPalThread *InternalGetCurrentThread(); #endif - DWORD m_dwLastError; DWORD m_dwExitCode; BOOL m_fExitCodeSet; CRITICAL_SECTION m_csLock; @@ -392,7 +392,6 @@ namespace CorUnix #ifdef _DEBUG m_dwGuard(0), #endif - m_dwLastError(0), m_dwExitCode(STILL_ACTIVE), m_fExitCodeSet(FALSE), m_fLockInitialized(FALSE), @@ -500,7 +499,7 @@ namespace CorUnix DWORD dwLastError ) { - m_dwLastError = dwLastError; + errno = dwLastError; }; DWORD @@ -508,7 +507,7 @@ namespace CorUnix void ) { - return m_dwLastError; + return errno; }; void diff --git a/src/utilcode/CMakeLists.txt b/src/utilcode/CMakeLists.txt index 3d2140bd79..4f5020e2ab 100644 --- a/src/utilcode/CMakeLists.txt +++ b/src/utilcode/CMakeLists.txt @@ -66,6 +66,7 @@ set(UTILCODE_SOURCES stresslog.cpp debug.cpp pedecoder.cpp + winfix.cpp ) # These source file do not yet compile on Linux. @@ -82,7 +83,6 @@ if(WIN32) securitywrapper.cpp securityutil.cpp stacktrace.cpp - winfix.cpp ) endif(WIN32) diff --git a/src/utilcode/staticnohost/CMakeLists.txt b/src/utilcode/staticnohost/CMakeLists.txt index ea662454f7..6b63b39f7b 100644 --- a/src/utilcode/staticnohost/CMakeLists.txt +++ b/src/utilcode/staticnohost/CMakeLists.txt @@ -1,11 +1,11 @@ add_definitions(-DSELF_NO_HOST) +list(APPEND UTILCODE_SOURCES ../hostimpl.cpp) + if(WIN32) add_definitions(-D_CRTIMP=) # use static version of crt - list(APPEND UTILCODE_SOURCES ../hostimpl.cpp) add_precompiled_header(stdafx.h ../stdafx.cpp UTILCODE_SOURCES) - add_library(utilcodestaticnohost STATIC ${UTILCODE_SOURCES}) -elseif(CLR_CMAKE_PLATFORM_UNIX) - add_library(utilcodestaticnohost STATIC ${UTILCODE_SOURCES}) endif(WIN32) + +add_library(utilcodestaticnohost STATIC ${UTILCODE_SOURCES}) diff --git a/src/utilcode/winfix.cpp b/src/utilcode/winfix.cpp index 00c6392ec7..801cb5093c 100644 --- a/src/utilcode/winfix.cpp +++ b/src/utilcode/winfix.cpp @@ -23,6 +23,7 @@ #include "ndpversion.h" #include "pedecoder.h" + // ====== READ BEFORE ADDING CONTRACTS ================================================== // The functions in this file propagate SetLastError codes to their callers. // Contracts are not guaranteed to preserve these codes (and no, we're not taking @@ -131,6 +132,61 @@ class WinWrapperContract ULONG g_dwMaxDBCSCharByteSize = 0; +// The only purpose of this function is to make a local copy of lpCommandLine. +// Because windows implementation of CreateProcessW can actually change lpCommandLine, +// but we'd like to keep it const. +BOOL +WszCreateProcess( + LPCWSTR lpApplicationName, + LPCWSTR lpCommandLine, + LPSECURITY_ATTRIBUTES lpProcessAttributes, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + BOOL bInheritHandles, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPCWSTR lpCurrentDirectory, + LPSTARTUPINFOW lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation + ) +{ + WINWRAPPER_NO_CONTRACT(SetLastError(ERROR_OUTOFMEMORY); return 0;); + + BOOL fResult; + DWORD err; + { + size_t commandLineLength = wcslen(lpCommandLine) + 1; + NewArrayHolder<WCHAR> nonConstCommandLine(new (nothrow) WCHAR[commandLineLength]); + if (nonConstCommandLine == NULL) + { + SetLastError(ERROR_OUTOFMEMORY); + return 0; + } + + memcpy(nonConstCommandLine, lpCommandLine, commandLineLength * sizeof(WCHAR)); + + fResult = CreateProcessW(lpApplicationName, + nonConstCommandLine, + lpProcessAttributes, + lpThreadAttributes, + bInheritHandles, + dwCreationFlags, + lpEnvironment, + (LPWSTR)lpCurrentDirectory, + lpStartupInfo, + lpProcessInformation); + + // At the end of the current scope, the last error code will be overwritten by the destructor of + // NewArrayHolder. So we save the error code here, and restore it after the end of the current scope. + err = GetLastError(); + } + + SetLastError(err); + return fResult; +} + +#ifndef FEATURE_PAL + + #include "psapi.h" #include "tlhelp32.h" #include "winnls.h" @@ -371,55 +427,6 @@ lExit: } -BOOL -WszCreateProcess( - LPCWSTR lpApplicationName, - LPCWSTR lpCommandLine, - LPSECURITY_ATTRIBUTES lpProcessAttributes, - LPSECURITY_ATTRIBUTES lpThreadAttributes, - BOOL bInheritHandles, - DWORD dwCreationFlags, - LPVOID lpEnvironment, - LPCWSTR lpCurrentDirectory, - LPSTARTUPINFOW lpStartupInfo, - LPPROCESS_INFORMATION lpProcessInformation - ) -{ - WINWRAPPER_NO_CONTRACT(SetLastError(ERROR_OUTOFMEMORY); return 0;); - - BOOL fResult; - DWORD err; - { - size_t commandLineLength = wcslen(lpCommandLine) + 1; - NewArrayHolder<WCHAR> nonConstCommandLine(new (nothrow) WCHAR[commandLineLength]); - if (nonConstCommandLine == NULL) - { - SetLastError(ERROR_OUTOFMEMORY); - return 0; - } - - memcpy(nonConstCommandLine, lpCommandLine, commandLineLength * sizeof(WCHAR)); - - fResult = CreateProcessW(lpApplicationName, - nonConstCommandLine, - lpProcessAttributes, - lpThreadAttributes, - bInheritHandles, - dwCreationFlags, - lpEnvironment, - (LPWSTR)lpCurrentDirectory, - lpStartupInfo, - lpProcessInformation); - - // At the end of the current scope, the last error code will be overwritten by the destructor of - // NewArrayHolder. So we save the error code here, and restore it after the end of the current scope. - err = GetLastError(); - } - - SetLastError(err); - return fResult; -} - DWORD WszGetWorkingSet() @@ -513,3 +520,4 @@ WszGetProcessHandleCount() return dwHandleCount; } +#endif //!FEATURE_PAL
\ No newline at end of file diff --git a/src/vm/amd64/virtualcallstubamd64.S b/src/vm/amd64/virtualcallstubamd64.S index 25e5ece184..043d12b409 100644 --- a/src/vm/amd64/virtualcallstubamd64.S +++ b/src/vm/amd64/virtualcallstubamd64.S @@ -47,7 +47,7 @@ NESTED_END ResolveWorkerAsmStub, _TEXT LEAF_ENTRY ResolveWorkerChainLookupAsmStub, _TEXT // This will perform a quick chained lookup of the entry if the initial cache lookup fails // On Input: -// rsi contains our type (MethodTable) +// rdx contains our type (MethodTable) // r10 contains our contract (DispatchToken) // r11 contains the address of the indirection (and the flags in the low two bits) // [rsp+0x00] contains the pointer to the ResolveCacheElem @@ -64,25 +64,25 @@ MainLoop_RWCLAS: test rax,rax // test if we hit a terminating NULL jz Fail_RWCLAS - cmp rsi, [rax+00h] // compare our MT with the one in the ResolveCacheElem + cmp rdx, [rax+00h] // compare our MT with the one in the ResolveCacheElem jne MainLoop_RWCLAS cmp r10, [rax+08h] // compare our DispatchToken with one in the ResolveCacheElem jne MainLoop_RWCLAS Success_RWCLAS: - PREPARE_EXTERNAL_VAR CHAIN_SUCCESS_COUNTER, rsi - sub qword ptr [rsi],1 // decrement success counter + PREPARE_EXTERNAL_VAR CHAIN_SUCCESS_COUNTER, rdx + sub qword ptr [rdx],1 // decrement success counter jl Promote_RWCLAS mov rax, [rax+10h] // get the ImplTarget - pop rsi + pop rdx jmp rax Promote_RWCLAS: // Move this entry to head postion of the chain // be quick to reset the counter so we don't get a bunch of contending threads - mov qword ptr [rsi], INITIAL_SUCCESS_COUNT + mov qword ptr [rdx], INITIAL_SUCCESS_COUNT or r11, PROMOTE_CHAIN_FLAG mov r10, rax // We pass the ResolveCacheElem to ResolveWorkerAsmStub instead of the DispatchToken Fail_RWCLAS: - pop rsi // Restore the original saved rdx value + pop rdx // Restore the original saved rdx value push r10 // pass the DispatchToken or ResolveCacheElem to promote to ResolveWorkerAsmStub jmp C_FUNC(ResolveWorkerAsmStub) |