Content deleted Content added
Stevebroshar (talk | contribs) →Etymology: organize chronologically, clarify wording |
Atomixfart (talk | contribs) m I was trying to save in my archives |
||
(26 intermediate revisions by 23 users not shown) | |||
Line 1:
{{Short description|
{{Redirect|Debug}}
{{Software development process|Core activities}}
In [[
==Etymology==
Line 11:
[[File:First Computer Bug, 1945.jpg|thumb|A computer log entry from the Mark II, with a moth taped to the page]]
The term
A popular story from the 1940s is from [[Admiral Grace Hopper]].<ref>{{Cite web |url=https://books.google.com/books?id=JT0EAAAAMBAJ&pg=RA1-PA33 |title=InfoWorld Oct 5, 1981 |date=5 October 1981 |access-date=July 17, 2019 |archive-date=September 18, 2019 |archive-url=https://web.archive.org/web/20190918012636/https://books.google.com/books?id=JT0EAAAAMBAJ&pg=RA1-PA33&lpg=RA1-PA33&focus=viewport |url-status=live }}</ref>
Similarly, the term
The [[Oxford English Dictionary]] entry for
An article in "Airforce" (June 1945 p. 50) refers to ''debugging'' aircraft cameras.
The seminal article by Gill<ref>S. Gill, [https://www.jstor.org/stable/98663 The Diagnosis of Mistakes in Programmes on the EDSAC] {{Webarchive|url=https://web.archive.org/web/20200306083748/https://www.jstor.org/stable/98663 |date=2020-03-06 }}, Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences, Vol. 206, No. 1087 (May 22, 1951), pp. 538-554</ref> in 1951 is the earliest in-depth discussion of programming errors, but it does not use the term
▲The [[Oxford English Dictionary]] 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. An article in "Airforce" (June 1945 p. 50) also refers to debugging, this time of aircraft cameras. Hopper's [[computer bug|bug]] was found on September 9, 1947. Computer programmers did not adopt the term until the early 1950s.
▲The seminal article by Gill<ref>S. Gill, [https://www.jstor.org/stable/98663 The Diagnosis of Mistakes in Programmes on the EDSAC] {{Webarchive|url=https://web.archive.org/web/20200306083748/https://www.jstor.org/stable/98663 |date=2020-03-06 }}, Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences, Vol. 206, No. 1087 (May 22, 1951), pp. 538-554</ref> in 1951 is the earliest in-depth discussion of programming errors, but it does not use the term "bug" or "debugging".
In the [[Association for Computing Machinery|ACM]]'s digital library, the term
By 1963,
==Scope==
Line 40 ⟶ 43:
==Debugging process==
The debugging process normally begins with identifying the steps to reproduce the problem. This can be a non-trivial task, particularly with
After the bug is reproduced, the input of the program may need to be simplified to make it easier to debug. For example, a bug in a compiler can make it [[Crash (computing)|crash]] when parsing a 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. Simplification may be done manually using a [[Divide-and-conquer algorithm|divide-and-conquer]] approach, in which the programmer attempts to remove some parts of original test case then checks if the problem still occurs. When debugging in a [[Graphical user interface|GUI]], the programmer can try skipping some user interaction from the original problem description to check if the remaining actions are sufficient for causing the bug to occur.
Line 47 ⟶ 50:
==Techniques==
* ''Interactive debugging'' uses debugger tools which allow
* ''{{visible anchor|Print debugging}}'' or ''[[Tracing (software)|tracing]]'' is the act of watching (live or recorded) trace statements, or print statements, that indicate the flow of execution of a process and the data progression. Tracing can be done with specialized tools (like with GDB's trace) or by insertion of trace statements into the source code. The latter is sometimes called ''{{visible anchor|printf debugging}}'', due to the use of the [[printf]] function in C. This kind of debugging was turned on by the command TRON in the original versions of the novice-oriented [[BASIC]] programming language. TRON stood for, "Trace On." TRON caused the line numbers of each BASIC command line to print as the program ran.
* ''Activity tracing'' is like tracing (above), but rather than following program execution one instruction or function at a time, follows program activity based on the overall amount of time spent by the processor/CPU executing particular segments of code. This is typically presented as a fraction of the program's execution time spent processing instructions within defined memory addresses (machine code programs) or certain program modules (high level language or compiled programs). If the program being debugged is shown to be spending an inordinate fraction of its execution time within traced areas, this could indicate misallocation of processor time caused by faulty program logic, or at least inefficient allocation of processor time that could benefit from optimization efforts.
* ''{{visible anchor|Remote debugging}}'' is the process of debugging a program running on a system different from the debugger. To start remote debugging, a debugger connects to a remote system over a communications link such as a local area network. The debugger can then control the execution of the program on the remote system and retrieve information about its state.
* ''Post-mortem debugging'' is debugging of the program after it has already [[crash (computing)|crashed]]. Related techniques often include various tracing techniques like examining log files, outputting a [[call stack]] on the crash,<ref>{{cite web|url=https://www.drdobbs.com/tools/postmortem-debugging/185300443|title=Postmortem Debugging|work=Dr. Dobb's |access-date=2019-12-17|archive-date=2019-12-17|archive-url=https://web.archive.org/web/20191217045909/https://www.drdobbs.com/tools/postmortem-debugging/185300443|url-status=live}}</ref> and analysis of [[memory dump]] (or [[core dump]]) of the crashed process. The dump of the process could be obtained automatically by the system (for example, when the process has terminated due to an unhandled exception), or by a programmer-inserted instruction, or manually by the interactive user.
* ''"Wolf fence" algorithm:'' Edward Gauss described this simple but very useful and now famous algorithm in a 1982 article for [[Communications of the ACM]] as follows: "There's one wolf in Alaska; how do you find it? First build a fence down the middle of the state, wait for the wolf to howl, determine which side of the fence it is on. Repeat process on that side only, until you get to the point where you can see the wolf."<ref>{{cite journal
* ''[[Record and replay debugging]]'' is the technique of creating a program execution recording (e.g. using Mozilla's free [[rr (debugging)|rr]] debugging tool; enabling reversible debugging/execution), which can be replayed and interactively debugged. Useful for remote debugging and debugging intermittent, non-deterministic, and other hard-to-reproduce defects.
* ''[[Time travel debugging]]'' is the process of stepping back in time through source code (e.g. using [[Undo (company)|Undo LiveRecorder]]) to understand what is happening during execution of a computer program; to allow users to interact with the program; to change the history if desired and to watch how the program responds.
* ''[[Delta
* ''Saff Squeeze''{{snd}} a technique of isolating failure within the test using progressive inlining of parts of the failing test.<ref>{{cite web|url=http://www.threeriversinstitute.org/HitEmHighHitEmLow.html|archive-url=https://web.archive.org/web/20120311131729/http://www.threeriversinstitute.org/HitEmHighHitEmLow.html|url-status=dead|archive-date=2012-03-11|title=Kent Beck, Hit 'em High, Hit 'em Low: Regression Testing and the Saff Squeeze}}</ref><ref>{{cite web |last1=Rainsberger |first1=J.B. |title=The Saff Squeeze |url=https://blog.thecodewhisperer.com/permalink/the-saff-squeeze |website=The Code Whisperer |date=28 March 2022 |access-date=28 March 2022}}</ref>
* ''Causality tracking'': There are techniques to track the cause effect chains in the computation.<ref>{{cite journal|last=Zeller|first=Andreas|date=2002-11-01|title=Isolating cause-effect chains from computer programs|journal=ACM SIGSOFT Software Engineering Notes|volume=27|issue=6|pages=1–10|doi=10.1145/605466.605468|s2cid=12098165|issn=0163-5948}}</ref> Those techniques can be tailored for specific bugs, such as null pointer dereferences.<ref name="BondNethercote2007">{{cite book |last1=Bond|first1=Michael D.|title=Proceedings of the 22nd annual ACM SIGPLAN conference on Object oriented programming systems and applications - OOPSLA '07|last2=Nethercote|first2=Nicholas|last3=Kent|first3=Stephen W.|last4=Guyer|first4=Samuel Z.|last5=McKinley|first5=Kathryn S.|chapter=Tracking bad apples|year=2007|pages=405|doi=10.1145/1297027.1297057|isbn=9781595937865|s2cid=2832749}}</ref>
Line 113 ⟶ 116:
{{Wikibooks|Computer Programming Principles|Maintaining/Debugging|Debugging}}
* [http://www.dumpanalysis.org/ Crash dump analysis patterns]{{snd}} in-depth articles on analyzing and finding bugs in crash dumps
* [https://
* [http://www.clarinox.com/docs/whitepapers/EmbeddedDebugger.pdf Plug-in Based Debugging For Embedded Systems]
* [https://web.archive.org/web/20120112200659/http://www.byteparadigm.com/embedded-systems-test-and-debug---about-digital-input-generation-135.html Embedded Systems test and debug – about digital input generation]{{snd}} results of a survey about embedded system test and debug, Byte Paradigm (archived from the original on January 12, 2012)
|