* solib-svr4.c (svr4_truncate_ptr): New function.
[deliverable/binutils-gdb.git] / gdb / gnu-v3-abi.c
index 93bc9950ee873ec123785b74b638aa2f253fa3f5..ae2104d59c4720ecfe3ba6a79070e20e7dd65cba 100644 (file)
@@ -239,7 +239,8 @@ gnuv3_rtti_type (struct value *value,
      type_info object itself to get the class name.  But this way
      should work just as well, and doesn't read target memory.  */
   vtable_symbol_name = SYMBOL_DEMANGLED_NAME (vtable_symbol);
-  if (strncmp (vtable_symbol_name, "vtable for ", 11))
+  if (vtable_symbol_name == NULL
+      || strncmp (vtable_symbol_name, "vtable for ", 11))
     error ("can't find linker symbol for virtual table for `%s' value",
            TYPE_NAME (value_type));
   class_name = vtable_symbol_name + 11;
@@ -317,7 +318,9 @@ gnuv3_virtual_fn_field (struct value **value_p,
   /* Now value is an object of the appropriate base type.  Fetch its
      virtual table.  */
   /* It might be possible to do this cast at the same time as the above.
-     Does multiple inheritance affect this?  */
+     Does multiple inheritance affect this?
+     Can this even trigger, or is TYPE_VPTR_BASETYPE idempotent?
+  */
   if (TYPE_VPTR_BASETYPE (vfn_base) != vfn_base)
     value = value_cast (TYPE_VPTR_BASETYPE (vfn_base), value);
   vtable_address
@@ -336,6 +339,10 @@ gnuv3_virtual_fn_field (struct value **value_p,
   vfn = value_cast (lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j)),
                     vfn);
 
+  /* Is (type)value always numerically the same as (vfn_base)value?
+     If so we can spare this cast and use one of the ones above.  */
+  *value_p = value_addr (value_cast (type, *value_p));
+
   return vfn;
 }
 
This page took 0.023673 seconds and 4 git commands to generate.