Exercise : jGRASP Debugger

We are going to practice stepping into a method and stepping over a method. Using Pyramids.java, set a breakpoint on the first call to drawPyramid and hit the debug button. The program should begin executing. Arrange your windows so that you can see both the jGRASP window and the DrawingPanel window at the same time. Under the debug controls, you should see these options:

Hover your mouse over the leftmost one (the down-pointing arrow). jGRASP indicates that this is used to "Step over" a method call. Use this when you don't want to see the details of how a method executes. Hit this once. You should be at the second call on drawPyramid. Hit the button again to get to the third call.

Hover your mouse over the second icon (the one that looks like an arrow pointing down and right) and jGRASP will tell you that this is used to "Step in" a method. Click on that to step into the third method call.

continued on the next slide...

Exercise - jGRASP Debugger

Now you can use the "Step over" button to step through this execution line by line. Fill in the table below to indicate what value stairX is set to for the first few iterations of the for loop.

Iteration stairX
i = 0
267
i = 1
265
i = 2
262
i = 3
260
i = 4
257