* value.h (unpack_bits_as_long): Delete declaration.
	(unpack_value_bits_as_long): Declare.
	(unpack_value_field_as_long): Declare.
	(value_field_bitfield): Declare.
	* value.c (unpack_bits_as_long): Rename to...
	(unpack_value_bits_as_long_1): ... this.  Add embedded_offset and
	value parameters.  Return the extracted result in a new output
	parameter.  If the value contents are unavailable, return false,
	otherwise return true.
	(unpack_value_bits_as_long): New.
	(unpack_field_as_long): Rename to...
	(unpack_value_field_as_long_1): ... this.  Add embedded_offset and
	Add embedded_offset and value parameters.  Return the extracted
	result in a new output parameter. If the value contents are
	unavailable, return false, otherwise return true.
	(unpack_value_field_as_long): New.
	(unpack_field_as_long_1): New.
	(unpack_field_as_long): Reimplement as wrapper around
	unpack_value_field_as_long_1.
	(value_field_bitfield): New function.
	* valops.c (value_fetch_lazy): When fetching a bitfield, use
	unpack_value_bits_as_long.  Mark the value as unavailable, if it
	is unavailable.
	* jv-valprint.c (java_print_value_fields): Use
	value_field_bitfield.
	* p-valprint.c (pascal_object_print_value_fields): Use
	value_field_bitfield.
	* cp-valprint.c (cp_print_value_fields): Use value_field_bitfield.
This commit is contained in:
Pedro Alves 2011-02-14 11:25:59 +00:00
parent 3158c6ed12
commit 5467c6c807
7 changed files with 186 additions and 43 deletions

View file

@ -989,11 +989,7 @@ value_fetch_lazy (struct value *val)
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
struct value *parent = value_parent (val);
LONGEST offset = value_offset (val);
LONGEST num = unpack_bits_as_long (value_type (val),
(value_contents_for_printing (parent)
+ offset),
value_bitpos (val),
value_bitsize (val));
LONGEST num;
int length = TYPE_LENGTH (type);
if (!value_bits_valid (val,
@ -1001,7 +997,17 @@ value_fetch_lazy (struct value *val)
value_bitsize (val)))
error (_("value has been optimized out"));
store_signed_integer (value_contents_raw (val), length, byte_order, num);
if (!unpack_value_bits_as_long (value_type (val),
value_contents_for_printing (parent),
offset,
value_bitpos (val),
value_bitsize (val), parent, &num))
mark_value_bytes_unavailable (val,
value_embedded_offset (val),
length);
else
store_signed_integer (value_contents_raw (val), length,
byte_order, num);
}
else if (VALUE_LVAL (val) == lval_memory)
{