Bagikan melalui


IDiaSymbol

Describes the properties of a symbol instance.

IDiaSymbol : IUnknown

Methods in Alphabetical Order

The following table shows the methods of IDiaSymbol.

Note

Symbols will return meaningful data for only some of these methods, depending on the type of symbol. If a method returns S_OK, then that method has returned meaningful data.

Method

Description

IDiaSymbol::findChildren

Retrieves all children of the symbol.

IDiaSymbol::get_access

Retrieves the access modifier of a class member.

IDiaSymbol::get_addressOffset

Retrieves the offset part of an address location.

IDiaSymbol::get_addressSection

Retrieves the section part of an address location.

IDiaSymbol::get_addressTaken

Retrieves a flag indicating whether another symbol references this address.

IDiaSymbol::get_age

Retrieves the age value of a program database.

IDiaSymbol::get_arrayIndexType

Retrieves the symbol identifier of the array index type.

IDiaSymbol::get_arrayIndexTypeId

Retrieves the array index type identifier of the symbol.

IDiaSymbol::get_backEndMajor

Retrieves the back-end major version number.

IDiaSymbol::get_backEndMinor

Retrieves the back-end minor version number.

IDiaSymbol::get_backEndBuild

Retrieves the back-end build number.

IDiaSymbol::get_baseType

Retrieves the type tag of a simple type.

IDiaSymbol::get_bitPosition

Retrieves the bit position of a location.

IDiaSymbol::get_callingConvention

Returns an indicator of a method's calling convention.

IDiaSymbol::get_classParent

Retrieves a reference to the class parent of the symbol.

IDiaSymbol::get_classParentId

Retrieves the class parent identifier of the symbol.

IDiaSymbol::get_code

Retrieves a flag indicating whether the symbol refers to a code address.

IDiaSymbol::get_compilerGenerated

Retrieves a flag indicating whether the symbol was compiler-generated.

IDiaSymbol::get_compilerName

(DIA SDK v8.0) Retrieves the name of the compiler used to create the Compiland.

IDiaSymbol::get_constructor

Retrieves a flag indicating whether the user-defined data type has a constructor.

IDiaSymbol::get_container

(DIA SDK v8.0) Retrieves the containing symbol of this symbol.

IDiaSymbol::get_constType

Retrieves a flag indicating whether the user-defined data type is constant.

IDiaSymbol::get_count

Retrieves the number of items in a list or array.

IDiaSymbol::get_customCallingConvention

(DIA SDK v8.0) Retrieves a flag indicating whether the function uses a custom calling convention.

IDiaSymbol::get_dataBytes

Retrieves the data bytes of an OEM symbol.

IDiaSymbol::get_dataKind

Retrieves the variable classification of a data symbol.

IDiaSymbol::get_editAndContinueEnabled

Retrieves the flag describing the Edit and Continue features of the compiled program or unit.

IDiaSymbol::get_farReturn

(DIA SDK v8.0) Retrieves a flag indicating whether the function uses a far return.

IDiaSymbol::get_frontEndMajor

Retrieves the front-end major version number.

IDiaSymbol::get_frontEndMinor

Retrieves the front-end minor version number.

IDiaSymbol::get_frontEndBuild

Retrieves the front-end build number.

IDiaSymbol::get_function

Retrieves a flag indicating whether the public symbol refers to a function.

IDiaSymbol::get_guid

Retrieves the symbol's GUID.

IDiaSymbol::get_hasAlloca

(DIA SDK v8.0) Retrieves a flag indicating whether the function contains a call to alloca.

IDiaSymbol::get_hasAssignmentOperator

Retrieves a flag indicating whether the user-defined data type has any assignment operators defined.

IDiaSymbol::get_hasCastOperator

Retrieves a flag indicating whether the user-defined data type has any cast operators defined.

IDiaSymbol::get_hasDebugInfo

(DIA SDK v8.0) Retrieves a flag indicating whether the compiland contains any debugging information.

IDiaSymbol::get_hasEH

(DIA SDK v8.0) Retrieves a flag indicating whether the function has a C++-style exception handler.

IDiaSymbol::get_hasEHa

(DIA SDK v8.0) Retrieves a flag indicating whether the function has an asynchronous exception handler.

IDiaSymbol::get_hasInlAsm

(DIA SDK v8.0) Retrieves a flag indicating whether the function has inline assembly.

IDiaSymbol::get_hasLongJump

(DIA SDK v8.0) Retrieves a flag indicating whether the function contains a longjmp command (part of C-style exception handling).

IDiaSymbol::get_hasManagedCode

(DIA SDK v8.0) Retrieves a flag indicating whether the module contains managed code.

IDiaSymbol::get_hasNestedTypes

Retrieves a flag indicating whether the user-defined data type has nested type definitions.

IDiaSymbol::get_hasSecurityChecks

(DIA SDK v8.0) Retrieves a flag indicating whether the function or compiland has security checks compiled in (via the /GS (Buffer Security Check) compiler switch).

IDiaSymbol::get_hasSEH

(DIA SDK v8.0) Retrieves a flag indicating whether the function has Win32-style Structured Exception Handling.

IDiaSymbol::get_hasSetJump

(DIA SDK v8.0) Retrieves a flag indicating whether the function contains a setjmp command.

IDiaSymbol::get_indirectVirtualBaseClass

Retrieves a flag indicating whether the user-defined data type is an indirect virtual base class.

IDiaSymbol::get_InlSpec

(DIA SDK v8.0) Retrieves a flag indicating whether the function has been marked with the inline attribute.

IDiaSymbol::get_interruptReturn

(DIA SDK v8.0) Retrieves a flag indicating whether the function has a return from interrupt instruction.

IDiaSymbol::get_intro

Retrieves a flag indicating whether the function is the base class virtual function.

IDiaSymbol::get_isAggregated

(DIA SDK v8.0) Retrieves a flag indicating whether the data is part of an aggregate of many symbols.

IDiaSymbol::get_isCTypes

(DIA SDK v8.0) Retrieves a flag indicating whether the symbol file contains C types.

IDiaSymbol::get_isCVTCIL

(DIA SDK v8.0) Retrieves a flag indicating whether the module was converted from Common Intermediate Language (CIL) to native code.

IDiaSymbol::get_isDataAligned

(DIA SDK v8.0) Retrieves a flag indicating whether the elements of a user-defined data type are aligned to a specific boundary.

IDiaSymbol::get_isHotpatchable

(DIA SDK v8.0) Retrieves a flag indicating whether the module was compiled with the /hotpatch (Create Hotpatchable Image) compiler switch.

IDiaSymbol::get_isLTCG

(DIA SDK v8.0) Retrieves a flag indicating whether the managed compiland was linked with the linker's LTCG.

IDiaSymbol::get_isMSILNetmodule

(DIA SDK v8.0) Retrieves a flag indicating whether the managed compiland is a .netmodule (containing only metadata).

IDiaSymbol::get_isNaked

(DIA SDK v8.0) Retrieves a flag indicating whether the function has the naked (C+) attribute.

IDiaSymbol::get_isSplitted

(DIA SDK v8.0) Retrieves a flag indicating whether the data has been split into an aggregate of separate symbols.

IDiaSymbol::get_isStatic

Retrieves a flag indicating whether a function or thunk layer is static.

IDiaSymbol::get_isStripped

(DIA SDK v8.0) Retrieves a flag indicating whether private symbols have been stripped from the symbol file.

IDiaSymbol::get_language

Retrieves the language of the source.

IDiaSymbol::get_length

Retrieves the number of bytes of memory used by the object represented by this symbol.

IDiaSymbol::get_lexicalParent

Retrieves a reference to the lexical parent of the symbol.

IDiaSymbol::get_lexicalParentId

Retrieves the lexical parent identifier of the symbol.

IDiaSymbol::get_libraryName

Retrieves the file name of the library or object file from which the object was loaded.

IDiaSymbol::get_liveLVarInstances

(DIA SDK v8.0) Retrieves a list of live local variables at a particular virtual address.

IDiaSymbol::get_locationType

Retrieves the location type of a data symbol.

IDiaSymbol::get_lowerBound

Retrieves the lower bound of a FORTRAN array dimension.

IDiaSymbol::get_lowerBoundId

Retrieves the symbol identifier of the lower bound of a FORTRAN array dimension.

IDiaSymbol::get_machineType

Retrieves the type of the target CPU.

IDiaSymbol::get_managed

Retrieves a flag that indicating whether the symbol refers to managed code.

IDiaSymbol::get_msil

Retrieves a flag indicating whether the symbol refers to Microsoft Intermediate Language (MSIL) code.

IDiaSymbol::get_name

Retrieves the name of the symbol.

IDiaSymbol::get_nested

Retrieves a flag indicating whether the user-defined data type is nested.

IDiaSymbol::get_noInline

(DIA SDK v8.0) Retrieves a flag indicating whether the function is marked with the noinline attribute.

IDiaSymbol::get_noReturn

(DIA SDK v8.0) Retrieves a flag indicating whether the function has been declared with the noreturn attribute.

IDiaSymbol::get_noStackOrdering

(DIA SDK v8.0) Retrieves a flag indicating whether no stack ordering could be done as part of stack buffer checking.

IDiaSymbol::get_notReached

(DIA SDK v8.0) Retrieves a flag indicating whether the function or label is never reached.

IDiaSymbol::get_objectPointerType

Retrieves the type of the object pointer for a class method.

IDiaSymbol::get_oemId

Retrieves the symbol's oemId value.

IDiaSymbol::get_oemSymbolId

Retrieves the symbol's oemSymbolId value.

IDiaSymbol::get_offset

Retrieves the offset of the symbol location.

IDiaSymbol::get_optimizedCodeDebugInfo

(DIA SDK v8.0) Retrieves a flag indicating whether the function or label contains optimized code as well as debug information.

IDiaSymbol::get_overloadedOperator

Retrieves a flag indicating whether the user-defined data type has overloaded operators.

IDiaSymbol::get_packed

Retrieves a flag indicating whether the user-defined data type is packed.

IDiaSymbol::get_platform

Retrieves the platform type for which the program or compiland was compiled.

IDiaSymbol::get_pure

Retrieves a flag that indicating whether the function is pure virtual.

IDiaSymbol::get_rank

Retrieves the rank of a FORTRAN multidimensional array.

IDiaSymbol::get_reference

Retrieves a flag indicating whether a pointer type is a reference.

IDiaSymbol::get_registerId

Retrieves the register designator of the location.

IDiaSymbol::get_relativeVirtualAddress

Retrieves the relative virtual address (RVA) of the location.

IDiaSymbol::get_scoped

Retrieves a flag indicating whether the user-defined data type appears in a nonglobal lexical scope.

IDiaSymbol::get_signature

Retrieves the symbol's signature value.

IDiaSymbol::get_slot

Retrieves the slot number of the location.

IDiaSymbol::get_sourceFileName

Retrieves the file name of the source file.

IDiaSymbol::get_symbolsFileName

Retrieves the name of the file from which the symbols were loaded.

IDiaSymbol::get_symIndexId

Retrieves the unique symbol identifier.

IDiaSymbol::get_symTag

Retrieves the symbol type classifier.

IDiaSymbol::get_targetOffset

Retrieves the offset section of a thunk target.

IDiaSymbol::get_targetRelativeVirtualAddress

Retrieves the relative virtual address (RVA) of a thunk target.

IDiaSymbol::get_targetSection

Retrieves the address section of a thunk target.

IDiaSymbol::get_targetVirtualAddress

Retrieves the virtual address (VA) of a thunk target.

IDiaSymbol::get_thisAdjust

Retrieves the logical this adjustor for the method.

IDiaSymbol::get_thunkOrdinal

Retrieves the thunk type of a function.

IDiaSymbol::get_timeStamp

Retrieves the timestamp of the underlying executable file.

IDiaSymbol::get_token

Retrieves the metadata token of a managed function or variable.

IDiaSymbol::get_type

Retrieves a reference to the function signature.

IDiaSymbol::get_typeId

Retrieves the type identifier of the symbol.

IDiaSymbol::get_types

Retrieves an array of compiler-specific type values for this symbol.

IDiaSymbol::get_typeIds

Retrieves an array of compiler-specific type identifier values for this symbol.

IDiaSymbol::get_udtKind

Retrieves the variety of a user-defined type (UDT).

IDiaSymbol::get_unalignedType

Retrieves a flag indicating whether the user-defined data type is unaligned.

IDiaSymbol::get_undecoratedName

Retrieves the undecorated name for a C++ decorated, or linkage, name.

IDiaSymbol::get_undecoratedNameEx

Extension of the get_undecoratedName method that retrieves the undecorated name based on the value of an extension field.

IDiaSymbol::get_upperBound

Retrieves the upper bound of a FORTRAN array dimension.

IDiaSymbol::get_upperBoundId

Retrieves the symbol identifier of the upper bound of a FORTRAN array dimension.

IDiaSymbol::get_value

Retrieves the value of a constant.

IDiaSymbol::get_virtual

Retrieves a flag indicating whether the function is virtual.

IDiaSymbol::get_virtualAddress

Retrieves the virtual address (VA) of the location.

IDiaSymbol::get_virtualBaseClass

Retrieves a flag indicating whether the user-defined data type is a virtual base class.

IDiaSymbol::get_virtualBaseDispIndex

Retrieves the index to the virtual base displacement table.

IDiaSymbol::get_virtualBaseOffset

Retrieves the offset in the virtual function table of a virtual function.

IDiaSymbol::get_virtualBasePointerOffset

Retrieves the offset of the virtual base pointer.

IDiaSymbol::get_virtualBaseTableType

Retrieves the type of a virtual base table pointer.

IDiaSymbol::get_virtualTableShape

Retrieves the symbol interface of the type of the virtual table for a user-defined type.

IDiaSymbol::get_virtualTableShapeId

Retrieves the virtual table shape identifier of the symbol.

IDiaSymbol::get_volatileType

Retrieves a flag indicating whether the user-defined data type is volatile.

Remarks

Notes for Callers

Obtain this interface by calling one of the following methods:

Example

This example shows how to display the local variables for a function at a given relative virtual address. It also shows how symbols of different types are related to each other.

Note

CDiaBSTR is a class that wraps a BSTR and automatically handles freeing the string when the instantiation goes out of scope.

void DumpLocalVars( DWORD rva, IDiaSession *pSession )
{
    CComPtr< IDiaSymbol > pBlock;
    if ( FAILED( psession->findSymbolByRVA( rva, SymTagBlock, &pBlock ) ) )
    {
        Fatal( "Failed to find symbols by RVA" );
    }
    CComPtr< IDiaSymbol > pscope;
    for ( ; pBlock != NULL; )
    {
        CComPtr< IDiaEnumSymbols > pEnum;
        // local data search
        if ( FAILED( pBlock->findChildren( SymTagNull, NULL, nsNone, &pEnum ) ) )
        {
            Fatal( "Local scope findChildren failed" );
        }
        CComPtr< IDiaSymbol > pSymbol;
        DWORD tag;
        DWORD celt;
        while ( pEnum != NULL &&
                SUCCEEDED( pEnum->Next( 1, &pSymbol, &celt ) ) &&
                celt == 1)
        {
            pSymbol->get_symTag( &tag );
            if ( tag == SymTagData )
            {
                CDiaBSTR name;
                DWORD    kind;
                pSymbol->get_name( &name );
                pSymbol->get_dataKind( &kind );
                if ( name != NULL )
                    wprintf_s( L"\t%s (%s)\n", name, szDataKinds[ kind ] );
            }
            else if ( tag == SymTagAnnotation )
            {
                CComPtr< IDiaEnumSymbols > pValues;
                // local data search
                wprintf_s( L"\tAnnotation:\n" );
                if ( FAILED( pSymbol->findChildren( SymTagNull, NULL, nsNone, &pValues ) ) )
                    Fatal( "Annotation findChildren failed" );
                pSymbol = NULL;
                while ( pValues != NULL &&
                        SUCCEEDED( pValues->Next( 1, &pSymbol, &celt ) ) &&
                        celt == 1 )
                {
                    CComVariant value;
                    if ( pSymbol->get_value( &value ) != S_OK )
                        Fatal( "No value for annotation data." );
                    wprintf_s( L"\t\t%ws\n", value.bstrVal );
                    pSymbol = NULL;
                }
            }
            pSymbol = NULL;
        }
        pBlock->get_symTag( &tag ); 
        if ( tag == SymTagFunction )    // stop when at function scope
            break;
        // move to lexical parent
        CComPtr< IDiaSymbol > pParent;
        if ( SUCCEEDED( pBlock->get_lexicalParent( &pParent ) )
            && pParent != NULL ) {
            pBlock = pParent;
        }
        else
        {
            Fatal( "Finding lexical parent failed." );
        }
    };
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See Also

Reference

IDiaEnumSymbolsByAddr

IDiaEnumSymbols

IDiaSession

Class Hierarchy of Symbol Types

Compiland

Other Resources

Interfaces (Debug Interface Access SDK)

Symbols and Symbol Tags