]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/cp-abi.h
(Changes from Daniel Berlin, with revisions by Jim Blandy.)
[thirdparty/binutils-gdb.git] / gdb / cp-abi.h
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
28 /* Kinds of constructors. All these values are guaranteed to be
29 non-zero. */
30 enum ctor_kinds {
31
32 /* Initialize a complete object, including virtual bases, using
33 memory provided by caller. */
34 complete_object_ctor = 1,
35
36 /* Initialize a base object of some larger object. */
37 base_object_ctor,
38
39 /* An allocating complete-object constructor. */
40 complete_object_allocating_ctor
41 };
42
43
44 /* Kinds of destructors. All these values are guaranteed to be
45 non-zero. */
46 enum dtor_kinds {
47
48 /* A destructor which finalizes the entire object, and then calls
49 `delete' on its storage. */
50 deleting_dtor = 1,
51
52 /* A destructor which finalizes the entire object, but does not call
53 `delete'. */
54 complete_object_dtor,
55
56 /* A destructor which finalizes a subobject of some larger object. */
57 base_object_dtor
58 };
59
60
61 struct cp_abi_ops
62 {
63 const char *shortname;
64 const char *longname;
65 const char *doc;
66
67 /* The functions here that attempt to determine what sort of thing a
68 mangled name refers to may well be revised in the future. It
69 would certainly be cleaner to carry this information explicitly
70 in GDB's data structures than to derive it from the mangled name. */
71
72 /* Return non-zero iff NAME is the mangled name of a constructor.
73 Actually, return an `enum ctor_kind' value describing what *kind*
74 of constructor it is. */
75 enum ctor_kinds (*is_constructor_name) (const char *name);
76
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 enum dtor_kinds (*is_destructor_name) (const char *name);
81
82 /* Return non-zero iff NAME is the mangled name of a vtable. */
83 int (*is_vtable_name) (const char *name);
84
85 /* Return non-zero iff NAME is the un-mangled name of an operator,
86 perhaps scoped within some class. */
87 int (*is_operator_name) (const char *name);
88
89 value_ptr (*virtual_fn_field) (value_ptr * arg1p, struct fn_field * f,
90 int j, struct type * type, int offset);
91
92 /* Find the real run-time type of a value using RTTI.
93 * V is a pointer to the value.
94 * A pointer to the struct type entry of the run-time type
95 * is returneed.
96 * FULL is a flag that is set only if the value V includes
97 * the entire contents of an object of the RTTI type.
98 * TOP is the offset to the top of the enclosing object of
99 * the real run-time type. This offset may be for the embedded
100 * object, or for the enclosing object of V.
101 * USING_ENC is the flag that distinguishes the two cases.
102 * If it is 1, then the offset is for the enclosing object,
103 * otherwise for the embedded object.
104 *
105 */
106
107 struct type *(*rtti_type) (value_ptr v, int *full, int *top,
108 int *using_enc);
109 };
110
111
112 extern struct cp_abi_ops *cp_abis;
113
114 extern int num_cp_abis;
115
116 extern struct cp_abi_ops current_cp_abi;
117
118 extern enum ctor_kinds is_constructor_name (const char *name);
119 extern enum dtor_kinds is_destructor_name (const char *name);
120 extern int is_vtable_name (const char *name);
121 extern int is_operator_name (const char *name);
122 extern value_ptr value_virtual_fn_field (value_ptr * arg1p,
123 struct fn_field *f, int j,
124 struct type *type, int offset);
125 extern struct type *value_rtti_type (value_ptr v, int *full, int *top,
126 int *using_enc);
127 extern int register_cp_abi (struct cp_abi_ops abi);
128 extern int switch_to_cp_abi (const char *short_name);
129
130 #endif
131