* ada-lang.c (ada_evaluate_subexp): Improve handling of integer
authorJoel Brobecker <brobecker@gnat.com>
Sat, 15 Nov 2008 18:27:27 +0000 (18:27 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Sat, 15 Nov 2008 18:27:27 +0000 (18:27 +0000)
type dereferencing.

gdb/ChangeLog
gdb/ada-lang.c

index 811a760c76f712975381942bb2c4bd5f0cc337b8..36d6592e8aad0757d64fcddd75027c235258b1fb 100644 (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>
 
        * NEWS: Mention sparc64-linux-gnu gdbserver support.
 2008-11-15  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * NEWS: Mention sparc64-linux-gnu gdbserver support.
index 9fdd944197f2cd035b4b776bea8b3e2a704e399a..2ccba785e06c9591027824c4ce80d6bc24d9ceae 100644 (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?? */
       type = ada_check_typedef (value_type (arg1));
 
       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.  */
 
       if (ada_is_array_descriptor_type (type))
         /* GDB allows dereferencing GNAT array descriptors.  */
This page took 0.031257 seconds and 4 git commands to generate.