Debugging by Thinking: A Multidisciplinary Approach (HP Technologies)

9.6 Display procedure arguments

9.6.1 Basic tactic

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

9.6.2 Purpose

Determine the values that are inputs to each procedure.

9.6.3 Questions answered

9.6.4 Potential problems

9.6.5 Refined tactics

  1. Print relevant global variables as well as arguments.

  2. Print function results before returning. This is made much easier if the function is coded to have a single exit.

  3. In addition to the inserted print statements, do the following:

    • Add an execution option to the program.

    • Insert a guard statement that executes the print statement only if the execution option was used.

9.6.6 Related tactics

9.6.7 Choosing tactics

Use the basic tactic when one of the following conditions is true:

9.6.8 Language specifics

Категории