/* Abstraction of GNU v2 abi.
- Copyright 2001, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dberlin@redhat.com>
#include "value.h"
#include "demangle.h"
#include "cp-abi.h"
+#include "cp-support.h"
+#include "gnu-v2-abi.h"
#include <ctype.h>
struct cp_abi_ops gnu_v2_abi_ops;
static int vb_match (struct type *, int, struct type *);
-int gnuv2_baseclass_offset (struct type *type, int index, char *valaddr,
- CORE_ADDR address);
static enum dtor_kinds
gnuv2_is_destructor_name (const char *name)
struct type * type, int offset)
{
struct value *arg1 = *arg1p;
- struct type *type1 = check_typedef (VALUE_TYPE (arg1));
+ struct type *type1 = check_typedef (value_type (arg1));
struct type *entry_type;
{
struct value *tmp = value_cast (context, value_addr (arg1));
arg1 = value_ind (tmp);
- type1 = check_typedef (VALUE_TYPE (arg1));
+ type1 = check_typedef (value_type (arg1));
}
context = type1;
/* With older versions of g++, the vtbl field pointed to an array
of structures. Nowadays it points directly to the structure. */
- if (TYPE_CODE (VALUE_TYPE (vtbl)) == TYPE_CODE_PTR
- && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (vtbl))) == TYPE_CODE_ARRAY)
+ if (TYPE_CODE (value_type (vtbl)) == TYPE_CODE_PTR
+ && TYPE_CODE (TYPE_TARGET_TYPE (value_type (vtbl))) == TYPE_CODE_ARRAY)
{
/* Handle the case where the vtbl field points to an
array of structures. */
entry = value_ind (vtbl);
}
- entry_type = check_typedef (VALUE_TYPE (entry));
+ entry_type = check_typedef (value_type (entry));
if (TYPE_CODE (entry_type) == TYPE_CODE_STRUCT)
{
/* Move the `this' pointer according to the virtual function table. */
- VALUE_OFFSET (arg1) += value_as_long (value_field (entry, 0));
+ arg1->offset += value_as_long (value_field (entry, 0));
if (!VALUE_LAZY (arg1))
{
else
error ("I'm confused: virtual function table has bad type");
/* Reinstantiate the function pointer with the correct type. */
- VALUE_TYPE (vfn) = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j));
+ vfn->type = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j));
*arg1p = arg1;
return vfn;
*using_enc = 0;
/* Get declared type */
- known_type = VALUE_TYPE (v);
+ known_type = value_type (v);
CHECK_TYPEDEF (known_type);
/* RTTI works only or class objects */
if (TYPE_CODE (known_type) != TYPE_CODE_CLASS)
*(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)
-1 is returned on error. */
int
-gnuv2_baseclass_offset (struct type *type, int index, char *valaddr,
- CORE_ADDR address)
+gnuv2_baseclass_offset (struct type *type, int index,
+ const bfd_byte *valaddr, CORE_ADDR address)
{
struct type *basetype = TYPE_BASECLASS (type, index);