summaryrefslogtreecommitdiff
path: root/gdb/gnu-v3-abi.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:57:14 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:57:14 +0000
commit5b86fd99d277d035b218d3f7e6df6a36cebe8624 (patch)
tree27a766d6447dd5208407f6de0f0fae38f86cf657 /gdb/gnu-v3-abi.c
parentf139ea31f3fc9b82f94e6478abd6d94869576ef8 (diff)
downloadgdb-5b86fd99d277d035b218d3f7e6df6a36cebe8624.tar.gz
* gdbtypes.c (make_pointer_type, make_reference_type,
smash_to_memberptr_type, lookup_array_range_type, check_stub_method): Use type architecture instead of current_gdbarch. * gdbtypes.h (address_space_name_to_int, address_space_int_to_name): Add GDBARCH paramter. * gdbtypes.c (address_space_name_to_int, address_space_int_to_name): Add GDBARCH parameter. Use it instead of current_gdbarch. * c-typeprint.c (c_type_print_modifier): Update call. * parse.c (push_type_address_space): Likewise. * findvar.c (extract_typed_address, store_typed_address): Use type architecture instead of current_gdbarch. * value.c (value_as_address, unpack_field_as_long): Use type architecture instead of current_gdbarch. * doublest.c (floatformat_from_length): Add GDBARCH argument. Use it instead of current_gdbarch. (floatformat_from_type): Pass type architecture. * infcall.c (find_function_addr): Use type architecture instead of current_gdbarch. * valarith.c (value_bitstring_subscript, value_x_binop, value_neg, value_bit_index): Use type architecture instead of current_gdbarch. * valops.c (value_cast, value_slice): Likewise. * value.h (modify_field): Add TYPE argument. * value.c (modify_field): Add TYPE argument. Use type architecture instead of current_gdbarch. (set_internalvar_component): Likewise. * eval.c (evaluate_struct_tuple): Update call. * valops.c (value_assign): Likewise. * ada-lang.c (modify_general_field): Likewise. Add TYPE argument. (make_array_descriptor): Update calls. (move_bits): Add BITS_BIG_ENDIAN_P argument. Use it instead of current_gdbarch. (ada_value_assign, value_assign_to_component): Update calls. (decode_packed_array, ada_value_primitive_packed_val, ada_value_assign, value_assign_to_component): Use type arch instead of current_gdbarch. * printcmd.c (float_type_from_length): Remove GDBARCH argument, use type architecture instead. (print_scalar_formatted, printf_command): Update calls. Use type architecture instead of current_gdbarch. * valprint.c (val_print_type_code_int): Use type architecture instead of current_gdbarch. * varobj.c (value_get_print_value): Likewise. * python/python-prettyprint.c (print_string_repr): Add GDBARCH argument. Use it instead of current_gdbarch. (apply_val_pretty_printer): Update call. * ada-valprint.c (ada_val_print_1): Use type architecture instead of current_gdbarch. * c-valprint.c (print_function_pointer_address): Add GDBARCH argument. Use it instead of current_gdbarch. (c_val_print): Update calls passing type architecture. * f-valprint.c (f_val_print): Use type architecture instead of current_gdbarch. * jv-valprint (java_value_print): Likewise. * m2-valprint.c (print_function_pointer_address): Add GDBARCH argument. Use it instead of current_gdbarch. (print_unpacked_pointer): Update calls passing type architecture. * scm-valprint.c (scm_scmval_print): Use type architecture instead of current_gdbarch. * gnu-v3-abi.c (get_class_arch): Remove. (gnuv3_rtti_type): Use get_type_arch instead of get_class_arch. Remove special-case check for Java classes. (gnuv3_virtual_fn_field, gnuv3_baseclass_offset, gnuv3_print_method_ptr, gnuv3_method_ptr_size, gnuv3_make_method_ptr, gnuv3_method_ptr_to_value): Use get_type_arch instead of get_class_arch.
Diffstat (limited to 'gdb/gnu-v3-abi.c')
-rw-r--r--gdb/gnu-v3-abi.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 09c8e69f744..0afb2f93879 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -45,21 +45,6 @@ gnuv3_is_operator_name (const char *name)
}
-/* Determine architecture of class DOMAIN. This architecture is used
- to query C++ ABI details (types, method pointer layout, etc.).
-
- Note that we assume DOMAIN must have been allocated with an OBJFILE;
- GDB does not provide any built-in class types. Thus we use the
- architecture of that OBJFILE to define the C++ ABI. */
-
-static struct gdbarch *
-get_class_arch (struct type *domain)
-{
- gdb_assert (TYPE_CODE (domain) == TYPE_CODE_CLASS);
- gdb_assert (TYPE_OBJFILE (domain) != NULL);
- return get_objfile_arch (TYPE_OBJFILE (domain));
-}
-
/* To help us find the components of a vtable, we build ourselves a
GDB type object representing the vtable structure. Following the
V3 ABI, it goes something like this:
@@ -227,14 +212,8 @@ gnuv3_rtti_type (struct value *value,
if (TYPE_CODE (values_type) != TYPE_CODE_CLASS)
return NULL;
- /* This routine may be called for Java types that do not have
- a proper objfile. Just return NULL for those. */
- if (!TYPE_OBJFILE (values_type)
- || !TYPE_OBJFILE (values_type)->obfd)
- return NULL;
-
/* Determine architecture. */
- gdbarch = get_class_arch (values_type);
+ gdbarch = get_type_arch (values_type);
vtable_type = gdbarch_data (gdbarch, vtable_type_gdbarch_data);
/* If we can't find the virtual table pointer for values_type, we
@@ -386,7 +365,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
error (_("Only classes can have virtual functions."));
/* Determine architecture. */
- gdbarch = get_class_arch (values_type);
+ gdbarch = get_type_arch (values_type);
/* Cast our value to the base class which defines this virtual
function. This takes care of any necessary `this'
@@ -420,7 +399,7 @@ gnuv3_baseclass_offset (struct type *type, int index, const bfd_byte *valaddr,
int vbasetype_vptr_fieldno;
/* Determine architecture. */
- gdbarch = get_class_arch (type);
+ gdbarch = get_type_arch (type);
vtable_type = gdbarch_data (gdbarch, vtable_type_gdbarch_data);
ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
@@ -574,7 +553,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
struct ui_file *stream)
{
struct type *domain = TYPE_DOMAIN_TYPE (type);
- struct gdbarch *gdbarch = get_class_arch (domain);
+ struct gdbarch *gdbarch = get_type_arch (domain);
CORE_ADDR ptr_value;
LONGEST adjustment;
int vbit;
@@ -640,7 +619,7 @@ static int
gnuv3_method_ptr_size (struct type *type)
{
struct type *domain_type = check_typedef (TYPE_DOMAIN_TYPE (type));
- struct gdbarch *gdbarch = get_class_arch (domain_type);
+ struct gdbarch *gdbarch = get_type_arch (domain_type);
return 2 * TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
}
@@ -651,7 +630,7 @@ gnuv3_make_method_ptr (struct type *type, gdb_byte *contents,
CORE_ADDR value, int is_virtual)
{
struct type *domain_type = check_typedef (TYPE_DOMAIN_TYPE (type));
- struct gdbarch *gdbarch = get_class_arch (domain_type);
+ struct gdbarch *gdbarch = get_type_arch (domain_type);
int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
/* FIXME drow/2006-12-24: The adjustment of "this" is currently
@@ -693,7 +672,7 @@ gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
method_type = TYPE_TARGET_TYPE (check_typedef (value_type (method_ptr)));
/* Extract the pointer to member. */
- gdbarch = get_class_arch (domain_type);
+ gdbarch = get_type_arch (domain_type);
vbit = gnuv3_decode_method_ptr (gdbarch, contents, &ptr_value, &adjustment);
/* First convert THIS to match the containing type of the pointer to