IDiaSession

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::findChildrenEx Retrieves all children of a specified parent identifier that match the name and symbol type, including optimized locals.
IDiaSession::findChildrenExByAddr Retrieves all children of a specified parent identifier that match the name and symbol type, including optimized locals, that contains, or is closest to, a specified address.
IDiaSession::findChildrenExByVA Retrieves all children of a specified parent identifier that match the name and symbol type, including optimized locals, that contains, or is closest to, a specified virtual address (VA).
IDiaSession::findChildrenExByRVA Retrieves all children of a specified parent identifier that match the name and symbol type, including optimized locals, that contains, or is closest to, a specified relative virtual address (RVA).
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::findAcceleratorInlineesByLinenum Returns an enumeration of symbols for inline frames that correspond to the specified source location.
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::addressForVA Returns the equivalent address for the specified virtual address (VA).
IDiaSession::addressForRVA Returns the equivalent address for the specified relative virtual address (RVA).
IDiaSession::findILOffsetsByAddr Retrieves an enumeration that allows a client to iterate through the MSIL offsets within a specified address range.
IDiaSession::findILOffsetsByRVA Retrieves an enumeration that allows a client to iterate through the MSIL offsets within a specified relative virtual address (RVA) range.
IDiaSession::findILOffsetsByVA Retrieves an enumeration that allows a client to iterate through the MSIL offsets within a specified virtual address (VA) range.
IDiaSession::findInputAssemblyFiles Retrieves an enumeration that allows a client to iterate through the .NET Native input assembly files.
IDiaSession::findInputAssembly Retrieves a .NET Native input assembly file by index.
IDiaSession::findInputAssemblyById Retrieves .NET Native input assembly file by unique identifier.
IDiaSession::getFuncMDTokenMapSize Retrieves the size, in bytes, of the .NET Native metadata function token map.
IDiaSession::getFuncMDTokenMap Retrieves the contents of the .NET Native metadata function token map.
IDiaSession::getTypeMDTokenMapSize Retrieves the size, in bytes, of the .NET Native metadata type token map.
IDiaSession::getTypeMDTokenMap Retrieves the contents of the .NET Native metadata type token map.
IDiaSession::getNumberOfFunctionFragments_VA Retrieves the number of discontiguous fragments for the function at the specified virtual address (VA).
IDiaSession::getNumberOfFunctionFragments_RVA Retrieves the number of discontiguous fragments for the function at the specified relative virtual address (RVA).
IDiaSession::getFunctionFragments_VA Retrieves the addresses and lengths of discontiguous fragments for the function at the specified virtual address (VA).
IDiaSession::getFunctionFragments_RVA Retrieves the addresses and lengths of discontiguous fragments for the function at the specified relative virtual address (RVA).
IDiaSession::getExports Retrieves an enumerator for all exported symbols.
IDiaSession::getHeapAllocationSites Retrieves an enumerator for all SymTagHeapAllocationSite symbols.
IDiaSession::findInputAssemblyFile Retrieves the .NET Native input assembly file that is the parent of the specified symbol.

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 Debug Interface Access (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