Fix for PR gdb/209, PR gdb/156:
[deliverable/binutils-gdb.git] / gdb / gnu-v3-abi.c
index 1bd4ce68b98c8da204894972913b22faff8226f3..bffdca56b95a759d769fe4a1123b0428ece259ab 100644 (file)
@@ -23,8 +23,9 @@
 #include "value.h"
 #include "cp-abi.h"
 #include "demangle.h"
+#include "gdb_assert.h"
 
-struct cp_abi_ops gnu_v3_abi_ops;
+static struct cp_abi_ops gnu_v3_abi_ops;
 
 static int
 gnuv3_is_vtable_name (const char *name)
@@ -76,7 +77,7 @@ gnuv3_is_operator_name (const char *name)
    vtable_type_gdbarch_data is a gdbarch per-architecture data pointer
    which refers to the struct type * for this structure, laid out
    appropriately for the architecture.  */
-struct gdbarch_data *vtable_type_gdbarch_data;
+static struct gdbarch_data *vtable_type_gdbarch_data;
 
 
 /* Human-readable names for the numbers of the fields above.  */
@@ -156,8 +157,7 @@ build_gdb_vtable_type (struct gdbarch *arch)
   field++;
 
   /* We assumed in the allocation above that there were four fields.  */
-  if (field != field_list + 4)
-    abort ();
+  gdb_assert (field == (field_list + 4));
 
   t = init_type (TYPE_CODE_STRUCT, offset, 0, 0, 0);
   TYPE_NFIELDS (t) = field - field_list;
@@ -209,7 +209,7 @@ gnuv3_rtti_type (struct value *value,
   /* Fetch VALUE's virtual table pointer, and tweak it to point at
      an instance of our imaginary gdb_gnu_v3_abi_vtable structure.   */
   vtable_address
-    = value_as_pointer (value_field (value, TYPE_VPTR_FIELDNO (value_type)));
+    = value_as_address (value_field (value, TYPE_VPTR_FIELDNO (value_type)));
   vtable = value_at_lazy (vtable_type,
                           vtable_address - vtable_address_point_offset (),
                           VALUE_BFD_SECTION (value));
@@ -311,7 +311,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
   /* Now value is an object of the appropriate base type.  Fetch its
      virtual table.  */
   vtable_address
-    = value_as_pointer (value_field (value, TYPE_VPTR_FIELDNO (vfn_base)));
+    = value_as_address (value_field (value, TYPE_VPTR_FIELDNO (vfn_base)));
   vtable = value_at_lazy (vtable_type,
                           vtable_address - vtable_address_point_offset (),
                           VALUE_BFD_SECTION (value));
This page took 0.024427 seconds and 4 git commands to generate.