CSC/ECE 517 Fall 2009/wiki1b 1 db
A debugger is a computer program (or a software tool) used by software developers to test, find and fix bugs in other programs. The debugger allows the software developer to monitor the program (s)he is trying to debug, stop and restart it, set breakpoints and even change the values in memory. With the advances of debuggers, they are now part of most IDEs (Integrated Development Environments) and can make it even easier to set the code in the same that causes it the bug to happen.
History
When computer programming first appeared, so did the need to debug them. Although not a debugger tool, the first mean of debugging was by analyzing the core dump of the program that crashed. This allowed the developer to work on the problem without using the system for this purpose. Early operation systems would not allow debuggers to monitor running processes so core dumps had to be used to analyse memory.
Types of Debugging
Several types of tools have been developed to try to make the process of debugging easier. Here are some examples:
- core dump debugging - analyzing the recorded state of a program after it has crashed
- memory debugger - tool to find memory leaks and buffer overflow.
- DEBUG - built-in DOS and Windows debugger
- GDB - Command Line debugger, standard debugger for GNU applications and works for several languagues
- DBX - Command Line source-level debugger
- IDB - Intel debugger
Control Flow Debugging:
Programming errors may be caused by incorrect control flow or data flow. Debuggers make use of conditional breakpoints and single stepping to allow the programmer to test the flow of the program.
Other programming languages, such as Eiffel, provide build in support for debugging through the use of conditional assertions. This differs from conditional breakpoints in that it is checked only at specific program execution states such as before a method invocation or after a method exits.
Data Observation Debugging:
Memory inspection and Data Structure Display provide a way for programmers to peek into memory during the execution of a program. The amount of information may be large, so some debuggers provide a way of filtering that information and displaying only a subsection of all memory state.
Data breakpoints combines control flow debugging with data observation by breaking (or stopping) the running program when a particular even occurs to a change in a variable.
Debugging in Development Environments
With the advances of Commercial, such as Komodo, and Open Source Development Environments, such as Eclipse and Netbeans, the advances in debugging have been astonishing. Different plug-ins can be added to each IDE to allow debugging of other languages.
- Single-stepping
- Step over - steps over any function call treating it as a single line of code
- Trace Into - steps into the function allowing the programmer to single step each line inside the function also
- Break Points - allows the program to start and stop at a particular point, without having the user to single-step several lines of code before reaching the point of interest
- Watches - programmers can also monitor a variable's value by setting a watch on it
- Multiple views for debugging
- Expression view - Displays all objects that have been inspected and their fields
- Breakpoint view - Displays all available breakpoints and allows enabling/disabling and deleting them
- Debug view - shows active threads and stacks
- Multiple types of breakpoints
- Line - program execution breaks when the particular line of the program is reached
- Method - program execution breaks when a particular method is invoked. Can also set hit count so that, for example, will only break when the method is called the 2nd time.
- Field - program execution breaks when a particular variable is accessed or modified
- Java Exception - program execution breaks when a particular exception is raised