QuickBasic Debugging

This material came from pages on qbasic.phatcode.net, unfortunately they no longer appear to be available.

  • You can debug as you program – no need to restart the application after making a code change in most cases.

Watching

  • Watch Expression – Monitor the value of a variable as one moves through the code.
  • Watchpoint – Stops the program when a monitored value/expression becomes true (nonzero).
  • Watch Window – Appears at the top of the screen during program execution.
    • True = -1; False = 0
    • You have to add a watch for each part of the program in which one wants to monitor a variable/expression.
    • You must select trace on command from the debug menu before debugging the program.
  • Add Watch – Displays values of variables and expressions as they change during the program’s execution, displayed at the top of the screen.
  • Instant Watch – Move the cursor within or to the right of a variable or select an expression and choose instant watch from the debug menu.
    • Shift + F9.

Tracing and History

  • Tracing – Turns on history and allows you to see the last twenty statements executed as well as the twenty statements about to be executed.
  • Trace On – Steps through the app in slow motion, highlighting each statement as it is executed.
  • Trace on Command – Highlights each statement as it executes.
    • Normal Tracing – Run entire program at once.
    • Single Stepping – One statement at a time.
    • Procedure Stepping – One procedure at a time.
  • Breakpoint – A place in a program where execution should pause.
  • History Back – Interrupt program execution using CTRL+BREAK.
    • Use Shift + F8 to check the last twenty statements.
  • History Forward – Can only be used after using History Back.
    • Use Shift + F10.

Other

  • Toggle Breakpoint
  • Break on Errors
  • Set Next Statement
  • Immediate Window – Appears at the bottom of the screen.
    • Use it to input code directly and execute it.
    • Accesses code in the currently active module/procedure.