Your New Jekyll Site


Why debugging matters

21 Apr 2011

Mistake, Error, Defect, Bug, Fault, Anomaly, … Feature!! We know it by many names Smile

The hardest bugs are generally not Access violations / Null pointer references. Under the debugger, you will get a first chance exception on the offending line. A memory crash dump also gives you the same information. It is far more difficult to track down memory corruption, memory leaks and analyze strange behavior. In those cases, previous operations influence, but the symptom is discovered much later. A slow system, may also need to be debugged, to see what is really going on, and if there are any locks that hinders other threads to run. Debugging can also be used to verify correct behavior of a program, by single stepping the code, and checking intermediate values which leads to the result.

Debugging can be a little like detective work, you can be Sherlock Holmes. You have to find clues by carefully investigating the crime scene and do deductive reasoning in order to to find suspicious code. A real detective always have an assistant, Sherlock Holmes, had Dr. Watson. You may of course choose a personal assistant of your choice.

Typical causes of errors

Visual studio is my favorite debugger, because it is very easy to use and quite powerful.

But some problems are better looked at with windbg, which gives you more control and more information. It is not easy to use, but in the end it pays off learning it.