CSC/ECE 517 Fall 2009/wiki1b 1 db: Difference between revisions
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
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 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. | ||
== Control Flow Debugging: == | == Types of Debugging == | ||
=== 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. | 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. | ||
Line 11: | Line 12: | ||
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. | 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: == | === 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. | 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. | ||
Line 18: | Line 19: | ||
Debugging in commercial development environments | == Debugging in Development Environments == | ||
Borland C++ Builder | === Debugging in commercial development environments === | ||
Visual C++ | Commencial development environments such as: | ||
*Borland C++ Builder | |||
*Visual C++ | |||
* Single-stepping | * Single-stepping | ||
Line 28: | Line 32: | ||
* 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 | === 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: | In addition to the debugging functionality available in the Commercial Development environments, Open Source and Integrated Development Environments include: | ||
Revision as of 04:03, 21 September 2009
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.
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.
Types of Debugging
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
Debugging in commercial development environments
Commencial development environments such as:
- Borland C++ Builder
- Visual C++
- 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
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
- 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
- Four 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