Creating a Bound Breakpoint
A bound breakpoint implements the where and when of breaking into a program at a desired point. After the bound breakpoint is created with a call to IDebugPendingBreakpoint2::Bind and is encountered during execution, the session debug manager (SDM) finds the exact bound location of the breakpoint so that the IDE can be updated to show the breakpoint in context.
Process
The following describes how the bound breakpoint is used by the SDM:
The SDM calls IDebugBoundBreakpoint2::GetBreakpointResolution to obtain an IDebugBreakpointResolution2 interface (which TextInterpreter implements in the CBreakpointResolution class).
The SDM then calls IDebugBreakpointResolution2::GetResolutionInfo to obtain a BP_RESOLUTION_INFO structure.
From this structure, the SDM extracts either the BP_RESOLUTION_CODE or BP_RESOLUTION_DATA structure (stored as a union, the interpretation of which is determined by the BP_TYPE code returned by a call to IDebugBreakpointResolution2::GetBreakpointType).
If the breakpoint type is code (as will be the case in TextInterpreter), the SDM extracts the IDebugCodeContext2 interface from the BP_RESOLUTION_CODE structure.
Nota
The BP_RESOLUTION_DATA structure describes an expression that was bound to and its location. The BP_RESOLUTION_DATA structure is not used in TextInterpreter.
The SDM obtains an IDebugDocumentContext2 interface from the code context with a call to IDebugCodeContext2::GetDocumentContext.
The SDM then obtains the document name with a call to IDebugDocumentContext2::GetName and the breakpoint location within the document with a call to IDebugDocumentContext2::GetSourceRange.
In TextInterpreter, the document and code contexts are considered the same; that is, each line of text is considered a code context. As a result, the IDebugDocumentContext2 and IDebugCodeContext2 interfaces will be implemented on the same class, CDebugContext. In a more typical situation, these contexts would be implemented as separate objects.
Creating and implementing the CBoundBreakpoint class consists of the following steps: