Using Type Transformation

Creating a type transformation requires a sophisticated understanding of the way the compiler stores information. However, using the type transformation is a simple process of instantiating the callback functions. At many sites, the person who creates prototypes is different than the person who actually uses them. That is, a prototype builder will create libraries of prototypes that others will use.

For example, after someone writes the type transformation functions for a std::vector type and places them in a .tcl file, anyone can use Tcl's source command to install the type transformation. In most cases, however, the transformation is placed in an initialization file. The type mapping macros end with two CLI statements that instantiate the type transformation. Here, for example, are the statements to install the std::vector type transformation:

set proto_id [TV::prototype create array]

TV::prototype set $proto_id \
    name    {^(class|struct) (std::)?vector *<.*>$}    \
    language    C++     \
    validate_callback    vector_validate     \
    type_callback    vector_type     \
    address_callback    vector_address    \
    typedef_callback    vector_typedef     \
    rank_callback    vector_rank     \
    bounds_callback    vector_bounds 

This example invokes the TV::prototype command twice. The first time obtains a TotalView-generated identifier for the prototype. (This is similar to a handle.) The second associated properties with a prototype ID.

Once the type transformation code is loaded, TotalView automatically applies it and you can forget that it exists. The only exception is when you want to see the underlying implementation type. You can do this by using the <internal> string to cast the type in a Variable Window. For example, the following figure shows how the std::vector appears when it is cast to class vector<int,allocator<int>> <internal>.

Internal View of std::vector<int>

 
 
 
 
support@etnus.com
Copyright © 2001, Etnus, LLC. All rights reserved.
Version 5.0