IDebugComPlusSymbolProvider::GetFunctionLineOffset
Recupera l'indirizzo all'interno di una funzione che rappresenta l'offset di riga specificato.
Sintassi
int GetFunctionLineOffset(
IDebugAddress pAddress,
uint dwLine,
out IDebugAddress ppNewAddress
);
Parametri
pAddress
[in] Indirizzo che rappresenta la funzione.
dwLine
[in] Offset linea dall'inizio della funzione.
ppNewAddress
[out] Nuovo indirizzo che rappresenta l'offset di riga dall'inizio della funzione.
Valore restituito
Se ha esito positivo, restituisce S_OK
; in caso contrario, restituisce un codice di errore.
Esempio
Nell'esempio seguente viene illustrato come implementare questo metodo per un oggetto CDebugSymbolProvider che espone l'interfaccia IDebugComPlusSymbolProvider .
HRESULT CDebugSymbolProvider::GetFunctionLineOffset(
IDebugAddress *pAddress,
DWORD dwLine,
IDebugAddress **ppNewAddress
)
{
HRESULT hr = S_OK;
CDEBUG_ADDRESS address;
CComPtr<CModule> pModule;
DWORD dwOffset;
CDebugAddress* paddr = NULL;
METHOD_ENTRY(CDebugSymbolProvider::GetFunctionLineOffset);
IfFalseGo( pAddress, S_FALSE );
IfFailGo( pAddress->GetAddress( &address ) );
ASSERT(address.addr.dwKind == ADDRESS_KIND_METADATA_METHOD);
IfFalseGo( address.addr.dwKind == ADDRESS_KIND_METADATA_METHOD, S_FALSE );
IfFailGo( GetModule( address.GetModule(), &pModule) );
// Find the first offset for dwLine in the function
IfFailGo( pModule->GetFunctionLineOffset( address.addr.addr.addrMethod.tokMethod,
address.addr.addr.addrMethod.dwVersion,
dwLine,
&dwOffset ) );
// Create the new Address
address.addr.addr.addrMethod.dwOffset = dwOffset;
IfNullGo( paddr = new CDebugAddress(address), E_OUTOFMEMORY );
IfFailGo( paddr->QueryInterface( __uuidof(IDebugAddress),
(void**) ppNewAddress ) );
Error:
METHOD_EXIT(CDebugSymbolProvider::GetFunctionLineOffset, hr);
RELEASE( paddr );
return hr;
}