Chapter 9 Examining and Editing Data and Program Elements
This chapter explains how to examine and edit data and view the various elements of your program, with the following sections:
This chapter does not discuss array data. For that information, see
Chapter 10, "Examining Arrays".
Changing How Data is Displayed
When a debugger displays a variable, it relies on the definitions of the data used by your compiler. The following two sections show how you can change the way TotalView displays this information:
Displaying STL Variables
The C++ STL (Standard Template Library) greatly simplifies access to data. Since it offers standard and prepackaged ways to organize data, you do not have to be concerned with the mechanics of the access method. The disadvantage to using the STL while debugging is that the information debuggers display is organized according to the compiler’s view of the data, rather than the STL’s logical view. For example, here is how your compiler sees a map compiled using the GNU C++ compiler (gcc):
Most of the information is generated by the STL template and, in most cases, is not interesting. In addition, the STL does not aggregate the information in a useful way.
STLView solves these problems by rearranging (that is, transforming) the data so that you can easily examine it. For example, here is the transformed map.
Figure 109 shows an untransformed and transformed list and vector.
NOTE >> By default, TotalView transforms STL strings, vectors, lists, maps, multimaps, sets, and multisets. You can create transformations for other STL containers. See
"Creating Type Transformations" in the
TotalView Reference Guide for more information.
By default, TotalView transforms STL types. If you need to look at the untransformed data structures, clear the
View simplified STL containers (and user-defined transformations) checkbox on the
Options Page of the
File > Preference Dialog Box.
Following pointers in an STL data structure to retrieve values can be time-consuming. By default, TotalView only follows 500 pointers. You can change this by altering the value of the
TV::ttf_ max_length variable.