Most commercial programs undergo testing to identify and correct as many bugs as possible before the software ships to users. These bugs can be obvious defects that occur during normal activity, or they can crop up in specific situations, caused by an unexpected user action. When documenting a bug, testers record as much information as possible about the state of the program when the error occurred, to allow coders to replicate it.
Technicians have used the term "bug" to describe mechanical or electronic errors since the late 19th century, but the term "debugging" became literal in 1945 when a moth caused a stuck relay in a computer project at Harvard University. Today's bugs are usually the virtual sort, and programmers must work carefully and diligently to eliminate them.
Once a tester reports a bug, a coder attempts to replicate it by performing the same actions the tester took. If the same problem occurs, the coder tries to identify the problem and devise a solution. Sometimes a bug can be difficult to replicate, however, due to a specific set of circumstances that caused the error or from incomplete information from the tester.
A debugger is software or a mode that allows a coder to monitor a program as it executes. Debuggers track memory usage, register values and can allow the user to halt and manipulate processes to identify defects in the code’s execution. These programs also frequently feature the creation of specific testing environments, letting coders place specific memory values to simulate the conditions that led to a reported bug. They also contain extensive logging and documentation features, to provide as much information as possible about code conflicts and errors as they happen.
Debugging programs also allow an experienced and talented coder to reverse-engineer an unfamiliar program without access to its source code, although this process is much more difficult than debugging known code. Anti-malware coders, for instance, use debugging tools to learn about the behavior of malicious programs by identifying triggers and weak points, before devising protection and removal guidelines.