Chapter 3. INSPECTING AND SETTING VARIABLES

INSPECTING AND SETTING VARIABLES

You found in Chapter 1 that in GDB you can print the value of a variable using the print command and that this can be done in DDD and Eclipse by moving the mouse pointer to an instance of the variable anywhere in the source code. But both GDB and the GUIs also offer much more powerful ways to inspect variables and data structures, as we will see in this chapter.

Our Main Example Code

Following is a straightforward (though not necessarily efficient, modular, etc.) implementation of a binary tree:

// bintree.c: routines to do insert and sorted print of a binary tree #include <stdio.h> #include ...

Get The Art of Debugging with GDB, DDD, and Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.