Fix an internal error on writing pieced value

In ee40d8d (Move computed value's frame id to piece_closure), I only
updated read_pieced_value to use frame_id from piece_closure, but
forgot to update write_pieced_value, so it causes the following
internal error on arm-linux,

set variable l = 4^M
gdb/git/gdb/value.c:1579: internal-error: frame_id* deprecated_value_next_frame_id_hack(value*): Assertion `value->lval == lval_register' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.base/store.exp: var longest l; setting l to 4 (GDB internal error)

This patch fixes the internal error.

gdb:

2017-01-04  Yao Qi  <yao.qi@linaro.org>

	* dwarf2loc.c (write_pieced_value): Don't use VALUE_FRAME_ID (to),
	use c->frame_id when the piece location is DWARF_VALUE_REGISTER.
This commit is contained in:
Yao Qi 2017-01-04 09:32:46 +00:00
parent c27e4edb52
commit 2aaaf250e8
2 changed files with 6 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2017-01-04 Yao Qi <yao.qi@linaro.org>
* dwarf2loc.c (write_pieced_value): Don't use VALUE_FRAME_ID (to),
use c->frame_id when the piece location is DWARF_VALUE_REGISTER.
2017-01-01 Joel Brobecker <brobecker@adacore.com>
Update copyright year range in all GDB files.

View File

@ -1908,24 +1908,12 @@ write_pieced_value (struct value *to, struct value *from)
const gdb_byte *contents;
struct piece_closure *c
= (struct piece_closure *) value_computed_closure (to);
struct frame_info *frame;
size_t type_len;
size_t buffer_size = 0;
std::vector<gdb_byte> buffer;
int bits_big_endian
= gdbarch_bits_big_endian (get_type_arch (value_type (to)));
/* VALUE_FRAME_ID is used instead of VALUE_NEXT_FRAME_ID here
because FRAME is passed to get_frame_register_bytes() and
put_frame_register_bytes(), both of which do their own "->next"
operations. */
frame = frame_find_by_id (VALUE_FRAME_ID (to));
if (frame == NULL)
{
mark_value_bytes_optimized_out (to, 0, TYPE_LENGTH (value_type (to)));
return;
}
contents = value_contents (from);
bits_to_skip = 8 * value_offset (to);
if (value_bitsize (to))
@ -1988,6 +1976,7 @@ write_pieced_value (struct value *to, struct value *from)
{
case DWARF_VALUE_REGISTER:
{
struct frame_info *frame = frame_find_by_id (c->frame_id);
struct gdbarch *arch = get_frame_arch (frame);
int gdb_regnum = dwarf_reg_to_regnum_or_error (arch, p->v.regno);
int reg_offset = dest_offset;