12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4<strong>14</strong> Day 11<br />

Figure 11.9.<br />

The Call stack<br />

w<strong>in</strong>dow.<br />

NOTE<br />

In this case the first function on the list is TMa<strong>in</strong>Form::WatchBtnClick(). Follow<strong>in</strong>g that you<br />

see calls to some VCL functions and a couple calls to functions (unnamed) <strong>in</strong> the W<strong>in</strong>dows<br />

KERNEL32.DLL. Remember that the functions are listed <strong>in</strong> reverse order—the function<br />

executed last shows up first <strong>in</strong> the call stack list.<br />

Double-click<strong>in</strong>g on a function name <strong>in</strong> the Call stack w<strong>in</strong>dow will take you to the source code<br />

l<strong>in</strong>e for that function if the function is <strong>in</strong> your program. In case of functions <strong>in</strong> W<strong>in</strong>dows<br />

DLLs, the Call stack w<strong>in</strong>dow will conta<strong>in</strong> just an address and the name of the DLL. Doubleclick<strong>in</strong>g<br />

on a listed function that is conta<strong>in</strong>ed <strong>in</strong> a DLL will display the CPU View w<strong>in</strong>dow<br />

(the CPU View is discussed <strong>in</strong> the next section).<br />

If you have l<strong>in</strong>ked to the debug version of VCL, double-click<strong>in</strong>g on a<br />

VCL method <strong>in</strong> the Call stack w<strong>in</strong>dow will display the VCL source<br />

code for that method. If you have not l<strong>in</strong>ked to the debug version of<br />

VCL, double-click<strong>in</strong>g on a VCL method <strong>in</strong> the Call stack w<strong>in</strong>dow will<br />

display the CPU View.<br />

View<strong>in</strong>g the call stack is most useful after a W<strong>in</strong>dows Access Violation error. By view<strong>in</strong>g the<br />

call stack, you can see where your program was just before the error occurred. Know<strong>in</strong>g where<br />

your program was just before it crashed is often the first step <strong>in</strong> determ<strong>in</strong><strong>in</strong>g what went wrong.<br />

TIP<br />

If the call stack list conta<strong>in</strong>s seem<strong>in</strong>gly nonsensical <strong>in</strong>formation, it<br />

could be that the call stack was corrupted. A corrupted call stack is<br />

usually an <strong>in</strong>dicator of a stack problem. This is not as likely to occur <strong>in</strong><br />

a 32-bit program as it is <strong>in</strong> a 16-bit program, but it can still happen.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!