IDebugComPlusSymbolProvider2::LoadSymbolsFromCallbackIDebugComPlusSymbolProvider2::LoadSymbolsFromCallback

Charge les symboles à l’aide de la méthode de rappel spécifiée de débogage.Loads debug symbols using the specified callback method.

SyntaxeSyntax

HRESULT LoadSymbolsFromCallback(  
   ULONG32   ulAppDomainID,  
   GUID      guidModule,  
   IUnknown* pUnkMetadataImport,  
   IUnknown* pUnkCorDebugModule,  
   BSTR      bstrModuleName,  
   BSTR      bstrSymSearchPath,  
   IUnknown* pCallback  
);  
int LoadSymbolsFromCallback(  
   uint   ulAppDomainID,  
   Guid   guidModule,  
   object pUnkMetadataImport,  
   object pUnkCorDebugModule,  
   string bstrModuleName,  
   string bstrSymSearchPath,  
   object pCallback  
);  

ParamètresParameters

ulAppDomainID
[in] Identificateur du domaine d’application.[in] Identifier of the application domain.

guidModule
[in] Identificateur unique du module.[in] Unique identifier of the module.

pUnkMetadataImport
[in] Objet qui contient les métadonnées du symbole.[in] Object that contains the symbol metadata.

pUnkCorDebugModule
[in] Objet qui implémente le ICorDebugModule (Interface).[in] Object that implements the ICorDebugModule Interface.

bstrModuleName
[in] Nom du module.[in] Name of the module.

bstrSymSearchPath
[in] Chemin d’accès pour rechercher le fichier de symboles.[in] Path to search for the symbol file.

pCallback
[in] Objet qui représente la méthode de rappel.[in] Object that represents the callback method.

Valeur de retourReturn Value

En cas de réussite, retourne S_OK; sinon, retourne un code d’erreur.If successful, returns S_OK; otherwise, returns an error code.

ExempleExample

L’exemple suivant montre comment implémenter cette méthode pour un CDebugSymbolProvider objet qui expose la IDebugComPlusSymbolProvider2 interface.The following example shows how to implement this method for a CDebugSymbolProvider object that exposes the IDebugComPlusSymbolProvider2 interface.

HRESULT CDebugSymbolProvider::LoadSymbolsFromCallback(  
    ULONG32 ulAppDomainID,  
    GUID guidModule,  
    IUnknown *pMetadataImport,  
    IUnknown * _pCorModule,  
    BSTR bstrModule,  
    BSTR bstrSearchPath,  
    IUnknown *pCallback)  
{  
    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(pMetadataImport, IUnknown));  

    METHOD_ENTRY( CDebugSymbolProvider::LoadSymbol );  

    IfFalseGo( pMetadataImport, E_INVALIDARG );  
    IfFalseGo( _pCorModule, E_INVALIDARG );  

    IfFailGo( pMetadataImport->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,  
                                         pCallback );  

    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;  
}  

Voir aussiSee Also

IDebugComPlusSymbolProvider2IDebugComPlusSymbolProvider2