Beispiel #1
0
static void
print_range_type (struct type *raw_type, struct ui_file *stream)
{
    const char *name;
    struct type *base_type;
    const char *subtype_info;

    gdb_assert (raw_type != NULL);
    name = TYPE_NAME (raw_type);
    gdb_assert (name != NULL);

    if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
        base_type = TYPE_TARGET_TYPE (raw_type);
    else
        base_type = raw_type;

    subtype_info = strstr (name, "___XD");
    if (subtype_info == NULL)
        print_range (raw_type, stream);
    else
    {
        int prefix_len = subtype_info - name;
        char *bounds_str;
        int n;

        subtype_info += 5;
        bounds_str = strchr (subtype_info, '_');
        n = 1;

        if (*subtype_info == 'L')
        {
            print_range_bound (base_type, bounds_str, &n, stream);
            subtype_info += 1;
        }
        else
            print_dynamic_range_bound (base_type, name, prefix_len, "___L",
                                       stream);

        fprintf_filtered (stream, " .. ");

        if (*subtype_info == 'U')
            print_range_bound (base_type, bounds_str, &n, stream);
        else
            print_dynamic_range_bound (base_type, name, prefix_len, "___U",
                                       stream);
    }
}
/* Print the range type named NAME: */
static void
print_range_type_named(char *name, struct ui_file *stream)
{
  struct type *raw_type = ada_find_any_type(name);
  struct type *base_type;
  char *subtype_info;

  if (raw_type == NULL)
    base_type = builtin_type_int;
  else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
    base_type = TYPE_TARGET_TYPE (raw_type);
  else
    base_type = raw_type;

  subtype_info = strstr (name, "___XD");
  if (subtype_info == NULL && raw_type == NULL)
    fprintf_filtered (stream, "? .. ?");
  else if (subtype_info == NULL)
    print_range (raw_type, stream);
  else
    {
      int prefix_len = subtype_info - name;
      char *bounds_str;
      int n;

      subtype_info += 5;
      bounds_str = strchr (subtype_info, '_');
      n = 1;

      if (*subtype_info == 'L')
	{
	  print_range_bound (base_type, bounds_str, &n, stream);
	  subtype_info += 1;
	}
      else
	print_dynamic_range_bound (base_type, name, prefix_len, "___L",
				   stream);

      fprintf_filtered (stream, " .. ");

      if (*subtype_info == 'U')
	print_range_bound (base_type, bounds_str, &n, stream);
      else
	print_dynamic_range_bound (base_type, name, prefix_len, "___U",
				   stream);
    }
}