ICorDebugVariableHome – rozhraní

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

Metody

Metoda Popis
GetArgumentIndex – metoda Získá index argumentu funkce.
GetCode – metoda Získá "ICorDebugCode" instance, která obsahuje tento ICorDebugVariableHome objekt.
GetLiveRange – metoda Získá nativní rozsah, přes který je tato proměnná aktivní.
GetLocationType – metoda Získá typ nativního umístění proměnné.
GetOffset – metoda Získá posun ze 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 slotu místní proměnné.

Příklad

Následující fragment kódu používá objekt ICorDebugCode4 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 Požadavky na systém.

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

Knihovny: CorGuids.lib

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

Viz také