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:
'''Debugger''' is a computer tool (or program) used to find and fix bugs in other computer programs.  It is generally used to determine the position of a program when a program 'crashes' or cannot continue because of a bad instruction or a memory access to a location not allowed for the current running program.  With the advances of debuggers, they are now part of most IDEs (Integrated Development Environments) and can now do much more including executing a program a step at a time, stopping the program at a predetermined breakpoint and track values in variables as they change.
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 ==
== History ==


When computer programming first appeared, so did the need to debug them.  Although static programming errors can be easily detected by analyzing the code syntactically, runtime errors are much harder to find and may could potentially depend on the running environment.
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 ==
== 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: ===
=== Control Flow Debugging: ===


Line 20: Line 30:


== Debugging in Development Environments ==
== Debugging in Development Environments ==
=== Debugging in commercial development environments ===
Commencial development environments such as:
*Borland C++ Builder
*Visual C++


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
* Single-stepping
Line 31: Line 38:
* 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
* 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
* Watches - programmers can also monitor a variable's value by setting a watch on it
=== Debugging in open source development environments ===
In addition to the debugging functionality available in the Commercial Development environments, Open Source and Integrated Development Environments include:
* Multiple views for debugging
* Multiple views for debugging
** Expression view - Displays all objects that have been inspected and their fields
** 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
** Breakpoint view - Displays all available breakpoints and allows enabling/disabling and deleting them
** Debug view - shows active threads and stacks
** Debug view - shows active threads and stacks
* Four types of breakpoints
* Multiple types of breakpoints
** Line - program execution breaks when the particular line of the program is reached
** 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.
** 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
** 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

Revision as of 02:09, 22 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) 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