diff options
Diffstat (limited to 'contrib/gdb/gdb/gnu-v2-abi.c')
-rw-r--r-- | contrib/gdb/gdb/gnu-v2-abi.c | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/contrib/gdb/gdb/gnu-v2-abi.c b/contrib/gdb/gdb/gnu-v2-abi.c index 2b086c5..8cb2a7e 100644 --- a/contrib/gdb/gdb/gnu-v2-abi.c +++ b/contrib/gdb/gdb/gnu-v2-abi.c @@ -1,6 +1,8 @@ /* Abstraction of GNU v2 abi. + + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Daniel Berlin <dberlin@redhat.com> - Copyright 2001 Free Software Foundation, Inc. This file is part of GDB. @@ -28,6 +30,7 @@ #include "value.h" #include "demangle.h" #include "cp-abi.h" +#include "cp-support.h" #include <ctype.h> @@ -182,14 +185,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 +246,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; @@ -276,9 +260,9 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) *(strchr(demangled_name,' '))=0; /* Lookup the type for the name */ - rtti_type=lookup_typename(demangled_name, (struct block *)0,1); - - if (rtti_type==NULL) + /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */ + rtti_type = cp_lookup_rtti_type (demangled_name, NULL); + if (rtti_type == NULL) return NULL; if (TYPE_N_BASECLASSES(rtti_type) > 1 && full && (*full) != 1) @@ -304,8 +288,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 +332,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 +355,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 +402,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); } |