CSC/ECE 517 Fall 2009/wiki1b 1 db: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
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 making it easier for the developer to set the state of the program in execution and monitor the code in memory as the bug appears.
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 [http://en.wikipedia.org/wiki/Integrated_development_environment IDEs] (Integrated Development Environments) which makes it easier for the developer to set the state of the program in execution and monitor the code in memory.


== History ==
== History ==


When computers first appeared, so did programs and the need to debug them.  Although not a debugger tool, the first mean of debugging was by analyzing the [http://www.wikipedia.org/wiki/Core_dump 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.
When computers first appeared, so did programs and the need to debug them.  Although not a debugger tool, the first way to debug a program was by analyzing the [http://www.wikipedia.org/wiki/Core_dump core dump] of the program that crashed.  This allowed the developer to work on the problem in a separate system while the main system could continue being used for its main purpose.  Early [http://en.wikipedia.org/wiki/Operating_systems operating systems] were not setup not allow debuggers to monitor running processes and so core dumps were used to understand the state of the process long after it had disappeared.


== Types of Debugging ==
== Types of Debugging ==
Line 28: Line 28:
Data breakpoints combines control flow debugging with data observation by breaking (or stopping) the running program when a particular event occurs to a change in a variable.
Data breakpoints combines control flow debugging with data observation by breaking (or stopping) the running program when a particular event occurs to a change in a variable.


== Advances in Debugging ==


== Debugging in Development Environments ==
== Debugging in Development Environments ==
Line 47: Line 48:
** Field - program execution breaks when a particular variable is accessed or modified
** Field - program execution breaks when a particular variable is accessed or modified
** Java Exception - program execution breaks when a particular exception is raised
** Java Exception - program execution breaks when a particular exception is raised
== References ==

Revision as of 21:40, 28 September 2009

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) which makes it easier for the developer to set the state of the program in execution and monitor the code in memory.

History

When computers first appeared, so did programs and the need to debug them. Although not a debugger tool, the first way to debug a program was by analyzing the core dump of the program that crashed. This allowed the developer to work on the problem in a separate system while the main system could continue being used for its main purpose. Early operating systems were not setup not allow debuggers to monitor running processes and so core dumps were used to understand the state of the process long after it had disappeared.

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 built-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 event occurs to a change in a variable.

Advances in Debugging

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

References