Partager via


Creating CBreakpointResolution

A bound breakpoint represents a place in the program where execution will stop when the conditions of the breakpoint are satisfied. A caller that receives the IDebugBoundBreakpoint2 interface can then make inquiries about the state of the bound breakpoint. In addition, the caller can ask about what kind of breakpoint is represented by the interface and what context it is in. All of this information is collected in its own interface called IDebugBreakpointResolution2, implemented in TextInterpreter on the CBreakpointResolution class.

To create the CBreakpointResolution 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 BreakpointResolution.

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

  4. Clear the Attributed option.

  5. Change the Interface to IDebugBreakpointResolution2.

  6. Click Next or click the Options link on the left. Answer Yes if asked whether to merge with the existing context 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 context files.

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

    [
        object,
        uuid(FE310C43-5ADF-4440-8D06-681371B6C006),
        helpstring("IDebugBreakpointResolution2 Interface"),
        pointer_default(unique)
    ]
    interface IDebugBreakpointResolution2 : IUnknown{
    };
    
  10. In Context.h in the CBreakpointResolution class, add the following bold lines. These are the declarations for the methods on the IDebugBreakpointResolution2 interface.

    END_COM_MAP()
    
        //////////////////////////////////////////////////////////// 
        // IDebugBreakpointResolution2 
        STDMETHOD(GetBreakpointType)(BP_TYPE* pBPType);  
        STDMETHOD(GetResolutionInfo)(  
            BPRESI_FIELDS dwFields,  
            BP_RESOLUTION_INFO* pBPResolutionInfo);  
    
  11. Open the Context.cpp file, find the definition for the new CBreakpointResolution class, and add the following bold lines. These are the definitions for the methods on the IDebugBreakpointResolution2 interface (all of which return E_NOTIMPL for now).

    // CBreakpointResolution
    
    ////////////////////////////////////////////////////////////////////////////// 
    // IDebugBreakpointResolution2 
    HRESULT CBreakpointResolution::GetBreakpointType(BP_TYPE* pBPType) 
    { 
        //TODO: RETURN BREAKPOINT TYPE 
        return E_NOTIMPL;  
    } 
    
    HRESULT CBreakpointResolution::GetResolutionInfo(BPRESI_FIELDS dwFields, 
                                                     BP_RESOLUTION_INFO* pBPResolutionInfo) 
    { 
        //TODO: RETURN RESOLUTION INFO 
        return E_NOTIMPL; 
    } 
    
  12. Build the project to make sure there are no errors.

See Also

Concepts

Creating a Bound Breakpoint