IDebugComPlusSymbolProvider::GetTypeFromAddressIDebugComPlusSymbolProvider::GetTypeFromAddress

Extrait vers un type de symbole donné son adresse de débogage.Retrieves to a symbol type given its debug address.

SyntaxeSyntax

HRESULT GetTypeFromAddress(  
   IDebugAddress* pAddress,  
   IDebugField**  ppField  
);  
int GetTypeFromAddress(  
   IDebugAddress   pAddress,  
   out IDebugField ppField  
);  

ParamètresParameters

pAddress
[in] L’adresse de débogage qui est représenté par un IDebugAddress interface.[in] The debug address that is represented by an IDebugAddress interface.

ppField
[out] Retourne le type de tableau, elle est représentée par une IDebugClassField interface.[out] Returns the array type as it is represented by an IDebugClassField interface.

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 IDebugComPlusSymbolProvider interface.The following example shows how to implement this method for a CDebugSymbolProvider object that exposes the IDebugComPlusSymbolProvider interface.

HRESULT CDebugSymbolProvider::GetTypeFromAddress(  
    IDebugAddress *pAddress,  
    IDebugField **ppField)  
{  
    HRESULT hr = E_FAIL;  
    CDEBUG_ADDRESS da;  
    CDebugGenericParamScope* pGenScope = NULL;  

    METHOD_ENTRY( CDebugDynamicFieldSymbol::GetTypeFromPrimitive );  

    ASSERT(IsValidObjectPtr(this, CDebugSymbolProvider));  
    ASSERT(IsValidWritePtr(ppField, IDebugField*));  

    IfFailGo( pAddress->GetAddress(&da) );  

    switch ( da.addr.dwKind )  
    {  
        case ADDRESS_KIND_METADATA_LOCAL:  
        case ADDRESS_KIND_METADATA_PARAM:  
        case ADDRESS_KIND_METADATA_FIELD:  
        case ADDRESS_KIND_METADATA_ARRAYELEM:  
        case ADDRESS_KIND_METADATA_METHOD:  
            {  
                IfFailGo( this->CreateClassType(da.GetModule(), da.tokClass, ppField) );  
                break;  
            }  

        case ADDRESS_KIND_METADATA_RETVAL:  
            {  
                if ( da.addr.addr.addrRetVal.dwCorType )  
                {  

                    IfNullGo( pGenScope = new CDebugGenericParamScope(da.GetModule(), da.tokClass, da.GetMethod()), E_OUTOFMEMORY );  
                    IfFailGo( this->CreateType((const COR_SIGNATURE*)(&da.addr.addr.addrRetVal.rgSig),  
                                               da.addr.addr.addrRetVal.dwSigSize,  
                                               da.GetModule(),  
                                               mdMethodDefNil,  
                                               pGenScope,  
                                               ppField) );  
                }  
                else  
                {  
                    IfFailGo( this->CreateClassType(da.GetModule(), da.tokClass, ppField) );  
                }  

                break;  
            }  

        default:  
            {  
                ASSERT(!"Address type not supported.");  
            }  
    }  

Error:  

    METHOD_EXIT( CDebugDynamicFieldSymbol::GetTypeFromPrimitive, hr );  

    RELEASE( pGenScope );  

    return hr;  
}  

Voir aussiSee Also

IDebugComPlusSymbolProviderIDebugComPlusSymbolProvider