Conditional Breakpoints
There is no mention anywhere within the Active Scripting documentation of how to perform conditional breakpoints because the framework doesn't directly support them. SampleDebugger doesn't provide this functionality, but here's how it can be done.
  1. Create a thread that can be used to resume the application when it hits a breakpoint.
  2. Set a breakpoint for a particular source line.
  3. Modify the BREAKPOINT structure to hold a string parameter that represents the condition that should evaluate to true when the breakpoint executes.
  4. When the breakpoint is reached via the onHandleBreakPoint method, get a pointer to the top stack frame and query it for IDebugExpression.
  5. Execute the expression without side effects and then just wait for it to complete.
  6. If the expression evaluated to true, notify the user that the breakpoint was hit; otherwise, signal the thread created in step 1 to resume the application.
      Similar steps can be taken to implement breakpoints that are executed after a number of iterations. Instead of evaluating an expression, a counter is incremented and checked against a maximum value that represents the number of iterations to skip the breakpoint. When the counter and the maximum value are equivalent, then the software would notify the user of the breakpoint. If this does not occur, the application would resume as if nothing happened.