[PATCH 09/12] DWARF value, mark unavailable in bits not bytes.

Andrew Burgess
2013-08-12T12:30:37Z

A later patch revealed that in the dwarf code we're marking
a value unavailable in bytes using a bit based offset and a
byte based size.

Here I switch to using just bits to do the job.

OK to apply?

Thanks,
Andrew

gdb/ChangeLog

2013-08-08 Andrew Burgess <aburgess@broadcom.com>

* dwarf2loc.c (read_pieced_value): Mark optimized out and
unavailable in bits not bytes.
* value.c (mark_value_bits_unavailable): New function.
(mark_value_bytes_unavailable): Use mark_value_bits_unavailable.
* value.h (mark_value_bits_unavailable): New function.

diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index bae425a..553f720 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1694,9 +1694,9 @@ read_pieced_value (struct value *v)
memset (buffer, 0, this_size);
if (optim)
- mark_value_bytes_optimized_out (v, offset, this_size);
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
if (unavail)
- mark_value_bytes_unavailable (v, offset, this_size);
+ mark_value_bits_unavailable (v, offset, this_size_bits);
}
}
else
diff --git a/gdb/value.c b/gdb/value.c
index 19ba16c..c41e6e1 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -572,9 +572,17 @@ insert_into_bit_range_vector (VEC(range_s)
**vectorp, int offset, int length)
void
mark_value_bytes_unavailable (struct value *value, int offset, int length)
{
+ mark_value_bits_unavailable (value, offset * TARGET_CHAR_BIT,
+ length * TARGET_CHAR_BIT);
+}
+
+void
+mark_value_bits_unavailable (struct value *value, int offset, int length)
+{
insert_into_bit_range_vector (&value->unavailable,
- offset * TARGET_CHAR_BIT,
- length * TARGET_CHAR_BIT);
+ offset,
+ length,
+ bit_range_unavailable);
}
void
diff --git a/gdb/value.h b/gdb/value.h
index 81c1cc5..8226a0d 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -449,6 +449,12 @@ extern int value_entirely_unavailable (struct value
*value);
extern void mark_value_bytes_unavailable (struct value *value,
int offset, int length);
+/* Mark VALUE's content bits starting at OFFSET and extending for
+ LENGTH bits as unavailable. */
+
+extern void mark_value_bits_unavailable (struct value *value,
+ int offset, int length);
+
/* Set contents of OPTIMIZEDP to nonzero if any part of VALUE is optimized
out, otherwise set to zero. Set contents of UNAVAILABLEP to nonzero if
any part of VALUE is unavailable, otherwise set to zero. */