Compartilhar via


IDiaEnumSymbolsByAddr

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

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

Reference

IDiaSession::getSymbolsByAddr

IDiaEnumSymbols

Other Resources

Interfaces (Debug Interface Access SDK)