aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.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
commit50810684816502312a09d6713844c7a63ffd97cc (patch)
treead3673787cc1c22af679e7adf030f46692934265 /gdb/value.c
parente9bb382b835d19c078eca9908ec6fe66f7af67fa (diff)
downloadfsf-binutils-gdb-50810684816502312a09d6713844c7a63ffd97cc.zip
fsf-binutils-gdb-50810684816502312a09d6713844c7a63ffd97cc.tar.gz
fsf-binutils-gdb-50810684816502312a09d6713844c7a63ffd97cc.tar.bz2
* 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/value.c')
-rw-r--r--gdb/value.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 7b95c42..fb8da3e 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1162,7 +1162,7 @@ set_internalvar_component (struct internalvar *var, int offset, int bitpos,
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),
@@ -1505,13 +1505,15 @@ value_as_double (struct value *val)
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
@@ -1596,8 +1598,8 @@ value_as_address (struct value *val)
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));
@@ -1988,7 +1990,7 @@ unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
/* 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);
@@ -2020,7 +2022,8 @@ unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
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);
@@ -2044,7 +2047,7 @@ modify_field (gdb_byte *addr, LONGEST fieldval, int bitpos, int 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);