共用方式為


IDebugBreakpointErrorEvent2::GetErrorBreakpoint

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

Gets an IDebugErrorBreakpoint2 object that describes the reason why a breakpoint was not bound.

Syntax

HRESULT GetErrorBreakpoint( 
    IDebugErrorBreakpoint2** ppErrorBP
);
int GetErrorBreakpoint( 
    out IDebugErrorBreakpoint2 ppErrorBP
);

Parameters

ppErrorBP
[out] Returns an IDebugErrorBreakpoint2 object that describes the warning or error.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Remarks

After the IDebugErrorBreakpoint2 interface is obtained, call the GetBreakpointResolution method to get an IDebugErrorBreakpointResolution2 object. Then the GetResolutionInfo method can be used to determine an invalid location, an invalid expression, or reasons why the pending breakpoint was not bound, such as code not loaded yet, and so on.

Example

The following example shows how to implement this method for a CBreakpointSetDebugEventBase object that exposes the IDebugBreakpointErrorEvent2 interface.

STDMETHODIMP CBreakpointErrorDebugEventBase::GetErrorBreakpoint(
    IDebugErrorBreakpoint2 **ppbp)
{
    HRESULT hRes = E_FAIL;

    if ( ppbp )
    {
        if ( m_pError )
        {
            *ppbp = m_pError;

            m_pError->AddRef();

            hRes = S_OK;
        }
        else
            hRes = E_FAIL;
    }
    else
        hRes = E_INVALIDARG;

    return ( hRes );
}

See also