O'Reilly logo

C++ All-In-One For Dummies®, 2nd Edition by Jeff Cogswell, John Paul Mueller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Stopping and Inspecting Your Code

In This Chapter

  • Setting, enabling, and disabling breakpoints

  • Temporarily setting or disabling a breakpoint

  • Inspecting a variable

  • Watching all the local variables

  • Watching any variable

Sometimes, things break. But what we're talking about here is the code. Now this is one of those instances when a word or phrase has lots of different meanings. Programmers talk about breaking the code. This phrase usually means one of two things: It may mean that the programmer made a mistake and the code no longer works. But in this chapter, we're using a different definition for the term. When you're debugging a program, you can have the program run until it gets to a certain line in the code. The debugger then stops at that line, and you can look at the values of variables, inspect things about the code, or even change the variables. When the program stops, that's called breaking. The reason it stops on that particular line is because you put a breakpoint on that line.

In this chapter, we talk about setting and manipulating breakpoints in your code (if nothing else in your code is broken) and inspecting and modifying various aspects of your code, such as variables, after your code stops at a breakpoint.

Tip

In the examples in this chapter, we use the debugger supplied with the CodeBlocks IDE. If you use a different product, the debugger will probably work about the same but not precisely the same. For example, everything we show you how to do here you can do ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required