Share via


IDiaSession::findLinesByAddr

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

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

Reference

IDiaEnumLineNumbers

IDiaSession

IDiaSession::findLinesByVA