2005-02-07 Andrew Cagney <cagney@gnu.org>

* value.c (set_value_bitpos, set_value_bitsize): Define.
	* value.h (set_value_bitpos, set_value_bitsize): Declare.
	* ada-lang.c, valarith.c: Update.
This commit is contained in:
Andrew Cagney 2005-02-08 04:57:03 +00:00
parent 0a40490e6a
commit 9bbda50381
5 changed files with 24 additions and 8 deletions

View file

@ -1,5 +1,9 @@
2005-02-07 Andrew Cagney <cagney@gnu.org>
* value.c (set_value_bitpos, set_value_bitsize): Define.
* value.h (set_value_bitpos, set_value_bitsize): Declare.
* ada-lang.c, valarith.c: Update.
* cp-valprint.c, c-valprint.c, infcall.c: Use value_contents or
value_contents_writeable, include note that there are problems.
* breakpoint.c, infcall.c: Use VALUE_LVAL.

View file

@ -448,8 +448,8 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
result = allocate_value (type);
VALUE_LVAL (result) = VALUE_LVAL (val);
result->bitsize = value_bitsize (val);
result->bitpos = value_bitpos (val);
set_value_bitsize (result, value_bitsize (val));
set_value_bitpos (result, value_bitpos (val));
VALUE_ADDRESS (result) = VALUE_ADDRESS (val) + value_offset (val);
if (value_lazy (val)
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
@ -1830,16 +1830,16 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr,
if (VALUE_LVAL (obj) == lval_internalvar)
VALUE_LVAL (v) = lval_internalvar_component;
VALUE_ADDRESS (v) = VALUE_ADDRESS (obj) + value_offset (obj) + offset;
v->bitpos = bit_offset + value_bitpos (obj);
v->bitsize = bit_size;
set_value_bitpos (v, bit_offset + value_bitpos (obj));
set_value_bitsize (v, bit_size);
if (value_bitpos (v) >= HOST_CHAR_BIT)
{
VALUE_ADDRESS (v) += 1;
v->bitpos -= HOST_CHAR_BIT;
set_value_bitpos (v, value_bitpos (v) - HOST_CHAR_BIT);
}
}
else
v->bitsize = bit_size;
set_value_bitsize (v, bit_size);
unpacked = (unsigned char *) value_contents (v);
srcBitsLeft = bit_size;

View file

@ -233,8 +233,8 @@ value_subscript (struct value *array, struct value *idx)
bit_index = index % TARGET_CHAR_BIT;
byte >>= (BITS_BIG_ENDIAN ? TARGET_CHAR_BIT - 1 - bit_index : bit_index);
v = value_from_longest (LA_BOOL_TYPE, byte & 1);
v->bitpos = bit_index;
v->bitsize = 1;
set_value_bitpos (v, bit_index);
set_value_bitsize (v, 1);
VALUE_LVAL (v) = VALUE_LVAL (array);
if (VALUE_LVAL (array) == lval_internalvar)
VALUE_LVAL (v) = lval_internalvar_component;

View file

@ -156,12 +156,22 @@ value_bitpos (struct value *value)
{
return value->bitpos;
}
void
set_value_bitpos (struct value *value, int bit)
{
value->bitpos = bit;
}
int
value_bitsize (struct value *value)
{
return value->bitsize;
}
void
set_value_bitsize (struct value *value, int bit)
{
value->bitsize = bit;
}
bfd_byte *
value_contents_raw (struct value *value)

View file

@ -184,7 +184,9 @@ extern struct type *value_type (struct value *);
extern void deprecated_set_value_type (struct value *value,
struct type *type);
extern int value_bitsize (struct value *);
extern void set_value_bitsize (struct value *, int bit);
extern int value_bitpos (struct value *);
extern void set_value_bitpos (struct value *, int bit);
extern int value_offset (struct value *);
extern void set_value_offset (struct value *, int offset);