IDiaSymbol

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at IDiaSymbol.

Describes the properties of a symbol instance.

IDiaSymbol : IUnknown  

The following table shows the methods of IDiaSymbol.

System_CAPS_ICON_note.jpg 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.

MethodDescription
IDiaSymbol::findChildrenRetrieves all children of the symbol.
IDiaSymbol::findChildrenExRetrieves the children of the symbol. This method is the extended version of IDiaSymbol::findChildren.
IDiaSymbol::findChildrenExByAddrRetrieves the children of the symbol that are valid at a specified address.
IDiaSymbol::findChildrenExByRVARetrieves the children of the symbol that are valid at a specified relative virtual address (RVA).
IDiaSymbol::findChildrenExByVARetrieves the children of the symbol that are valid at a specified virtual address.
IDiaSymbol::findInlineFramesByAddrRetrieves an enumeration that allows a client to iterate through all of the inline frames on a given address.
IDiaSymbol::findInlineFramesByRVARetrieves an enumeration that allows a client to iterate through all of the inline frames on a specified relative virtual address (RVA).
IDiaSymbol::findInlineFramesByVARetrieves an enumeration that allows a client to iterate through all of the inline frames on a specified virtual address (VA).
IDiaSymbol::findInlineeLinesRetrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, in this symbol.
IDiaSymbol::findInlineeLinesByAddrRetrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, in this symbol within the specified address range.
IDiaSymbol::findInlineeLinesByRVARetrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, in this symbol within the specified relative virtual address (RVA).
IDiaSymbol::findInlineeLinesByVARetrieves an enumeration that allows a client to iterate through the line number information of all functions that are inlined, directly or indirectly, in this symbol within the specified virtual address (VA).
IDiaSymbol::findSymbolsByRVAForAcceleratorPointerTagGiven a corresponding tag value, this method returns an enumeration of symbols that are contained in this stub function at a specified relative virtual address.
IDiaSymbol::findSymbolsForAcceleratorPointerTagReturns the number of accelerator pointer tags in a C++ AMP stub function.
IDiaSymbol::get_acceleratorPointerTagsReturns all accelerator pointer tag values that correspond to a C++ AMP accelerator stub function.
IDiaSymbol::get_accessRetrieves the access modifier of a class member.
IDiaSymbol::get_addressOffsetRetrieves the offset part of an address location.
IDiaSymbol::get_addressSectionRetrieves the section part of an address location.
IDiaSymbol::get_addressTakenRetrieves a flag indicating whether another symbol references this address.
IDiaSymbol::get_ageRetrieves the age value of a program database.
IDiaSymbol::get_arrayIndexTypeRetrieves the symbol identifier of the array index type.
IDiaSymbol::get_arrayIndexTypeIdRetrieves the array index type identifier of the symbol.
IDiaSymbol::get_backEndMajorRetrieves the back-end major version number.
IDiaSymbol::get_backEndMinorRetrieves the back-end minor version number.
IDiaSymbol::get_backEndBuildRetrieves the back-end build number.
IDiaSymbol::get_baseDataOffsetRetrieves the base data offset.
IDiaSymbol::get_baseDataSlotRetrieves the base data slot.
IDiaSymbol::get_baseSymbolRetrieves the symbol from which the pointer is based.
IDiaSymbol::get_baseSymbolIdRetrieves the symbol ID from which the pointer is based.
IDiaSymbol::get_baseTypeRetrieves the type tag of a simple type.
IDiaSymbol::get_bitPositionRetrieves the bit position of a location.
IDiaSymbol::get_builtInKindRetrieves a built-in kind of the HLSL type.
IDiaSymbol::get_callingConventionReturns an indicator of a method's calling convention.
IDiaSymbol::get_classParentRetrieves a reference to the class parent of the symbol.
IDiaSymbol::get_classParentIdRetrieves the class parent identifier of the symbol.
IDiaSymbol::get_codeRetrieves a flag indicating whether the symbol refers to a code address.
IDiaSymbol::get_compilerGeneratedRetrieves a flag indicating whether the symbol was compiler-generated.
IDiaSymbol::get_compilerNameRetrieves the name of the compiler used to create the Compiland.
IDiaSymbol::get_constructorRetrieves a flag indicating whether the user-defined data type has a constructor.
IDiaSymbol::get_containerRetrieves the containing symbol of this symbol.
IDiaSymbol::get_constTypeRetrieves a flag indicating whether the user-defined data type is constant.
IDiaSymbol::get_countRetrieves the number of items in a list or array.
IDiaSymbol::get_countLiveRangesRetrieves the number of valid address ranges associated with the local symbol.
IDiaSymbol::get_customCallingConventionRetrieves a flag indicating whether the function uses a custom calling convention.
IDiaSymbol::get_dataBytesRetrieves the data bytes of an OEM symbol.
IDiaSymbol::get_dataKindRetrieves the variable classification of a data symbol.
IDiaSymbol::get_editAndContinueEnabledRetrieves the flag describing the Edit and Continue features of the compiled program or unit.
IDiaSymbol::get_farReturnRetrieves a flag indicating whether the function uses a far return.
IDiaSymbol::get_frontEndMajorRetrieves the front-end major version number.
IDiaSymbol::get_frontEndMinorRetrieves the front-end minor version number.
IDiaSymbol::get_frontEndBuildRetrieves the front-end build number.
IDiaSymbol::get_functionRetrieves a flag indicating whether the public symbol refers to a function.
IDiaSymbol::get_guidRetrieves the symbol's GUID.
IDiaSymbol::get_hasAllocaRetrieves a flag indicating whether the function contains a call to alloca.
IDiaSymbol::get_hasAssignmentOperatorRetrieves a flag indicating whether the user-defined data type has any assignment operators defined.
IDiaSymbol::get_hasCastOperatorRetrieves a flag indicating whether the user-defined data type has any cast operators defined.
IDiaSymbol::get_hasDebugInfoRetrieves a flag indicating whether the compiland contains any debugging information.
IDiaSymbol::get_hasEHRetrieves a flag indicating whether the function has a C++-style exception handler.
IDiaSymbol::get_hasEHaRetrieves a flag indicating whether the function has an asynchronous exception handler.
IDiaSymbol::get_hasInlAsmRetrieves a flag indicating whether the function has inline assembly.
IDiaSymbol::get_hasLongJumpRetrieves a flag indicating whether the function contains a longjmp command (part of C-style exception handling).
IDiaSymbol::get_hasManagedCodeRetrieves a flag indicating whether the module contains managed code.
IDiaSymbol::get_hasNestedTypesRetrieves a flag indicating whether the user-defined data type has nested type definitions.
IDiaSymbol::get_hasSecurityChecksRetrieves a flag indicating whether the function or compiland has security checks compiled in (via the /GS (Buffer Security Check) compiler switch).
IDiaSymbol::get_hasSEHRetrieves a flag indicating whether the function has Win32-style Structured Exception Handling.
IDiaSymbol::get_hasSetJumpRetrieves a flag indicating whether the function contains a setjmp command.
IDiaSymbol::get_indirectVirtualBaseClassRetrieves a flag indicating whether the user-defined data type is an indirect virtual base class.
IDiaSymbol::get_InlSpecRetrieves a flag indicating whether the function has been marked with the inline attribute.
IDiaSymbol::get_interruptReturnRetrieves a flag indicating whether the function has a return from interrupt instruction.
IDiaSymbol::get_introRetrieves a flag indicating whether the function is the base class virtual function.
IDiaSymbol::get_isAcceleratorGroupSharedLocalRetrieves a flag that indicates whether the symbol corresponds to a group shared local variable in code compiled for a C++ AMP Accelerator.
IDiaSymbol::get_isAcceleratorPointerTagLiveRangeRetrieves a flag that indicates whether the symbol corresponds to the definition range symbol for the tag component of a pointer variable in code compiled for a C++ AMP Accelerator. The definition range symbol is the location of a variable for a span of addresses.
IDiaSymbol::get_isAcceleratorStubFunctionIndicates whether the symbol corresponds to a top-level function symbol for a shader compiled for an accelerator that corresponds to a parallel_for_each call.
IDiaSymbol::get_isAggregatedRetrieves a flag indicating whether the data is part of an aggregate of many symbols.
IDiaSymbol::get_isCTypesRetrieves a flag indicating whether the symbol file contains C types.
IDiaSymbol::get_isCVTCILRetrieves a flag indicating whether the module was converted from Common Intermediate Language (CIL) to native code.
IDiaSymbol::get_isDataAlignedRetrieves a flag indicating whether the elements of a user-defined data type are aligned to a specific boundary.
IDiaSymbol::get_isHLSLDataSpecifies whether this symbol represents High Level Shader Language (HLSL) data.
IDiaSymbol::get_isHotpatchableRetrieves a flag indicating whether the module was compiled with the /hotpatch (Create Hotpatchable Image) compiler switch.
IDiaSymbol::get_isLTCGRetrieves a flag indicating whether the managed compiland was linked with the linker's LTCG.
IDiaSymbol::get_isMatrixRowMajorSpecifies whether the matrix is row major.
IDiaSymbol::get_isMSILNetmoduleRetrieves a flag indicating whether the managed compiland is a .netmodule (containing only metadata).
IDiaSymbol::get_isMultipleInheritanceSpecifies whether the this pointer points to a data member with multiple inheritance.
IDiaSymbol::get_isNakedRetrieves a flag indicating whether the function has the naked attribute.
IDiaSymbol::get_isOptimizedAwaySpecifies whether the variable is optimized away.
IDiaSymbol::get_isPointerBasedOnSymbolValueSpecifies whether the this pointer is based on a symbol value.
IDiaSymbol::get_isPointerToDataMemberSpecifies whether this symbol is a pointer to a data member.
IDiaSymbol::get_isPointerToMemberFunctionSpecifies whether this symbol is a pointer to a member function.
IDiaSymbol::get_isReturnValueSpecifies whether the variable carries a return value.
IDiaSymbol::get_isSdlSpecifies whether the module is compiled with the /SDL option.
IDiaSymbol::get_isSingleInheritanceSpecifies whether the this pointer points to a data member with single inheritance.
IDiaSymbol::get_isSplittedRetrieves a flag indicating whether the data has been split into an aggregate of separate symbols.
IDiaSymbol::get_isStaticRetrieves a flag indicating whether a function or thunk layer is static.
IDiaSymbol::get_isStrippedRetrieves a flag indicating whether private symbols have been stripped from the symbol file.
IDiaSymbol::get_isVirtualInheritanceSpecifies whether the this pointer points to a data member with virtual inheritance.
IDiaSymbol::get_languageRetrieves the language of the source.
IDiaSymbol::get_lengthRetrieves the number of bytes of memory used by the object represented by this symbol.
IDiaSymbol::get_lexicalParentRetrieves a reference to the lexical parent of the symbol.
IDiaSymbol::get_lexicalParentIdRetrieves the lexical parent identifier of the symbol.
IDiaSymbol::get_libraryNameRetrieves the file name of the library or object file from which the object was loaded.
IDiaSymbol::get_liveRangeLengthReturns the length of the address range in which the local symbol is valid.
IDiaSymbol::get_liveRangeStartAddressSectionReturns the section part of the starting address range in which the local symbol is valid.
IDiaSymbol::get_liveRangeStartAddressOffsetReturns the offset part of the starting address range in which the local symbol is valid.
IDiaSymbol::get_liveRangeStartRelativeVirtualAddressReturns the start of the address range in which the local symbol is valid.
IDiaSymbol::get_locationTypeRetrieves the location type of a data symbol.
IDiaSymbol::get_lowerBoundRetrieves the lower bound of a FORTRAN array dimension.
IDiaSymbol::get_lowerBoundIdRetrieves the symbol identifier of the lower bound of a FORTRAN array dimension.
IDiaSymbol::get_machineTypeRetrieves the type of the target CPU.
IDiaSymbol::get_managedRetrieves a flag that indicating whether the symbol refers to managed code.
IDiaSymbol::get_memorySpaceKindRetrieves the memory space kind.
IDiaSymbol::get_msilRetrieves a flag indicating whether the symbol refers to Microsoft Intermediate Language (MSIL) code.
IDiaSymbol::get_nameRetrieves the name of the symbol.
IDiaSymbol::get_nestedRetrieves a flag indicating whether the user-defined data type is nested.
IDiaSymbol::get_noInlineRetrieves a flag indicating whether the function is marked with the noinline attribute.
IDiaSymbol::get_noReturnRetrieves a flag indicating whether the function has been declared with the noreturn attribute.
IDiaSymbol::get_noStackOrderingRetrieves a flag indicating whether no stack ordering could be done as part of stack buffer checking.
IDiaSymbol::get_notReachedRetrieves a flag indicating whether the function or label is never reached.
IDiaSymbol::get_numberOfAcceleratorPointerTagsReturns the number of accelerator pointer tags in a C++ AMP stub function.
IDiaSymbol::get_numberOfModifiersRetrieves the number of modifiers that are applied to the original type.
IDiaSymbol::get_numberOfRegisterIndicesRetrieves the number of register indices.
IDiaSymbol::get_numberOfRowsRetrieves the number of rows in the matrix.
IDiaSymbol::get_numberOfColumnsRetrieves the number of columns in the matrix.
IDiaSymbol::get_objectFileNameRetrieves the object file name.
IDiaSymbol::get_objectPointerTypeRetrieves the type of the object pointer for a class method.
IDiaSymbol::get_oemIdRetrieves the symbol's oemId value.
IDiaSymbol::get_oemSymbolIdRetrieves the symbol's oemSymbolId value.
IDiaSymbol::get_offsetRetrieves the offset of the symbol location.
IDiaSymbol::get_optimizedCodeDebugInfoRetrieves a flag indicating whether the function or label contains optimized code as well as debug information.
IDiaSymbol::get_overloadedOperatorRetrieves a flag indicating whether the user-defined data type has overloaded operators.
IDiaSymbol::get_packedRetrieves a flag indicating whether the user-defined data type is packed.
IDiaSymbol::get_platformRetrieves the platform type for which the program or compiland was compiled.
IDiaSymbol::get_pureRetrieves a flag that indicating whether the function is pure virtual.
IDiaSymbol::get_rankRetrieves the rank of a FORTRAN multidimensional array.
IDiaSymbol::get_referenceRetrieves a flag indicating whether a pointer type is a reference.
IDiaSymbol::get_registerIdRetrieves the register designator of the location.
IDiaSymbol::get_registerTypeRetrieves the register type.
IDiaSymbol::get_relativeVirtualAddressRetrieves the relative virtual address (RVA) of the location.
IDiaSymbol::get_restrictedTypeSpecifies whether the this pointer is flagged as restricted.
IDiaSymbol::get_samplerSlotRetrieves the sampler slot.
IDiaSymbol::get_scopedRetrieves a flag indicating whether the user-defined data type appears in a nonglobal lexical scope.
IDiaSymbol::get_signatureRetrieves the symbol's signature value.
IDiaSymbol::get_sizeInUdtRetrieves the size of a member of a user-defined type.
IDiaSymbol::get_slotRetrieves the slot number of the location.
IDiaSymbol::get_sourceFileNameRetrieves the file name of the source file.
IDiaSymbol::getSrcLineOnTypeDefnRetrieves the source file and line number that indicate where a specified user-defined type is defined.
IDiaSymbol::get_strideRetrieves the stride of the matrix or strided array.
IDiaSymbol::get_subTypeRetrieves the sub type.
IDiaSymbol::get_subTypeIdRetrieves the sub type ID.
IDiaSymbol::get_symbolsFileNameRetrieves the name of the file from which the symbols were loaded.
IDiaSymbol::get_symIndexIdRetrieves the unique symbol identifier.
IDiaSymbol::get_symTagRetrieves the symbol type classifier.
IDiaSymbol::get_targetOffsetRetrieves the offset section of a thunk target.
IDiaSymbol::get_targetRelativeVirtualAddressRetrieves the relative virtual address (RVA) of a thunk target.
IDiaSymbol::get_targetSectionRetrieves the address section of a thunk target.
IDiaSymbol::get_targetVirtualAddressRetrieves the virtual address (VA) of a thunk target.
IDiaSymbol::get_textureSlotRetrieves the texture slot.
IDiaSymbol::get_thisAdjustRetrieves the logical this adjustor for the method.
IDiaSymbol::get_thunkOrdinalRetrieves the thunk type of a function.
IDiaSymbol::get_timeStampRetrieves the timestamp of the underlying executable file.
IDiaSymbol::get_tokenRetrieves the metadata token of a managed function or variable.
IDiaSymbol::get_typeRetrieves a reference to the function signature.
IDiaSymbol::get_typeIdRetrieves the type identifier of the symbol.
IDiaSymbol::get_typesRetrieves an array of compiler-specific type values for this symbol.
IDiaSymbol::get_typeIdsRetrieves an array of compiler-specific type identifier values for this symbol.
IDiaSymbol::get_uavSlotRetrieves the uav slot.
IDiaSymbol::get_udtKindRetrieves the variety of a user-defined type (UDT).
IDiaSymbol::get_unalignedTypeRetrieves a flag indicating whether the user-defined data type is unaligned.
IDiaSymbol::get_undecoratedNameRetrieves the undecorated name for a C++ decorated, or linkage, name.
IDiaSymbol::get_undecoratedNameExExtension of the get_undecoratedName method that retrieves the undecorated name based on the value of an extension field.
IDiaSymbol::get_unmodifiedTypeIdRetrieves the ID of the original (unmodified) type.
IDiaSymbol::get_upperBoundRetrieves the upper bound of a FORTRAN array dimension.
IDiaSymbol::get_upperBoundIdRetrieves the symbol identifier of the upper bound of a FORTRAN array dimension.
IDiaSymbol::get_valueRetrieves the value of a constant.
IDiaSymbol::get_virtualRetrieves a flag indicating whether the function is virtual.
IDiaSymbol::get_virtualAddressRetrieves the virtual address (VA) of the location.
IDiaSymbol::get_virtualBaseClassRetrieves a flag indicating whether the user-defined data type is a virtual base class.
IDiaSymbol::get_virtualBaseDispIndexRetrieves the index to the virtual base displacement table.
IDiaSymbol::get_virtualBaseOffsetRetrieves the offset in the virtual function table of a virtual function.
IDiaSymbol::get_virtualBasePointerOffsetRetrieves the offset of the virtual base pointer.
IDiaSymbol::get_virtualBaseTableTypeRetrieves the type of a virtual base table pointer.
IDiaSymbol::get_virtualTableShapeRetrieves the symbol interface of the type of the virtual table for a user-defined type.
IDiaSymbol::get_virtualTableShapeIdRetrieves the virtual table shape identifier of the symbol.
IDiaSymbol::get_volatileTypeRetrieves a flag indicating whether the user-defined data type is volatile.

Obtain this interface by calling one of the following methods:

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.

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

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

Interfaces (Debug Interface Access SDK)
IDiaEnumSymbolsByAddr
IDiaEnumSymbols
IDiaSession
Class Hierarchy of Symbol Types
Symbols and Symbol Tags
Compiland

Show: