aboutsummaryrefslogtreecommitdiff
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
commit72d5681a84985b3eef4cb6bf613026c151f4a5b4 (patch)
tree8352c394eec54f9b0f03318980b1973bc1c15656 /gdb/ada-exp.y
parent30b0e2d89f2dd2a37c2d459fa8007306e67c8e2e (diff)
downloadgdb-72d5681a84985b3eef4cb6bf613026c151f4a5b4.zip
gdb-72d5681a84985b3eef4cb6bf613026c151f4a5b4.tar.gz
gdb-72d5681a84985b3eef4cb6bf613026c151f4a5b4.tar.bz2
* 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 9e91817..73bd120 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)
{