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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

394 Day 11<br />

The IDE debugger provides several features and tools to help you <strong>in</strong> your debugg<strong>in</strong>g chores.<br />

Specifically, the follow<strong>in</strong>g features are discussed here:<br />

■ Debugger menu items<br />

■ Us<strong>in</strong>g breakpo<strong>in</strong>ts<br />

■ Inspect<strong>in</strong>g variables with the Watch List<br />

■ Inspect<strong>in</strong>g objects with the Debug Inspector<br />

■ Other debugg<strong>in</strong>g tools<br />

■ Stepp<strong>in</strong>g through code<br />

■ Debugg<strong>in</strong>g techniques<br />

Why Use the Debugger?<br />

The quick answer is that the debugger helps you track down bugs <strong>in</strong> your program. But the<br />

debugg<strong>in</strong>g process is not just for f<strong>in</strong>d<strong>in</strong>g and fix<strong>in</strong>g bugs—it is a development tool as well.<br />

As important as debugg<strong>in</strong>g is, many programmers don’t take the time to learn how to use all<br />

the features of the IDE debugger. As a result, they cost themselves time and money, not to<br />

mention the frustration of a bug that can’t easily be tracked down.<br />

You beg<strong>in</strong> a debugg<strong>in</strong>g session by start<strong>in</strong>g up the program under the debugger. You<br />

automatically run your program us<strong>in</strong>g the debugger when you click the Run button on the<br />

speedbar. You can also choose Run | Run from the ma<strong>in</strong> menu or press F9 on the keyboard.<br />

The Debugg<strong>in</strong>g Menu Items<br />

Before we get <strong>in</strong>to the details of the debugger, let’s go over the menu items that perta<strong>in</strong> to<br />

the debugger. Some of these menu items are on the ma<strong>in</strong> menu under Run, and others are<br />

on the Code Editor speed menu. Most of these items are discussed <strong>in</strong> detail as you work<br />

through the chapter, so I’ll just touch on them here so that you are at least familiar with them.<br />

Table 11.1 lists the Code Editor speed menu items that are specific to the debugger and their<br />

descriptions.<br />

Table 11.1. The Code Editor speed menu’s debugg<strong>in</strong>g items.<br />

Item Shortcut Description<br />

Toggle Breakpo<strong>in</strong>t F5 Toggles a breakpo<strong>in</strong>t on or off for the current<br />

l<strong>in</strong>e <strong>in</strong> the Code Editor.<br />

Run to Cursor none Starts the program (if necessary) and runs it<br />

until the l<strong>in</strong>e <strong>in</strong> the editor w<strong>in</strong>dow conta<strong>in</strong><strong>in</strong>g<br />

the cursor is reached.

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

Saved successfully!

Ooh no, something went wrong!