parameters: (expr, value, is_child)
return_statement: return False
docstring: Function to explore structs/classes and union values.
          See Explorer.explore_expr for more information.
docstring_summary: Function to explore structs/classes and union values.
          See Explorer.explore_expr for more information.
docstring_tokens: Function to explore structs / classes and union values . See Explorer . explore_expr for more information .
function: def explore_expr(expr, value, is_child):
          """Function to explore structs/classes and union values.
          See Explorer.explore_expr for more information.
          """
          datatype = value.type
          type_code = datatype.code
          fields = datatype.fields()
  
          if type_code == gdb.TYPE_CODE_STRUCT:
              type_desc = "struct/class"
          else:
              type_desc = "union"
  
          if CompoundExplorer._get_real_field_count(fields) == 0:
              print ("The value of '%s' is a %s of type '%s' with no fields." %
                     (expr, type_desc, str(value.type)))
              if is_child:
                  Explorer.return_to_parent_value_prompt()
              return False
  
          print ("The value of '%s' is a %s of type '%s' with the following "
                "fields:\n" % (expr, type_desc, str(value.type)))
  
          has_explorable_fields = False
          choice_to_compound_field_map = { }
          current_choice = 0
          print_list = [ ]
          for field in fields:
              if field.artificial:
                  continue
              field_full_name = Explorer.guard_expr(expr) + "." + field.name
              if field.is_base_class:
                  field_value = value.cast(field.type)
              else:
                  field_value = value[field.name]
              literal_value = ""
              if type_code == gdb.TYPE_CODE_UNION:
                  literal_value = ("<Enter %d to explore this field of type "
                                   "'%s'>" % (current_choice, str(field.type)))
                  has_explorable_fields = True
              else:
                  if Explorer.is_scalar_type(field.type):
                      literal_value = ("%s .. (Value of type '%s')" %
                                       (str(field_value), str(field.type)))
                  else:
                      if field.is_base_class:
                          field_desc = "base class"
                      else:
                          field_desc = "field"
                      literal_value = ("<Enter %d to explore this %s of type "
                                       "'%s'>" %
                                       (current_choice, field_desc,
                                        str(field.type)))
                      has_explorable_fields = True
  
              choice_to_compound_field_map[str(current_choice)] = (
                  field_full_name, field_value)
              current_choice = current_choice + 1
  
              print_list.append((field.name, literal_value))
  
          CompoundExplorer._print_fields(print_list)
          print ("")
  
          if has_explorable_fields:
              choice = raw_input("Enter the field number of choice: ")
              if choice in choice_to_compound_field_map:
                  Explorer.explore_expr(choice_to_compound_field_map[choice][0],
                                        choice_to_compound_field_map[choice][1],
                                        True)
                  return True
              else:
                  if is_child:
                      Explorer.return_to_parent_value()
          else:
              if is_child:
                  Explorer.return_to_parent_value_prompt()
  
          return False
function_tokens: def explore_expr ( expr , value , is_child ) : datatype = value . type type_code = datatype . code fields = datatype . fields ( ) if type_code == gdb . TYPE_CODE_STRUCT : type_desc = "struct/class" else : type_desc = "union" if CompoundExplorer . _get_real_field_count ( fields ) == 0 : print ( "The value of '%s' is a %s of type '%s' with no fields." % ( expr , type_desc , str ( value . type ) ) ) if is_child : Explorer . return_to_parent_value_prompt ( ) return False print ( "The value of '%s' is a %s of type '%s' with the following " "fields:\n" % ( expr , type_desc , str ( value . type ) ) ) has_explorable_fields = False choice_to_compound_field_map = { } current_choice = 0 print_list = [ ] for field in fields : if field . artificial : continue field_full_name = Explorer . guard_expr ( expr ) + "." + field . name if field . is_base_class : field_value = value . cast ( field . type ) else : field_value = value [ field . name ] literal_value = "" if type_code == gdb . TYPE_CODE_UNION : literal_value = ( "<Enter %d to explore this field of type " "'%s'>" % ( current_choice , str ( field . type ) ) ) has_explorable_fields = True else : if Explorer . is_scalar_type ( field . type ) : literal_value = ( "%s .. (Value of type '%s')" % ( str ( field_value ) , str ( field . type ) ) ) else : if field . is_base_class : field_desc = "base class" else : field_desc = "field" literal_value = ( "<Enter %d to explore this %s of type " "'%s'>" % ( current_choice , field_desc , str ( field . type ) ) ) has_explorable_fields = True choice_to_compound_field_map [ str ( current_choice ) ] = ( field_full_name , field_value ) current_choice = current_choice + 1 print_list . append ( ( field . name , literal_value ) ) CompoundExplorer . _print_fields ( print_list ) print ( "" ) if has_explorable_fields : choice = raw_input ( "Enter the field number of choice: " ) if choice in choice_to_compound_field_map : Explorer . explore_expr ( choice_to_compound_field_map [ choice ] [ 0 ] , choice_to_compound_field_map [ choice ] [ 1 ] , True ) return True else : if is_child : Explorer . return_to_parent_value ( ) else : if is_child : Explorer . return_to_parent_value_prompt ( ) return False