The const is deliberate to remind you that changes should not be made to the object being formatted for display. Many real-world applications are not entirely
const-correct, and in cases where you must cast away the
const, extreme caution is advised.
You will need to define a TV_ttf_display_type function for each type you want to format. A
TV_ttf_display_type function may be at global scope, or it may be a class (static) method. It cannot be a member function.
The second issue concerns how the TV_ttf_display_type function which you will write communicates with TotalView. The API you will need to use is given in the header file
tv_data_display.h included with your TotalView distribution in the
<totalview-installation>/src directory.
Your TV_ttf_display_type will use the provided function
TV_ttf_add_row to tell TotalView what information should be displayed. Its prototype is:
The field_name parameter is the descriptive name of the data field being computed. It will be shown by TotalView in a form similar to that of the name of a structure's field. The
type_name parameter is the type of the data to be displayed. It must be the name of a legal type name in the program, or one of TotalView's types.
The third parameter, address, is the address in your program's address space of the object to be displayed.
TV_ttf_add_row should be called only as a result of TotalView invoking your
TV_ttf_display_type function. It may be called by a
TV_ttf_display_type called by TotalView, or by one of the descendant callees of that
TV_ttf_display_type.
For brevity and clarity, we have omitted all error checking of the value returned from TV_ttf_add_row. We will discuss the possible values that a
TV_ttf_display_type may return later.