(name, datatype, is_child)
return False
Function to explore struct/class and union types.
        See Explorer.explore_type for more information.
Function to explore struct/class and union types.
        See Explorer.explore_type for more information.
Function to explore struct / class and union types . See Explorer . explore_type for more information .
def explore_type(name, datatype, is_child):
        """Function to explore struct/class and union types.
        See Explorer.explore_type for more information.
        """
        type_code = datatype.code
        type_desc = ""
        if type_code == gdb.TYPE_CODE_STRUCT:
            type_desc = "struct/class"
        else:
            type_desc = "union"

        fields = datatype.fields()
        if CompoundExplorer._get_real_field_count(fields) == 0:
            if is_child:
                print ("%s is a %s of type '%s' with no fields." %
                       (name, type_desc, str(datatype)))
                Explorer.return_to_enclosing_type_prompt()
            else:
                print ("'%s' is a %s with no fields." % (name, type_desc))
            return False

        if is_child:
            print ("%s is a %s of type '%s' "
                   "with the following fields:\n" %
                   (name, type_desc, str(datatype)))
        else:
            print ("'%s' is a %s with the following "
                   "fields:\n" %
                   (name, type_desc))

        has_explorable_fields = False
        current_choice = 0
        choice_to_compound_field_map = { }
        print_list = [ ]
        for field in fields:
            if field.artificial:
                continue
            if field.is_base_class:
                field_desc = "base class"
            else:
                field_desc = "field"
            rhs = ("<Enter %d to explore this %s of type '%s'>" %
                   (current_choice, field_desc, str(field.type)))
            print_list.append((field.name, rhs))
            choice_to_compound_field_map[str(current_choice)] = (
                field.name, field.type, field_desc)
            current_choice = current_choice + 1

        CompoundExplorer._print_fields(print_list)
        print ("")

        if len(choice_to_compound_field_map) > 0:
            choice = raw_input("Enter the field number of choice: ")
            if choice in choice_to_compound_field_map:
                if is_child:
                    new_name = ("%s '%s' of %s" % 
                                (choice_to_compound_field_map[choice][2],
                                 choice_to_compound_field_map[choice][0],
                                 name))
                else:
                    new_name = ("%s '%s' of '%s'" % 
                                (choice_to_compound_field_map[choice][2],
                                 choice_to_compound_field_map[choice][0],
                                 name))
                Explorer.explore_type(new_name,
                    choice_to_compound_field_map[choice][1], True)
                return True
            else:
                if is_child:
                    Explorer.return_to_enclosing_type()
        else:
            if is_child:
                Explorer.return_to_enclosing_type_prompt()

        return False
def explore_type ( name , datatype , is_child ) : type_code = datatype . code type_desc = "" if type_code == gdb . TYPE_CODE_STRUCT : type_desc = "struct/class" else : type_desc = "union" fields = datatype . fields ( ) if CompoundExplorer . _get_real_field_count ( fields ) == 0 : if is_child : print ( "%s is a %s of type '%s' with no fields." % ( name , type_desc , str ( datatype ) ) ) Explorer . return_to_enclosing_type_prompt ( ) else : print ( "'%s' is a %s with no fields." % ( name , type_desc ) ) return False if is_child : print ( "%s is a %s of type '%s' " "with the following fields:\n" % ( name , type_desc , str ( datatype ) ) ) else : print ( "'%s' is a %s with the following " "fields:\n" % ( name , type_desc ) ) has_explorable_fields = False current_choice = 0 choice_to_compound_field_map = { } print_list = [ ] for field in fields : if field . artificial : continue if field . is_base_class : field_desc = "base class" else : field_desc = "field" rhs = ( "<Enter %d to explore this %s of type '%s'>" % ( current_choice , field_desc , str ( field . type ) ) ) print_list . append ( ( field . name , rhs ) ) choice_to_compound_field_map [ str ( current_choice ) ] = ( field . name , field . type , field_desc ) current_choice = current_choice + 1 CompoundExplorer . _print_fields ( print_list ) print ( "" ) if len ( choice_to_compound_field_map ) > 0 : choice = raw_input ( "Enter the field number of choice: " ) if choice in choice_to_compound_field_map : if is_child : new_name = ( "%s '%s' of %s" % ( choice_to_compound_field_map [ choice ] [ 2 ] , choice_to_compound_field_map [ choice ] [ 0 ] , name ) ) else : new_name = ( "%s '%s' of '%s'" % ( choice_to_compound_field_map [ choice ] [ 2 ] , choice_to_compound_field_map [ choice ] [ 0 ] , name ) ) Explorer . explore_type ( new_name , choice_to_compound_field_map [ choice ] [ 1 ] , True ) return True else : if is_child : Explorer . return_to_enclosing_type ( ) else : if is_child : Explorer . return_to_enclosing_type_prompt ( ) return False