2003-10-06 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / gnu-v2-abi.c
index 2b086c57f5eacfde3c22d727b1583070ed6c66c0..2234d3bf8ef34c382901cf2010fc2b6f5a4c0234 100644 (file)
@@ -1,6 +1,8 @@
 /* Abstraction of GNU v2 abi.
+
+   Copyright 2001, 2003 Free Software Foundation, Inc.
+
    Contributed by Daniel Berlin <dberlin@redhat.com>
-   Copyright 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -182,14 +184,13 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
 }
 
 
-struct type *
+static struct type *
 gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
 {
   struct type *known_type;
   struct type *rtti_type;
   CORE_ADDR coreptr;
   struct value *vp;
-  int using_enclosing = 0;
   long top_offset = 0;
   char rtti_type_name[256];
   CORE_ADDR vtbl;
@@ -244,30 +245,12 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
   if (VALUE_ADDRESS (value_field (v, TYPE_VPTR_FIELDNO (known_type))) == 0)
     return NULL;
 
-  /*
-    If we are enclosed by something that isn't us, adjust the
-    address properly and set using_enclosing.
-  */
-  if (VALUE_ENCLOSING_TYPE(v) != VALUE_TYPE(v))
-    {
-      struct value *tempval;
-      int bitpos = TYPE_BASECLASS_BITPOS (known_type,
-                                          TYPE_VPTR_FIELDNO (known_type));
-      tempval=value_field (v, TYPE_VPTR_FIELDNO(known_type));
-      VALUE_ADDRESS(tempval) += bitpos / 8;
-      vtbl=value_as_address (tempval);
-      using_enclosing=1;
-    }
-  else
-    {
-      vtbl=value_as_address(value_field(v,TYPE_VPTR_FIELDNO(known_type)));
-      using_enclosing=0;
-    }
+  vtbl=value_as_address(value_field(v,TYPE_VPTR_FIELDNO(known_type)));
 
   /* Try to find a symbol that is the vtable */
   minsym=lookup_minimal_symbol_by_pc(vtbl);
   if (minsym==NULL
-      || (demangled_name=SYMBOL_NAME(minsym))==NULL
+      || (demangled_name=DEPRECATED_SYMBOL_NAME (minsym))==NULL
       || !is_vtable_name (demangled_name))
     return NULL;
 
@@ -304,8 +287,6 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
       if (full)
         *full=1;
     }
-  if (using_enc)
-    *using_enc=using_enclosing;
 
   return rtti_type;
 }
@@ -350,8 +331,8 @@ vb_match (struct type *type, int index, struct type *basetype)
 
   if (TYPE_NAME (basetype) != NULL
       && TYPE_NAME (TYPE_TARGET_TYPE (fieldtype)) != NULL
-      && STREQ (TYPE_NAME (basetype),
-               TYPE_NAME (TYPE_TARGET_TYPE (fieldtype))))
+      && strcmp (TYPE_NAME (basetype),
+                TYPE_NAME (TYPE_TARGET_TYPE (fieldtype))) == 0)
     return 1;
   return 0;
 }
@@ -373,8 +354,8 @@ gnuv2_baseclass_offset (struct type *type, int index, char *valaddr,
   if (BASETYPE_VIA_VIRTUAL (type, index))
     {
       /* Must hunt for the pointer to this virtual baseclass.  */
-      register int i, len = TYPE_NFIELDS (type);
-      register int n_baseclasses = TYPE_N_BASECLASSES (type);
+      int i, len = TYPE_NFIELDS (type);
+      int n_baseclasses = TYPE_N_BASECLASSES (type);
 
       /* First look for the virtual baseclass pointer
          in the fields.  */
@@ -420,10 +401,12 @@ init_gnuv2_ops (void)
   gnu_v2_abi_ops.baseclass_offset = gnuv2_baseclass_offset;
 }
 
+extern initialize_file_ftype _initialize_gnu_v2_abi; /* -Wmissing-prototypes */
+
 void
 _initialize_gnu_v2_abi (void)
 {
   init_gnuv2_ops ();
-  register_cp_abi (gnu_v2_abi_ops);
-  switch_to_cp_abi ("gnu-v2");
+  register_cp_abi (&gnu_v2_abi_ops);
+  set_cp_abi_as_auto_default (gnu_v2_abi_ops.shortname);
 }
This page took 0.026366 seconds and 4 git commands to generate.