Condividi tramite


Interfaccia ICorDebugVariableHome

Rappresenta una variabile o un argomento locale di una funzione.

Methods

Metodo Description
Metodo GetArgumentIndex Ottiene l'indice di un argomento della funzione.
Metodo GetCode Ottiene l'istanza "ICorDebugCode" che contiene questo ICorDebugVariableHome oggetto.
GetLiveRange, metodo Ottiene l'intervallo nativo su cui è attiva questa variabile.
Metodo GetLocationType Ottiene il tipo della posizione nativa della variabile.
Metodo GetOffset Ottiene l'offset dal registro di base per una variabile.
Metodo GetRegister Ottiene il registro contenente una variabile con un tipo di posizione e VLT_REGISTERil registro di base per una variabile con un tipo di posizione .VLT_REGISTER_RELATIVE
GetSlotIndex, metodo Ottiene l'indice dello slot gestito di una variabile locale.

Example

Il frammento di codice seguente usa l'oggetto ICorDebugCode4 denominato pCode4.

ICorDebugCode4 *pCode4 = NULL;
pCode->QueryInterface(IID_ICorDebugCode4, &pCode4);

ICorDebugVariableEnum *pVarLocEnum = NULL;
pCode4->EnumerateVariableHomes(&pVarLocEnum);

// retrieve local variables and arguments
ULONG celt = 0;
pVarLocEnum->GetCount(&celt);
ICorDebugVariableHome **homes = new ICorDebugVariableHome *[celt];
ULONG celtFetched = 0;
pVarLocEnum->Next(celt, homes, &celtFetched);

for (int i = 0; i < celtFetched; i++)
{
    VariableLocationType locType = VLT_INVALID;
    homes[i].GetLocationType(&locType);
    switch (locType)
    {
    case VLT_REGISTER:
        CorDebugRegister register = 0;
        locals[i].GetRegister(&register);
        // now we know which register it is in
        break;
    case VLT_REGISTER_RELATIVE:
        CorDebugRegister baseRegister = 0;
        LONG offset = 0;
        locals[i].GetRegister(&register);
        locals[i].GetOffset(&offset);
        // now we know the register-relative offset
        break;
    case VLT_INVALID:
        // handle case where we can't access the location
        break;
    }
}

Requisiti

Piattaforme: Vedere Sistemi operativi supportati da .NET.

Intestazione: CorDebug.idl, CorDebug.h

Biblioteca: CorGuids.lib

Versioni di .NET: Disponibile a partire da .NET Framework 4.6.2

Vedere anche