IDiaSession::findLinesByAddr

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Retrieves the lines in a specified compiland that contain a specified address.

Syntax

HRESULT findLinesByAddr (   
   DWORD                 seg,  
   DWORD                 offset,  
   DWORD                 length,  
   IDiaEnumLineNumbers** ppResult  
);  

Parameters

seg
[in] Specifies the section component of the specific address.

offset
[in] Specifies the offset component of the specific address.

length
[in] Specifies the number of bytes of address range to cover with this query.

ppResult
[out] Returns an IDiaEnumLineNumbers object that contains a list of all the line numbers that cover the specified address range.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Example

This example shows a function that obtains all line numbers contained in a function using the function's address and length.

IDiaEnumLineNumbers* GetLineNumbersByAddr(IDiaSymbol *pFunc,  
                                          IDiaSession *pSession)  
{  
    IDiaEnumLineNumbers* pEnum = NULL;  
    DWORD                seg;  
    DWORD                offset;  
    ULONGLONG            length;  
  
    if (pFunc->get_addressSection ( &seg ) == S_OK &&  
        pFunc->get_addressOffset ( &offset ) == S_OK)  
    {  
        pFunc->get_length ( &length );  
        pSession->findLinesByAddr( seg, offset, static_cast<DWORD>( length ), &pEnum );  
    }  
    return(pEnum);  
}  

See Also

IDiaEnumLineNumbers
IDiaSession
IDiaSession::findLinesByVA