aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 6ec2e9d..8089a32 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10642,10 +10642,17 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
therefore already coerced to a simple array. Nothing further
to do. */
;
- else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_REF
- || (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY
- && VALUE_LVAL (argvec[0]) == lval_memory))
- argvec[0] = value_addr (argvec[0]);
+ else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_REF)
+ {
+ /* Make sure we dereference references so that all the code below
+ feels like it's really handling the referenced value. Wrapping
+ types (for alignment) may be there, so make sure we strip them as
+ well. */
+ argvec[0] = ada_to_fixed_value (coerce_ref (argvec[0]));
+ }
+ else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY
+ && VALUE_LVAL (argvec[0]) == lval_memory)
+ argvec[0] = value_addr (argvec[0]);
type = ada_check_typedef (value_type (argvec[0]));