Child pages
  • Question 11 - Debugging
Skip to end of metadata
Go to start of metadata

When it comes to debugging, you can use a graphical environment that allows debugging or if one is not available then you must follow certain tips. Graphical debugging environments allow more or less the following functionalities
1.- Watches
It's a way of monitoring the value of a variable, it helps when the desired result is not achieved, this way you can track what values are being calculated by the program.
2.- Breakpoints
You can specify a point in the program were you want it to stop in order to track values of variables or check program direction in case of conditionals.
3.- Steps
With this you can execute the program line by line, it provides two  functionalities when subroutines of functions are encountered in the trace:
a).- Step into

The tracing program will continue executing line by line in the subroutine or function encountered in the trace

b).- Step through

The tracing program will not trace the subroutine or function but will just execute all of its code, this is time saving when there is no need to check the execution of the subroutine or function and tracing is focused on the main program.

Whenever a graphical debugger is unavailable, the best procedure is just employ as many "PRINT" statements in your program, this is to keep track of what values your variables are taking.

You can also use this in order to keep track of the direction the program is taking, example:

PRINT "I'm before the decision"
  PRINT "A is less than B"
  do stuff
  PRINT "A is not less than B"
  do other stuff

These extra PRINT statemens can be taken out once your program is running correctly.

Examples of Debuggers or IDEs that contain debugging capabilities:



Visual Studio

  • No labels