Debug code

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Debug code is computer code introduced to a computer program to test for errors or to help determine the cause of an error. It can be as simple as an echo command to print the value of a variable at certain points of a program. Modern integrated development environments sometimes render this unnecessary by allowing the placement of stop points at specific places in the program, and providing the ability to view the value of variables through the IDE rather than program output.

Many videogame cheat codes, such as level select, invincibility, etc. were originally introduced as debug code to allow the programmers and/or testers to skip hindrances that would prevent them from rapidly getting to parts of the game that needed to be tested; and in these cases cheat modes are often referred to as debugging mode. Embedded systems sometimes contains debugging code; an example is the Background Debug Mode interface.

It is recommended as a best practice that debugging code be removed from production versions of applications, as it can slow them down.[1]