* eval.c (evaluate_subexp_standard): Assert that there is at
[binutils-gdb.git] / gdb / eval.c
index cf3e8765d38b11d16ec930c4dce59c5c7dabb764..ccb6b742b618b6a04f8840be23a34b7fc5cf4be4 100644 (file)
 #include "exceptions.h"
 #include "regcache.h"
 #include "user-regs.h"
+#include "valprint.h"
 
 #include "gdb_assert.h"
 
 /* This is defined in valops.c */
 extern int overload_resolution;
 
-/* JYG: lookup rtti type of STRUCTOP_PTR when this is set to continue
-   on with successful lookup for member/method of the rtti type. */
-extern int objectprint;
-
 /* Prototypes for local functions. */
 
 static struct value *evaluate_subexp_for_sizeof (struct expression *, int *);
@@ -1628,8 +1625,10 @@ evaluate_subexp_standard (struct type *expect_type,
         struct type *type = value_type (arg1);
         struct type *real_type;
         int full, top, using_enc;
-        
-        if (objectprint && TYPE_TARGET_TYPE(type) &&
+       struct value_print_options opts;
+
+       get_user_print_options (&opts);
+        if (opts.objectprint && TYPE_TARGET_TYPE(type) &&
             (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
           {
             real_type = value_rtti_target_type (arg1, &full, &top, &using_enc);
@@ -1977,6 +1976,8 @@ evaluate_subexp_standard (struct type *expect_type,
        if (nargs != ndimensions)
          error (_("Wrong number of subscripts"));
 
+       gdb_assert (nargs > 0);
+
        /* Now that we know we have a legal array subscript expression 
           let us actually find out where this element exists in the array. */