How to debug a program without a debugger?

Viewed 10586

Interview question-

Often its pretty easier to debug a program once you have trouble with your code.You can put watches,breakpoints and etc.Life is much easier because of debugger.

But how to debug a program without a debugger?

One possible approach which I know is simply putting print statements in your code wherever you want to check for the problems.

Are there any other approaches other than this?

As its a general question, its not restricted to any specific language.So please share your thoughts on how you would have done it?

EDIT- While submitting your answer, please mention a useful resource (if you have any) about any concept. e.g. Logging
This will be lot helpful for those who don't know about it at all.(This includes me, in some cases :)

UPDATE: Michal Sznajderhas put a real "best" answer and also made it a community wiki.Really deserves lots of up votes.

15 Answers
Related