Wiki Home

VFP Debugger Break Points

Namespace: WIN_COM_API
A topic devoted to VFP debugger breakpoints
There are many ways to set breakpoints:

Cool tip:
  • The “TimeBomb”: minute( datetime() ) in the watch window with a break set. Helps deal with endless loops. Every minute the value will change, and that will cause the debugger to suspend the current app, regardless of what it is doing. Example: You want to examine the code that called messagebox() which prevents debugger events, like suspend. Set timebomb, run code that calls messagebox(), wait for minute to roll over (task bar clock), exit messagebox(), program halts on next line.

  • Set a breakpoint when a desired function starts, put "mycode" $ lower( program() ) in the watch window and set it to break on change. It will switch from .f. to .t. when "mycode" starts executing, and the program will suspend. "mycode" can be a function name, method name, vcx, or most any way that code is named.
  • Also, if you want to break on a specific object's method, such as Init(), you can refine the trick above to read "myobjectname.init" $ lower( program() ). This will avoid breaking on every single Init() which fires.
    You can also add this breakpoint with the breakpoints dialog by specifying myobjectname.init in the Location field and pressing the Add button.

    If you want to break when an expression changes, not when it goes out of scope, use an IIF with expression = the current value, and a dummy expression, and a constant so that the only time the whole thing evaluates is when the value actually has changed. like so: iif( nCtr = 5, uDummy, .t. ). this expression will not break as nCtr goes in and out of scope, but will cause a break when nCtr changes from 5. Similare to scope is data sessions. To watch for a change in field state: iif( set('datasession')=3 and !eof("qt3"), getfldstate( -1, "qt3" ), "111" ) -- Carl Karsten
    See also: VFP Debugger Call Stack Window
    Category VFP Ide Category VFP Debugger Category 3 Star Topics
  • ( Topic last updated: 2001.10.05 02:33:11 PM )