+2004-09-18 Paul N. Hilfinger <hilfinger@gnat.com>
+
+ * ada-exp.y (type_int): New function to add layer of abstraction
+ around references to expression types.
+ (type_long): Ditto.
+ (type_long_long): Ditto.
+ (type_float): Ditto.
+ (type_double): Ditto.
+ (type_long_double): Ditto.
+ (type_char): Ditto.
+ (type_system_address): Ditto.
+ (simple_exp): Use type_* functions in place of builtin_*
+ variables.
+ (exp): Ditto.
+ (write_var_from_name): Ditto.
+ (write_object_renaming): Ditto.
+ * ada-lang.c (ada_create_fundamental_type): Remove redundant
+ declaration.
+ (build_ada_types): Remove, replacing with...
+ (ada_language_arch_info): New function to initialize primitive
+ type vector in language_arch_info.
+ (ada_array_length): Remove use of builtin_type_ada_int.
+ (value_pos_atr): Ditto.
+ (ada_evaluate_subexp): Ditto.
+ (builtin_type_ada_int, builtin_type_ada_short, builtin_type_ada_long,
+ builtin_type_ada_long_long, builtin_type_ada_char,
+ builtin_type_ada_float, builtin_type_ada_double,
+ builtin_type_ada_long_double, builtin_type_ada_natural,
+ builtin_type_ada_positive, builtin_type_ada_system_address): Remove.
+ (ada_builtin_types): Remove.
+ (ada_language_defn): Remove entries for la_builtin_type_vector and
+ string_char_type and use ada_language_arch_info.
+ (_initialize_ada_language): Do type-vector initialization along
+ the lines of c-lang.c.
+ (ada_create_fundamental_type): Break up line.
+ (ada_dump_symtab): Remove unused function.
+ (enum ada_primitive_types): Define.
+ * ada-lang.h (builtin_type_ada_int, builtin_type_ada_short,
+ builtin_type_ada_long,builtin_type_ada_long_long,builtin_type_ada_char,
+ builtin_type_ada_float, builtin_type_ada_double,
+ builtin_type_ada_long_double, builtin_type_ada_natural,
+ builtin_type_ada_positive, builtin_type_ada_system_address): Remove.
+ * ada-lex.l: Use type_* functions in place of builtin_* variables.
+ (processInt): Ditto.
+ (processReal): Ditto.
+ (name_lookup): Ditto.
+ * ada-typeprint.c (print_range): Use builtin_type_int, not
+ builtin_type_ada_int.
+
2004-09-18 Mark Kettenis <kettenis@gnu.org>
* i386-tdep.c (i386_register_name): Rename regno to regnum.
standard curses on HP-UX.
* configure: Regenerated.
-2004-09-18 Paul N. Hilfinger <hilfingr@otisco.mckusick.com>
+2004-09-18 Paul N. Hilfinger <hilfinger@gnat.com>
* ada-lang.c: (ada_main_name, ada_value_slice_ptr, ada_value_slice,
ada_breakpoint_rewrite, ada_template_to_fixed_record_type_1):
static void write_var_from_name (struct block *, struct name_info);
static LONGEST convert_char_literal (struct type *, LONGEST);
+
+static struct type *type_int (void);
+
+static struct type *type_long (void);
+
+static struct type *type_long_long (void);
+
+static struct type *type_float (void);
+
+static struct type *type_double (void);
+
+static struct type *type_long_double (void);
+
+static struct type *type_char (void);
+
+static struct type *type_system_address (void);
%}
%union
| simple_exp TICK_ADDRESS
{ write_exp_elt_opcode (UNOP_ADDR);
write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type (builtin_type_ada_system_address);
+ write_exp_elt_type (type_system_address ());
write_exp_elt_opcode (UNOP_CAST);
}
| simple_exp TICK_FIRST tick_arglist
- { write_int ($3, builtin_type_int);
+ { write_int ($3, type_int ());
write_exp_elt_opcode (OP_ATR_FIRST); }
| simple_exp TICK_LAST tick_arglist
- { write_int ($3, builtin_type_int);
+ { write_int ($3, type_int ());
write_exp_elt_opcode (OP_ATR_LAST); }
| simple_exp TICK_LENGTH tick_arglist
- { write_int ($3, builtin_type_int);
+ { write_int ($3, type_int ());
write_exp_elt_opcode (OP_ATR_LENGTH); }
| simple_exp TICK_SIZE
{ write_exp_elt_opcode (OP_ATR_SIZE); }
| opt_type_prefix TICK_POS '(' exp ')'
{ write_exp_elt_opcode (OP_ATR_POS); }
| type_prefix TICK_FIRST tick_arglist
- { write_int ($3, builtin_type_int);
+ { write_int ($3, type_int ());
write_exp_elt_opcode (OP_ATR_FIRST); }
| type_prefix TICK_LAST tick_arglist
- { write_int ($3, builtin_type_int);
+ { write_int ($3, type_int ());
write_exp_elt_opcode (OP_ATR_LAST); }
| type_prefix TICK_LENGTH tick_arglist
- { write_int ($3, builtin_type_int);
+ { write_int ($3, type_int ());
write_exp_elt_opcode (OP_ATR_LENGTH); }
| type_prefix TICK_VAL '(' exp ')'
{ write_exp_elt_opcode (OP_ATR_VAL); }
;
exp : NULL_PTR
- { write_int (0, builtin_type_int); }
+ { write_int (0, type_int ()); }
;
exp : STRING
if (name.msym != NULL)
{
write_exp_msymbol (name.msym,
- lookup_function_type (builtin_type_int),
- builtin_type_int);
+ lookup_function_type (type_int ()),
+ type_int ());
}
else if (name.sym == NULL)
{
goto BadEncoding;
suffix = next;
write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_ada_int);
+ write_exp_elt_type (type_int ());
write_exp_elt_longcst ((LONGEST) val);
write_exp_elt_opcode (OP_LONG);
}
return val;
}
+static struct type *
+type_int (void)
+{
+ return builtin_type (current_gdbarch)->builtin_int;
+}
+
+static struct type *
+type_long (void)
+{
+ return builtin_type (current_gdbarch)->builtin_long;
+}
+
+static struct type *
+type_long_long (void)
+{
+ return builtin_type (current_gdbarch)->builtin_long_long;
+}
+
+static struct type *
+type_float (void)
+{
+ return builtin_type (current_gdbarch)->builtin_float;
+}
+
+static struct type *
+type_double (void)
+{
+ return builtin_type (current_gdbarch)->builtin_double;
+}
+
+static struct type *
+type_long_double (void)
+{
+ return builtin_type (current_gdbarch)->builtin_long_double;
+}
+
+static struct type *
+type_char (void)
+{
+ return language_string_char_type (current_language, current_gdbarch);
+}
+
+static struct type *
+type_system_address (void)
+{
+ struct type *type
+ = language_lookup_primitive_type_by_name (current_language,
+ current_gdbarch,
+ "system__address");
+ return type != NULL ? type : lookup_pointer_type (builtin_type_void);
+}
+
void
_initialize_ada_exp (void)
{
static struct value *evaluate_subexp_type (struct expression *, int *);
-static struct type *ada_create_fundamental_type (struct objfile *, int);
-
static int is_dynamic_field (struct type *, int);
static struct type *to_fixed_variant_branch_type (struct type *, char *,
static void error_breakpoint_runtime_sym_not_found (const char *err_desc);
static int is_runtime_sym_defined (const char *name, int allow_tramp);
+
+static void ada_language_arch_info (struct gdbarch *,
+ struct language_arch_info *);
+
+static void check_size (const struct type *);
\f
}
else
return
- value_from_longest (builtin_type_ada_int,
+ value_from_longest (builtin_type_int,
value_as_long (desc_one_bound (desc_bounds (arr),
n, 1))
- value_as_long (desc_one_bound (desc_bounds (arr),
static struct value *
value_pos_atr (struct value *arg)
{
- return value_from_longest (builtin_type_ada_int, pos_atr (arg));
+ return value_from_longest (builtin_type_int, pos_atr (arg));
}
/* Evaluate the TYPE'VAL attribute applied to ARG. */
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (builtin_type_ada_int, not_lval);
+ return value_zero (builtin_type_int, not_lval);
else
return value_pos_atr (arg1);
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (builtin_type_ada_int, not_lval);
+ return value_zero (builtin_type_int, not_lval);
else
- return value_from_longest (builtin_type_ada_int,
+ return value_from_longest (builtin_type_int,
TARGET_CHAR_BIT
* TYPE_LENGTH (VALUE_TYPE (arg1)));
0, "integer", objfile);
break;
case FT_SIGNED_INTEGER:
- type = init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, 0, "integer", objfile); /* FIXME -fnf */
+ type = init_type (TYPE_CODE_INT, TARGET_INT_BIT /
+ TARGET_CHAR_BIT,
+ 0, "integer", objfile); /* FIXME -fnf */
break;
case FT_UNSIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
return (type);
}
-struct type *builtin_type_ada_int;
-struct type *builtin_type_ada_short;
-struct type *builtin_type_ada_long;
-struct type *builtin_type_ada_long_long;
-struct type *builtin_type_ada_char;
-struct type *builtin_type_ada_float;
-struct type *builtin_type_ada_double;
-struct type *builtin_type_ada_long_double;
-struct type *builtin_type_ada_natural;
-struct type *builtin_type_ada_positive;
-struct type *builtin_type_ada_system_address;
-
-struct type **const (ada_builtin_types[]) =
-{
- &builtin_type_ada_int,
- &builtin_type_ada_long,
- &builtin_type_ada_short,
- &builtin_type_ada_char,
- &builtin_type_ada_float,
- &builtin_type_ada_double,
- &builtin_type_ada_long_long,
- &builtin_type_ada_long_double,
- &builtin_type_ada_natural, &builtin_type_ada_positive,
- /* The following types are carried over from C for convenience. */
-&builtin_type_int,
- &builtin_type_long,
- &builtin_type_short,
- &builtin_type_char,
- &builtin_type_float,
- &builtin_type_double,
- &builtin_type_long_long,
- &builtin_type_void,
- &builtin_type_signed_char,
- &builtin_type_unsigned_char,
- &builtin_type_unsigned_short,
- &builtin_type_unsigned_int,
- &builtin_type_unsigned_long,
- &builtin_type_unsigned_long_long,
- &builtin_type_long_double,
- &builtin_type_complex, &builtin_type_double_complex, 0};
+enum ada_primitive_types {
+ ada_primitive_type_int,
+ ada_primitive_type_long,
+ ada_primitive_type_short,
+ ada_primitive_type_char,
+ ada_primitive_type_float,
+ ada_primitive_type_double,
+ ada_primitive_type_void,
+ ada_primitive_type_long_long,
+ ada_primitive_type_long_double,
+ ada_primitive_type_natural,
+ ada_primitive_type_positive,
+ ada_primitive_type_system_address,
+ nr_ada_primitive_types
+};
static void
-build_ada_types (struct gdbarch *current_gdbarch)
-{
- builtin_type_ada_int =
+ada_language_arch_info (struct gdbarch *current_gdbarch,
+ struct language_arch_info *lai)
+{
+ const struct builtin_type *builtin = builtin_type (current_gdbarch);
+ lai->primitive_type_vector
+ = GDBARCH_OBSTACK_CALLOC (current_gdbarch, nr_ada_primitive_types + 1,
+ struct type *);
+ lai->primitive_type_vector [ada_primitive_type_int] =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "integer", (struct objfile *) NULL);
- builtin_type_ada_long =
+ lai->primitive_type_vector [ada_primitive_type_long] =
init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
0, "long_integer", (struct objfile *) NULL);
- builtin_type_ada_short =
+ lai->primitive_type_vector [ada_primitive_type_short] =
init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
0, "short_integer", (struct objfile *) NULL);
- builtin_type_ada_char =
+ lai->primitive_type_vector [ada_primitive_type_char] =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0, "character", (struct objfile *) NULL);
- builtin_type_ada_float =
+ lai->string_char_type = builtin->builtin_char;
+ lai->primitive_type_vector [ada_primitive_type_float] =
init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
0, "float", (struct objfile *) NULL);
- builtin_type_ada_double =
+ lai->primitive_type_vector [ada_primitive_type_double] =
init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "long_float", (struct objfile *) NULL);
- builtin_type_ada_long_long =
+ lai->primitive_type_vector [ada_primitive_type_long_long] =
init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
0, "long_long_integer", (struct objfile *) NULL);
- builtin_type_ada_long_double =
+ lai->primitive_type_vector [ada_primitive_type_long_double] =
init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "long_long_float", (struct objfile *) NULL);
- builtin_type_ada_natural =
+ lai->primitive_type_vector [ada_primitive_type_natural] =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "natural", (struct objfile *) NULL);
- builtin_type_ada_positive =
+ lai->primitive_type_vector [ada_primitive_type_positive] =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "positive", (struct objfile *) NULL);
+ lai->primitive_type_vector [ada_primitive_type_void] = builtin->builtin_void;
-
- builtin_type_ada_system_address =
+ lai->primitive_type_vector [ada_primitive_type_system_address] =
lookup_pointer_type (init_type (TYPE_CODE_VOID, 1, 0, "void",
(struct objfile *) NULL));
- TYPE_NAME (builtin_type_ada_system_address) = "system__address";
+ TYPE_NAME (lai->primitive_type_vector [ada_primitive_type_system_address])
+ = "system__address";
}
-
\f
/* Language vector */
const struct language_defn ada_language_defn = {
"ada", /* Language name */
language_ada,
- ada_builtin_types,
+ NULL,
range_check_off,
type_check_off,
case_sensitive_on, /* Yes, Ada is case-insensitive, but
ada_op_print_tab, /* expression operators for printing */
0, /* c-style arrays */
1, /* String lower bound */
- &builtin_type_ada_char,
+ NULL,
ada_get_gdb_completer_word_break_characters,
+ ada_language_arch_info,
#ifdef GNAT_GDB
ada_translate_error_message, /* Substitute Ada-specific terminology
in errors and warnings. */
void
_initialize_ada_language (void)
{
-
- build_ada_types (current_gdbarch);
- gdbarch_data_register_post_init (build_ada_types);
add_language (&ada_language_defn);
varsize_limit = 65536;