This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: optimized-out pieces
> +static int
> +check_pieced_value_validity (const struct value *value, int bit_offset,
> + int bit_length)
> +{
> + struct piece_closure *c
> + = (struct piece_closure *) value_computed_closure (value);
> + int i;
> +
> + bit_offset += 8 * value_offset (value);
I miss some `value_bitpos (value)' possibility here.
> + for (i = 0; i < c->n_pieces && bit_length > 0; i++)
> + {
> + struct dwarf_expr_piece *p = &c->pieces[i];
> + size_t this_size_bits = p->size;
> +
> + if (bit_offset > 0)
> + {
> + if (bit_offset >= this_size_bits)
> + {
> + bit_offset -= this_size_bits;
> + continue;
> + }
> +
> + bit_length -= bit_offset;
Here should be `bit_length -= this_size_bits - bit_offset'.
If we heve:
this_size_bits = 8
bit_offset = 7
bit_length = 2
then your code does
bit_length -= 7; bit_length = -5;
while for the next piece it should be:
bit_length -= 1; bit_length = 1;
> + bit_offset = 0;
> + }
> + else
> + bit_length -= this_size_bits;
> +
> + if (p->location == DWARF_VALUE_OPTIMIZED_OUT)
> + return 0;
> + }
> +
> + return 1;
> +}
Thanks,
Jan