* gdb.base/maint.exp: Treat $EXEEXT as optional in output.
[deliverable/binutils-gdb.git] / gdb / cp-abi.h
CommitLineData
015a42b4
JB
1/* Abstraction of various C++ ABI's we support, and the info we need
2 to get from them.
3 Contributed by Daniel Berlin <dberlin@redhat.com>
4 Copyright 2001 Free Software Foundation, Inc.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or
9 modify
10 it under the terms of the GNU General Public License as published
11 by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
24
25#ifndef CP_ABI_H_
26#define CP_ABI_H_ 1
27
c5f5341b
JB
28/* The functions here that attempt to determine what sort of thing a
29 mangled name refers to may well be revised in the future. It would
30 certainly be cleaner to carry this information explicitly in GDB's
31 data structures than to derive it from the mangled name. */
32
33
015a42b4
JB
34/* Kinds of constructors. All these values are guaranteed to be
35 non-zero. */
36enum ctor_kinds {
37
38 /* Initialize a complete object, including virtual bases, using
39 memory provided by caller. */
40 complete_object_ctor = 1,
41
42 /* Initialize a base object of some larger object. */
43 base_object_ctor,
44
45 /* An allocating complete-object constructor. */
46 complete_object_allocating_ctor
47};
48
c5f5341b
JB
49/* Return non-zero iff NAME is the mangled name of a constructor.
50 Actually, return an `enum ctor_kind' value describing what *kind*
51 of constructor it is. */
52extern enum ctor_kinds is_constructor_name (const char *name);
53
015a42b4
JB
54
55/* Kinds of destructors. All these values are guaranteed to be
56 non-zero. */
57enum dtor_kinds {
58
59 /* A destructor which finalizes the entire object, and then calls
60 `delete' on its storage. */
61 deleting_dtor = 1,
62
63 /* A destructor which finalizes the entire object, but does not call
64 `delete'. */
65 complete_object_dtor,
66
67 /* A destructor which finalizes a subobject of some larger object. */
68 base_object_dtor
69};
70
c5f5341b
JB
71/* Return non-zero iff NAME is the mangled name of a destructor.
72 Actually, return an `enum dtor_kind' value describing what *kind*
73 of destructor it is. */
74extern enum dtor_kinds is_destructor_name (const char *name);
75
76
77/* Return non-zero iff NAME is the mangled name of a vtable. */
78extern int is_vtable_name (const char *name);
79
80
81/* Return non-zero iff NAME is the un-mangled name of an operator,
82 perhaps scoped within some class. */
83extern int is_operator_name (const char *name);
84
85
86/* Return an object's virtual function as a value.
87
88 VALUEP is a pointer to a pointer to a value, holding the object
89 whose virtual function we want to invoke. If the ABI requires a
90 virtual function's caller to adjust the `this' pointer by an amount
91 retrieved from the vtable before invoking the function (i.e., we're
92 not using "vtable thunks" to do the adjustment automatically), then
93 this function may set *VALUEP to point to a new object with an
94 appropriately tweaked address.
95
96 The J'th element of the overload set F is the virtual function of
97 *VALUEP we want to invoke.
98
99 TYPE is the base type of *VALUEP whose method we're invoking ---
100 this is the type containing F. OFFSET is the offset of that base
101 type within *VALUEP. */
102extern value_ptr value_virtual_fn_field (value_ptr *valuep,
103 struct fn_field *f, int j,
104 struct type *type, int offset);
105
106
107/* Try to find the run-time type of VALUE, using C++ run-time type
108 information. Return the run-time type, or zero if we can't figure
109 it out.
110
111 If we do find the run-time type:
112 - Set *FULL to non-zero if VALUE already contains the complete
113 run-time object, not just some embedded base class of the object.
114 - Set *TOP and *USING_ENC to indicate where the enclosing object
115 starts relative to VALUE:
116 - If *USING_ENC is zero, then *TOP is the offset from the start
117 of the complete object to the start of the embedded subobject
118 VALUE represents. In other words, the enclosing object starts
119 at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
120 VALUE_EMBEDDED_OFFSET (VALUE) + *TOP
121 - If *USING_ENC is non-zero, then *TOP is the offset from the
122 address of the complete object to the enclosing object stored
123 in VALUE. In other words, the enclosing object starts at
124 VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) + *TOP.
125 If VALUE's type and enclosing type are the same, then these two
126 cases are equivalent.
127
128 FULL, TOP, and USING_ENC can each be zero, in which case we don't
129 provide the corresponding piece of information. */
130extern struct type *value_rtti_type (struct value *value,
131 int *full, int *top, int *using_enc);
132
015a42b4
JB
133
134struct cp_abi_ops
135{
136 const char *shortname;
137 const char *longname;
138 const char *doc;
139
c5f5341b 140 /* ABI-specific implementations for the functions declared above. */
015a42b4 141 enum ctor_kinds (*is_constructor_name) (const char *name);
015a42b4 142 enum dtor_kinds (*is_destructor_name) (const char *name);
015a42b4 143 int (*is_vtable_name) (const char *name);
015a42b4 144 int (*is_operator_name) (const char *name);
015a42b4
JB
145 value_ptr (*virtual_fn_field) (value_ptr * arg1p, struct fn_field * f,
146 int j, struct type * type, int offset);
015a42b4
JB
147 struct type *(*rtti_type) (value_ptr v, int *full, int *top,
148 int *using_enc);
149};
150
151
152extern struct cp_abi_ops *cp_abis;
015a42b4 153extern int num_cp_abis;
015a42b4 154extern struct cp_abi_ops current_cp_abi;
015a42b4
JB
155extern int register_cp_abi (struct cp_abi_ops abi);
156extern int switch_to_cp_abi (const char *short_name);
157
158#endif
159
This page took 0.051268 seconds and 4 git commands to generate.