Compartilhar via


IDiaSession

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

Provides a query context for debug symbols.

Syntax

IDiaSession : IUnknown  

Methods

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. Note: 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.
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.
IDiaSession::findInlineFramesByAddr Retrieves an enumeration that allows a client to iterate through all of the inline frames on a given address.
IDiaSession::findInlineFramesByRVA Retrieves an enumeration that allows a client to iterate through all of the inline frames on a specified relative virtual address (RVA).
IDiaSession::findInlineFramesByVA Retrieves an enumeration that allows a client to iterate through all of the inline frames on a specified virtual address (VA).
IDiaSession::findInlineeLines Retrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, by the specified parent symbol.
IDiaSession::findInlineeLinesByAddr Retrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, by the specified parent symbol and are contained within the specified address range.
IDiaSession::findInlineeLinesByRVA Retrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, by the specified parent symbol and are contained within the specified relative virtual address (RVA).
IDiaSession::findInlineeLinesByVA Retrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, by the specified parent symbol and are contained within the specified virtual address (VA).
IDiaSession::findInlineeLinesByLinenum Retrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, in the specified source file and line number.
IDiaSession::findInlineesByName Retrieves an enumeration that allows a client to iterate through the line number information of all inlined functions that match a specified name.
IDiaSession::findSymbolsForAcceleratorPointerTag Returns an enumeration of symbols for the variable that the specified tag value corresponds to in the parent Accelerator stub function.
IDiaSession::findSymbolsByRVAForAcceleratorPointerTag Given a corresponding tag value, this method returns an enumeration of symbols that are contained in a specified parent Accelerator stub function at a specified relative virtual address.
IDiaSession::findAcceleratorInlineesByName Returns an enumeration of symbols for inline frames corresponding to the specified inline function name.
IDiaSession::findAcceleratorInlineesByLinenum Returns an enumeration of symbols for inline frames that correspond to the specified source location.

Remarks

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.

Example

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" );  
    }  
}  

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See Also

Interfaces (Debug Interface Access SDK)
Overview
Exe
IDiaAddressMap
IDiaDataSource
IDiaDataSource::openSession
IDiaSymbol::findChildren
Querying the .Pdb File