Breakpoints

The Breakpoints command displays a dialog box that controls pauses in program execution. Breakpoints can be set unconditionally at a location or can be made conditional on the basis of expressions or messages.

Use the Breakpoints dialog box to set the following items, depending on the specific type of breakpoint. The next section describes the type of breakpoints you can set in the Breakpoints dialog box.

Break

Displays a dialog box where you can specify the type of breakpoint. The default is “at Location.”

Location

Specifies the code or memory location where the breakpoint is to be set.

Wnd Proc

Specifies the Windows procedure where the breakpoint is to be set. Select the procedure from the list or type the name.

Expression

The expression is considered true when it is evaluated as a nonzero value.

Length

Specifies the size of a memory location.

Messages

Displays a dialog box where you can specify the Windows messages that will cause a break when the message is received. Groups of messages can be selected to enable or disable categories of messages.

You can specify either a single message or a class of messages as breakpoints in the Messages dialog box. You can select from one to all the standard classes of Windows messages.

Types of Breakpoints

A breakpoint causes execution to pause and returns control to you. You can set the following types of breakpoints in the Break list box in the Breakpoints dialog box:

Break at Location

Sets an unconditional breakpoint at the specific code location.

Break at Location if Expression is True

Sets a breakpoint at the specific code location if the given expression is true.

Break at Location if Expression has Changed

Sets a breakpoint at the specific code location if the given expression changes.

Break if Expression is True

Sets a breakpoint if the given expression is true. The program pauses at the line on which the expression becomes true.

Break if Expression has Changed

Sets a breakpoint if the given expression changes. The program pauses at the line on which the expression changes.

Break at Wnd Proc

Sets an unconditional breakpoint at the specified Windows procedure.

Break at Wnd Proc if Expression is True

Sets a breakpoint at a Windows procedure when the given expression is true.

Break at Wnd Proc if Expression has Changed

Sets a breakpoint at the specified Windows procedure if the given expression changes.

Break at Wnd Proc if Message is Received

Sets a breakpoint at the specified Windows procedure if the given message is received.

Breakpoints at Program Locations

Breakpoints are usually set at a specific location before an error occurs to test code up to that point. Breakpoints can be set at the current insertion point or at a location you specify. The code location must be specified in one of two ways:

Format Example Description

Filename!.line number main.c!.34 Sets a breakpoint at line 34 in MAIN.C
Function name print_routine Sets a breakpoint at the beginning of this function
Function!.linenumber about!.34 Sets a breakpoint at line 34 in the About function
Exefile!.linenumber generic.exe!.34 Sets a breakpoint at line 34 in the Generic EXE file.

Breakpoints and Expressions

In addition to setting a breakpoint based on location, you can also set breakpoints to test whether an expression has changed or if it is true or false.

An expression consists of constants and variables combined with operators. (A complete list of operators is available in the online reference.)

Related Command

Debug menu: Quickwatch

See Also

Setting and Removing Breakpoints, page 41; Other Debugging Features, page 46