Creating CBoundBreakpoint

Like a pending breakpoint, a bound breakpoint is always implemented as a separate object.

In TextInterpreter, the CBoundBreakpoint class implements the IDebugBoundBreakpoint2 interface.

To create the CBoundBreakpoint class

  1. In Solution Explorer, right-click the TextInterpreter project; click Add Class, click an ATL Simple object, and click Add.

  2. For the Short name, type BoundBreakpoint.

  3. Modify the .h file to be Breakpoint.h and the .cpp file to be Breakpoint.cpp.

  4. Clear the Attributed option.

  5. Change the Interface to IDebugBoundBreakpoint2.

  6. Click Next or click the Options link on the left. Answer Yes if asked whether to merge with the existing breakpoint files.

  7. Change the Interface from Dual to Custom.

  8. Click Finish to add the ATL object to the project. Answer Yes if asked whether to merge with the existing breakpoint files.

  9. Open the TextInterpreter.idl file and remove the declaration for the interface IDebugBoundBreakpoint2 , which looks similar to the following (the uuid may be different):

    [
        object,
        uuid(2F8DE2F5-2ACD-4ECF-8162-D6A7B0815EE5),
        helpstring("IDebugBoundBreakpoint2 Interface"),
        pointer_default(unique)
    ]
    interface IDebugBoundBreakpoint2 : IUnknown{
    };
    
  10. Open the Breakpoint.h file, find the declaration for the new CBoundBreakpoint class, and add the following bold lines. These are the declarations for the methods on the IDebugBoundBreakpoint2 interface.

    END_COM_MAP()
    
        //////////////////////////////////////////////////////////// 
        // IDebugBoundBreakpoint2 
        STDMETHOD(GetPendingBreakpoint)(IDebugPendingBreakpoint2** ppPendingBreakpoint);  
        STDMETHOD(GetState)(BP_STATE* pState);  
        STDMETHOD(GetHitCount)(DWORD* pdwHitCount);  
        STDMETHOD(GetBreakpointResolution)(IDebugBreakpointResolution2** ppBPResolution);  
        STDMETHOD(Enable)(BOOL fEnable);  
        STDMETHOD(SetHitCount)(DWORD dwHitCount);  
        STDMETHOD(SetCondition)(BP_CONDITION bpCondition);  
        STDMETHOD(SetPassCount)(BP_PASSCOUNT bpPassCount);  
        STDMETHOD(Delete)(void);  
    
  11. Open the Breakpoint.cpp file and add the following bold lines. These are the definitions for the methods on the IDebugBoundBreakpoint2 interface (all of which return E_NOTIMPL for now).

    // CBoundBreakpoint
    
    ////////////////////////////////////////////////////////////////////////////// 
    // IDebugBoundBreakpoint2 
    HRESULT CBoundBreakpoint::GetState(BP_STATE* pState)  
    { return E_NOTIMPL; } 
    HRESULT CBoundBreakpoint::GetHitCount(DWORD* pdwHitCount)  
    { return E_NOTIMPL; } 
    HRESULT CBoundBreakpoint::Enable(BOOL fEnable)  
    { return E_NOTIMPL; } 
    HRESULT CBoundBreakpoint::SetHitCount(DWORD dwHitCount)  
    { return E_NOTIMPL; } 
    HRESULT CBoundBreakpoint::SetCondition(BP_CONDITION bpCondition)  
    { return E_NOTIMPL; } 
    HRESULT CBoundBreakpoint::SetPassCount(BP_PASSCOUNT bpPassCount)  
    { return E_NOTIMPL; } 
    HRESULT CBoundBreakpoint::Delete(void)  
    { return E_NOTIMPL; } 
    
    HRESULT CBoundBreakpoint::GetPendingBreakpoint( 
        IDebugPendingBreakpoint2** ppPendingBreakpoint)  
    { 
        //TODO: RETURN PENDING BREAKPOINT 
        return E_NOTIMPL;  
    } 
    
    HRESULT CBoundBreakpoint::GetBreakpointResolution( 
        IDebugBreakpointResolution2** ppBPResolution)  
    { 
        //TODO: RETURN BREAKPOINT RESOLUTION 
        return E_NOTIMPL;  
    } 
    
  12. Build the project to make sure there are no errors.

See Also

Concepts

Creating a Bound Breakpoint