Redefining the Type: list_type Procedure

The list_type function returns the structure definition that TotalView will use. This definition essentially duplicates the type's definition except that two of the type IDs become pointers to the real target type rather than pointers to void.

proc list_type {instance_id} {
    set instance_name [TV::type get $instance_id name]
    set target_name "$instance_name *"
    set ptr_id [TV::image lookup \
        [TV::type get $instance_id image_id] types $target_name]
    
    # In case there is more than one type that matches, 
    # choose the first.
    set ptr_id [lindex $ptr_id 0]
    
    # Walk over the fields changing the types of appropriate 
    # ones. Note that this does not touch the addressing. It 
    # merely changes the types of some of the fields.
    set original_fields [TV::type get $instance_id struct_fields]
    
    foreach field $original_fields {
        set field_name [lindex $field 0]
    
        if {$field_name == "_M_next" || \
                    $field_name == "_M_prev"} {
            set field [lreplace $field 1 1 $ptr_id]
        } 
        lappend result_fields $field
    }
    
    return $result_fields
}
 
 
 
 
support@etnus.com
Copyright © 2001, Etnus, LLC. All rights reserved.
Version 5.0