Debugging tools

Debugging is the process of finding and eliminating bugs within your code. This can be done by using test data or simply reading the code. However this is not always the best way. Most integrated development environments (IDEs) have special tools in order to help the programmer.

The most common tools are -

 

The image on the right (click for full size) shows Net Beans and some basic debugging tools in action. Most IDE's have the exact same options and work in the exact same way. If you delve under the hood you will find a large number of advanced features which will help you identify and debug more stubborn problems

Variable watch - Allows you to see the value of variables at any point in your program. In conjunction with breakpoints and trace allows you to see how variables change.

Breakpoints - Will stop a program at the breakpoint to allow a trace to start. You can set breakpoints at any point in your code apart from variable declarations

Trace - Allows you to step into your code. Step into will jump into any procedures you may have. Step over will not do any jumping.

Stack traces - When procedures are called they are put onto the stack. A stack trace, or call stack, will show all of the functions called and the line number they were called from.