Debugging is a methodical process of finding and reducing the number of bugs A software bug is the common term used to describe an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways. Most bugs arise from mistakes and errors made by people in either a program's source code or its design, and a few are caused by, or defects, in a computer program A computer program is a sequence of instructions written to perform a specified task for a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute the instructions. The same program in its human- or a piece of electronic hardware Electronic hardware refers to interconnected electronic components which perform analog and/or logic operations on received and locally stored information to produce as output and/or store resulting new information and/or to provide control for output actuator mechanisms, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa. The software quality metrics of coupling and cohesion were invented by Larry Constantine, an original developer of Structured Design who was also an early proponent of these concepts, as changes in one may cause bugs to emerge in another. Many entire books have been written about debugging (see below: Further reading), as it involves numerous aspects, including: interactive In the fields of information science, communication, and industrial design, there is debate over the meaning of interactivity. In the "contingency view" of interactivity, there are three levels: Noninteractive, when a message is not related to previous messages; Reactive, when a message is related only to one immediately previous message; debugging, control flow In computer science, control flow refers to the order in which the individual statements, instructions, or function calls of an imperative or a declarative program are executed or evaluated, integration testing, log files A data logger is an electronic device that records data over time or in relation to location either with a built in instrument or sensor or via external instruments and sensors. Increasingly, but not entirely, they are based on a digital processor (or computer). They generally are small, battery powered, portable, and equipped with a, monitoring, memory dumps, Statistical Process Control Statistical process control is an effective method of monitoring a process through the use of control charts. Control charts enable the use of objective criteria for distinguishing background variation from events of significance based on statistical techniques. Much of its power lies in the ability to monitor both process center and its variation, and special design tactics to improve detection while simplifying changes.
Contents |
Origin
There is some controversy over the origin of the term "debugging."
The terms "bug" and "debugging" are both popularly attributed to Admiral Grace Hopper in the 1940s[1]. While she was working on a Mark II Computer at Harvard University, her associates discovered a moth stuck in a relay and thereby impeding operation, whereupon she remarked that they were "debugging" the system. However the term "bug" in the meaning of technical error dates back at least to 1878 and Thomas Edison Thomas Alva Edison was an American inventor, scientist, and businessman who developed many devices that greatly influenced life around the world, including the phonograph, the motion picture camera, and a long-lasting, practical electric light bulb. Dubbed "The Wizard of Menlo Park" (now Edison, New Jersey) by a newspaper reporter, he (see software bug A software bug is the common term used to describe an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways. Most bugs arise from mistakes and errors made by people in either a program's source code or its design, and a few are caused by for a full discussion), and "debugging" seems to have been used as a term in aeronautics before entering the world of computers. Indeed, in an interview Grace Hopper remarked that she was not coining the term. The moth fit the already existing terminology, so she saved it.
The Oxford English Dictionary The Oxford English Dictionary , published by the Oxford University Press, is a dictionary of the English language. Two fully-bound print editions of the OED have been published under its current name, in 1928 and 1989. As of December 2008[update], the editors had completed one quarter of a third edition entry for "debug" quotes the term "debugging" used in reference to airplane engine testing in a 1945 article in the Journal of the Royal Aeronautical Society, Hopper's bug A software bug is the common term used to describe an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways. Most bugs arise from mistakes and errors made by people in either a program's source code or its design, and a few are caused by was found on the 9th of September in 1947. The term was not adopted by computer programmers until the early 1950s. The seminal article by Gill [2] in 1951 is the earliest in-depth discussion of programming errors, but it does not use the term "bug" or "debugging". In the ACM The Association for Computing Machinery, or ACM, is a learned society for computing. It was founded in 1947 as the world's first scientific and educational computing society. Its membership is more than 92,000 as of 2009. Its headquarters are in New York City's digital library, the term "debugging" is first used in three papers from 1952 ACM National Meetings.[3][4][5] Two of the three use the term in quotation marks. By 1963, "debugging" was a common enough term to be mentioned in passing without explanation on page 1 of the CTSS The Compatible Time-Sharing System, or the CTSS, was one of the first time-sharing operating systems; it was developed at MIT's Computation Center. CTSS was first demonstrated in 1961, and was operated at MIT until 1973. During part of this time, MIT's Project MAC had a second copy of CTSS, but the system did not spread beyond two sites . CTSS was manual.[6]
Kidwell's article Stalking the Elusive Computer Bug[7] discusses the etymology of "bug" and "debug" in greater detail.
The scope of debugging
As software and electronic systems have become generally more complex, the various common debugging techniques have expanded with more methods to detect anomalies, assess impact, and schedule software patches A patch is a small piece of software designed to fix problems with or update a computer program or its supporting data. This includes fixing security vulnerabilities and other bugs, and improving the usability or performance. Though meant to fix problems, poorly designed patches can sometimes introduce new problems or full updates to a system. The words "anomaly" and "discrepancy" can be used, as being more neutral terms, to avoid the words "error" and "defect" or "bug" where there might be an implication that all so-called errors, defects or bugs must be fixed (at all costs). Instead, an impact assessment Impact assessment is "a process aimed at structuring and supporting the development of policies. It identifies and assesses the problem at stake and the objectives pursued. It identifies the main options for achieving the objective and analyses their likely impacts in the economic, environmental and social fields. It outlines advantages and can be made to determine if changes to remove an anomaly (or discrepancy) would be cost-effective for the system, or perhaps a scheduled new release might render the change(s) unnecessary. Not all issues are life-critical Risks of this sort are usually managed with the methods and tools of safety engineering. A life-critical system is designed to lose less than one life per billion hours of operation. Typical design methods include probabilistic risk assessment, a method that combines failure modes and effects analysis with fault tree analysis. Some Flame Sensors or mission-critical The term mission critical refers to any factor (equipment, process, procedure, software, etc.) which is crucial to the successful completion of an entire project. It may also refer to a project the success of which is vital to the mission of the organization which attempts it in a system. Also, it is important to avoid the situation where a change might be more upsetting to users, long-term, than living with the known problem(s) (where the "cure would be worse than the disease"). Basing decisions of the acceptability of some anomalies can avoid a culture of a "zero-defects" mandate, where people might be tempted to deny the existence of problems so that the result would appear as zero defects. Considering the collateral issues, such as the cost-versus-benefit impact assessment, then broader debugging techniques will expand to determine the frequency of anomalies (how often the same "bugs" occur) to help assess their impact to the overall system.
Tools
Debugging ranges, in complexity, from fixing simple errors to performing lengthy and tiresome tasks of data collection, analysis, and scheduling updates. The debugging skill of the programmer can be a major factor in the ability to debug a problem, but the difficulty of software debugging varies greatly with the complexity of the system, and also depends, to some extent, on the programming language A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human communication(s) used and the available tools, such as debuggers A debugger or debugging tool is a computer program that is used to test and debug other programs . The code to be examined might alternatively be running on an instruction set simulator (ISS), a technique that allows great power in its ability to halt when specific conditions are encountered but which will typically be somewhat slower than. Debuggers are software tools which enable the programmer A programmer, computer programmer or coder is someone who writes computer software. The term computer programmer can refer to a specialist in one area of computer programming or to a generalist who writes code for many kinds of software. One who practices or professes a formal approach to programming may also be known as a programmer analyst. A to monitor the execution Execution in computer and software engineering is the process by which a computer or a virtual machine carries out the instructions of a computer program. The instructions in the program trigger sequences of simple actions on the executing machine. Those actions produce effects according to the semantics of the instructions in the program of a program, stop it, re-start it, set breakpoints A breakpoint, in software development, is an intentional stopping or pausing place in a program, put in place for debugging purposes. More generally, a breakpoint is a means of acquiring knowledge about a program during its execution. During the interruption, the programmer inspects the test environment to find out whether the program functions as, change values in memory and even, in some cases, go back in time. The term debugger can also refer to the person who is doing the debugging.
Generally, high-level programming languages A high-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or be more portable across platforms. Such languages hide the details of CPU operations such as memory access models and, such as Java Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode (class file), make debugging easier, because they have features such as exception handling Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution that make real sources of erratic behaviour easier to spot. In lower-level programming languages such as C C is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system or assembly Assembly languages are a type of low-level languages for programming computers, microprocessors, microcontrollers, and other integrated circuits. They implement a symbolic representation of the numeric machine codes and other constants needed to program a particular CPU architecture. This representation is usually defined by the hardware, bugs may cause silent problems such as memory corruption Memory corruption happens when the contents of a memory location are unintentionally modified due to programming errors. When the corrupted memory contents are used later in the computer program, it leads either to program crash or to strange and bizarre program behavior, and it is often difficult to see where the initial problem happened. In those cases, memory debugger A memory debugger is a programming tool for finding memory leaks and buffer overflows. These are due to bugs related to the allocation and deallocation of dynamic memory. Programs written in languages that have garbage collection, such as managed code, might also need memory debuggers, e.g. for memory leaks due to "living" references in tools may be needed.
In certain situations, general purpose software tools that are language specific in nature can be very useful. These take the form of static code analysis tools. These tools look for a very specific set of known problems, some common and some rare, within the source code. All such issues detected by these tools would rarely be picked up by a compiler or interpreter, thus they are not syntax checkers, but more semantic checkers. Some tools claim to be able to detect 300+ unique problems. Both commercial and free tools exist in various languages. These tools can be extremely useful when checking very large source trees, where it is impractical to do code walkthroughs. A typical example of a problem detected would be a variable dereference that occurs before the variable is assigned a value. Another example would be to perform strong type checking when the language does not require such. Thus, they are better at locating likely errors, versus actual errors. As a result, these tools have a reputation of false positives. The old Unix lint In computer programming, lint was the name originally given to a particular program that flagged suspicious and non-portable constructs in C language source code. The term is now applied generically to tools that flag suspicious usage in software written in any computer language. The term lint-like behavior is sometimes applied to the process of program is an early example.
For debugging electronic hardware (e.g., computer hardware A personal computer is made up of multiple physical components of computer hardware, upon which can be installed an operating system and a multitude of software to perform the operator's desired functions) as well as low-level software (e.g., BIOSes In IBM PC Compatible computers, the basic input/output system , also known as the System BIOS, is a de facto standard defining a firmware interface, device drivers In computing, a device driver or software driver is a computer program allowing higher-level computer programs to interact with a hardware device) and firmware In electronics and computing, firmware is a term often used to denote the fixed, usually rather small, programs and data structures that internally control various electronic devices. Typical examples of devices containing firmware range from end-user products such as remote controls or calculators, through computer parts and devices like hard, instruments such as oscilloscopes An oscilloscope is a type of electronic test instrument that allows signal voltages to be viewed, usually as a two-dimensional graph of one or more electrical potential differences (vertical(Y) axis) plotted as a function of time or of some other voltage (horizontal(x) axis). Although an oscilloscope displays voltage on its vertical axis, any, logic analyzers or in-circuit emulators (ICEs) An in-circuit emulator is a hardware device used to debug the software of an embedded system. It is usually in the form of bond-out processor which has many internal signals brought out for the purpose of debugging. These signals provide information about the state of the processor. Embedded systems present special problems for a programmer are often used, alone or in combination. An ICE may perform many of the typical software debugger's tasks on low-level software Computer software, or just software, is the collection of computer programs and related data that provide the instructions telling a computer what to do. The term was coined to contrast to the old term hardware . In contrast to hardware, software is intangible, meaning it "cannot be touched". Software is also sometimes used in a more and firmware In electronics and computing, firmware is a term often used to denote the fixed, usually rather small, programs and data structures that internally control various electronic devices. Typical examples of devices containing firmware range from end-user products such as remote controls or calculators, through computer parts and devices like hard.
Various debugging techniques
Print debugging is the act of watching (live or recorded) trace statements, or print statements, that indicate the flow of execution of a process.
Often the first step in debugging is to attempt to reproduce the problem. This can be a non-trivial task, for example as with parallel processes Parallel processing is the ability of the brain to simultaneously process incoming stimuli. This becomes most important in vision, as the brain divides what it sees into four components: color, motion, shape, and depth. These are individually analyzed and then compared to stored memories, which helps the brain identify what you are viewing. The or some unusual software bugs. Also, specific user environment and usage history can make it difficult to reproduce the problem.
After the bug is reproduced, the input of the program needs to be simplified to make it easier to debug. For example, a bug in a compiler can make it crash A crash or in computing is a condition where a program (either an application or part of the operating system) stops performing its expected function and also stops responding to other parts of the system. Often the offending program may simply appear to freeze. If this program is a critical part of the operating system kernel the entire computer when parsing some large source file. However, after simplification of the test case, only few lines from the original source file can be sufficient to reproduce the same crash. Such simplification can be made manually, using a divide-and-conquer In computer science, divide and conquer is an important algorithm design paradigm based on multi-branched recursion. A divide and conquer algorithm works by recursively breaking down a problem into two or more sub-problems of the same (or related) type, until these become simple enough to be solved directly. The solutions to the sub-problems are approach. The programmer will try to remove some parts of original test case and check if the problem still exists. When debugging the problem in a GUI A graphical user interface (sometimes pronounced gooey) is a type of user interface item that allows people to interact with programs in more ways than typing such as computers; hand-held devices such as MP3 Players, Portable Media Players or Gaming devices; household appliances and office equipment with images rather than text commands. A GUI, the programmer can try to skip some user interaction from the original problem description and check if remaining actions are sufficient for bugs to appear. To automate test case simplification, delta debugging Delta Debugging automates the scientific method of debugging. The Delta Debugging algorithm isolates failure causes automatically - by systematically narrowing down failure-inducing circumstances until a minimal set remains. Delta Debugging has been applied to isolate failure-inducing program input , failure-inducing user interaction (e.g. the methods can be used.[8]
After the test case is sufficiently simplified, a programmer can use a debugger A debugger or debugging tool is a computer program that is used to test and debug other programs . The code to be examined might alternatively be running on an instruction set simulator (ISS), a technique that allows great power in its ability to halt when specific conditions are encountered but which will typically be somewhat slower than tool to examine program states (values of variables, plus the call stack In computer science, a call stack is a dynamic stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, control stack, function stack, or run-time stack, and is often shortened to just "the stack") and track down the origin of the problem(s). Alternatively, tracing In software engineering, tracing is a specialized use of logging to record information about a program's execution. This information is typically used by programmers for debugging purposes, and additionally, depending on the type and detail of information contained in a trace log, by experienced system administrators or technical support personnel can be used. In simple cases, tracing is just a few print statements, which output the values of variables at certain points of program execution.
Remote debugging is the process of debugging a program running on a system different than the debugger. To start remote debugging, debugger connects to a remote system over a network. Once connected, debugger can control the execution of the program on the remote system and retrieve information about its state.
Post-mortem debugging is the act of debugging the memory dump (or core dump In computing, a core dump consists of the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally . In practice, other key pieces of program state are usually dumped at the same time, including the processor registers, which may include the program counter and stack) of a process. The dump of the process space could be obtained automatically by the system, or by a programmer-inserted instruction, or manually by the interactive user. Crash A crash or in computing is a condition where a program (either an application or part of the operating system) stops performing its expected function and also stops responding to other parts of the system. Often the offending program may simply appear to freeze. If this program is a critical part of the operating system kernel the entire computer dumps (core dumps) are often generated after a process has terminated due to an unhandled exception.
Anti-debugging
Anti-debugging is "the implementation of one or more techniques within computer code that hinders attempts at reverse engineering Reverse engineering is the process of discovering the technological principles of a device, object or system through analysis of its structure, function and operation. It often involves taking something (e.g., a mechanical device, electronic component, or software program) apart and analyzing its workings in detail to be used in maintenance, or to or debugging a target process".[9] The types of technique are:
- API-based: check for the existence of a debugger using system information
- Exception-based: check to see if exceptions are interfered with
- Process and thread blocks: check whether process and thread blocks have been manipulated
- Modified code: check for code modifications made by a debugger handling software breakpoints
- Hardware- and register-based: check for hardware breakpoints and CPU registers
- Timing and latency: check the time taken for the execution of instructions
Debugging can be inhibited by using one or more of the above techniques. There are enough anti-debugging techniques available to sufficiently protect software against most threats.[10]
See also
| Software Testing portal |
Notes
- ^ Grace Hopper from FOLDOC
- ^ S. Gill, The Diagnosis of Mistakes in Programmes on the EDSAC, Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences, Vol. 206, No. 1087 (May 22, 1951), pp. 538-554
- ^ Robert V. D. Campbell, Evolution of automatic computation, Proceedings of the 1952 ACM national meeting (Pittsburgh), p 29-32, 1952.
- ^ Alex Orden, Solution of systems of linear inequalities on a digital computer, Proceedings of the 1952 ACM national meeting (Pittsburgh), p. 91-95, 1952.
- ^ Howard B. Demuth, John B. Jackson, Edmund Klein, N. Metropolis, Walter Orvedahl, James H. Richardson, MANIAC, Proceedings of the 1952 ACM national meeting (Toronto), p. 13-16
- ^ The Compatible Time-Sharing System, M.I.T. Press, 1963
- ^ Peggy Aldrich Kidwell, Stalking the Elusive Computer Bug, IEEE Annals of the History of Computing, 1998.
- ^ Zeller, p. 123.
- ^ Shields, Tyler (2008-12-02). "Anti-Debugging Series - Part I". Veracode. http://www.veracode.com/blog/2008/12/anti-debugging-series-part-i/. Retrieved 2009-03-17.
- ^ doi:10.1109/MSP.2007.71
References
- Andreas Zeller: Why Programs Fail: A Guide to Systematic Debugging, Morgan Kaufmann, 2005. ISBN 1-55860-866-4
Further reading
- David J. Agans: Debugging: The Nine Indispensable Rules for Finding Even the Most Elusive Software and Hardware Problems, AMACOM, 2002. ISBN 0-8144-7168-4
- Bill Blunden: Software Exorcism: A Handbook for Debugging and Optimizing Legacy Code, APress, 2003. ISBN 1-59059-234-4
- Ann R. Ford, Toby J. Teorey: Practical Debugging in C++, Prentice Hall, 2002. ISBN 0-13-065394-2
- Thorsten Grötker, Ulrich Holtmann, Holger Keding, Markus Wloka, The Developer's Guide to Debugging, Springer, 2008. ISBN 1-40205-539-0
- Robert C. Metzger: Debugging by Thinking : A Multidisciplinary Approach, Digital Press, 2003. ISBN 1-55558-307-5
- Glenford J Myers: *The Art of Software Testing, John Wiley & Sons inc, 2004. ISBN 0-471-04328-1
- John Robbins: Debugging Applications, Microsoft Press, 2000. ISBN 0-7356-0886-5
- Matthew A. Telles, Yuan Hsieh: The Science of Debugging, The Coriolis Group, 2001. ISBN 1-57610-917-8
- Dmitry Vostokov: Memory Dump Analysis Anthology, Volume 1, OpenTask, 2008. ISBN 978-0-9558328-0-2
- Artzi, Shay; Adam Kiezun, Julian Dolby, Frank Tip, Danny Dig, Amit Paradkar, Michael D. Ernst (2008). Finding bugs in dynamic web applications. p. 261. doi:10.1145/1390630.1390662.
External links
| Wikiquote has a collection of quotations related to: Debugging |
| The Wikibook Computer Programming Principles has a page on the topic of Debugging |
- Debugging tools at the Open Directory Project
- Algorithmic and Automatic Debugging - extensive collection of links to debugging tools and methods
- Crash dump analysis patterns - In-depth articles on analyzing and finding bugs in crash dumps
- Debugging Tools for Windows
- GDB: The GNU Project Debugger
- DDD/DataDisplayDebugger
Categories: Debugging
Personal tools
- New features
- Log in / create account
Namespaces
- Article
- Discussion
Variants
Views
- Read
- Edit
- View history
Actions
Navigation
- Main page
- Contents
- Featured content
- Current events
- Random article
Interaction
- About Wikipedia
- Community portal
- Recent changes
- Contact Wikipedia
- Donate to Wikipedia
- Help
Toolbox
- What links here
- Related changes
- Upload file
- Special pages
- Permanent link
- Cite this page
Print/export
- Create a book
- Download as PDF
- Printable version
Languages
- Български
- Česky
- Español
- فارسی
- 한국어
- Bahasa Indonesia
- Italiano
- עברית
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Simple English
- Slovenščina
- Suomi
- Türkçe
- 中文