From 9bbda5038131704610b27bee2c70e81c68374f61 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 8 Feb 2005 04:57:03 +0000 Subject: [PATCH] 2005-02-07 Andrew Cagney * value.c (set_value_bitpos, set_value_bitsize): Define. * value.h (set_value_bitpos, set_value_bitsize): Declare. * ada-lang.c, valarith.c: Update. --- gdb/ChangeLog | 4 ++++ gdb/ada-lang.c | 12 ++++++------ gdb/valarith.c | 4 ++-- gdb/value.c | 10 ++++++++++ gdb/value.h | 2 ++ 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6f7da53301e..e3f67c12534 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2005-02-07 Andrew Cagney + * 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. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index b3bed523033..b2fb2a671c2 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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; diff --git a/gdb/valarith.c b/gdb/valarith.c index 6447b48d3b0..b3f6c49d5cd 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -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; diff --git a/gdb/value.c b/gdb/value.c index b584fb99d9f..de9fd15c36d 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -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) diff --git a/gdb/value.h b/gdb/value.h index b8d1490cfbe..5173ead8003 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -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); -- 2.30.2