Exemple #1
0
static struct type *
amd64_register_type (struct gdbarch *gdbarch, int regnum)
{
  struct type *t;

  gdb_assert (regnum >= 0 && regnum < AMD64_NUM_REGS);

  /* ??? Unfortunately, amd64_init_abi is called too early, and so we
     cannot create the amd64_sse_type early enough to avoid any check
     at this point.  */
  t = *amd64_register_info[regnum].type;
  if (t != NULL)
    return t;

  gdb_assert (amd64_sse_type == NULL);

  t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION);
  append_composite_type_field (t, "v4_float", builtin_type_v4_float);
  append_composite_type_field (t, "v2_double", builtin_type_v2_double);
  append_composite_type_field (t, "v16_int8", builtin_type_v16_int8);
  append_composite_type_field (t, "v8_int16", builtin_type_v8_int16);
  append_composite_type_field (t, "v4_int32", builtin_type_v4_int32);
  append_composite_type_field (t, "v2_int64", builtin_type_v2_int64);
  append_composite_type_field (t, "uint128", builtin_type_int128);

  TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
  TYPE_NAME (t) = "builtin_type_vec128i";
      
  amd64_sse_type = t;
  return t;
}
/* Make TYPE unsigned if its range of values includes no negatives.  */
static void
adjust_type_signedness (struct type *type)
{
  if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
      && TYPE_LOW_BOUND (type) >= 0)
    TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
}
Exemple #3
0
static CORE_ADDR
iq2000_pointer_to_address (struct type * type, const void * buf)
{
    enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
    CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));

    if (target == TYPE_CODE_FUNC
            || target == TYPE_CODE_METHOD
            || (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_CODE_SPACE) != 0)
        addr = insn_addr_from_ptr (addr);

    return addr;
}
static int
print_record_field_types (struct type *type, struct type *outer_type,
			  struct ui_file *stream, int show, int level)
{
  int len, i, flds;

  flds = 0;
  len = TYPE_NFIELDS (type);

  if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0)
    return -1;

  for (i = 0; i < len; i += 1)
    {
      QUIT;

      if (ada_is_parent_field (type, i) || ada_is_ignored_field (type, i))
	;
      else if (ada_is_wrapper_field (type, i))
	flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type,
					  stream, show, level);
      else if (ada_is_variant_part (type, i))
	{
	  print_variant_part (type, i, outer_type, stream, show, level);
	  flds = 1;
	}
      else
	{
	  flds += 1;
	  fprintf_filtered (stream, "\n%*s", level + 4, "");
	  ada_print_type (TYPE_FIELD_TYPE (type, i),
			  TYPE_FIELD_NAME (type, i),
			  stream, show - 1, level + 4);
	  fprintf_filtered (stream, ";");
	}
    }

  return flds;
}
Exemple #5
0
void
c_type_print_base (struct type *type, struct ui_file *stream, int show,
		   int level)
{
  int i;
  int len, real_len;
  int lastval;
  char *mangled_name;
  char *demangled_name;
  char *demangled_no_static;
  enum
    {
      s_none, s_public, s_private, s_protected
    }
  section_type;
  int need_access_label = 0;
  int j, len2;

  QUIT;

  wrap_here ("    ");
  if (type == NULL)
    {
      fputs_filtered (_("<type unknown>"), stream);
      return;
    }

  /* When SHOW is zero or less, and there is a valid type name, then always
     just print the type name directly from the type.  */
  /* If we have "typedef struct foo {. . .} bar;" do we want to print it
     as "struct foo" or as "bar"?  Pick the latter, because C++ folk tend
     to expect things like "class5 *foo" rather than "struct class5 *foo".  */

  if (show <= 0
      && TYPE_NAME (type) != NULL)
    {
      c_type_print_modifier (type, stream, 0, 1);
      fputs_filtered (TYPE_NAME (type), stream);
      return;
    }

  CHECK_TYPEDEF (type);

  switch (TYPE_CODE (type))
    {
    case TYPE_CODE_TYPEDEF:
    case TYPE_CODE_ARRAY:
    case TYPE_CODE_PTR:
    case TYPE_CODE_MEMBER:
    case TYPE_CODE_REF:
    case TYPE_CODE_FUNC:
    case TYPE_CODE_METHOD:
      c_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
      break;

    case TYPE_CODE_STRUCT:
      c_type_print_modifier (type, stream, 0, 1);
      /* Note TYPE_CODE_STRUCT and TYPE_CODE_CLASS have the same value,
       * so we use another means for distinguishing them.
       */
      if (HAVE_CPLUS_STRUCT (type))
	{
	  switch (TYPE_DECLARED_TYPE (type))
	    {
	    case DECLARED_TYPE_CLASS:
	      fprintf_filtered (stream, "class ");
	      break;
	    case DECLARED_TYPE_UNION:
	      fprintf_filtered (stream, "union ");
	      break;
	    case DECLARED_TYPE_STRUCT:
	      fprintf_filtered (stream, "struct ");
	      break;
	    default:
	      /* If there is a CPLUS_STRUCT, assume class if not
	       * otherwise specified in the declared_type field.
	       */
	      fprintf_filtered (stream, "class ");
	      break;
	    }			/* switch */
	}
      else
	{
	  /* If not CPLUS_STRUCT, then assume it's a C struct */
	  fprintf_filtered (stream, "struct ");
	}
      goto struct_union;

    case TYPE_CODE_UNION:
      c_type_print_modifier (type, stream, 0, 1);
      fprintf_filtered (stream, "union ");

    struct_union:

      /* Print the tag if it exists. 
       * The HP aCC compiler emits
       * a spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
       * tag  for unnamed struct/union/enum's, which we don't
       * want to print.
       */
      if (TYPE_TAG_NAME (type) != NULL &&
	  strncmp (TYPE_TAG_NAME (type), "{unnamed", 8))
	{
	  fputs_filtered (TYPE_TAG_NAME (type), stream);
	  if (show > 0)
	    fputs_filtered (" ", stream);
	}
      wrap_here ("    ");
      if (show < 0)
	{
	  /* If we just printed a tag name, no need to print anything else.  */
	  if (TYPE_TAG_NAME (type) == NULL)
	    fprintf_filtered (stream, "{...}");
	}
      else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
	{
	  cp_type_print_derivation_info (stream, type);

	  fprintf_filtered (stream, "{\n");
	  if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
	    {
	      if (TYPE_STUB (type))
		fprintfi_filtered (level + 4, stream, _("<incomplete type>\n"));
	      else
		fprintfi_filtered (level + 4, stream, _("<no data fields>\n"));
	    }

	  /* Start off with no specific section type, so we can print
	     one for the first field we find, and use that section type
	     thereafter until we find another type. */

	  section_type = s_none;

	  /* For a class, if all members are private, there's no need
	     for a "private:" label; similarly, for a struct or union
	     masquerading as a class, if all members are public, there's
	     no need for a "public:" label. */

	  if ((TYPE_DECLARED_TYPE (type) == DECLARED_TYPE_CLASS) ||
	      (TYPE_DECLARED_TYPE (type) == DECLARED_TYPE_TEMPLATE))
	    {
	      QUIT;
	      len = TYPE_NFIELDS (type);
	      for (i = TYPE_N_BASECLASSES (type); i < len; i++)
		if (!TYPE_FIELD_PRIVATE (type, i))
		  {
		    need_access_label = 1;
		    break;
		  }
	      QUIT;
	      if (!need_access_label)
		{
		  len2 = TYPE_NFN_FIELDS (type);
		  for (j = 0; j < len2; j++)
		    {
		      len = TYPE_FN_FIELDLIST_LENGTH (type, j);
		      for (i = 0; i < len; i++)
			if (!TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type, j), i))
			  {
			    need_access_label = 1;
			    break;
			  }
		      if (need_access_label)
			break;
		    }
		}
	    }
	  else if ((TYPE_DECLARED_TYPE (type) == DECLARED_TYPE_STRUCT) ||
		   (TYPE_DECLARED_TYPE (type) == DECLARED_TYPE_UNION))
	    {
	      QUIT;
	      len = TYPE_NFIELDS (type);
	      for (i = TYPE_N_BASECLASSES (type); i < len; i++)
		if (TYPE_FIELD_PRIVATE (type, i) || TYPE_FIELD_PROTECTED (type, i))
		  {
		    need_access_label = 1;
		    break;
		  }
	      QUIT;
	      if (!need_access_label)
		{
		  len2 = TYPE_NFN_FIELDS (type);
		  for (j = 0; j < len2; j++)
		    {
		      QUIT;
		      len = TYPE_FN_FIELDLIST_LENGTH (type, j);
		      for (i = 0; i < len; i++)
			if (TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type, j), i) ||
			    TYPE_FN_FIELD_PROTECTED (TYPE_FN_FIELDLIST1 (type, j), i))
			  {
			    need_access_label = 1;
			    break;
			  }
		      if (need_access_label)
			break;
		    }
		}
	    }

	  /* If there is a base class for this type,
	     do not print the field that it occupies.  */

	  len = TYPE_NFIELDS (type);
	  for (i = TYPE_N_BASECLASSES (type); i < len; i++)
	    {
	      QUIT;
	      /* Don't print out virtual function table.  */
	      /* HP ANSI C++ case */
	      if (TYPE_HAS_VTABLE (type)
		  && (strncmp (TYPE_FIELD_NAME (type, i), "__vfp", 5) == 0))
		continue;
	      /* Other compilers */
	      if (strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5) == 0
		  && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
		continue;

	      /* If this is a C++ class we can print the various C++ section
	         labels. */

	      if (HAVE_CPLUS_STRUCT (type) && need_access_label)
		{
		  if (TYPE_FIELD_PROTECTED (type, i))
		    {
		      if (section_type != s_protected)
			{
			  section_type = s_protected;
			  fprintfi_filtered (level + 2, stream,
					     "protected:\n");
			}
		    }
		  else if (TYPE_FIELD_PRIVATE (type, i))
		    {
		      if (section_type != s_private)
			{
			  section_type = s_private;
			  fprintfi_filtered (level + 2, stream, "private:\n");
			}
		    }
		  else
		    {
		      if (section_type != s_public)
			{
			  section_type = s_public;
			  fprintfi_filtered (level + 2, stream, "public:\n");
			}
		    }
		}

	      print_spaces_filtered (level + 4, stream);
	      if (TYPE_FIELD_STATIC (type, i))
		{
		  fprintf_filtered (stream, "static ");
		}
	      c_print_type (TYPE_FIELD_TYPE (type, i),
			    TYPE_FIELD_NAME (type, i),
			    stream, show - 1, level + 4);
	      if (!TYPE_FIELD_STATIC (type, i)
		  && TYPE_FIELD_PACKED (type, i))
		{
		  /* It is a bitfield.  This code does not attempt
		     to look at the bitpos and reconstruct filler,
		     unnamed fields.  This would lead to misleading
		     results if the compiler does not put out fields
		     for such things (I don't know what it does).  */
		  fprintf_filtered (stream, " : %d",
				    TYPE_FIELD_BITSIZE (type, i));
		}
	      fprintf_filtered (stream, ";\n");
	    }

	  /* If there are both fields and methods, put a blank line
	      between them.  Make sure to count only method that we will
	      display; artificial methods will be hidden.  */
	  len = TYPE_NFN_FIELDS (type);
	  real_len = 0;
	  for (i = 0; i < len; i++)
	    {
	      struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
	      int len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
	      int j;
	      for (j = 0; j < len2; j++)
		if (!TYPE_FN_FIELD_ARTIFICIAL (f, j))
		  real_len++;
	    }
	  if (real_len > 0 && section_type != s_none)
	    fprintf_filtered (stream, "\n");

	  /* C++: print out the methods */
	  for (i = 0; i < len; i++)
	    {
	      struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
	      int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
	      char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
	      char *name = type_name_no_tag (type);
	      int is_constructor = name && strcmp (method_name, name) == 0;
	      for (j = 0; j < len2; j++)
		{
		  char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
		  int is_full_physname_constructor =
		   is_constructor_name (physname) 
		   || is_destructor_name (physname)
		   || method_name[0] == '~';

		  /* Do not print out artificial methods.  */
		  if (TYPE_FN_FIELD_ARTIFICIAL (f, j))
		    continue;

		  QUIT;
		  if (TYPE_FN_FIELD_PROTECTED (f, j))
		    {
		      if (section_type != s_protected)
			{
			  section_type = s_protected;
			  fprintfi_filtered (level + 2, stream,
					     "protected:\n");
			}
		    }
		  else if (TYPE_FN_FIELD_PRIVATE (f, j))
		    {
		      if (section_type != s_private)
			{
			  section_type = s_private;
			  fprintfi_filtered (level + 2, stream, "private:\n");
			}
		    }
		  else
		    {
		      if (section_type != s_public)
			{
			  section_type = s_public;
			  fprintfi_filtered (level + 2, stream, "public:\n");
			}
		    }

		  print_spaces_filtered (level + 4, stream);
		  if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
		    fprintf_filtered (stream, "virtual ");
		  else if (TYPE_FN_FIELD_STATIC_P (f, j))
		    fprintf_filtered (stream, "static ");
		  if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
		    {
		      /* Keep GDB from crashing here.  */
		      fprintf_filtered (stream, _("<undefined type> %s;\n"),
					TYPE_FN_FIELD_PHYSNAME (f, j));
		      break;
		    }
		  else if (!is_constructor &&	/* constructors don't have declared types */
			   !is_full_physname_constructor &&	/*    " "  */
			   !is_type_conversion_operator (type, i, j))
		    {
		      type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
				  "", stream, -1);
		      fputs_filtered (" ", stream);
		    }
		  if (TYPE_FN_FIELD_STUB (f, j))
		    /* Build something we can demangle.  */
		    mangled_name = gdb_mangle_name (type, i, j);
		  else
		    mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);

		  demangled_name =
		    cplus_demangle (mangled_name,
				    DMGL_ANSI | DMGL_PARAMS);
		  if (demangled_name == NULL)
		    {
		      /* in some cases (for instance with the HP demangling),
		         if a function has more than 10 arguments, 
		         the demangling will fail.
		         Let's try to reconstruct the function signature from 
		         the symbol information */
		      if (!TYPE_FN_FIELD_STUB (f, j))
			{
			  int staticp = TYPE_FN_FIELD_STATIC_P (f, j);
			  struct type *mtype = TYPE_FN_FIELD_TYPE (f, j);
			  cp_type_print_method_args (mtype,
						     "",
						     method_name,
						     staticp,
						     stream);
			}
		      else
			fprintf_filtered (stream, _("<badly mangled name '%s'>"),
					  mangled_name);
		    }
		  else
		    {
		      char *p;
		      char *demangled_no_class
			= remove_qualifiers (demangled_name);

		      /* get rid of the `static' appended by the demangler */
		      p = strstr (demangled_no_class, " static");
		      if (p != NULL)
			{
			  int length = p - demangled_no_class;
			  demangled_no_static = (char *) xmalloc (length + 1);
			  strncpy (demangled_no_static, demangled_no_class, length);
			  *(demangled_no_static + length) = '\0';
			  fputs_filtered (demangled_no_static, stream);
			  xfree (demangled_no_static);
			}
		      else
			fputs_filtered (demangled_no_class, stream);
		      xfree (demangled_name);
		    }

		  if (TYPE_FN_FIELD_STUB (f, j))
		    xfree (mangled_name);

		  fprintf_filtered (stream, ";\n");
		}
	    }

	  fprintfi_filtered (level, stream, "}");

	  if (TYPE_LOCALTYPE_PTR (type) && show >= 0)
	    fprintfi_filtered (level, stream, _(" (Local at %s:%d)\n"),
			       TYPE_LOCALTYPE_FILE (type),
			       TYPE_LOCALTYPE_LINE (type));
	}
      if (TYPE_CODE (type) == TYPE_CODE_TEMPLATE)
	goto go_back;
      break;

    case TYPE_CODE_ENUM:
      c_type_print_modifier (type, stream, 0, 1);
      /* HP C supports sized enums */
      if (deprecated_hp_som_som_object_present)
	switch (TYPE_LENGTH (type))
	  {
	  case 1:
	    fputs_filtered ("char ", stream);
	    break;
	  case 2:
	    fputs_filtered ("short ", stream);
	    break;
	  default:
	    break;
	  }
      fprintf_filtered (stream, "enum ");
      /* Print the tag name if it exists.
         The aCC compiler emits a spurious 
         "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
         tag for unnamed struct/union/enum's, which we don't
         want to print. */
      if (TYPE_TAG_NAME (type) != NULL &&
	  strncmp (TYPE_TAG_NAME (type), "{unnamed", 8))
	{
	  fputs_filtered (TYPE_TAG_NAME (type), stream);
	  if (show > 0)
	    fputs_filtered (" ", stream);
	}

      wrap_here ("    ");
      if (show < 0)
	{
	  /* If we just printed a tag name, no need to print anything else.  */
	  if (TYPE_TAG_NAME (type) == NULL)
	    fprintf_filtered (stream, "{...}");
	}
      else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
	{
	  fprintf_filtered (stream, "{");
	  len = TYPE_NFIELDS (type);
	  lastval = 0;
	  for (i = 0; i < len; i++)
	    {
	      QUIT;
	      if (i)
		fprintf_filtered (stream, ", ");
	      wrap_here ("    ");
	      fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
	      if (lastval != TYPE_FIELD_BITPOS (type, i))
		{
		  /* APPLE LOCAL begin print unsigned */
		  if (TYPE_FLAGS (type) & TYPE_FLAG_UNSIGNED)
		    fprintf_filtered (stream, " = %u", TYPE_FIELD_BITPOS (type, i));
		  else
		    fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
		  /* APPLE LOCAL end print unsigned */
		  lastval = TYPE_FIELD_BITPOS (type, i);
		}
	      lastval++;
	    }
	  fprintf_filtered (stream, "}");
	}
      break;

    case TYPE_CODE_VOID:
      fprintf_filtered (stream, "void");
      break;

    case TYPE_CODE_UNDEF:
      fprintf_filtered (stream, _("struct <unknown>"));
      break;

    case TYPE_CODE_ERROR:
      fprintf_filtered (stream, _("<unknown type>"));
      break;

    case TYPE_CODE_RANGE:
      /* This should not occur */
      fprintf_filtered (stream, _("<range type>"));
      break;

    case TYPE_CODE_TEMPLATE:
      /* Called on "ptype t" where "t" is a template.
         Prints the template header (with args), e.g.:
         template <class T1, class T2> class "
         and then merges with the struct/union/class code to
         print the rest of the definition. */
      c_type_print_modifier (type, stream, 0, 1);
      fprintf_filtered (stream, "template <");
      for (i = 0; i < TYPE_NTEMPLATE_ARGS (type); i++)
	{
	  struct template_arg templ_arg;
	  templ_arg = TYPE_TEMPLATE_ARG (type, i);
	  fprintf_filtered (stream, "class %s", templ_arg.name);
	  if (i < TYPE_NTEMPLATE_ARGS (type) - 1)
	    fprintf_filtered (stream, ", ");
	}
      fprintf_filtered (stream, "> class ");
      /* Yuck, factor this out to a subroutine so we can call
         it and return to the point marked with the "goback:" label... - RT */
      goto struct_union;
    go_back:
      if (TYPE_NINSTANTIATIONS (type) > 0)
	{
	  fprintf_filtered (stream, _("\ntemplate instantiations:\n"));
	  for (i = 0; i < TYPE_NINSTANTIATIONS (type); i++)
	    {
	      fprintf_filtered (stream, "  ");
	      c_type_print_base (TYPE_INSTANTIATION (type, i), stream, 0, level);
	      if (i < TYPE_NINSTANTIATIONS (type) - 1)
		fprintf_filtered (stream, "\n");
	    }
	}
      break;

    case TYPE_CODE_NAMESPACE:
      fputs_filtered ("namespace ", stream);
      fputs_filtered (TYPE_TAG_NAME (type), stream);
      break;

    default:
      /* Handle types not explicitly handled by the other cases,
         such as fundamental types.  For these, just print whatever
         the type name is, as recorded in the type itself.  If there
         is no type name, then complain. */
      if (TYPE_NAME (type) != NULL)
	{
	  c_type_print_modifier (type, stream, 0, 1);
	  fputs_filtered (TYPE_NAME (type), stream);
	}
      else
	{
	  /* At least for dump_symtab, it is important that this not be
	     an error ().  */
	  fprintf_filtered (stream, _("<invalid type code %d>"),
			    TYPE_CODE (type));
	}
      break;
    }
}
static void
initialize_tdesc_powerpc_7400 (void)
{
  struct target_desc *result = allocate_target_description ();
  struct tdesc_feature *feature;
  struct type *field_type, *type;

  feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
  tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "pc", 64, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "msr", 65, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "lr", 67, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "ctr", 68, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32");

  feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu");
  tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int");

  feature = tdesc_create_feature (result, "OEA");
  tdesc_create_reg (feature, "sr0", 71, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr1", 72, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr2", 73, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr3", 74, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr4", 75, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr5", 76, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr6", 77, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr7", 78, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr8", 79, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr9", 80, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr10", 81, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr11", 82, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr12", 83, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr13", 84, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr14", 85, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sr15", 86, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "pvr", 87, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ibat0u", 88, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ibat0l", 89, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ibat1u", 90, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ibat1l", 91, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ibat2u", 92, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ibat2l", 93, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ibat3u", 94, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ibat3l", 95, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dbat0u", 96, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dbat0l", 97, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dbat1u", 98, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dbat1l", 99, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dbat2u", 100, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dbat2l", 101, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dbat3u", 102, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dbat3l", 103, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sdr1", 104, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "asr", 105, 1, NULL, 64, "int");
  tdesc_create_reg (feature, "dar", 106, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dsisr", 107, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sprg0", 108, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sprg1", 109, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sprg2", 110, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "sprg3", 111, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "srr0", 112, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "srr1", 113, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "tbl", 114, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "tbu", 115, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dec", 116, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "dabr", 117, 1, NULL, 32, "int");
  tdesc_create_reg (feature, "ear", 118, 1, NULL, 32, "int");

  feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
  field_type = tdesc_named_type (feature, "ieee_single");
  type = init_vector_type (field_type, 4);
  TYPE_NAME (type) = xstrdup ("v4f");
  tdesc_record_type (feature, type);

  field_type = tdesc_named_type (feature, "int32");
  type = init_vector_type (field_type, 4);
  TYPE_NAME (type) = xstrdup ("v4i32");
  tdesc_record_type (feature, type);

  field_type = tdesc_named_type (feature, "int16");
  type = init_vector_type (field_type, 8);
  TYPE_NAME (type) = xstrdup ("v8i16");
  tdesc_record_type (feature, type);

  field_type = tdesc_named_type (feature, "int8");
  type = init_vector_type (field_type, 16);
  TYPE_NAME (type) = xstrdup ("v16i8");
  tdesc_record_type (feature, type);

  type = init_composite_type (NULL, TYPE_CODE_UNION);
  TYPE_NAME (type) = xstrdup ("vec128");
  field_type = tdesc_named_type (feature, "uint128");
  append_composite_type_field (type, xstrdup ("uint128"), field_type);
  field_type = tdesc_named_type (feature, "v4f");
  append_composite_type_field (type, xstrdup ("v4_float"), field_type);
  field_type = tdesc_named_type (feature, "v4i32");
  append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
  field_type = tdesc_named_type (feature, "v8i16");
  append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
  field_type = tdesc_named_type (feature, "v16i8");
  append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
  TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
  tdesc_record_type (feature, type);

  tdesc_create_reg (feature, "vr0", 119, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr1", 120, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr2", 121, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr3", 122, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr4", 123, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr5", 124, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr6", 125, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr7", 126, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr8", 127, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr9", 128, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr10", 129, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr11", 130, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr12", 131, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr13", 132, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr14", 133, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr15", 134, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr16", 135, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr17", 136, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr18", 137, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr19", 138, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr20", 139, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr21", 140, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr22", 141, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr23", 142, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr24", 143, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr25", 144, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr26", 145, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr27", 146, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr28", 147, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr29", 148, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr30", 149, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr31", 150, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vscr", 151, 1, "vector", 32, "int");
  tdesc_create_reg (feature, "vrsave", 152, 1, "vector", 32, "int");

  tdesc_powerpc_7400 = result;
}
Exemple #7
0
static void
chill_type_print_base (struct type *type, struct ui_file *stream, int show,
		       int level)
{
  register int len;
  register int i;
  struct type *index_type;
  struct type *range_type;
  LONGEST low_bound;
  LONGEST high_bound;

  QUIT;

  wrap_here ("    ");
  if (type == NULL)
    {
      fputs_filtered ("<type unknown>", stream);
      return;
    }

  /* When SHOW is zero or less, and there is a valid type name, then always
     just print the type name directly from the type. */

  if ((show <= 0) && (TYPE_NAME (type) != NULL))
    {
      fputs_filtered (TYPE_NAME (type), stream);
      return;
    }

  if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF)
    CHECK_TYPEDEF (type);

  switch (TYPE_CODE (type))
    {
    case TYPE_CODE_TYPEDEF:
      chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
      break;
    case TYPE_CODE_PTR:
      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
	{
	  fprintf_filtered (stream,
			    TYPE_NAME (type) ? TYPE_NAME (type) : "PTR");
	  break;
	}
      fprintf_filtered (stream, "REF ");
      chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
      break;

    case TYPE_CODE_BOOL:
      /* FIXME: we should probably just print the TYPE_NAME, in case
         anyone ever fixes the compiler to give us the real names
         in the presence of the chill equivalent of typedef (assuming
         there is one).  */
      fprintf_filtered (stream,
			TYPE_NAME (type) ? TYPE_NAME (type) : "BOOL");
      break;

    case TYPE_CODE_ARRAY:
      fputs_filtered ("ARRAY (", stream);
      range_type = TYPE_FIELD_TYPE (type, 0);
      if (TYPE_CODE (range_type) != TYPE_CODE_RANGE)
	chill_print_type (range_type, "", stream, 0, level);
      else
	{
	  index_type = TYPE_TARGET_TYPE (range_type);
	  low_bound = TYPE_FIELD_BITPOS (range_type, 0);
	  high_bound = TYPE_FIELD_BITPOS (range_type, 1);
	  print_type_scalar (index_type, low_bound, stream);
	  fputs_filtered (":", stream);
	  print_type_scalar (index_type, high_bound, stream);
	}
      fputs_filtered (") ", stream);
      chill_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, level);
      break;

    case TYPE_CODE_BITSTRING:
      fprintf_filtered (stream, "BOOLS (%d)",
		      TYPE_FIELD_BITPOS (TYPE_FIELD_TYPE (type, 0), 1) + 1);
      break;

    case TYPE_CODE_SET:
      fputs_filtered ("POWERSET ", stream);
      chill_print_type (TYPE_INDEX_TYPE (type), "", stream,
			show - 1, level);
      break;

    case TYPE_CODE_STRING:
      range_type = TYPE_FIELD_TYPE (type, 0);
      index_type = TYPE_TARGET_TYPE (range_type);
      high_bound = TYPE_FIELD_BITPOS (range_type, 1);
      fputs_filtered ("CHARS (", stream);
      print_type_scalar (index_type, high_bound + 1, stream);
      fputs_filtered (")", stream);
      break;

    case TYPE_CODE_MEMBER:
      fprintf_filtered (stream, "MEMBER ");
      chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
      break;
    case TYPE_CODE_REF:
      fprintf_filtered (stream, "/*LOC*/ ");
      chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
      break;
    case TYPE_CODE_FUNC:
      fprintf_filtered (stream, "PROC (");
      len = TYPE_NFIELDS (type);
      for (i = 0; i < len; i++)
	{
	  struct type *param_type = TYPE_FIELD_TYPE (type, i);
	  if (i > 0)
	    {
	      fputs_filtered (", ", stream);
	      wrap_here ("    ");
	    }
	  if (TYPE_CODE (param_type) == TYPE_CODE_REF)
	    {
	      chill_type_print_base (TYPE_TARGET_TYPE (param_type),
				     stream, 0, level);
	      fputs_filtered (" LOC", stream);
	    }
	  else
	    chill_type_print_base (param_type, stream, show, level);
	}
      fprintf_filtered (stream, ")");
      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
	{
	  fputs_filtered (" RETURNS (", stream);
	  chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
	  fputs_filtered (")", stream);
	}
      break;

    case TYPE_CODE_STRUCT:
      if (chill_varying_type (type))
	{
	  chill_type_print_base (TYPE_FIELD_TYPE (type, 1),
				 stream, 0, level);
	  fputs_filtered (" VARYING", stream);
	}
      else
	{
	  fprintf_filtered (stream, "STRUCT ");

	  fprintf_filtered (stream, "(\n");
	  if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
	    {
	      if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
		{
		  fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
		}
	      else
		{
		  fprintfi_filtered (level + 4, stream, "<no data fields>\n");
		}
	    }
	  else
	    {
	      len = TYPE_NFIELDS (type);
	      for (i = TYPE_N_BASECLASSES (type); i < len; i++)
		{
		  struct type *field_type = TYPE_FIELD_TYPE (type, i);
		  QUIT;
		  print_spaces_filtered (level + 4, stream);
		  if (TYPE_CODE (field_type) == TYPE_CODE_UNION)
		    {
		      int j;	/* variant number */
		      fputs_filtered ("CASE OF\n", stream);
		      for (j = 0; j < TYPE_NFIELDS (field_type); j++)
			{
			  int k;	/* variant field index */
			  struct type *variant_type
			  = TYPE_FIELD_TYPE (field_type, j);
			  int var_len = TYPE_NFIELDS (variant_type);
			  print_spaces_filtered (level + 4, stream);
			  if (strcmp (TYPE_FIELD_NAME (field_type, j),
				      "else") == 0)
			    fputs_filtered ("ELSE\n", stream);
			  else
			    fputs_filtered (":\n", stream);
			  if (TYPE_CODE (variant_type) != TYPE_CODE_STRUCT)
			    error ("variant record confusion");
			  for (k = 0; k < var_len; k++)
			    {
			      print_spaces_filtered (level + 8, stream);
			      chill_print_type (TYPE_FIELD_TYPE (variant_type, k),
					  TYPE_FIELD_NAME (variant_type, k),
						stream, show - 1, level + 8);
			      if (k < (var_len - 1))
				fputs_filtered (",", stream);
			      fputs_filtered ("\n", stream);
			    }
			}
		      print_spaces_filtered (level + 4, stream);
		      fputs_filtered ("ESAC", stream);
		    }
		  else
		    chill_print_type (field_type,
				      TYPE_FIELD_NAME (type, i),
				      stream, show - 1, level + 4);
		  if (i < (len - 1))
		    {
		      fputs_filtered (",", stream);
		    }
		  fputs_filtered ("\n", stream);
		}
	    }
	  fprintfi_filtered (level, stream, ")");
	}
      break;

    case TYPE_CODE_RANGE:
      {
	struct type *target = TYPE_TARGET_TYPE (type);
	if (target && TYPE_NAME (target))
	  fputs_filtered (TYPE_NAME (target), stream);
	else
	  fputs_filtered ("RANGE", stream);
	if (target == NULL)
	  target = builtin_type_long;
	fputs_filtered (" (", stream);
	print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
	fputs_filtered (":", stream);
	print_type_scalar (target, TYPE_HIGH_BOUND (type), stream);
	fputs_filtered (")", stream);
      }
      break;

    case TYPE_CODE_ENUM:
      {
	register int lastval = 0;
	fprintf_filtered (stream, "SET (");
	len = TYPE_NFIELDS (type);
	for (i = 0; i < len; i++)
	  {
	    QUIT;
	    if (i)
	      fprintf_filtered (stream, ", ");
	    wrap_here ("    ");
	    fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
	    if (lastval != TYPE_FIELD_BITPOS (type, i))
	      {
		fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
		lastval = TYPE_FIELD_BITPOS (type, i);
	      }
	    lastval++;
	  }
	fprintf_filtered (stream, ")");
      }
      break;

    case TYPE_CODE_VOID:
    case TYPE_CODE_UNDEF:
    case TYPE_CODE_ERROR:
    case TYPE_CODE_UNION:
    case TYPE_CODE_METHOD:
      error ("missing language support in chill_type_print_base");
      break;

    default:

      /* Handle types not explicitly handled by the other cases,
         such as fundamental types.  For these, just print whatever
         the type name is, as recorded in the type itself.  If there
         is no type name, then complain. */

      if (TYPE_NAME (type) != NULL)
	{
	  fputs_filtered (TYPE_NAME (type), stream);
	}
      else
	{
	  error ("Unrecognized type code (%d) in symbol table.",
		 TYPE_CODE (type));
	}
      break;
    }
}
static void
initialize_tdesc_powerpc_64 (void)
{
  struct target_desc *result = allocate_target_description ();
  struct tdesc_feature *feature;
  struct type *field_type, *type;

  set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));

  feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
  tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "pc", 64, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "msr", 65, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32");
  tdesc_create_reg (feature, "lr", 67, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "ctr", 68, 1, NULL, 64, "uint64");
  tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32");

  feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu");
  tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double");
  tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int");

  feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
  field_type = tdesc_named_type (feature, "ieee_single");
  type = init_vector_type (field_type, 4);
  TYPE_NAME (type) = xstrdup ("v4f");
  tdesc_record_type (feature, type);

  field_type = tdesc_named_type (feature, "int32");
  type = init_vector_type (field_type, 4);
  TYPE_NAME (type) = xstrdup ("v4i32");
  tdesc_record_type (feature, type);

  field_type = tdesc_named_type (feature, "int16");
  type = init_vector_type (field_type, 8);
  TYPE_NAME (type) = xstrdup ("v8i16");
  tdesc_record_type (feature, type);

  field_type = tdesc_named_type (feature, "int8");
  type = init_vector_type (field_type, 16);
  TYPE_NAME (type) = xstrdup ("v16i8");
  tdesc_record_type (feature, type);

  type = init_composite_type (NULL, TYPE_CODE_UNION);
  TYPE_NAME (type) = xstrdup ("vec128");
  field_type = tdesc_named_type (feature, "uint128");
  append_composite_type_field (type, xstrdup ("uint128"), field_type);
  field_type = tdesc_named_type (feature, "v4f");
  append_composite_type_field (type, xstrdup ("v4_float"), field_type);
  field_type = tdesc_named_type (feature, "v4i32");
  append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
  field_type = tdesc_named_type (feature, "v8i16");
  append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
  field_type = tdesc_named_type (feature, "v16i8");
  append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
  TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
  tdesc_record_type (feature, type);

  tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr2", 73, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr3", 74, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr4", 75, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr5", 76, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr6", 77, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr7", 78, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr8", 79, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr9", 80, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr10", 81, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr11", 82, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr12", 83, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr13", 84, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr14", 85, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr15", 86, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr16", 87, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr17", 88, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr18", 89, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr19", 90, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr20", 91, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr21", 92, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr22", 93, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr23", 94, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr24", 95, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr25", 96, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr26", 97, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr27", 98, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr28", 99, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr29", 100, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr30", 101, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vr31", 102, 1, NULL, 128, "vec128");
  tdesc_create_reg (feature, "vscr", 103, 1, "vector", 32, "int");
  tdesc_create_reg (feature, "vrsave", 104, 1, "vector", 32, "int");

  tdesc_powerpc_64 = result;
}