Debugging is the most time consuming activity of programming. So using appropriate tools and techniques is paramount to efficiency and productivity.
What are your favorite debugging techniques, and in which cases do you apply each of them?
There are many orthogonal criteria to consider:
- Programming languages (tools usually are language specific, and there are maybe some techniques that are applicable only within specific languages)
- Applications (web applications, client side, server side, singlethreaded versus multithreaded)
- Environment (how many tiers, is it on a stored procedure, is it on an embedded device)
But I'm mainly interested on techniques (and tools, if there are any) which are generally applicable and that you find most useful for finding and squashing bugs.