/* Support for printing Ada types for GDB, the GNU debugger.
- Copyright (C) 1986, 1988, 1989, 1991, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1986, 1988, 1989, 1991, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "gdb_obstack.h"
}
}
-
-/* Print a description of a type in the format of a
- typedef for the current language.
- NEW is the new name for a type TYPE. */
-
-void
-ada_typedef_print (struct type *type, struct symbol *new,
- struct ui_file *stream)
-{
- /* XXX: type_sprint */
- fprintf_filtered (stream, "type %.*s is ",
- ada_name_prefix_len (SYMBOL_PRINT_NAME (new)),
- SYMBOL_PRINT_NAME (new));
- type_print (type, "", stream, 1);
-}
-
/* Print range type TYPE on STREAM. */
static void
case TYPE_CODE_ENUM:
break;
default:
- target_type = builtin_type_int;
+ target_type = builtin_type_int32;
break;
}
/* We extract the range type bounds respectively from the first element
and the last element of the type->fields array */
const LONGEST lower_bound = (LONGEST) TYPE_LOW_BOUND (type);
- const LONGEST upper_bound =
- (LONGEST) TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1);
+ const LONGEST upper_bound = (TYPE_CODE (type) == TYPE_CODE_RANGE
+ ? (LONGEST) TYPE_HIGH_BOUND (type)
+ : (LONGEST) TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1));
ada_print_scalar (target_type, lower_bound, stream);
fprintf_filtered (stream, " .. ");
the upper bound of the 0 .. -1 range types to be printed as
a very large unsigned number instead of -1.
To workaround this stabs deficiency, we replace the TYPE by
- builtin_type_long when we detect that the bound is negative,
+ builtin_type_int32 when we detect that the bound is negative,
and the type is a TYPE_CODE_INT. The bound is negative when
'm' is the last character of the number scanned in BOUNDS. */
if (bounds[*n - 1] == 'm' && TYPE_CODE (type) == TYPE_CODE_INT)
- type = builtin_type_long;
+ type = builtin_type_int32;
ada_print_scalar (type, B, stream);
if (bounds[*n] == '_')
*n += 2;
char *subtype_info;
if (raw_type == NULL)
- base_type = builtin_type_int;
+ base_type = builtin_type_int32;
else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (raw_type);
else
int bitsize;
int n_indices;
+ if (ada_is_packed_array_type (type))
+ type = ada_coerce_to_simple_array_type (type);
+
bitsize = 0;
fprintf_filtered (stream, "array (");
+ if (type == NULL)
+ {
+ fprintf_filtered (stream, _("<undecipherable array type>"));
+ return;
+ }
+
n_indices = -1;
if (show < 0)
fprintf_filtered (stream, "...");
else
{
- if (ada_is_packed_array_type (type))
- type = ada_coerce_to_simple_array_type (type);
- if (type == NULL)
- {
- fprintf_filtered (stream, _("<undecipherable array type>"));
- return;
- }
if (ada_is_simple_array_type (type))
{
struct type *range_desc_type =
flds = 0;
len = TYPE_NFIELDS (type);
- if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0)
+ if (len == 0 && TYPE_STUB (type))
return -1;
for (i = 0; i < len; i += 1)
int show, int level)
{
struct type *type = ada_check_typedef (ada_get_base_type (type0));
- char *type_name = decoded_type_name (type);
+ char *type_name = decoded_type_name (type0);
int is_var_decl = (varstring != NULL && varstring[0] != '\0');
if (type == NULL)
if (ada_is_aligner_type (type))
ada_print_type (ada_aligned_type (type), "", stream, show, level);
else if (ada_is_packed_array_type (type))
- print_array_type (type, stream, show, level);
+ {
+ if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ {
+ fprintf_filtered (stream, "access ");
+ print_array_type (TYPE_TARGET_TYPE (type), stream, show, level);
+ }
+ else
+ {
+ print_array_type (type, stream, show, level);
+ }
+ }
else
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
print_array_type (type, stream, show, level);
break;
+ case TYPE_CODE_BOOL:
+ fprintf_filtered (stream, "(false, true)");
+ break;
case TYPE_CODE_INT:
if (ada_is_fixed_point_type (type))
print_fixed_point_type (type, stream);