IDiaEnumSymbolsByAddr

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. 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

Enumerates by address the various symbols contained in the data source.

Syntax

IDiaEnumSymbolsByAddr : IUnknown

Methods in Vtable Order

The following table shows the methods of IDiaEnumSymbolsByAddr.

Method Description
IDiaEnumSymbolsByAddr::symbolByAddr Positions the enumerator by performing a lookup by section and offset.
IDiaEnumSymbolsByAddr::symbolByRVA Positions the enumerator by performing a lookup by relative virtual address (RVA).
IDiaEnumSymbolsByAddr::symbolByVA Positions the enumerator by performing a lookup by virtual address (VA).
IDiaEnumSymbolsByAddr::Next Retrieves the next symbols in order by address. Updates the enumerator position by number of elements fetched.
IDiaEnumSymbolsByAddr::Prev Retrieves the previous symbols in order by address. Updates the enumerator position by number of elements fetched.
IDiaEnumSymbolsByAddr::Clone Makes a copy of an object.

Remarks

This interface provides symbols grouped by address. To work with symbols grouped by type, for example SymTagUDT (user-defined type) or SymTagBaseClass, use the IDiaEnumSymbols interface.

Notes for Callers

Obtain this interface by calling the IDiaSession::getSymbolsByAddr method.

Example

This function displays the name and address of all symbols ordered by relative virtual address.

void ShowSymbolsByAddress(IDiaSession *pSession)
{
    CComPtr<IDiaEnumSymbolsByAddr> pEnumByAddr;
    if ( FAILED( psession->getSymbolsByAddr( &pEnumByAddr ) ) )
    {
        Fatal( "getSymbolsByAddr" );
    }
    CComPtr<IDiaSymbol> pSym;
    if ( FAILED( pEnumByAddr->symbolByAddr( 1, 0, &pSym ) ) )
    {
        Fatal( "symbolByAddr" );
    }
    DWORD rvaLast = 0;
    if ( pSym->get_relativeVirtualAddress( &rvaLast ) == S_OK )
    {
        pSym = 0;
        if ( FAILED( pEnumByAddr->symbolByRVA( rvaLast, &pSym ) ) )
        {
            Fatal( "symbolByAddr" );
        }
        printf( "Symbols in order\n" );
        do
        {
            CDiaBSTR name;
            if ( pSym->get_name( &name ) != S_OK )
            {
                printf( "\t0x%08X (%ws) <no name>\n", rvaLast );
            }
            else
            {
                printf( "\t0x%08X %ws\n", rvaLast, name );
            }
            pSym = 0;
            celt = 0;
            if ( FAILED( hr = pEnumByAddr->Next( 1, &pSym, &celt ) ) )
            {
                break;
            }
        } while ( celt == 1 );
    }
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See also