Using Edit and Continue

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

With Edit and Continue (a new feature in Visual C++ 6.0), you can make changes to your source code while the program is being debugged (with some limitations). You can apply code changes while the program is running or halted under the debugger.

To apply code changes to a program you are debugging

  • From the Debug menu, click Apply Code Changes.

Some code changes cause the point of execution to move to a new location when Edit and Continue applies the changes. Edit and Continue places the point of execution as accurately as possible, but the results may not be correct in all cases. A dialog box informs you when the point of execution changes. You should verify that the location is correct before you continue debugging and use Set Next Statement if necessary.

Edit and Continue can also apply changes automatically when you select a Go or Step command for a program that is halted. You can turn off this automatic Edit and Continue, if you prefer. (If you turn the automatic feature off, you can still apply code changes manually using Apply Code Changes.)

To enable/disable Automatic Edit and Continue

  1. From the Tools Menu, click Options.

  2. In the Options dialog box, select the Debug tab.

  3. On the Debug tab, select or clear the Debug commands invoke Edit and Continue check box, as appropriate.

Because Debug commands invoke Edit and Continue is a tools option rather than a project option, altering this setting affects all projects you work on. You do not need to rebuild your application after changing this setting. You can change the setting even while debugging.

Edit and Continue uses the Program Database to store information needed to apply code changes. When you create a new project, Visual C++ chooses the appropriate option (Program Database for Edit and Continue) in the Project Settings dialog box. If you change this option (in order to use C7-compatible debug information, for example), Edit and Continue is disabled.

To enable/disable Edit and Continue for the current project

  1. From the Project menu, click Settings.

  2. In the Project Settings dialog box, select the C/C++ tab and the General category.

  3. On the C/C++ tab, select the Debug Info list box and select Program Database for Edit and Continue to enable Edit and Continue or select any other option to disable it.

  4. Click OK to close the dialog box.

  5. Rebuild your application with the new setting.

Choosing Program Database for Edit and Continue selects the /ZI compiler option.

Note   Do not enable Edit and Continue if you are debugging optimized code. Edit and Continue is incompatible with optimizations. The result is a compiler error.