Gild Debugger (cont'd)

Step 6: Making Changes

Now we will want to fix the offending line of code. To do that, simply change line 40 to read:

return currentPower * 2;

Before any changes will take effect, the program must be saved (see "Accomplishing Common Tasks>Saving Files") and built (see "Accomplishing Common Tasks>Compiling/Building"). After you have performed these two tasks, the program can be run again to see what affect our changes had (see "Accomplishing Common Tasks>Running Your Programs"). After the program has been run, you will get this output in the Console View at the bottom of your screen.

The current power of 2 is 1
The current power of 2 is 2
The current power of 2 is 4
The current power of 2 is 8
The current power of 2 is 16
2^5 = 32

The output is correct, except for one problem: we are still missing the message line that includes 32. However, our line with the caret notation is correct, so our current problem is likely after the while() loop, but before the code that prints the caret notation. We will have to begin the debugging process again in order to see what the problem is. That is, we will have to debug recursively.


Previous | Index | Next