[prev] 41 [next]

Using a Debugger (cont)

Once you find that the value of a given variable (e.g. x) is wrong, the next step is to determine why it is wrong.

There are two possibilities:

  • the statement that assigned a value to x is wrong
  • the values of other variables used by that statement are wrong
Example:

if (c > 0) { x = a+b; }

If we know that

  • x is wrong after this statement
  • the condition and the expression correctly implement their specs
Then we need to find out where a, b and c were set.