IDebugComPlusSymbolProvider2::LoadSymbolsWithCorModuleIDebugComPlusSymbolProvider2::LoadSymbolsWithCorModule

Cargas depuración símbolos a partir de la ICorDebugModule objeto.Loads debug symbols given the ICorDebugModule object.

SintaxisSyntax

HRESULT LoadSymbolsWithCorModule(  
   ULONG32   ulAppDomainID,  
   GUID      guidModule,  
   ULONGLONG baseAddress,  
   IUnknown* pUnkMetadataImport,  
   IUnknown* pUnkCorDebugModule,  
   BSTR      bstrModuleName,  
   BSTR      bstrSymSearchPath  
);  
int LoadSymbolsWithCorModule(  
   uint   ulAppDomainID,  
   Guid   guidModule,  
   ulong  baseAddress,  
   object pUnkMetadataImport,  
   object pUnkCorDebugModule,  
   string bstrModuleName,  
   string bstrSymSearchPath  
);  

ParámetrosParameters

ulAppDomainID
[in] Identificador del dominio de aplicación.[in] Identifier of the application domain.

guidModule
[in] Identificador único del módulo.[in] Unique identifier of the module.

baseAddress
[in] Dirección de memoria base.[in] Base memory address.

pUnkMetadataImport
[in] Objeto que contiene los metadatos de símbolos de depuración.[in] Object that contains the debug symbol metadata.

pUnkCorDebugModule
[in] Objeto que implementa el ICorDebugModule (interfaz).[in] Object that implements the ICorDebugModule Interface.

bstrModuleName
[in] Nombre del módulo.[in] Name of the module.

bstrSymSearchPath
[in] Ruta de acceso para buscar el archivo de símbolos.[in] Path to search for the symbol file.

Valor devueltoReturn Value

Si se realiza correctamente, devuelve S_OK; en caso contrario, devuelve un código de error.If successful, returns S_OK; otherwise, returns an error code.

EjemploExample

En el ejemplo siguiente se muestra cómo implementar este método para un CDebugSymbolProvider objeto que expone la IDebugComPlusSymbolProvider2 interfaz.The following example shows how to implement this method for a CDebugSymbolProvider object that exposes the IDebugComPlusSymbolProvider2 interface.

HRESULT CDebugSymbolProvider::LoadSymbolsWithCorModule(  
    ULONG32 ulAppDomainID,  
    GUID guidModule,  
    ULONGLONG baseOffset,  
    IUnknown* _pMetadata,  
    IUnknown* _pCorModule,  
    BSTR bstrModule,  
    BSTR bstrSearchPath)  
{  
    EMIT_TICK_COUNT("Entry -- Loading symbols for the following target:");  
    USES_CONVERSION;  
    EmitTickCount(W2A(bstrModule));  

    CAutoLock Lock(this);  

    HRESULT hr = S_OK;  
    CComPtr<IMetaDataImport> pMetadata;  
    CComPtr<ICorDebugModule> pCorModule;  

    CModule* pmodule = NULL;  
    CModule* pmoduleNew = NULL;  
    bool fAlreadyLoaded = false;  
    Module_ID idModule(ulAppDomainID, guidModule);  
    bool fSymbolsLoaded = false;  
    DWORD dwCurrentState = 0;  

    ASSERT(IsValidObjectPtr(this, CDebugSymbolProvider));  
    ASSERT(IsValidInterfacePtr(_pMetadata, IUnknown));  

    METHOD_ENTRY( CDebugSymbolProvider::LoadSymbol );  

    IfFalseGo( _pMetadata, E_INVALIDARG );  
    IfFalseGo( _pCorModule, E_INVALIDARG );  

    IfFailGo( _pMetadata->QueryInterface( IID_IMetaDataImport,  
                                          (void**)&pMetadata) );  

    IfFailGo( _pCorModule->QueryInterface( IID_ICorDebugModule,  
                                           (void**)&pCorModule) );  

    ASSERT(guidModule != GUID_NULL);  

    fAlreadyLoaded = GetModule( idModule, &pmodule ) == S_OK;  

    IfNullGo( pmoduleNew = new CModule, E_OUTOFMEMORY );  

    //  
    //  We are now allowing modules to be created that do not have SymReaders.  
    //  It is likely there are a number of corner cases being ignored  
    //  that will require knowledge of the hr result below.  
    //  
    dwCurrentState = m_pSymProvGroup ? m_pSymProvGroup->GetCurrentState() : 0;  

    HRESULT hrLoad = pmoduleNew->Create( idModule,  
                                         dwCurrentState,  
                                         pMetadata,  
                                         pCorModule,  
                                         bstrModule,  
                                         bstrSearchPath,  
                                         baseOffset );  

    if (hrLoad == S_OK)  
    {  
        fSymbolsLoaded = true;  
    }  

    // Remove the old module  
    if (fAlreadyLoaded)  
    {  
        IfFailGo(pmoduleNew->AddEquivalentModulesFrom(pmodule));  
        RemoveModule( pmodule );  
    }  

    IfFailGo( AddModule( pmoduleNew ) );  

Error:  

    RELEASE (pmodule);  
    RELEASE (pmoduleNew);  

    if (SUCCEEDED(hr) && !fSymbolsLoaded)  
    {  
        hr = hrLoad;  
    }  

    METHOD_EXIT( CDebugSymbolProvider::LoadSymbol, hr );  
    EMIT_TICK_COUNT("Exit");  
    return hr;  
}  

Vea tambiénSee Also

IDebugComPlusSymbolProvider2IDebugComPlusSymbolProvider2