1 /* Abstraction of various C++ ABI's we support, and the info we need
4 Contributed by Daniel Berlin <dberlin@redhat.com>
6 Copyright (C) 2001, 2005 Free Software Foundation, Inc.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or
12 it under the terms of the GNU General Public License as published
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 Boston, MA 02110-1301, USA. */
34 /* The functions here that attempt to determine what sort of thing a
35 mangled name refers to may well be revised in the future. It would
36 certainly be cleaner to carry this information explicitly in GDB's
37 data structures than to derive it from the mangled name. */
40 /* Kinds of constructors. All these values are guaranteed to be
44 /* Initialize a complete object, including virtual bases, using
45 memory provided by caller. */
46 complete_object_ctor
= 1,
48 /* Initialize a base object of some larger object. */
51 /* An allocating complete-object constructor. */
52 complete_object_allocating_ctor
55 /* Return non-zero iff NAME is the mangled name of a constructor.
56 Actually, return an `enum ctor_kind' value describing what *kind*
57 of constructor it is. */
58 extern enum ctor_kinds
is_constructor_name (const char *name
);
61 /* Kinds of destructors. All these values are guaranteed to be
65 /* A destructor which finalizes the entire object, and then calls
66 `delete' on its storage. */
69 /* A destructor which finalizes the entire object, but does not call
73 /* A destructor which finalizes a subobject of some larger object. */
77 /* Return non-zero iff NAME is the mangled name of a destructor.
78 Actually, return an `enum dtor_kind' value describing what *kind*
79 of destructor it is. */
80 extern enum dtor_kinds
is_destructor_name (const char *name
);
83 /* Return non-zero iff NAME is the mangled name of a vtable. */
84 extern int is_vtable_name (const char *name
);
87 /* Return non-zero iff NAME is the un-mangled name of an operator,
88 perhaps scoped within some class. */
89 extern int is_operator_name (const char *name
);
92 /* Return an object's virtual function as a value.
94 VALUEP is a pointer to a pointer to a value, holding the object
95 whose virtual function we want to invoke. If the ABI requires a
96 virtual function's caller to adjust the `this' pointer by an amount
97 retrieved from the vtable before invoking the function (i.e., we're
98 not using "vtable thunks" to do the adjustment automatically), then
99 this function may set *VALUEP to point to a new object with an
100 appropriately tweaked address.
102 The J'th element of the overload set F is the virtual function of
103 *VALUEP we want to invoke.
105 TYPE is the base type of *VALUEP whose method we're invoking ---
106 this is the type containing F. OFFSET is the offset of that base
107 type within *VALUEP. */
108 extern struct value
*value_virtual_fn_field (struct value
**valuep
,
109 struct fn_field
*f
, int j
,
110 struct type
*type
, int offset
);
113 /* Try to find the run-time type of VALUE, using C++ run-time type
114 information. Return the run-time type, or zero if we can't figure
117 If we do find the run-time type:
118 - Set *FULL to non-zero if VALUE already contains the complete
119 run-time object, not just some embedded base class of the object.
120 - Set *TOP and *USING_ENC to indicate where the enclosing object
121 starts relative to VALUE:
122 - If *USING_ENC is zero, then *TOP is the offset from the start
123 of the complete object to the start of the embedded subobject
124 VALUE represents. In other words, the enclosing object starts
125 at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
126 value_embedded_offset (VALUE) + *TOP
127 - If *USING_ENC is non-zero, then *TOP is the offset from the
128 address of the complete object to the enclosing object stored
129 in VALUE. In other words, the enclosing object starts at
130 VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) + *TOP.
131 If VALUE's type and enclosing type are the same, then these two
132 cases are equivalent.
134 FULL, TOP, and USING_ENC can each be zero, in which case we don't
135 provide the corresponding piece of information. */
136 extern struct type
*value_rtti_type (struct value
*value
,
137 int *full
, int *top
, int *using_enc
);
139 /* Compute the offset of the baseclass which is
140 the INDEXth baseclass of class TYPE,
141 for value at VALADDR (in host) at ADDRESS (in target).
142 The result is the offset of the baseclass value relative
143 to (the address of)(ARG) + OFFSET.
145 -1 is returned on error. */
147 extern int baseclass_offset (struct type
*type
, int index
,
148 const bfd_byte
*valaddr
, CORE_ADDR address
);
152 const char *shortname
;
153 const char *longname
;
156 /* ABI-specific implementations for the functions declared above. */
157 enum ctor_kinds (*is_constructor_name
) (const char *name
);
158 enum dtor_kinds (*is_destructor_name
) (const char *name
);
159 int (*is_vtable_name
) (const char *name
);
160 int (*is_operator_name
) (const char *name
);
161 struct value
*(*virtual_fn_field
) (struct value
**arg1p
, struct fn_field
* f
,
162 int j
, struct type
* type
, int offset
);
163 struct type
*(*rtti_type
) (struct value
*v
, int *full
, int *top
,
165 int (*baseclass_offset
) (struct type
*type
, int index
,
166 const bfd_byte
*valaddr
, CORE_ADDR address
);
170 extern int register_cp_abi (struct cp_abi_ops
*abi
);
171 extern void set_cp_abi_as_auto_default (const char *short_name
);