aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/ada-lang.c12
-rw-r--r--gdb/valarith.c4
-rw-r--r--gdb/value.c10
-rw-r--r--gdb/value.h2
5 files changed, 24 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6f7da53..e3f67c1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b3bed52..b2fb2a6 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 6447b48..b3f6c49 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 b584fb9..de9fd15 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 b8d1490..5173ead 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);