Partager via


How to: Use the Debugger

You can use the Visual FoxPro debugger to trace through code during execution.

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:

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

Tasks

How to: See Stored Values

Reference

Output Display

Trace Window

Debugger Window

Other Resources

Using the Debugger

Testing and Debugging Applications