/* 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.
}
-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;
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;
if (full)
*full=1;
}
- if (using_enc)
- *using_enc=using_enclosing;
return rtti_type;
}
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;
}
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);
}