summaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-11-15 18:27:27 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-11-15 18:27:27 +0000
commit9696763752f28165fc6c2cdc8fdd21dda0ae7d4d (patch)
tree4a723b31d05f008680a711e2f694102e9926f25e /gdb/ada-lang.c
parentd4732f7c88f3c29788d7d9df21520c1abc66c4b3 (diff)
downloadbinutils-gdb-9696763752f28165fc6c2cdc8fdd21dda0ae7d4d.tar.gz
* ada-lang.c (ada_evaluate_subexp): Improve handling of integer
type dereferencing.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 9fdd944197f..2ccba785e06 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -9204,12 +9204,18 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
type = ada_check_typedef (value_type (arg1));
- if (TYPE_CODE (type) == TYPE_CODE_INT && expect_type != NULL)
- /* GDB allows dereferencing an int. We give it the expected
- type (which will be set in the case of a coercion or
- qualification). */
- return ada_value_ind (value_cast (lookup_pointer_type (expect_type),
- arg1));
+ if (TYPE_CODE (type) == TYPE_CODE_INT)
+ /* GDB allows dereferencing an int. If we were given
+ the expect_type, then use that as the target type.
+ Otherwise, assume that the target type is an int. */
+ {
+ if (expect_type != NULL)
+ return ada_value_ind (value_cast (lookup_pointer_type (expect_type),
+ arg1));
+ else
+ return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
+ (CORE_ADDR) value_as_address (arg1));
+ }
if (ada_is_array_descriptor_type (type))
/* GDB allows dereferencing GNAT array descriptors. */