(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
/* Abstraction of GNU v2 abi.
|
2003-01-13 Andrew Cagney <ac131313@redhat.com>
* ax-gdb.c, c-valprint.c, charset.c, corefile.c: Update copyright.
* demangle.c, disasm.c, dwarf2cfi.c, dwarfread.c: Update copyright.
* elfread.c, eval.c, expprint.c, expression.h: Update copyright.
* f-typeprint.c, findvar.c, gcore.c, gdb_mbuild.sh: Update copyright.
* gdbtypes.h, gnu-v2-abi.c, inferior.h, inftarg.c: Update copyright.
* language.c, language.h, m32r-tdep.c: Update copyright.
* mn10200-tdep.c, scm-lang.c, scm-lang.h: Update copyright.
* somsolib.c, somsolib.h, symfile.c, symtab.h: Update copyright.
* thread-db.c, typeprint.c, utils.c, valarith.c: Update copyright.
* values.c, win32-nat.c, x86-64-linux-nat.c: Update copyright.
* x86-64-linux-tdep.c, z8k-tdep.c: Update copyright.
* cli/cli-decode.h, config/h8500/tm-h8500.h: Update copyright.
Index: mi/ChangeLog
2003-01-13 Andrew Cagney <ac131313@redhat.com>
* mi-cmd-env.c: Update copyright.
2003-01-14 08:49:06 +08:00
|
|
|
|
|
2003-12-05 12:25:09 +08:00
|
|
|
|
Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
|
2003-01-13 Andrew Cagney <ac131313@redhat.com>
* ax-gdb.c, c-valprint.c, charset.c, corefile.c: Update copyright.
* demangle.c, disasm.c, dwarf2cfi.c, dwarfread.c: Update copyright.
* elfread.c, eval.c, expprint.c, expression.h: Update copyright.
* f-typeprint.c, findvar.c, gcore.c, gdb_mbuild.sh: Update copyright.
* gdbtypes.h, gnu-v2-abi.c, inferior.h, inftarg.c: Update copyright.
* language.c, language.h, m32r-tdep.c: Update copyright.
* mn10200-tdep.c, scm-lang.c, scm-lang.h: Update copyright.
* somsolib.c, somsolib.h, symfile.c, symtab.h: Update copyright.
* thread-db.c, typeprint.c, utils.c, valarith.c: Update copyright.
* values.c, win32-nat.c, x86-64-linux-nat.c: Update copyright.
* x86-64-linux-tdep.c, z8k-tdep.c: Update copyright.
* cli/cli-decode.h, config/h8500/tm-h8500.h: Update copyright.
Index: mi/ChangeLog
2003-01-13 Andrew Cagney <ac131313@redhat.com>
* mi-cmd-env.c: Update copyright.
2003-01-14 08:49:06 +08:00
|
|
|
|
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
Contributed by Daniel Berlin <dberlin@redhat.com>
|
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify
|
|
|
|
|
it under the terms of the GNU General Public License as published
|
|
|
|
|
by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "gdb_string.h"
|
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
|
#include "value.h"
|
|
|
|
|
#include "demangle.h"
|
|
|
|
|
#include "cp-abi.h"
|
2003-12-05 12:25:09 +08:00
|
|
|
|
#include "cp-support.h"
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
|
|
struct cp_abi_ops gnu_v2_abi_ops;
|
|
|
|
|
|
|
|
|
|
static int vb_match (struct type *, int, struct type *);
|
2002-01-05 02:20:19 +08:00
|
|
|
|
int gnuv2_baseclass_offset (struct type *type, int index, char *valaddr,
|
|
|
|
|
CORE_ADDR address);
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
|
|
|
|
|
static enum dtor_kinds
|
|
|
|
|
gnuv2_is_destructor_name (const char *name)
|
|
|
|
|
{
|
|
|
|
|
if ((name[0] == '_' && is_cplus_marker (name[1]) && name[2] == '_')
|
|
|
|
|
|| strncmp (name, "__dt__", 6) == 0)
|
|
|
|
|
return complete_object_dtor;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static enum ctor_kinds
|
|
|
|
|
gnuv2_is_constructor_name (const char *name)
|
|
|
|
|
{
|
|
|
|
|
if ((name[0] == '_' && name[1] == '_'
|
|
|
|
|
&& (isdigit (name[2]) || strchr ("Qt", name[2])))
|
|
|
|
|
|| strncmp (name, "__ct__", 6) == 0)
|
|
|
|
|
return complete_object_ctor;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
gnuv2_is_vtable_name (const char *name)
|
|
|
|
|
{
|
|
|
|
|
return (((name)[0] == '_'
|
|
|
|
|
&& (((name)[1] == 'V' && (name)[2] == 'T')
|
|
|
|
|
|| ((name)[1] == 'v' && (name)[2] == 't'))
|
|
|
|
|
&& is_cplus_marker ((name)[3])) ||
|
|
|
|
|
((name)[0] == '_' && (name)[1] == '_'
|
|
|
|
|
&& (name)[2] == 'v' && (name)[3] == 't' && (name)[4] == '_'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
gnuv2_is_operator_name (const char *name)
|
|
|
|
|
{
|
|
|
|
|
return strncmp (name, "operator", 8) == 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return a virtual function as a value.
|
|
|
|
|
ARG1 is the object which provides the virtual function
|
|
|
|
|
table pointer. *ARG1P is side-effected in calling this function.
|
|
|
|
|
F is the list of member functions which contains the desired virtual
|
|
|
|
|
function.
|
|
|
|
|
J is an index into F which provides the desired virtual function.
|
|
|
|
|
|
|
|
|
|
TYPE is the type in which F is located. */
|
2001-10-21 09:06:25 +08:00
|
|
|
|
static struct value *
|
|
|
|
|
gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
struct type * type, int offset)
|
|
|
|
|
{
|
2001-10-21 09:06:25 +08:00
|
|
|
|
struct value *arg1 = *arg1p;
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
struct type *type1 = check_typedef (VALUE_TYPE (arg1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct type *entry_type;
|
|
|
|
|
/* First, get the virtual function table pointer. That comes
|
|
|
|
|
with a strange type, so cast it to type `pointer to long' (which
|
|
|
|
|
should serve just fine as a function type). Then, index into
|
|
|
|
|
the table, and convert final value to appropriate function type. */
|
2001-10-21 09:06:25 +08:00
|
|
|
|
struct value *entry;
|
|
|
|
|
struct value *vfn;
|
|
|
|
|
struct value *vtbl;
|
|
|
|
|
struct value *vi = value_from_longest (builtin_type_int,
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
(LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
|
|
|
|
|
struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j);
|
|
|
|
|
struct type *context;
|
|
|
|
|
if (fcontext == NULL)
|
|
|
|
|
/* We don't have an fcontext (e.g. the program was compiled with
|
|
|
|
|
g++ version 1). Try to get the vtbl from the TYPE_VPTR_BASETYPE.
|
|
|
|
|
This won't work right for multiple inheritance, but at least we
|
|
|
|
|
should do as well as GDB 3.x did. */
|
|
|
|
|
fcontext = TYPE_VPTR_BASETYPE (type);
|
|
|
|
|
context = lookup_pointer_type (fcontext);
|
|
|
|
|
/* Now context is a pointer to the basetype containing the vtbl. */
|
|
|
|
|
if (TYPE_TARGET_TYPE (context) != type1)
|
|
|
|
|
{
|
2001-10-21 09:06:25 +08:00
|
|
|
|
struct value *tmp = value_cast (context, value_addr (arg1));
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
arg1 = value_ind (tmp);
|
|
|
|
|
type1 = check_typedef (VALUE_TYPE (arg1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context = type1;
|
|
|
|
|
/* Now context is the basetype containing the vtbl. */
|
|
|
|
|
|
|
|
|
|
/* This type may have been defined before its virtual function table
|
|
|
|
|
was. If so, fill in the virtual function table entry for the
|
|
|
|
|
type now. */
|
|
|
|
|
if (TYPE_VPTR_FIELDNO (context) < 0)
|
|
|
|
|
fill_in_vptr_fieldno (context);
|
|
|
|
|
|
|
|
|
|
/* The virtual function table is now an array of structures
|
|
|
|
|
which have the form { int16 offset, delta; void *pfn; }. */
|
|
|
|
|
vtbl = value_primitive_field (arg1, 0, TYPE_VPTR_FIELDNO (context),
|
|
|
|
|
TYPE_VPTR_BASETYPE (context));
|
|
|
|
|
|
|
|
|
|
/* 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)
|
|
|
|
|
{
|
|
|
|
|
/* Handle the case where the vtbl field points to an
|
|
|
|
|
array of structures. */
|
|
|
|
|
vtbl = value_ind (vtbl);
|
|
|
|
|
|
|
|
|
|
/* Index into the virtual function table. This is hard-coded because
|
|
|
|
|
looking up a field is not cheap, and it may be important to save
|
|
|
|
|
time, e.g. if the user has set a conditional breakpoint calling
|
|
|
|
|
a virtual function. */
|
|
|
|
|
entry = value_subscript (vtbl, vi);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Handle the case where the vtbl field points directly to a structure. */
|
|
|
|
|
vtbl = value_add (vtbl, vi);
|
|
|
|
|
entry = value_ind (vtbl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
if (!VALUE_LAZY (arg1))
|
|
|
|
|
{
|
|
|
|
|
VALUE_LAZY (arg1) = 1;
|
|
|
|
|
value_fetch_lazy (arg1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vfn = value_field (entry, 2);
|
|
|
|
|
}
|
|
|
|
|
else if (TYPE_CODE (entry_type) == TYPE_CODE_PTR)
|
|
|
|
|
vfn = entry;
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
*arg1p = arg1;
|
|
|
|
|
return vfn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-09 02:27:14 +08:00
|
|
|
|
static struct type *
|
2001-10-21 09:06:25 +08:00
|
|
|
|
gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
{
|
|
|
|
|
struct type *known_type;
|
|
|
|
|
struct type *rtti_type;
|
|
|
|
|
CORE_ADDR coreptr;
|
2001-10-21 09:06:25 +08:00
|
|
|
|
struct value *vp;
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
long top_offset = 0;
|
|
|
|
|
char rtti_type_name[256];
|
|
|
|
|
CORE_ADDR vtbl;
|
|
|
|
|
struct minimal_symbol *minsym;
|
|
|
|
|
struct symbol *sym;
|
|
|
|
|
char *demangled_name;
|
|
|
|
|
struct type *btype;
|
|
|
|
|
|
|
|
|
|
if (full)
|
|
|
|
|
*full = 0;
|
|
|
|
|
if (top)
|
|
|
|
|
*top = -1;
|
|
|
|
|
if (using_enc)
|
|
|
|
|
*using_enc = 0;
|
|
|
|
|
|
|
|
|
|
/* Get declared type */
|
|
|
|
|
known_type = VALUE_TYPE (v);
|
|
|
|
|
CHECK_TYPEDEF (known_type);
|
|
|
|
|
/* RTTI works only or class objects */
|
|
|
|
|
if (TYPE_CODE (known_type) != TYPE_CODE_CLASS)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/* Plan on this changing in the future as i get around to setting
|
|
|
|
|
the vtables properly for G++ compiled stuff. Also, I'll be using
|
|
|
|
|
the type info functions, which are always right. Deal with it
|
|
|
|
|
until then. */
|
|
|
|
|
|
|
|
|
|
/* If the type has no vptr fieldno, try to get it filled in */
|
|
|
|
|
if (TYPE_VPTR_FIELDNO(known_type) < 0)
|
|
|
|
|
fill_in_vptr_fieldno(known_type);
|
|
|
|
|
|
|
|
|
|
/* If we still can't find one, give up */
|
|
|
|
|
if (TYPE_VPTR_FIELDNO(known_type) < 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/* Make sure our basetype and known type match, otherwise, cast
|
|
|
|
|
so we can get at the vtable properly.
|
|
|
|
|
*/
|
|
|
|
|
btype = TYPE_VPTR_BASETYPE (known_type);
|
|
|
|
|
CHECK_TYPEDEF (btype);
|
|
|
|
|
if (btype != known_type )
|
|
|
|
|
{
|
|
|
|
|
v = value_cast (btype, v);
|
|
|
|
|
if (using_enc)
|
|
|
|
|
*using_enc=1;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
We can't use value_ind here, because it would want to use RTTI, and
|
|
|
|
|
we'd waste a bunch of time figuring out we already know the type.
|
|
|
|
|
Besides, we don't care about the type, just the actual pointer
|
|
|
|
|
*/
|
|
|
|
|
if (VALUE_ADDRESS (value_field (v, TYPE_VPTR_FIELDNO (known_type))) == 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2002-08-20 06:53:33 +08:00
|
|
|
|
vtbl=value_as_address(value_field(v,TYPE_VPTR_FIELDNO(known_type)));
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
|
|
|
|
|
/* Try to find a symbol that is the vtable */
|
|
|
|
|
minsym=lookup_minimal_symbol_by_pc(vtbl);
|
|
|
|
|
if (minsym==NULL
|
2003-02-25 David Carlton <carlton@math.stanford.edu>
* symtab.h (SYMBOL_NATURAL_NAME): New macro.
(SYMBOL_LINKAGE_NAME): Ditto.
(SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and
SYMBOL_LINKAGE_NAME.
(struct general_symbol_info): Expand comment.
(DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME.
(SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME.
(SYMBOL_MATCHES_REGEXP): Ditto.
* symtab.c (symbol_natural_name): New function.
* objfiles.h: Replace all uses of SYMBOL_NAME by
DEPRECATED_SYMBOL_NAME.
* xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto.
* symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto.
* somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto.
* printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto.
* minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto.
* i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto.
* gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto.
* dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto.
* cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto.
* blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto.
* ada-exp.y: Ditto.
* ada-exp.y: Update copyright.
* sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto.
* cp-valprint.c: Ditto.
2003-02-25 David Carlton <carlton@math.stanford.edu>
* generic/gdbtk.h: Replace all instances of SYMBOL_NAME by
DEPRECATED_SYMBOL_NAME.
* generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Ditto.
* generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Update copyright.
2003-02-25 David Carlton <carlton@math.stanford.edu>
* mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with
DEPRECATED_SYMBOL_NAME. Update copyright.
2003-02-26 05:36:23 +08:00
|
|
|
|
|| (demangled_name=DEPRECATED_SYMBOL_NAME (minsym))==NULL
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
|| !is_vtable_name (demangled_name))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/* If we just skip the prefix, we get screwed by namespaces */
|
|
|
|
|
demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI);
|
|
|
|
|
*(strchr(demangled_name,' '))=0;
|
|
|
|
|
|
|
|
|
|
/* Lookup the type for the name */
|
2003-12-05 12:25:09 +08:00
|
|
|
|
/* 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)
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (TYPE_N_BASECLASSES(rtti_type) > 1 && full && (*full) != 1)
|
|
|
|
|
{
|
|
|
|
|
if (top)
|
|
|
|
|
*top=TYPE_BASECLASS_BITPOS(rtti_type,TYPE_VPTR_FIELDNO(rtti_type))/8;
|
|
|
|
|
if (top && ((*top) >0))
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_LENGTH(rtti_type) > TYPE_LENGTH(known_type))
|
|
|
|
|
{
|
|
|
|
|
if (full)
|
|
|
|
|
*full=0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (full)
|
|
|
|
|
*full=1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (full)
|
|
|
|
|
*full=1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rtti_type;
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-05 02:20:19 +08:00
|
|
|
|
/* Return true if the INDEXth field of TYPE is a virtual baseclass
|
|
|
|
|
pointer which is for the base class whose type is BASECLASS. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
vb_match (struct type *type, int index, struct type *basetype)
|
|
|
|
|
{
|
|
|
|
|
struct type *fieldtype;
|
|
|
|
|
char *name = TYPE_FIELD_NAME (type, index);
|
|
|
|
|
char *field_class_name = NULL;
|
|
|
|
|
|
|
|
|
|
if (*name != '_')
|
|
|
|
|
return 0;
|
|
|
|
|
/* gcc 2.4 uses _vb$. */
|
|
|
|
|
if (name[1] == 'v' && name[2] == 'b' && is_cplus_marker (name[3]))
|
|
|
|
|
field_class_name = name + 4;
|
|
|
|
|
/* gcc 2.5 will use __vb_. */
|
|
|
|
|
if (name[1] == '_' && name[2] == 'v' && name[3] == 'b' && name[4] == '_')
|
|
|
|
|
field_class_name = name + 5;
|
|
|
|
|
|
|
|
|
|
if (field_class_name == NULL)
|
|
|
|
|
/* This field is not a virtual base class pointer. */
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* It's a virtual baseclass pointer, now we just need to find out whether
|
|
|
|
|
it is for this baseclass. */
|
|
|
|
|
fieldtype = TYPE_FIELD_TYPE (type, index);
|
|
|
|
|
if (fieldtype == NULL
|
|
|
|
|
|| TYPE_CODE (fieldtype) != TYPE_CODE_PTR)
|
|
|
|
|
/* "Can't happen". */
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* What we check for is that either the types are equal (needed for
|
|
|
|
|
nameless types) or have the same name. This is ugly, and a more
|
|
|
|
|
elegant solution should be devised (which would probably just push
|
|
|
|
|
the ugliness into symbol reading unless we change the stabs format). */
|
|
|
|
|
if (TYPE_TARGET_TYPE (fieldtype) == basetype)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (TYPE_NAME (basetype) != NULL
|
|
|
|
|
&& TYPE_NAME (TYPE_TARGET_TYPE (fieldtype)) != NULL
|
2003-01-10 02:30:32 +08:00
|
|
|
|
&& strcmp (TYPE_NAME (basetype),
|
|
|
|
|
TYPE_NAME (TYPE_TARGET_TYPE (fieldtype))) == 0)
|
2002-01-05 02:20:19 +08:00
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute the offset of the baseclass which is
|
|
|
|
|
the INDEXth baseclass of class TYPE,
|
|
|
|
|
for value at VALADDR (in host) at ADDRESS (in target).
|
|
|
|
|
The result is the offset of the baseclass value relative
|
|
|
|
|
to (the address of)(ARG) + OFFSET.
|
|
|
|
|
|
|
|
|
|
-1 is returned on error. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
gnuv2_baseclass_offset (struct type *type, int index, char *valaddr,
|
|
|
|
|
CORE_ADDR address)
|
|
|
|
|
{
|
|
|
|
|
struct type *basetype = TYPE_BASECLASS (type, index);
|
|
|
|
|
|
|
|
|
|
if (BASETYPE_VIA_VIRTUAL (type, index))
|
|
|
|
|
{
|
|
|
|
|
/* Must hunt for the pointer to this virtual baseclass. */
|
2003-09-16 Andrew Cagney <cagney@redhat.com>
* buildsym.c: Remove more occurances of "register".
* coffread.c, dbxread.c, dcache.c, dwarf2read.c: Ditto.
* environ.c, eval.c, f-valprint.c, findvar.c: Ditto.
* gdbtypes.c, gnu-v2-abi.c, h8300-tdep.c, hppa-tdep.c: Ditto.
* infcmd.c, mdebugread.c, minsyms.c, mips-tdep.c: Ditto.
* printcmd.c, remote-vx.c, sh-stub.c, sh-tdep.c: Ditto.
* sh64-tdep.c, source.c, stabsread.c, stack.c: Ditto.
* standalone.c, symfile.c, symmisc.c, symtab.c: Ditto.
* utils.c, valops.c, values.c, xcoffread.c: Ditto.
2003-09-17 02:56:35 +08:00
|
|
|
|
int i, len = TYPE_NFIELDS (type);
|
|
|
|
|
int n_baseclasses = TYPE_N_BASECLASSES (type);
|
2002-01-05 02:20:19 +08:00
|
|
|
|
|
|
|
|
|
/* First look for the virtual baseclass pointer
|
|
|
|
|
in the fields. */
|
|
|
|
|
for (i = n_baseclasses; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
if (vb_match (type, i, basetype))
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR addr
|
|
|
|
|
= unpack_pointer (TYPE_FIELD_TYPE (type, i),
|
|
|
|
|
valaddr + (TYPE_FIELD_BITPOS (type, i) / 8));
|
|
|
|
|
|
|
|
|
|
return addr - (LONGEST) address;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Not in the fields, so try looking through the baseclasses. */
|
|
|
|
|
for (i = index + 1; i < n_baseclasses; i++)
|
|
|
|
|
{
|
|
|
|
|
int boffset =
|
|
|
|
|
baseclass_offset (type, i, valaddr, address);
|
|
|
|
|
if (boffset)
|
|
|
|
|
return boffset;
|
|
|
|
|
}
|
|
|
|
|
/* Not found. */
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Baseclass is easily computed. */
|
|
|
|
|
return TYPE_BASECLASS_BITPOS (type, index) / 8;
|
|
|
|
|
}
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
init_gnuv2_ops (void)
|
|
|
|
|
{
|
|
|
|
|
gnu_v2_abi_ops.shortname = "gnu-v2";
|
|
|
|
|
gnu_v2_abi_ops.longname = "GNU G++ Version 2 ABI";
|
|
|
|
|
gnu_v2_abi_ops.doc = "G++ Version 2 ABI";
|
|
|
|
|
gnu_v2_abi_ops.is_destructor_name = gnuv2_is_destructor_name;
|
|
|
|
|
gnu_v2_abi_ops.is_constructor_name = gnuv2_is_constructor_name;
|
|
|
|
|
gnu_v2_abi_ops.is_vtable_name = gnuv2_is_vtable_name;
|
|
|
|
|
gnu_v2_abi_ops.is_operator_name = gnuv2_is_operator_name;
|
|
|
|
|
gnu_v2_abi_ops.virtual_fn_field = gnuv2_virtual_fn_field;
|
|
|
|
|
gnu_v2_abi_ops.rtti_type = gnuv2_value_rtti_type;
|
2002-01-05 02:20:19 +08:00
|
|
|
|
gnu_v2_abi_ops.baseclass_offset = gnuv2_baseclass_offset;
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-09 02:27:14 +08:00
|
|
|
|
extern initialize_file_ftype _initialize_gnu_v2_abi; /* -Wmissing-prototypes */
|
|
|
|
|
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
void
|
|
|
|
|
_initialize_gnu_v2_abi (void)
|
|
|
|
|
{
|
|
|
|
|
init_gnuv2_ops ();
|
* cp-abi.c: Include "command.h", "gdbcmd.h", and "ui-out.h".
(auto_cp_abi): New variable.
(current_cp_abi, num_cp_abis): Make static.
(CP_ABI_MAX): Define.
(cp_abis): Turn into an array.
(value_virtual_fn_field): Fix formatting.
(switch_to_cp_abi, register_cp_abi): Update. register_cp_abi now
takes a pointer.
(set_cp_abi_as_auto_default, set_cp_abi_cmd, show_cp_abi_cmd)
(list_cp_abis, _initialize_cp_abi): New functions.
* cp-abi.h: Add prototype for set_cp_abi_as_auto_default. Remove
declarations for cp_abis, num_cp_abis, current_cp_abi, and
switch_to_cp_abi. Update prototype for register_cp_abi.
* Makefile.in (cp-abi.o): Update dependencies.
* minsyms.c (install_minimal_symbols): Call set_cp_abi_as_auto_default
instead of switch_to_cp_abi.
* gnu-v2-abi.c (_initialize_gnu_v2_abi): Likewise. Update call to
register_cp_abi.
* gnu-v3-abi.c (_initialize_gnu_v3_abi): Update call to
register_cp_abi.
* hpacc-abi.c (_initialize_hpacc_abi): Likewise.
2003-03-06 02:01:46 +08:00
|
|
|
|
register_cp_abi (&gnu_v2_abi_ops);
|
|
|
|
|
set_cp_abi_as_auto_default (gnu_v2_abi_ops.shortname);
|
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
2001-04-27 08:19:09 +08:00
|
|
|
|
}
|