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
In Solution Explorer, right-click the TextInterpreter project; click Add Class, click an ATL Simple Object, and click Add.
For the Short name, type BreakpointResolution.
Modify the .h file to be Context.h and the .cpp file to be Context.cpp.
Clear the Attributed option.
Change the Interface to IDebugBreakpointResolution2.
Click Next or click the Options link on the left. Answer Yes if asked whether to merge with the existing context files.
Change the Interface from Dual to Custom.
Click Finish to add the ATL object to the project. Answer Yes if asked whether to merge with the existing context files.
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{ };
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);
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; }
Build the project to make sure there are no errors.