summaryrefslogtreecommitdiff
path: root/gdb/ada-exp.y
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2004-09-18 22:23:23 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2004-09-18 22:23:23 +0000
commit60470ef19639288edbd69ec4b8aefd8031edbf0b (patch)
tree3fc9ffe05d4cb6df42d4507480d94004322691f5 /gdb/ada-exp.y
parent9699060d161ba0ce817f667add76f7aeaf726594 (diff)
downloadgdb-60470ef19639288edbd69ec4b8aefd8031edbf0b.tar.gz
* 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.
Diffstat (limited to 'gdb/ada-exp.y')
-rw-r--r--gdb/ada-exp.y90
1 files changed, 79 insertions, 11 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 9e91817febd..73bd120a48f 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -126,6 +126,22 @@ static void write_object_renaming (struct block *, struct symbol *, int);
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
@@ -426,17 +442,17 @@ simple_exp : simple_exp TICK_ACCESS
| 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); }
@@ -449,13 +465,13 @@ simple_exp : simple_exp TICK_ACCESS
| 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); }
@@ -505,7 +521,7 @@ exp : FLOAT
;
exp : NULL_PTR
- { write_int (0, builtin_type_int); }
+ { write_int (0, type_int ()); }
;
exp : STRING
@@ -666,8 +682,8 @@ write_var_from_name (struct block *orig_left_context,
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)
{
@@ -779,7 +795,7 @@ write_object_renaming (struct block *orig_left_context,
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);
}
@@ -879,6 +895,58 @@ convert_char_literal (struct type *type, LONGEST val)
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)
{