summaryrefslogtreecommitdiff
path: root/gdb/ada-exp.y
diff options
context:
space:
mode:
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)
{