Compartir a través de


Isolating Problems

Once your testing has identified problems, you can use the Visual FoxPro debugging environment to isolate those problems by:

  • Starting a debugging session
  • Tracing through code
  • Suspending program execution
  • Seeing stored values
  • Output Display

Starting a Debugging Session

You start a debugging session by opening the debugging environment.

To open the debugger

  • From the Tools menu, choose Debugger.

    Note   If you're debugging in the Visual FoxPro environment, choose the debugging tool you want to open from the Tools menu.

You can also open the debugger with any of the following commands:

DEBUG

SET STEP ON

SET ECHO ON

The debugger opens automatically whenever a breakpoint condition is met.

Tracing Through Code

One of the most useful debugging strategies at your disposal is the ability to trace through code, see each line of code as it executes, and check the values of all variables, properties, and environment settings.

To trace through code

  1. Start a debugging session.
  2. If no program is open in the Trace window, choose Do from the Debug menu.
  3. Choose Step Into from the Debug menu or click the Step Into toolbar button.

An arrow in the gray area to the left of the code indicates the next line to execute.

Tip   The following tips apply:

  • Set breakpoints to narrow the range of code you need to step through.
  • You can skip a line of code you know will generate an error by placing the cursor on the line of code after the problem line and choosing Set Next Statement from the Debug menu.
  • If you have much code associated with Timer events, you can avoid tracing through this code by clearing Display Timer Event in the Debugging tab of the Options dialog box.

If you isolate a problem when you're debugging a program or object code, you can immediately fix it.

To fix problems encountered while tracing code

  • From the Debug menu, choose Fix.

When you choose Fix from the Debug menu, program execution is canceled and the code editor is opened to the location of the cursor in the Trace window.

See Also

Seeing Event Sequences | Suspending Program Execution | Testing and Debugging Applications | DEBUG | Seeing Stored Values | Using the Automated Test Harness