Sdílet prostřednictvím


ICorDebugVariableHome – rozhraní

Představuje místní proměnnou nebo argument funkce.

Methods

Metoda Description
GetArgumentIndex – metoda Získá index argumentu funkce.
GetCode – metoda Získá "ICorDebugCode" instance, která obsahuje tento ICorDebugVariableHome objekt.
GetLiveRange – metoda Získá nativní rozsah, ve kterém je tato proměnná aktivní.
GetLocationType – metoda Získá typ nativního umístění proměnné.
GetOffset – metoda Získá posun od základního registru pro proměnnou.
GetRegister – metoda Získá registr, který obsahuje proměnnou s typem VLT_REGISTERumístění , a základní registr pro proměnnou s typem VLT_REGISTER_RELATIVEumístění .
GetSlotIndex – metoda Získá spravovaný index slot-index místní proměnné.

Example

Následující fragment kódu používá ICorDebugCode4 objekt s názvem 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;
    }
}

Požadavky

Platformy: Viz podporované operační systémy .NET.

Záhlaví: CorDebug.idl, CorDebug.h

Knihovna: CorGuids.lib

Verze .NET: K dispozici od rozhraní .NET Framework 4.6.2

Viz také