aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2008-08-16 09:26:25 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2008-08-16 09:26:25 +0000
commit24209737f058af510525de950de9620b3c5ecd90 (patch)
tree49fdea9de194e9e187c40c14ebf5d8876289d1de /gdb/ada-lang.c
parent9f1d54327856555cb425e78313366cc77752a967 (diff)
downloadgdb-24209737f058af510525de950de9620b3c5ecd90.zip
gdb-24209737f058af510525de950de9620b3c5ecd90.tar.gz
gdb-24209737f058af510525de950de9620b3c5ecd90.tar.bz2
(pos_atr): Account for the possibility that the argument may be a reference.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index f3f1f34..63f1a41 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7634,7 +7634,8 @@ ada_attribute_name (enum exp_opcode n)
static LONGEST
pos_atr (struct value *arg)
{
- struct type *type = value_type (arg);
+ struct value *val = coerce_ref (arg);
+ struct type *type = value_type (val);
if (!discrete_type_p (type))
error (_("'POS only defined on discrete types"));
@@ -7642,7 +7643,7 @@ pos_atr (struct value *arg)
if (TYPE_CODE (type) == TYPE_CODE_ENUM)
{
int i;
- LONGEST v = value_as_long (arg);
+ LONGEST v = value_as_long (val);
for (i = 0; i < TYPE_NFIELDS (type); i += 1)
{
@@ -7652,7 +7653,7 @@ pos_atr (struct value *arg)
error (_("enumeration value is invalid: can't find 'POS"));
}
else
- return value_as_long (arg);
+ return value_as_long (val);
}
static struct value *