IDiaSession
This documentation is archived and is not being maintained.

IDiaSession 

Provides a query context for debug symbols.


IDiaSession : IUnknown

The following table shows the methods of IDiaSession.

Method Description

IDiaSession::get_loadAddress

Retrieves the load address for the executable file that corresponds to the symbols in this symbol store. This is the same value that was passed to the put_loadAddress method.

IDiaSession::put_loadAddress

Sets the load address for the executable file that corresponds to the symbols in this symbol store.

NoteNote

It is important to call this method when you get an IDiaSession object and before you start using the object.

IDiaSession::get_globalScope

Retrieves a reference to the global scope.

IDiaSession::getEnumTables

Retrieves an enumerator for all tables contained in the symbol store.

IDiaSession::getSymbolsByAddr

Retrieves an enumerator for all named symbols at static locations.

IDiaSession::findChildren

Retrieves all children of a specified parent identifier that match the name and symbol type.

IDiaSession::findSymbolByAddr

Retrieves a specified symbol type that contains, or is closest to, a specified address.

IDiaSession::findSymbolByRVA

Retrieves a specified symbol type that contains, or is closest to, a specified relative virtual address (RVA).

IDiaSession::findSymbolByVA

Retrieves a specified symbol type that contains, or is closest to, a specified virtual address (VA).

IDiaSession::findSymbolByToken

Retrieves the symbol that contains a specified metadata token.

IDiaSession::symsAreEquiv

Checks to see if two symbols are equivalent.

IDiaSession::symbolById

Retrieves a symbol by its unique identifier.

IDiaSession::findSymbolByRVAEx

Retrieves a specified symbol type that contains, or is closest to, a specified relative virtual address and offset.

IDiaSession::findSymbolByVAEx

Retrieves a specified symbol type that contains, or is closest to, a specified virtual address and offset.

IDiaSession::findFile

Retrieves a source file by compiland and name. See Glossary of DIA SDK Terms for the definition of a compiland.

IDiaSession::findFileById

Retrieves a source file by source file identifier.

IDiaSession::findLines

Retrieves line numbers within a specified compiland and source file identifier.

IDiaSession::findLinesByAddr

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

IDiaSession::findLinesByRVA

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

IDiaSession::findLinesByVA

Finds the line number information for lines contained in a specified address range.

IDiaSession::findLinesByLinenum

Retrieves the lines in a specified compiland by source file and line number.

IDiaSession::findInjectedSource

Retrieves a source that has been placed into the symbol store by attribute providers or other components of the compilation process.

IDiaSession::getEnumDebugStreams

Retrieves an enumerated sequence of debug data streams.

It is important to call the IDiaSession::put_loadAddress method after creating the IDiaSession object — and the value passed to the put_loadAddress method must be non-zero — for any virtual address (VA) properties of symbols to be accessible. The load address comes from whatever program loaded the executable being debugged. For example, you can call the Win32 function GetModuleInformation to retrieve the load address for the executable, given a handle to the executable.

This example shows how to obtain the IDiaSession interface as part of a general initialization of the DIA SDK.

CComPtr<IDiaDataSource> pSource;
ComPtr<IDiaSession> psession;


void InitializeDIA(const char *szFilename)
{
    HRESULT hr = CoCreateInstance( CLSID_DiaSource,
                                   NULL,
                                   CLSCTX_INPROC_SERVER,
                                   __uuidof( IDiaDataSource ),
                                  (void **) &pSource);
    if (FAILED(hr))
    {
        Fatal("Could not CoCreate CLSID_DiaSource. Register msdia80.dll." );
    }
    wchar_t wszFilename[ _MAX_PATH ];
    mbstowcs( wszFilename,
              szFilename,
              sizeof( wszFilename )/sizeof( wszFilename[0] ) );
    if ( FAILED( pSource->loadDataFromPdb( wszFilename ) ) )
    {
        if ( FAILED( pSource->loadDataForExe( wszFilename, NULL, NULL ) ) )
        {
            Fatal( "loadDataFromPdb/Exe" );
        }
    }
    if ( FAILED( pSource->openSession( &psession ) ) )
    {
        Fatal( "openSession" );
    }
}

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

Show:
© 2016 Microsoft