Share via


Debug Options on the Build/Debug Menu

Home Page (Debugger)OverviewHow Do I... Topics

To start debugging, choose the Go, Step Into, Run To Cursor or Attach to Process command from the Start Debug submenu of the Build menu. The following table lists the Start Debug menu commands that may appear and their actions.

Start Debug Commands (Build menu)

Menu
command

Action
Go Executes code from the current statement until a breakpoint or the end of the program is reached, or until the application pauses for user input. (Equivalent to the Go button on the toolbar.)
Step Into Single-steps through instructions in the program, and enters each function call that is encountered.
Run to Cursor Executes the program as far as the line that contains the insertion point. This is equivalent to setting a temporary breakpoint at the insertion point location.
Attach to Process Attaches the debugger to a process that is running. Then you can break into the process and perform debugging operations like normal.

When you begin debugging, the Debug menu appears, replacing the Build menu on the menu bar. You can then control program execution using the commands listed in the following table.

Debug Menu Commands that Control Program Execution

Debug menu
command

Action
Go Executes code from the current statement until a breakpoint or the end of the program is reached, or until the application pauses for user input. (Equivalent to the Go button on the Standard toolbar.) When the Debug menu is not available, you can choose Go from the Start Debug submenu of the Build menu.
Restart Resets execution to the first line of the program. This command reloads the program into memory, and discards the current values of all variables (breakpoints and watch expressions still apply). It automatically halts at the main() or WinMain() function.
Stop Debugging Terminates the debugging session, and returns to a normal editing session.
Break Halts the program at its current location.
Step Into Single-steps through instructions in the program, and enters each function call that is encountered.  When the Debug menu is not available, you can choose Step Into from the Start Debug submenu of the Build menu.
Step Over Single-steps through instructions in the program. If this command is used when you reach a function call, the function is executed without stepping through the function instructions.
Step Out Executes the program out of a function call, and stops on the instruction immediately following the call to the function. Using this command, you can quickly finish executing the current function after determining that a bug is not present in the function.
Run to Cursor Executes the program as far as the line that contains the insertion point. This command is equivalent to setting a temporary breakpoint at the insertion point location. When the Debug menu is not available, you can choose Run To Cursor from the Start Debug submenu of the Build menu.
Step Into Specific Function Single steps through instructions in the program, and enters the specified function call. This works for any number of nesting levels of functions.

The following additional commands appear on the Debug menu:

Exceptions Displays the Exceptions dialog, which you can use to specify how you want the debugger to handle your program exceptions.
Threads Displays the Threads dialog, which you can use to suspend, resume, or set focus to progam threads.
Show Next Statement Shows the next statement in your program code. If source code is not available, displays the statement within the Disassembly window.
QuickWatch Displays the Quick Watch window, where you can work with expressions.