From: Yao Qi Date: Wed, 4 Jan 2017 09:32:46 +0000 (+0000) Subject: Fix an internal error on writing pieced value X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2aaaf250e80afb4a5c66fb0b7801e24cc5c4e680;p=binutils-gdb.git 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 * dwarf2loc.c (write_pieced_value): Don't use VALUE_FRAME_ID (to), use c->frame_id when the piece location is DWARF_VALUE_REGISTER. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2837a9da587..1765543405a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-01-04 Yao Qi + + * 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 Update copyright year range in all GDB files. diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index bab179932c6..35de0ed6c55 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -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 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;