* ada-lang.c (ada_evaluate_subexp): Improve handling of integer

type dereferencing.
This commit is contained in:
Joel Brobecker 2008-11-15 18:27:27 +00:00
parent d4732f7c88
commit 9696763752
2 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2008-11-15 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_evaluate_subexp): Improve handling of integer
type dereferencing.
2008-11-15 Daniel Jacobowitz <dan@codesourcery.com> 2008-11-15 Daniel Jacobowitz <dan@codesourcery.com>
* NEWS: Mention sparc64-linux-gnu gdbserver support. * NEWS: Mention sparc64-linux-gnu gdbserver support.

View File

@ -9204,12 +9204,18 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */ arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
type = ada_check_typedef (value_type (arg1)); type = ada_check_typedef (value_type (arg1));
if (TYPE_CODE (type) == TYPE_CODE_INT && expect_type != NULL) if (TYPE_CODE (type) == TYPE_CODE_INT)
/* GDB allows dereferencing an int. We give it the expected /* GDB allows dereferencing an int. If we were given
type (which will be set in the case of a coercion or the expect_type, then use that as the target type.
qualification). */ Otherwise, assume that the target type is an int. */
return ada_value_ind (value_cast (lookup_pointer_type (expect_type), {
arg1)); 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)) if (ada_is_array_descriptor_type (type))
/* GDB allows dereferencing GNAT array descriptors. */ /* GDB allows dereferencing GNAT array descriptors. */