1 /* Generic code for supporting multiple C++ ABI's
2 Copyright 2001 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
25 struct cp_abi_ops current_cp_abi
;
27 struct cp_abi_ops
*cp_abis
;
32 is_constructor_name (const char *name
)
34 if ((current_cp_abi
.is_constructor_name
) == NULL
)
35 error ("ABI doesn't define required function is_constructor_name");
36 return (*current_cp_abi
.is_constructor_name
) (name
);
40 is_destructor_name (const char *name
)
42 if ((current_cp_abi
.is_destructor_name
) == NULL
)
43 error ("ABI doesn't define required function is_destructor_name");
44 return (*current_cp_abi
.is_destructor_name
) (name
);
48 is_vtable_name (const char *name
)
50 if ((current_cp_abi
.is_vtable_name
) == NULL
)
51 error ("ABI doesn't define required function is_vtable_name");
52 return (*current_cp_abi
.is_vtable_name
) (name
);
56 is_operator_name (const char *name
)
58 if ((current_cp_abi
.is_operator_name
) == NULL
)
59 error ("ABI doesn't define required function is_operator_name");
60 return (*current_cp_abi
.is_operator_name
) (name
);
64 baseclass_offset (struct type
*type
, int index
, char *valaddr
,
67 if (current_cp_abi
.baseclass_offset
== NULL
)
68 error ("ABI doesn't define required function baseclass_offset");
69 return (*current_cp_abi
.baseclass_offset
) (type
, index
, valaddr
, address
);
73 value_virtual_fn_field (struct value
**arg1p
, struct fn_field
* f
, int j
,
74 struct type
* type
, int offset
)
76 if ((current_cp_abi
.virtual_fn_field
) == NULL
)
78 return (*current_cp_abi
.virtual_fn_field
) (arg1p
, f
, j
, type
, offset
);
82 value_rtti_type (struct value
*v
, int *full
, int *top
, int *using_enc
)
84 if ((current_cp_abi
.rtti_type
) == NULL
)
86 return (*current_cp_abi
.rtti_type
) (v
, full
, top
, using_enc
);
90 register_cp_abi (struct cp_abi_ops abi
)
93 xrealloc (cp_abis
, (num_cp_abis
+ 1) * sizeof (struct cp_abi_ops
));
94 cp_abis
[num_cp_abis
++] = abi
;
101 switch_to_cp_abi (const char *short_name
)
104 for (i
= 0; i
< num_cp_abis
; i
++)
105 if (strcmp (cp_abis
[i
].shortname
, short_name
) == 0)
106 current_cp_abi
= cp_abis
[i
];