+
+ * 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.
+
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
static void extract_string (CORE_ADDR addr, char *buf);
-static void modify_general_field (char *, LONGEST, int, int);
+static void modify_general_field (struct type *, char *, LONGEST, int, int);
static struct type *desc_base_type (struct type *);
static struct value *value_subscript_packed (struct value *, int,
struct value **);
-static void move_bits (gdb_byte *, int, const gdb_byte *, int, int);
+static void move_bits (gdb_byte *, int, const gdb_byte *, int, int, int);
static struct value *coerce_unspec_val_to_type (struct value *,
struct type *);
/* Like modify_field, but allows bitpos > wordlength. */
static void
-modify_general_field (char *addr, LONGEST fieldval, int bitpos, int bitsize)
+modify_general_field (struct type *type, char *addr,
+ LONGEST fieldval, int bitpos, int bitsize)
{
- modify_field (addr + bitpos / 8, fieldval, bitpos % 8, bitsize);
+ modify_field (type, addr + bitpos / 8, fieldval, bitpos % 8, bitsize);
}
return NULL;
}
- if (gdbarch_bits_big_endian (current_gdbarch)
+ if (gdbarch_bits_big_endian (get_type_arch (value_type (arr)))
&& ada_is_modular_type (value_type (arr)))
{
/* This is a (right-justified) modular type representing a packed
int len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8;
/* Transmit bytes from least to most significant; delta is the direction
the indices move. */
- int delta = gdbarch_bits_big_endian (current_gdbarch) ? -1 : 1;
+ int delta = gdbarch_bits_big_endian (get_type_arch (type)) ? -1 : 1;
type = ada_check_typedef (type);
memset (unpacked, 0, TYPE_LENGTH (type));
return v;
}
- else if (gdbarch_bits_big_endian (current_gdbarch))
+ else if (gdbarch_bits_big_endian (get_type_arch (type)))
{
src = len - 1;
if (has_negatives (type)
not overlap. */
static void
move_bits (gdb_byte *target, int targ_offset, const gdb_byte *source,
- int src_offset, int n)
+ int src_offset, int n, int bits_big_endian_p)
{
unsigned int accum, mask;
int accum_bits, chunk_size;
targ_offset %= HOST_CHAR_BIT;
source += src_offset / HOST_CHAR_BIT;
src_offset %= HOST_CHAR_BIT;
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (bits_big_endian_p)
{
accum = (unsigned char) *source;
source += 1;
from_size = value_bitsize (fromval);
if (from_size == 0)
from_size = TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT;
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (gdbarch_bits_big_endian (get_type_arch (type)))
move_bits (buffer, value_bitpos (toval),
- value_contents (fromval), from_size - bits, bits);
+ value_contents (fromval), from_size - bits, bits, 1);
else
- move_bits (buffer, value_bitpos (toval), value_contents (fromval),
- 0, bits);
+ move_bits (buffer, value_bitpos (toval),
+ value_contents (fromval), 0, bits, 0);
write_memory (to_addr, buffer, len);
if (deprecated_memory_changed_hook)
deprecated_memory_changed_hook (to_addr, len);
else
bits = value_bitsize (component);
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (gdbarch_bits_big_endian (get_type_arch (value_type (container))))
move_bits (value_contents_writeable (container) + offset_in_container,
value_bitpos (container) + bit_offset_in_container,
value_contents (val),
TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits,
- bits);
+ bits, 1);
else
move_bits (value_contents_writeable (container) + offset_in_container,
value_bitpos (container) + bit_offset_in_container,
- value_contents (val), 0, bits);
+ value_contents (val), 0, bits, 0);
}
/* The value of the element of array ARR at the ARITY indices given in IND.
for (i = ada_array_arity (ada_check_typedef (value_type (arr))); i > 0; i -= 1)
{
- modify_general_field (value_contents_writeable (bounds),
+ modify_general_field (value_type (bounds),
+ value_contents_writeable (bounds),
ada_array_bound (arr, i, 0),
desc_bound_bitpos (bounds_type, i, 0),
desc_bound_bitsize (bounds_type, i, 0));
- modify_general_field (value_contents_writeable (bounds),
+ modify_general_field (value_type (bounds),
+ value_contents_writeable (bounds),
ada_array_bound (arr, i, 1),
desc_bound_bitpos (bounds_type, i, 1),
desc_bound_bitsize (bounds_type, i, 1));
bounds = ensure_lval (bounds, gdbarch, sp);
- modify_general_field (value_contents_writeable (descriptor),
+ modify_general_field (value_type (descriptor),
+ value_contents_writeable (descriptor),
value_address (ensure_lval (arr, gdbarch, sp)),
fat_pntr_data_bitpos (desc_type),
fat_pntr_data_bitsize (desc_type));
- modify_general_field (value_contents_writeable (descriptor),
+ modify_general_field (value_type (descriptor),
+ value_contents_writeable (descriptor),
value_address (bounds),
fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type));
struct value *func = ada_vax_float_print_function (type);
if (func != 0)
{
- struct gdbarch *gdbarch = current_gdbarch;
+ struct gdbarch *gdbarch = get_type_arch (type);
CORE_ADDR addr;
addr = value_as_address (call_function_by_hand (func, 1, &val));
val_print_string (builtin_type (gdbarch)->builtin_true_char,
opts.format = format;
print_scalar_formatted (valaddr, type, &opts, 0, stream);
}
- else if (ada_is_system_address_type (type)
- && TYPE_OBJFILE (type) != NULL)
+ else if (ada_is_system_address_type (type))
{
/* FIXME: We want to print System.Address variables using
the same format as for any access type. But for some
reason GNAT encodes the System.Address type as an int,
so we have to work-around this deficiency by handling
- System.Address values as a special case.
+ System.Address values as a special case. */
- We do this only for System.Address types defined in an
- objfile. For the built-in version of System.Address we
- have installed the proper type to begin with. */
-
- struct gdbarch *gdbarch = get_objfile_arch (TYPE_OBJFILE (type));
+ struct gdbarch *gdbarch = get_type_arch (type);
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
fprintf_filtered (stream, "(");
did_print_modifier = 1;
}
- address_space_id = address_space_int_to_name (TYPE_INSTANCE_FLAGS (type));
+ address_space_id = address_space_int_to_name (get_type_arch (type),
+ TYPE_INSTANCE_FLAGS (type));
if (address_space_id)
{
if (did_print_modifier || need_pre_space)
stream STREAM. */
static void
-print_function_pointer_address (CORE_ADDR address, struct ui_file *stream,
- int addressprint)
+print_function_pointer_address (struct gdbarch *gdbarch, CORE_ADDR address,
+ struct ui_file *stream, int addressprint)
{
- CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
- address,
+ CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
¤t_target);
/* If the function pointer is represented by a description, print the
CORE_ADDR address, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
unsigned int i = 0; /* Number of characters printed */
unsigned len;
struct type *elttype, *unresolved_elttype;
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
CORE_ADDR addr
= extract_typed_address (valaddr + embedded_offset, type);
- print_function_pointer_address (addr, stream, options->addressprint);
+ print_function_pointer_address (gdbarch, addr, stream,
+ options->addressprint);
break;
}
unresolved_elttype = TYPE_TARGET_TYPE (type);
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
- print_function_pointer_address (addr, stream,
+ print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
/* Return value is irrelevant except for string pointers. */
return (0);
CORE_ADDR addr
= extract_typed_address (valaddr + offset, field_type);
- print_function_pointer_address (addr, stream, options->addressprint);
+ print_function_pointer_address (gdbarch, addr, stream,
+ options->addressprint);
}
else
cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream,
but not passed on by GDB. This should be fixed. */
static const struct floatformat *
-floatformat_from_length (int len)
+floatformat_from_length (struct gdbarch *gdbarch, int len)
{
const struct floatformat *format;
- if (len * TARGET_CHAR_BIT == gdbarch_float_bit (current_gdbarch))
- format = gdbarch_float_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
- else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (current_gdbarch))
- format = gdbarch_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
- else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (current_gdbarch))
- format = gdbarch_long_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
+ if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
+ format = gdbarch_float_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
+ else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (gdbarch))
+ format = gdbarch_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
+ else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (gdbarch))
+ format = gdbarch_long_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
/* On i386 the 'long double' type takes 96 bits,
while the real number of used bits is only 80,
both in processor and in memory.
The code below accepts the real bit size. */
- else if ((gdbarch_long_double_format (current_gdbarch) != NULL)
+ else if ((gdbarch_long_double_format (gdbarch) != NULL)
&& (len * TARGET_CHAR_BIT ==
- gdbarch_long_double_format (current_gdbarch)[0]->totalsize))
- format = gdbarch_long_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
+ gdbarch_long_double_format (gdbarch)[0]->totalsize))
+ format = gdbarch_long_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
else
format = NULL;
if (format == NULL)
const struct floatformat *
floatformat_from_type (const struct type *type)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (TYPE_FLOATFORMAT (type) != NULL)
- return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)];
+ return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (gdbarch)];
else
- return floatformat_from_length (TYPE_LENGTH (type));
+ return floatformat_from_length (gdbarch, TYPE_LENGTH (type));
}
/* Extract a floating-point number of type TYPE from a target-order
bitpos += TYPE_FIELD_BITPOS (substruct_type, subfieldno);
addr = value_contents_writeable (struct_val) + bitpos / 8;
if (bitsize)
- modify_field (addr, value_as_long (val),
- bitpos % 8, bitsize);
+ modify_field (struct_type, addr,
+ value_as_long (val), bitpos % 8, bitsize);
else
memcpy (addr, value_contents (val),
TYPE_LENGTH (value_type (val)));
CORE_ADDR address, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
unsigned int i = 0; /* Number of characters printed */
struct type *elttype;
LONGEST val;
{
case TYPE_CODE_STRING:
f77_get_dynamic_length_of_aggregate (type);
- LA_PRINT_STRING (stream, builtin_type (current_gdbarch)->builtin_char,
+ LA_PRINT_STRING (stream, builtin_type (gdbarch)->builtin_char,
valaddr, TYPE_LENGTH (type), 0, options);
break;
_("extract_typed_address: "
"type is not a pointer or reference"));
- return gdbarch_pointer_to_address (current_gdbarch, type, buf);
+ return gdbarch_pointer_to_address (get_type_arch (type), type, buf);
}
_("store_typed_address: "
"type is not a pointer or reference"));
- gdbarch_address_to_pointer (current_gdbarch, type, buf, addr);
+ gdbarch_address_to_pointer (get_type_arch (type), type, buf, addr);
}
/* FIXME! Assume the machine has only one representation for
pointers! */
- TYPE_LENGTH (ntype) =
- gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+ TYPE_LENGTH (ntype)
+ = gdbarch_ptr_bit (get_type_arch (type)) / TARGET_CHAR_BIT;
TYPE_CODE (ntype) = TYPE_CODE_PTR;
/* Mark pointers as unsigned. The target converts between pointers
references, and that it matches the (only) representation for
pointers! */
- TYPE_LENGTH (ntype) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+ TYPE_LENGTH (ntype) =
+ gdbarch_ptr_bit (get_type_arch (type)) / TARGET_CHAR_BIT;
TYPE_CODE (ntype) = TYPE_CODE_REF;
if (!TYPE_REFERENCE_TYPE (type)) /* Remember it, if don't have one. */
/* Identify address space identifier by name --
return the integer flag defined in gdbtypes.h. */
extern int
-address_space_name_to_int (char *space_identifier)
+address_space_name_to_int (struct gdbarch *gdbarch, char *space_identifier)
{
- struct gdbarch *gdbarch = current_gdbarch;
int type_flags;
/* Check for known address space delimiters. */
if (!strcmp (space_identifier, "code"))
gdbtypes.h -- return the string version of the adress space name. */
const char *
-address_space_int_to_name (int space_flag)
+address_space_int_to_name (struct gdbarch *gdbarch, int space_flag)
{
- struct gdbarch *gdbarch = current_gdbarch;
if (space_flag & TYPE_INSTANCE_FLAG_CODE_SPACE)
return "code";
else if (space_flag & TYPE_INSTANCE_FLAG_DATA_SPACE)
lookup_array_range_type (struct type *element_type,
int low_bound, int high_bound)
{
- struct gdbarch *gdbarch = current_gdbarch;
+ struct gdbarch *gdbarch = get_type_arch (element_type);
struct type *index_type = builtin_type (gdbarch)->builtin_int;
struct type *range_type
= create_range_type (NULL, index_type, low_bound, high_bound);
TYPE_DOMAIN_TYPE (type) = domain;
/* Assume that a data member pointer is the same size as a normal
pointer. */
- TYPE_LENGTH (type) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+ TYPE_LENGTH (type)
+ = gdbarch_ptr_bit (get_type_arch (to_type)) / TARGET_CHAR_BIT;
TYPE_CODE (type) = TYPE_CODE_MEMBERPTR;
}
static void
check_stub_method (struct type *type, int method_id, int signature_id)
{
- struct gdbarch *gdbarch = current_gdbarch;
+ struct gdbarch *gdbarch = get_type_arch (type);
struct fn_field *f;
char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
char *demangled_name = cplus_demangle (mangled_name,
extern void replace_type (struct type *, struct type *);
-extern int address_space_name_to_int (char *);
+extern int address_space_name_to_int (struct gdbarch *, char *);
-extern const char *address_space_int_to_name (int);
+extern const char *address_space_int_to_name (struct gdbarch *, int);
extern struct type *make_type_with_address_space (struct type *type,
int space_identifier);
}
-/* 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:
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
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'
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;
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;
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);
}
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
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
find_function_addr (struct value *function, struct type **retval_type)
{
struct type *ftype = check_typedef (value_type (function));
+ struct gdbarch *gdbarch = get_type_arch (ftype);
enum type_code code = TYPE_CODE (ftype);
struct type *value_type = NULL;
CORE_ADDR funaddr;
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
{
- funaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
- funaddr,
+ funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
¤t_target);
value_type = TYPE_TARGET_TYPE (ftype);
}
CORE_ADDR nfunaddr;
funaddr = value_as_address (value_addr (function));
nfunaddr = funaddr;
- funaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
- funaddr,
+ funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
¤t_target);
if (funaddr != nfunaddr)
found_descriptor = 1;
if (retval_type != NULL)
*retval_type = value_type;
- return funaddr + gdbarch_deprecated_function_start_offset (current_gdbarch);
+ return funaddr + gdbarch_deprecated_function_start_offset (gdbarch);
}
/* For CALL_DUMMY_ON_STACK, push a breakpoint sequence that the called
java_value_print (struct value *val, struct ui_file *stream,
const struct value_print_options *options)
{
- struct gdbarch *gdbarch = current_gdbarch;
+ struct gdbarch *gdbarch = get_type_arch (value_type (val));
struct type *type;
CORE_ADDR address;
int i;
stream STREAM. */
static void
-print_function_pointer_address (CORE_ADDR address, struct ui_file *stream,
- int addressprint)
+print_function_pointer_address (struct gdbarch *gdbarch, CORE_ADDR address,
+ struct ui_file *stream, int addressprint)
{
- CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
- address,
+ CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
¤t_target);
/* If the function pointer is represented by a description, print the
const struct value_print_options *options,
struct ui_file *stream)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
- print_function_pointer_address (addr, stream, options->addressprint);
+ print_function_pointer_address (gdbarch, addr, stream,
+ options->addressprint);
/* Return value is irrelevant except for string pointers. */
return 0;
}
void
push_type_address_space (char *string)
{
- push_type_int (address_space_name_to_int (string));
+ push_type_int (address_space_name_to_int (parse_gdbarch, string));
}
enum type_pieces
/* Return builtin floating point type of same length as TYPE.
If no such type is found, return TYPE itself. */
static struct type *
-float_type_from_length (struct gdbarch *gdbarch, struct type *type)
+float_type_from_length (struct type *type)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
const struct builtin_type *builtin = builtin_type (gdbarch);
unsigned int len = TYPE_LENGTH (type);
const struct value_print_options *options,
int size, struct ui_file *stream)
{
- struct gdbarch *gdbarch = current_gdbarch;
+ struct gdbarch *gdbarch = get_type_arch (type);
LONGEST val_long = 0;
unsigned int len = TYPE_LENGTH (type);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
break;
case 'f':
- type = float_type_from_length (current_gdbarch, type);
+ type = float_type_from_length (type);
print_floating (valaddr, type, stream);
break;
gdb_byte *str;
CORE_ADDR tem;
int j;
- struct type *wctype = lookup_typename (current_language,
- current_gdbarch,
+ struct gdbarch *gdbarch
+ = get_type_arch (value_type (val_args[i]));
+ struct type *wctype = lookup_typename (current_language, gdbarch,
"wchar_t", NULL, 0);
int wcwidth = TYPE_LENGTH (wctype);
gdb_byte *buf = alloca (wcwidth);
break;
case wide_char_arg:
{
- struct type *wctype = lookup_typename (current_language,
- current_gdbarch,
+ struct gdbarch *gdbarch
+ = get_type_arch (value_type (val_args[i]));
+ struct type *wctype = lookup_typename (current_language, gdbarch,
"wchar_t", NULL, 0);
struct type *valtype;
struct obstack output;
/* If format string wants a float, unchecked-convert the value
to floating point of the same size. */
- type = float_type_from_length (current_gdbarch, type);
+ type = float_type_from_length (type);
val = unpack_double (type, value_contents (val_args[i]), &inv);
if (inv)
error (_("Invalid floating value found in program."));
/* If format string wants a float, unchecked-convert the value
to floating point of the same size. */
- type = float_type_from_length (current_gdbarch, type);
+ type = float_type_from_length (type);
val = unpack_double (type, value_contents (val_args[i]), &inv);
if (inv)
error (_("Invalid floating value found in program."));
/* Parameter data. */
struct type *param_type = value_type (val_args[i]);
unsigned int param_len = TYPE_LENGTH (param_type);
+ struct gdbarch *gdbarch = get_type_arch (param_type);
/* DFP output data. */
struct value *dfp_value = NULL;
if (*sos == 'H')
{
dfp_len = 4;
- dfp_type = builtin_type (current_gdbarch)->builtin_decfloat;
+ dfp_type = builtin_type (gdbarch)->builtin_decfloat;
}
else if (*sos == 'D' && *(sos - 1) == 'D')
{
dfp_len = 16;
- dfp_type = builtin_type (current_gdbarch)->builtin_declong;
+ dfp_type = builtin_type (gdbarch)->builtin_declong;
sos--;
}
else
{
dfp_len = 8;
- dfp_type = builtin_type (current_gdbarch)->builtin_decdouble;
+ dfp_type = builtin_type (gdbarch)->builtin_decdouble;
}
}
print_string_repr (PyObject *printer, const char *hint,
struct ui_file *stream, int recurse,
const struct value_print_options *options,
- const struct language_defn *language)
+ const struct language_defn *language,
+ struct gdbarch *gdbarch)
{
char *output;
struct value *replacement = NULL;
if (output)
{
if (hint && !strcmp (hint, "string"))
- LA_PRINT_STRING (stream, builtin_type (current_gdbarch)->builtin_char,
+ LA_PRINT_STRING (stream, builtin_type (gdbarch)->builtin_char,
(gdb_byte *) output, strlen (output),
0, options);
else
const struct value_print_options *options,
const struct language_defn *language)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
PyObject *printer = NULL;
PyObject *val_obj = NULL;
struct value *value;
make_cleanup (free_current_contents, &hint);
/* Print the section */
- print_string_repr (printer, hint, stream, recurse, options, language);
+ print_string_repr (printer, hint, stream, recurse, options, language,
+ gdbarch);
print_children (printer, hint, stream, recurse, options, language);
result = 1;
struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
+
#define SCM_SIZE (TYPE_LENGTH (type))
taloop:
switch (7 & (int) svalue)
if (SCM_ICHRP (svalue))
{
svalue = SCM_ICHR (svalue);
- scm_printchar (svalue, builtin_type (current_gdbarch)->builtin_char,
+ scm_printchar (svalue, builtin_type (gdbarch)->builtin_char,
stream);
break;
}
byte = *((char *) value_contents (bitstring) + offset);
bit_index = index % TARGET_CHAR_BIT;
- byte >>= (gdbarch_bits_big_endian (current_gdbarch) ?
+ byte >>= (gdbarch_bits_big_endian (get_type_arch (bitstring_type)) ?
TARGET_CHAR_BIT - 1 - bit_index : bit_index);
v = value_from_longest (type, byte & 1);
struct value *
value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
{
- struct gdbarch *gdbarch = current_gdbarch;
+ struct gdbarch *gdbarch = get_type_arch (value_type (arg1));
struct value **argvec;
char *ptr, *mangle_ptr;
char tstr[13], mangle_tstr[13];
memcpy (decbytes, value_contents (arg1), len);
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (get_type_arch (type)) == BFD_ENDIAN_LITTLE)
decbytes[len-1] = decbytes[len - 1] | 0x80;
else
decbytes[0] = decbytes[0] | 0x80;
int
value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
LONGEST low_bound, high_bound;
LONGEST word;
unsigned rel_index;
rel_index = index - low_bound;
word = extract_unsigned_integer (valaddr + (rel_index / TARGET_CHAR_BIT), 1);
rel_index %= TARGET_CHAR_BIT;
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (gdbarch_bits_big_endian (gdbarch))
rel_index = TARGET_CHAR_BIT - 1 - rel_index;
return (word >> rel_index) & 1;
}
otherwise occur when dealing with a target having two byte
pointers and four byte addresses. */
- int addr_bit = gdbarch_addr_bit (current_gdbarch);
+ int addr_bit = gdbarch_addr_bit (get_type_arch (type2));
LONGEST longest = value_as_long (arg2);
if (addr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)
(int) sizeof (LONGEST) * HOST_CHAR_BIT);
read_memory (value_address (toval), buffer, changed_len);
- modify_field (buffer, value_as_long (fromval),
+ modify_field (type, buffer, value_as_long (fromval),
value_bitpos (toval), value_bitsize (toval));
changed_addr = value_address (toval);
dest_buffer = buffer;
value_offset (toval),
changed_len, buffer);
- modify_field (buffer, value_as_long (fromval),
- value_bitpos (toval),
- value_bitsize (toval));
+ modify_field (type, buffer, value_as_long (fromval),
+ value_bitpos (toval), value_bitsize (toval));
put_frame_register_bytes (frame, value_reg,
value_offset (toval),
else if (element > 0)
{
int j = i % TARGET_CHAR_BIT;
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (gdbarch_bits_big_endian (get_type_arch (array_type)))
j = TARGET_CHAR_BIT - 1 - j;
value_contents_raw (slice)[i / TARGET_CHAR_BIT] |= (1 << j);
}
val_print_type_code_int (struct type *type, const gdb_byte *valaddr,
struct ui_file *stream)
{
- enum bfd_endian byte_order = gdbarch_byte_order (current_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
if (TYPE_LENGTH (type) > sizeof (LONGEST))
{
addr = value_contents_writeable (var->u.value);
if (bitsize)
- modify_field (addr + offset,
+ modify_field (value_type (var->u.value), addr + offset,
value_as_long (newval), bitpos, bitsize);
else
memcpy (addr + offset, value_contents (newval),
CORE_ADDR
value_as_address (struct value *val)
{
+ struct gdbarch *gdbarch = get_type_arch (value_type (val));
+
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
#if 0
/* gdbarch_addr_bits_remove is wrong if we are being called for a
non-address (e.g. argument to "signal", "info break", etc.), or
for pointers to char, in which the low bits *are* significant. */
- return gdbarch_addr_bits_remove (current_gdbarch, value_as_long (val));
+ return gdbarch_addr_bits_remove (gdbarch, value_as_long (val));
#else
/* There are several targets (IA-64, PowerPC, and others) which
if (TYPE_CODE (value_type (val)) != TYPE_CODE_PTR
&& TYPE_CODE (value_type (val)) != TYPE_CODE_REF
- && gdbarch_integer_to_address_p (current_gdbarch))
- return gdbarch_integer_to_address (current_gdbarch, value_type (val),
+ && gdbarch_integer_to_address_p (gdbarch))
+ return gdbarch_integer_to_address (gdbarch, value_type (val),
value_contents (val));
return unpack_long (value_type (val), value_contents (val));
/* Extract bits. See comment above. */
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (gdbarch_bits_big_endian (get_type_arch (type)))
lsbcount = (sizeof val * 8 - bitpos % 8 - bitsize);
else
lsbcount = (bitpos % 8);
0 <= BITPOS, where lbits is the size of a LONGEST in bits. */
void
-modify_field (gdb_byte *addr, LONGEST fieldval, int bitpos, int bitsize)
+modify_field (struct type *type, gdb_byte *addr,
+ LONGEST fieldval, int bitpos, int bitsize)
{
ULONGEST oword;
ULONGEST mask = (ULONGEST) -1 >> (8 * sizeof (ULONGEST) - bitsize);
oword = extract_unsigned_integer (addr, sizeof oword);
/* Shifting for bit field depends on endianness of the target machine. */
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (gdbarch_bits_big_endian (get_type_arch (type)))
bitpos = sizeof (oword) * 8 - bitpos - bitsize;
oword &= ~(mask << bitpos);
extern int record_latest_value (struct value *val);
-extern void modify_field (gdb_byte *addr, LONGEST fieldval, int bitpos,
- int bitsize);
+extern void modify_field (struct type *type, gdb_byte *addr,
+ LONGEST fieldval, int bitpos, int bitsize);
extern void type_print (struct type *type, char *varstring,
struct ui_file *stream, int show);
opts.raw = 1;
if (thevalue)
{
+ struct gdbarch *gdbarch = get_type_arch (value_type (value));
make_cleanup (xfree, thevalue);
- LA_PRINT_STRING (stb, builtin_type (current_gdbarch)->builtin_char,
+ LA_PRINT_STRING (stb, builtin_type (gdbarch)->builtin_char,
(gdb_byte *) thevalue, strlen (thevalue),
0, &opts);
}