OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [cp-abi.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* 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
struct value;
29
 
30
/* The functions here that attempt to determine what sort of thing a
31
   mangled name refers to may well be revised in the future.  It would
32
   certainly be cleaner to carry this information explicitly in GDB's
33
   data structures than to derive it from the mangled name.  */
34
 
35
 
36
/* Kinds of constructors.  All these values are guaranteed to be
37
   non-zero.  */
38
enum ctor_kinds {
39
 
40
  /* Initialize a complete object, including virtual bases, using
41
     memory provided by caller.  */
42
  complete_object_ctor = 1,
43
 
44
  /* Initialize a base object of some larger object.  */
45
  base_object_ctor,
46
 
47
  /* An allocating complete-object constructor.  */
48
  complete_object_allocating_ctor
49
};
50
 
51
/* Return non-zero iff NAME is the mangled name of a constructor.
52
   Actually, return an `enum ctor_kind' value describing what *kind*
53
   of constructor it is.  */
54
extern enum ctor_kinds is_constructor_name (const char *name);
55
 
56
 
57
/* Kinds of destructors.  All these values are guaranteed to be
58
   non-zero.  */
59
enum dtor_kinds {
60
 
61
  /* A destructor which finalizes the entire object, and then calls
62
     `delete' on its storage.  */
63
  deleting_dtor = 1,
64
 
65
  /* A destructor which finalizes the entire object, but does not call
66
     `delete'.  */
67
  complete_object_dtor,
68
 
69
  /* A destructor which finalizes a subobject of some larger object.  */
70
  base_object_dtor
71
};
72
 
73
/* Return non-zero iff NAME is the mangled name of a destructor.
74
   Actually, return an `enum dtor_kind' value describing what *kind*
75
   of destructor it is.  */
76
extern enum dtor_kinds is_destructor_name (const char *name);
77
 
78
 
79
/* Return non-zero iff NAME is the mangled name of a vtable.  */
80
extern int is_vtable_name (const char *name);
81
 
82
 
83
/* Return non-zero iff NAME is the un-mangled name of an operator,
84
   perhaps scoped within some class.  */
85
extern int is_operator_name (const char *name);
86
 
87
 
88
/* Return an object's virtual function as a value.
89
 
90
   VALUEP is a pointer to a pointer to a value, holding the object
91
   whose virtual function we want to invoke.  If the ABI requires a
92
   virtual function's caller to adjust the `this' pointer by an amount
93
   retrieved from the vtable before invoking the function (i.e., we're
94
   not using "vtable thunks" to do the adjustment automatically), then
95
   this function may set *VALUEP to point to a new object with an
96
   appropriately tweaked address.
97
 
98
   The J'th element of the overload set F is the virtual function of
99
   *VALUEP we want to invoke.
100
 
101
   TYPE is the base type of *VALUEP whose method we're invoking ---
102
   this is the type containing F.  OFFSET is the offset of that base
103
   type within *VALUEP.  */
104
extern struct value *value_virtual_fn_field (struct value **valuep,
105
                                             struct fn_field *f, int j,
106
                                             struct type *type, int offset);
107
 
108
 
109
/* Try to find the run-time type of VALUE, using C++ run-time type
110
   information.  Return the run-time type, or zero if we can't figure
111
   it out.
112
 
113
   If we do find the run-time type:
114
   - Set *FULL to non-zero if VALUE already contains the complete
115
     run-time object, not just some embedded base class of the object.
116
   - Set *TOP and *USING_ENC to indicate where the enclosing object
117
     starts relative to VALUE:
118
     - If *USING_ENC is zero, then *TOP is the offset from the start
119
       of the complete object to the start of the embedded subobject
120
       VALUE represents.  In other words, the enclosing object starts
121
       at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
122
       VALUE_EMBEDDED_OFFSET (VALUE) + *TOP
123
     - If *USING_ENC is non-zero, then *TOP is the offset from the
124
       address of the complete object to the enclosing object stored
125
       in VALUE.  In other words, the enclosing object starts at
126
       VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) + *TOP.
127
     If VALUE's type and enclosing type are the same, then these two
128
     cases are equivalent.
129
 
130
   FULL, TOP, and USING_ENC can each be zero, in which case we don't
131
   provide the corresponding piece of information.  */
132
extern struct type *value_rtti_type (struct value *value,
133
                                     int *full, int *top, int *using_enc);
134
 
135
/* Compute the offset of the baseclass which is
136
   the INDEXth baseclass of class TYPE,
137
   for value at VALADDR (in host) at ADDRESS (in target).
138
   The result is the offset of the baseclass value relative
139
   to (the address of)(ARG) + OFFSET.
140
 
141
   -1 is returned on error. */
142
 
143
extern int baseclass_offset (struct type *type, int index, char *valaddr,
144
                             CORE_ADDR address);
145
 
146
struct cp_abi_ops
147
{
148
  const char *shortname;
149
  const char *longname;
150
  const char *doc;
151
 
152
  /* ABI-specific implementations for the functions declared above.  */
153
  enum ctor_kinds (*is_constructor_name) (const char *name);
154
  enum dtor_kinds (*is_destructor_name) (const char *name);
155
  int (*is_vtable_name) (const char *name);
156
  int (*is_operator_name) (const char *name);
157
  struct value *(*virtual_fn_field) (struct value **arg1p, struct fn_field * f,
158
                                     int j, struct type * type, int offset);
159
  struct type *(*rtti_type) (struct value *v, int *full, int *top,
160
                             int *using_enc);
161
  int (*baseclass_offset) (struct type *type, int index, char *valaddr,
162
                           CORE_ADDR address);
163
};
164
 
165
 
166
extern struct cp_abi_ops *cp_abis;
167
extern int num_cp_abis;
168
extern struct cp_abi_ops current_cp_abi;
169
extern int register_cp_abi (struct cp_abi_ops abi);
170
extern int switch_to_cp_abi (const char *short_name);
171
 
172
#endif
173
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.