9.10 Force variable value


9.10 Force variable value

9.10.1 Basic tactic

Insert code to force a variable to take on a specific value.

9.10.2 Purpose

Determine what happens when a variable takes on a known value.

9.10.3 Questions answered

  • What are the side effects of executing a code segment at a particular point in time?

9.10.4 Potential problems

This tactic doesn’t answer the question of why the variable did not have the value originally.

9.10.5 Refined tactics

  1. Force a while loop to execute at least once.

  2. Force a counted loop to execute a certain number of times.

9.10.6 Related tactics

  • Use a high-level debugger or interpreter to do the following:

    • Set a breakpoint at the code block of interest.

    • Add a command list to the breakpoint to assign a variable a specific value and continue execution.

  • Use a high-level debugger or interpreter to do the following:

    • Set a breakpoint at the code block of interest.

    • Add a command list to the breakpoint step over a loop control statement to cause the loop to execute at least once

9.10.7 Choosing tactics

If there is a control path that isn’t being executed, and a variable that can take on a value that will exercise that path, use the basic or refined tactics. If you have a high level debugger, you can also use the related tactics.




Debugging by Thinking. A Multidisciplinary Approach
Debugging by Thinking: A Multidisciplinary Approach (HP Technologies)
ISBN: 1555583075
EAN: 2147483647
Year: 2002
Pages: 172

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net