IDiaSectionContrib

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

Retrieves data describing a section contribution, that is, a contiguous block of memory contributed to the image by a compiland.

Syntax

IDiaSectionContrib : IUnknown

Methods in Vtable Order

The following table shows the methods of IDiaSectionContrib.

Method Description
IDiaSectionContrib::get_compiland Retrieves a reference to the compiland symbol that contributed this section.
IDiaSectionContrib::get_addressSection Retrieves the section part of the contribution's address.
IDiaSectionContrib::get_addressOffset Retrieves the offset part of the contribution's address.
IDiaSectionContrib::get_relativeVirtualAddress Retrieves the image relative virtual address (RVA) of the contribution.
IDiaSectionContrib::get_virtualAddress Retrieves the virtual address (VA) of the contribution.
IDiaSectionContrib::get_length Retrieves the number of bytes in a section.
IDiaSectionContrib::get_notPaged Retrieves a flag that indicates whether the section cannot be paged out of memory.
IDiaSectionContrib::get_nopad Retrieves a flag indicating whether the section should not be padded to the next memory boundary.
IDiaSectionContrib::get_code Retrieves a flag that indicates whether the section contains executable code.
IDiaSectionContrib::get_code16bit Retrieves a flag that indicates whether the section contains 16-bit code.
IDiaSectionContrib::get_initializedData Retrieves a flag that indicates whether the section contains initialized data.
IDiaSectionContrib::get_uninitializedData Retrieves a flag that indicates whether the section contains uninitialized data.
IDiaSectionContrib::get_informational Retrieves a flag indicating whether a section contains comments or similar information.
IDiaSectionContrib::get_remove Retrieves a flag that indicates whether the section is removed before it is made part of the in-memory image.
IDiaSectionContrib::get_comdat Retrieves a flag that indicates whether the section is a COMDAT record.
IDiaSectionContrib::get_discardable Retrieves a flag that indicates whether the section can be discarded.
IDiaSectionContrib::get_notCached Retrieves a flag that indicates whether the section cannot be cached.
IDiaSectionContrib::get_share Retrieves a flag that indicates whether the section can be shared in memory.
IDiaSectionContrib::get_execute Retrieves a flag that indicates whether the section is executable as code.
IDiaSectionContrib::get_read Retrieves a flag that indicates whether the section can be read.
IDiaSectionContrib::get_write Retrieves a flag that indicates whether the section can be written.
IDiaSectionContrib::get_dataCrc Retrieves the cyclic redundancy check (CRC) of the data in the section.
IDiaSectionContrib::get_relocationsCrc Retrieves the CRC of the relocation information for the section.
IDiaLineNumber::get_compilandId Retrieves the compiland identifier for the section.

Remarks

Notes for Callers

This interface is obtained by calling the IDiaEnumSectionContribs::Item and IDiaEnumSectionContribs::Next methods. See the IDiaEnumSectionContribs interface for an example of obtaining the IDiaSectionContrib interface.

Example

This function shows the address of each section along with any associated symbols. See the IDiaEnumSectionContribs interface to see how the IDiaSectionContrib interface is obtained.

void PrintSectionContrib(IDiaSectionContrib* pSecContrib, IDiaSession* pSession)
{
    if (pSecContrib != NULL && pSession != NULL)
    {
        DWORD rva;
        if ( pSecContrib->get_relativeVirtualAddress( &rva ) == S_OK )
        {
            printf( "\taddr: 0x%.8X", rva );
            pSecContrib = NULL;
            CComPtr<IDiaSymbol> pSym;
            if ( psession->findSymbolByRVA( rva, SymTagNull, &pSym ) == S_OK )
            {
                CDiaBSTR name;
                DWORD    tag;
                pSym->get_symTag( &tag );
                pSym->get_name( &name );
                printf( "     symbol: %ws (%ws)\n",
                        name != NULL ? name : L"",
                        szTags[ tag ] );
            }
            else
            {
                printf( "<no symbol found?>\n" );
            }
        }
        else
        {
            DWORD isect;
            DWORD offset;
            pSecContrib->get_addressSection( &isect );
            pSecContrib->get_addressOffset( &offset );
            printf( "\taddr: 0x%.4X:0x%.8X", isect, offset );
            pSecContrib = NULL;
            CComPtr<IDiaSymbol> pSym;
            if ( SUCCEEDED( psession->findSymbolByAddr(
                                              isect,
                                              offset,
                                              SymTagNull,
                                              &pSym )
                          )
               )
            {
                CDiaBSTR name;
                DWORD    tag;
                pSym->get_symTag( &tag );
                pSym->get_name( &name );
                printf( "     symbol: %ws (%ws)\n",
                    name != NULL ? name : L"",
                    szTags[ tag ] );
            }
            else
            {
                printf( "<no symbol found?>\n" );
            }
        }
    }
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See also