The Science of Debugging
Chapter 7


7.4.3 Examining the Stack

As we discussed above, the 'Stack' is the collection of all the frames from the program's execution, and each has all the information about what happened at that level. Your debugger will show you what the problem is, but you often must traverse the stack to locate it's origin. First though, lets take a look at a stack.

Reference the previous full screen image, and look at the Call Stack Display. As you can see, the call stack lists the current frames you have open at this particular point (three in the example). As noted a few screens back, our stacks are always going to start at the third level. This is because we have to go through the Microsoft Windows layers to actually make a system call. The big yellow arrow shows you where you're at, in the same way the yellow arrow works in the breakpoint bar.

To change the stack you're in, just click on it in the Call Stack window. Your variable window will change, and the open file should switch to the point of entrance for that stack (ie, the function call that created it) so you can see exactly what's going on.

Point and click makes tracing through a stack a pretty simple procedure, so I won't include any examples here.



Index
7.4.2 Examining Variables. 7.5 Run Time Debugging