Compartir a través de


IDebugSymbolProvider

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

This interface represents a symbol provider that provides symbols and types, returning them as fields.

Syntax

IDebugSymbolProvider : IUnknown

Notes for Implementers

A symbol provider must implement this interface to supply symbol and type information to an expression evaluator.

Notes for Callers

This interface is obtained by using COM's CoCreateInstance function (for unmanaged symbol providers) or by loading the appropriate managed code assembly and instantiating the symbol provider based on the information found in that assembly. The debug engine instantiates the symbol provider to work in coordination with the expression evaluator. See the Example for one approach to instantiating this interface.

Methods in Vtable Order

The following table shows the methods of IDebugSymbolProvider.

Method Description
Initialize Deprecated. Do not use.
Uninitialize Deprecated. Do not use.
GetContainerField Gets the field that contains the debug address.
GetField Deprecated. Do not use.
GetAddressesFromPosition Maps a document position into an array of debug addresses.
GetAddressesFromContext Maps a document context into an array of debug addresses.
GetContextFromAddress Maps a debug address into a document context.
GetLanguage Gets the language used to compile the code at the debug address.
GetGlobalContainer Deprecated. Do not use.
GetMethodFieldsByName Gets the field representing a fully qualified method name.
GetClassTypeByName Gets the class field type representing a fully qualified class name.
GetNamespacesUsedAtAddress Creates an enumerator for namespaces associated with the debug address.
GetTypeByName Maps a symbol name to a symbol type.
GetNextAddress Gets the debug address that follows a given debug address in a method.

Remarks

This interface maps document positions into debug addresses and vice versa.

Requirements

Header: sh.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

Example

This example shows how to instantiate the symbol provider, given its GUID (a debug engine must know this value).

// A debug engine uses its own symbol provider and would know the GUID
// of that provider.
IDebugSymbolProvider *GetSymbolProvider(GUID *pSymbolProviderGuid)
{
    // This is typically defined globally. For this example, it is
    // defined here.
    static const WCHAR strRegistrationRoot[] = L"Software\\Microsoft\\VisualStudio\\8.0Exp";
    IDebugSymbolProvider *pProvider = NULL;
    if (pSymbolProviderGuid != NULL) {
        CLSID clsidProvider = { 0 };
        ::GetSPMetric(*pSymbolProviderGuid,
                      storetypeFile,
                      metricCLSID,
                      &clsidProvider,
                      strRegistrationRoot);
        if (IsEqualGUID(clsidProvider,GUID_NULL)) {
            // No file type provider, try metadata provider.
            ::GetSPMetric(*pSymbolProviderGuid,
                          ::storetypeMetadata,
                          metricCLSID,
                          &clsidProvider,
                          strRegistrationRoot);
        }
        if (!IsEqualGUID(clsidProvider,GUID_NULL)) {
            CComPtr<IDebugSymbolProvider> spSymbolProvider;
            spSymbolProvider.CoCreateInstance(clsidProvider);
            if (spSymbolProvider != NULL) {
                pProvider = spSymbolProvider.Detach();
            }
        }
    }
    return(pProvider);
}

See also