Debugging By Thinking: A Multidisciplinary Approach

Chapter 9: Debugging Tactics

Experiments are like cross-questioning a witness who will tell the truth but not the whole truth.

Alan Gregg

9.1 Preview

This chapter describes in detail basic and refined debugging tactics that every programmer should be able to use, given that they re supported in his or her development environment. It develops a standard methodology for defining tactics according to a list of questions. Each tactic is described using this methodology and is concluded by an example of finding an actual bug using it.

The following debugging tactics are described as follows:

  • Read the source code looking for problems.

  • Write and execute a unit test for a procedure.

  • Insert a statement in the source to print the value of a variable.

  • Insert a statement in the source to print a message when a code block is executed, listing the procedure name and some locality identifier.

  • Insert statements in the source to print the values of arguments on entry to a procedure.

  • Run the application under an interpreter or high-level debugger and generate a trace of all statements executed.

  • Run the application under an interpreter or high-level debugger and generate a snapshot of all variable values each time a statement in a specified procedure is executed.

  • Generate a memory map when the application is compiled and a memory dump when it completes execution.

  • Generate a memory map when the application is compiled and a memory dump when it completes execution.

  • Insert assertions into the program source that make the assumptions of the code...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Integrated Development Environment (IDE)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.