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. */
24 #include "gdb_string.h"
26 struct cp_abi_ops current_cp_abi
;
28 struct cp_abi_ops
*cp_abis
;
33 is_constructor_name (const char *name
)
35 if ((current_cp_abi
.is_constructor_name
) == NULL
)
36 error ("ABI doesn't define required function is_constructor_name");
37 return (*current_cp_abi
.is_constructor_name
) (name
);
41 is_destructor_name (const char *name
)
43 if ((current_cp_abi
.is_destructor_name
) == NULL
)
44 error ("ABI doesn't define required function is_destructor_name");
45 return (*current_cp_abi
.is_destructor_name
) (name
);
49 is_vtable_name (const char *name
)
51 if ((current_cp_abi
.is_vtable_name
) == NULL
)
52 error ("ABI doesn't define required function is_vtable_name");
53 return (*current_cp_abi
.is_vtable_name
) (name
);
57 is_operator_name (const char *name
)
59 if ((current_cp_abi
.is_operator_name
) == NULL
)
60 error ("ABI doesn't define required function is_operator_name");
61 return (*current_cp_abi
.is_operator_name
) (name
);
65 baseclass_offset (struct type
*type
, int index
, char *valaddr
,
68 if (current_cp_abi
.baseclass_offset
== NULL
)
69 error ("ABI doesn't define required function baseclass_offset");
70 return (*current_cp_abi
.baseclass_offset
) (type
, index
, valaddr
, address
);
74 value_virtual_fn_field (struct value
**arg1p
, struct fn_field
* f
, int j
,
75 struct type
* type
, int offset
)
77 if ((current_cp_abi
.virtual_fn_field
) == NULL
)
79 return (*current_cp_abi
.virtual_fn_field
) (arg1p
, f
, j
, type
, offset
);
83 value_rtti_type (struct value
*v
, int *full
, int *top
, int *using_enc
)
85 if ((current_cp_abi
.rtti_type
) == NULL
)
87 return (*current_cp_abi
.rtti_type
) (v
, full
, top
, using_enc
);
91 register_cp_abi (struct cp_abi_ops abi
)
94 xrealloc (cp_abis
, (num_cp_abis
+ 1) * sizeof (struct cp_abi_ops
));
95 cp_abis
[num_cp_abis
++] = abi
;
102 switch_to_cp_abi (const char *short_name
)
105 for (i
= 0; i
< num_cp_abis
; i
++)
106 if (strcmp (cp_abis
[i
].shortname
, short_name
) == 0)
107 current_cp_abi
= cp_abis
[i
];