/* Support for printing Ada types for GDB, the GNU debugger.
Copyright (C) 1986, 1988, 1989, 1991, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GDB.
print_dynamic_range_bound (struct type *, const char *, int,
const char *, struct ui_file *);
-static void print_range_type_named (char *, struct type *, struct ui_file *);
+static void print_range_type (struct type *, struct ui_file *);
\f
struct ui_file *stream)
{
LONGEST B;
+
if (ada_scan_number (bounds, *n, &B, n))
{
/* STABS decodes all range types which bounds are 0 .. -1 as
fprintf_filtered (stream, "?");
}
-/* Print the range type named NAME. If symbol lookup fails, fall back
- to ORIG_TYPE as base type. */
+/* Print RAW_TYPE as a range type, using any bound information
+ following the GNAT encoding (if available). */
static void
-print_range_type_named (char *name, struct type *orig_type,
- struct ui_file *stream)
+print_range_type (struct type *raw_type, struct ui_file *stream)
{
- struct type *raw_type = ada_find_any_type (name);
+ char *name;
struct type *base_type;
char *subtype_info;
- if (raw_type == NULL)
- raw_type = orig_type;
+ 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);
}
}
-/* Print representation of special VAX floating-point type TYPE on STREAM. */
-
-static void
-print_vax_floating_point_type (struct type *type, struct ui_file *stream)
-{
- fprintf_filtered (stream, "<float format %c>",
- ada_vax_float_type_suffix (type));
-}
-
/* Print simple (constrained) array type TYPE on STREAM. LEVEL is the
recursion (indentation) level, in case the element type itself has
nested structure, and SHOW is the number of levels of internal
{
if (ada_is_simple_array_type (type))
{
- struct type *range_desc_type =
- ada_find_parallel_type (type, "___XA");
+ struct type *range_desc_type;
struct type *arr_type;
+ range_desc_type = ada_find_parallel_type (type, "___XA");
+ ada_fixup_array_indexes_type (range_desc_type);
+
bitsize = 0;
if (range_desc_type == NULL)
{
else
{
int k;
+
n_indices = TYPE_NFIELDS (range_desc_type);
for (k = 0, arr_type = type;
k < n_indices;
{
if (k > 0)
fprintf_filtered (stream, ", ");
- print_range_type_named (TYPE_FIELD_NAME
- (range_desc_type, k),
- TYPE_INDEX_TYPE (arr_type), stream);
+ print_range_type (TYPE_FIELD_TYPE (range_desc_type, k),
+ stream);
if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
}
else
{
int i, i0;
+
for (i = i0 = ada_array_arity (type); i > 0; i -= 1)
fprintf_filtered (stream, "%s<>", i == i0 ? "" : ", ");
}
case 'S':
{
LONGEST W;
+
if (!ada_scan_number (name, p + 1, &W, &p))
goto Huh;
ada_print_scalar (val_type, W, stream);
case 'R':
{
LONGEST L, U;
+
if (!ada_scan_number (name, p + 1, &L, &p)
|| name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p))
goto Huh;
case TYPE_CODE_INT:
if (ada_is_fixed_point_type (type))
print_fixed_point_type (type, stream);
- else if (ada_is_vax_floating_type (type))
- print_vax_floating_point_type (type, stream);
else
{
char *name = ada_type_name (type);
+
if (!ada_is_range_type_name (name))
fprintf_filtered (stream, _("<%d-byte integer>"),
TYPE_LENGTH (type));
else
{
fprintf_filtered (stream, "range ");
- print_range_type_named (name, type, stream);
+ print_range_type (type, stream);
}
}
break;
case TYPE_CODE_RANGE:
if (ada_is_fixed_point_type (type))
print_fixed_point_type (type, stream);
- else if (ada_is_vax_floating_type (type))
- print_vax_floating_point_type (type, stream);
else if (ada_is_modular_type (type))
fprintf_filtered (stream, "mod %s",
int_string (ada_modulus (type), 10, 0, 0, 1));
break;
}
}
+
+/* Implement the la_print_typedef language method for Ada. */
+
+void
+ada_print_typedef (struct type *type, struct symbol *new_symbol,
+ struct ui_file *stream)
+{
+ type = ada_check_typedef (type);
+ ada_print_type (type, "", stream, 0, 0);
+ fprintf_filtered (stream, "\n");
+}