[prev] [index] [next]

Locating the Bug (cont)

A slightly smarter strategy, relying on the typical structure of programs:
  • display all major data structures just after they have been initialised
    • typically requires to implement a print function for each data structure (e.g. 2d array)
  • display major data structures at "strategic points" during the program's execution
  • display major data structures at the end of program execution
How to determine strategic points? E.g.
  • after the first, second, middle iterations of the main program loop
  • after the keystroke that causes an interactive program to crash
  • after the point where the last output from the program occurred