Implementing CBoundBreakpoint
In TextInterpreter, the IDebugBoundBreakpoint2 interface is implemented on the CBoundBreakpoint class. This class is very straightforward, as each method on the IDebugBoundBreakpoint2 interface returns values saved when the class was created and initialized in the implementation of IDebugPendingBreakpoint2::Bind (or, to be more specific, in TextInterpreter: CPendingBreakpoint::Bind).
The CPendingBreakpoint::Bind method creates an instance of CBoundBreakpoint and then calls CBoundBreakpoint::Initialize to establish the values to be returned by the methods on the IDebugBoundBreakpoint2 interface.
To implement CBoundBreakpoint
In Class View, right-click the CBoundBreakpoint class, select Add Variable, and add a variable with the Variable name m_spPendingBP, a Variable type of CComPtr<IDebugPendingBreakpoint2>, and an Access type of protected.
Add another variable to the CBoundBreakpoint class with the Variable name m_spBPRes, a Variable type of CComPtr<IDebugBreakpointResolution2>, and an Access type of protected.
In Class View, right-click the CBoundBreakpoint class and click Add Function to add a function with the Function name Initialize, a Return type of HRESULT, and the following parameters (in the order given, selecting the Add button between each one):
Parameter type
Parameter name
IDebugPendingBreakpoint2 *
pPending
IDebugBreakpointResolution2 *
pBPRes
Open the Breakpoint.cpp file, find CBoundBreakpoint::Initialize, and replace the line return E_NOTIMPL; with the following:
m_spPendingBP = pPending; m_spBPRes = pBPRes; return S_OK;
In CBoundBreakpoint::GetPendingBreakpoint, replace the line //TODO: RETURN PENDING BREAKPOINT as well as the following return statement with the following:
*ppPendingBreakpoint = m_spPendingBP; (*ppPendingBreakpoint)->AddRef(); return S_OK;
In CBoundBreakpoint::GetBreakpointResolution, replace the line //TODO: RETURN BREAKPOINT RESOLUTION as well as the following return statement with the following:
*ppBPResolution = m_spBPRes; (*ppBPResolution)->AddRef(); return S_OK;
Build the project to make sure there are no errors.