Debugging
Debugging is, as the name implies, the removal of so-called bugs from a computer. A computer bug is not a living creature--rather it is a defect in software or hardware that causes a program to malfunction.
While today's computer bugs are inanimate, the original computer bug was indeed a living creature. In 1945, a moth became trapped between two electrical relays of Harvard University's Mark II Aiken Relay Calculator, shutting the machine down. The bug was discovered and preserved for posterity by Grace Hopper. In her notes of the incident, she coined the term computer bug.
Debugging is an important aspect of computer operation. Prior to the year 2000, countries around the world spent billions of dollars to upgrade operating software in an attempt to circumvent anticipated calendar related computer malfunctions upon the change of the year to '00.' Because many operating systems denoted the year only by the last two digits, to save memory, it was thought that the year 00 would be recognized as either 1900 or nil-imput. While more of an issue than a bug, because the decision to use the last two digits of a year was a deliberate one, the consequences of a programming fault might have been tremendously inconvenient, even dangerous. Fortunately, little if any adverse events occurred.
Other computer bugs have had more consequential effects. A thunderstorm in Alabama in January 2000 caused the erasure of critical files in the state's medical computer system. The "glitch" delayed processing of prescriptions during the height of an influenza epidemic.
Debugging is a programming operation that involves locating something that the programmer believes to be true, but in fact is no longer true. Examples that a programmer routinely believes to be true are: at a certain point in the source file, a certain variable has a certain value, in any "if-then-else" statement, the "else" part is executed correctly, and when a certain function is specified, that function receives all parameters as it should. The process of finding the location of a bug consists of confirming all the options. When a case is found where the expected has not occurred, then the location of the bug will have been established/
The process of confirming and locating a computer bug typically involves the use of a binary search. A simplified example of this strategy is provided in the Guide to Faster, Less Frustrating Debugging, and is summarized here. The example assumes a program is one file of 200 lines, and that there are no function commands. The array x is executed as x[4]=9 for the entire program. The programmer would check the value of x[4] at the mid-way point of the program. If, at line 100, the value was nine, then the bug must be located somewhere in lines 101 to 200. Another line would be checked, such as line 150. If the value there was found to be -127, then the bug is now known to be somewhere on lines 101 to 150. Further probing would isolate the bug on a line. In reality, the debugging process can become more complicated, however, the basic search strategy is sound.
Such a search can be performed automatically by the use of debugging tools. Most computer systems have one or more debugging tools available. For example, Unix systems typically employ a text-based tool called gdb. A more user-friendly graphical user interface is available for gdb.
With the popularity of the World Wide Web, debugging has become even more important. Bugs can appear in CGI (Common Gateway Interface) programs, which are the most common means of allowing Web servers to interact in a dynamic way with users. Bugs in CGI programs occur commonly during the development and testing of a Web site. Debugging CGI errors can involve a number of options, including typing in certain commands designed to reconfigure the program, ensuring that the particular CGI script is running in the right directory, checking for upper or lower-case requirement in a command, ensuring correct syntax, ensuring that all files are present, and consulting the systems administrator.
Some examples of some CGI error messages due to a bug, and their meanings, are:
- 404 File not found (server cannot locate a file).
- 403 Forbidden (server does not have permission to run the script).
- 501 Method not implemented (script being treated as an ordinary file).
- Document contains no data (script was located and run but information was not sent).
- 500 Internal Server Error (problem accessing or running a file).
An initiative called the High Performance Debugging Standards Effort was begun in 1997 in order to standardize the debugging efforts for high performance computing--a branch of computer science that concentrates on supercomputers and their operational software. The first version of the standard was released in 1998. Implementation of the standards will promote compatibility of debugging tools for the various hardware and software systems.
This is the complete article, containing 795 words
(approx. 3 pages at 300 words per page).