共用方式為


Breakpoint-related methods

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

A debug engine (DE) must support the setting of breakpoints. Visual Studio debugging supports the following types of breakpoints:

  • Bound

    Requested through the UI and successfully bound to a specified code location

  • Pending

    Requested through the UI but not yet bound to actual instructions

Discussion

For example, a pending breakpoint occurs when the instructions are not yet loaded. When the code is loaded, pending breakpoints try to bind to code at the prescribed location, that is, to insert break instructions in the code. Events are sent to the session debug manager (SDM) to indicate successful binding or to notify that there were binding errors.

A pending breakpoint also manages its own internal list of corresponding bound breakpoints. One pending breakpoint can cause the insertion of many breakpoints in the code. The Visual Studio debugging UI shows a tree view of pending breakpoints and their corresponding bound breakpoints.

Creation and use of pending breakpoints require implementation of the IDebugEngine2::CreatePendingBreakpoint method as well as the following methods of IDebugPendingBreakpoint2 interfaces.

Method Description
CanBind Determines whether a specified pending breakpoint can bind to a code location.
Bind Binds a specified pending breakpoint to one or more code locations.
GetState Gets the state of a pending breakpoint.
GetBreakpointRequest Gets the breakpoint request used to create a pending breakpoint.
Enable Toggles the enabled state of a pending breakpoint.
EnumBoundBreakpoints Enumerates all breakpoints bound from a pending breakpoint.
EnumErrorBreakpoints Enumerates all error breakpoints that result from a pending breakpoint.
Delete Deletes a pending breakpoint and all breakpoints bound from it.

To enumerate the bound breakpoints and error breakpoints, you must implement all the methods of IEnumDebugBoundBreakpoints2 and of IEnumDebugErrorBreakpoints2.

Pending breakpoints that bind to a code location require implementation of the following IDebugBoundBreakpoint2 methods.

Method Description
GetPendingBreakpoint Gets the pending breakpoint that contains a breakpoint.
GetState Gets the state of a bound breakpoint.
GetBreakpointResolution Gets the breakpoint resolution that describes a breakpoint.
Enable Enables or disables a breakpoint.
Delete Deletes a bound breakpoint.

Resolution and request information require implementation of the following IDebugBreakpointResolution2 methods.

Method Description
GetBreakpointType Gets the type of the breakpoint represented by a resolution.
GetResolutionInfo Gets the breakpoint resolution information that describes a breakpoint.

Resolution of errors that might occur during binding requires implementation of the following IDebugErrorBreakpoint2 methods.

Method Description
GetPendingBreakpoint Gets the pending breakpoint that contains an error breakpoint.
GetBreakpointResolution Gets the breakpoint error resolution that describes an error breakpoint.

Resolution of errors that might occur during binding also requires the following methods of IDebugErrorBreakpointResolution2.

Method Description
GetBreakpointType Gets the type of a breakpoint.
GetResolutionInfo Gets the resolution information of a breakpoint.

Viewing the source code at a breakpoint requires you to implement the methods of IDebugStackFrame2::GetDocumentContext and/or the methods of IDebugStackFrame2::GetCodeContext.

See also