Validating the Type: the list_validate Procedure
The first operation that TotalView will perform is to look at the datatypes used in your application and decide which of them will be mapped. The validation callback routine checks insures the type matches this code's expectations. This routine will need to return the structure's definition.
The list_validate routine casts the types in one of the subtypes of _List_node<foo> that contains void * pointers. This allows them to be interpreted as _List_node<foo> * pointers.
Note: This code reflects the "libstd" c++ implementation of "list<>" used by Linux g++ compilers.
proc list_validate {instance_id} {
# Check for _M_next, _M_prev, and _M_data.
set fields [TV::type get $instance_id struct_fields]
set matched_fields 0
foreach field $fields {
set field_name [lindex $field 0]
switch -- $field_name {
_M_next -
_M_prev -
_M_data {
incr matched_fields
}
}
}
return [expr $matched_fields==3]
}