FYI: fix big-endian bug with DWARF_VALUE_STACK
Tom Tromey
tromey@redhat.com
Tue Feb 23 20:26:00 GMT 2010
>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:
Tom> + store_unsigned_integer (contents + offset, n,
Tom> + gdbarch_byte_order (c->arch),
Tom> + p->v.expr.value);
Ulrich> The original code looks broken to me too. But even the new code
Ulrich> doesn't seem quite right: if the requested piece size p->size
Ulrich> is larger than addr_size, the remaining bytes of the output value
Ulrich> are left undefined (well, probably zeroed -- but that still doesn't
Ulrich> look correct on a big-endian machine ...).
I asked about a similar case on dwarf-discuss, namely what if you have:
DW_OP_implicit_value[len=5] DW_OP_piece[len=10]
The answer I got was something along the lines of "that is undefined,
don't do that".
The archives seem to be closed to the public, but if you are a
subscriber you can see:
http://lists.dwarfstd.org/htdig.cgi/dwarf-discuss-dwarfstd.org/2009-June/000760.html
I think the same has to apply to your example.
Ulrich> Why would that code look at gdbarch_addr_bit at all? I think this
Ulrich> should simply do something like:
Ulrich> store_unsigned_integer (contents + offset, p->size,
Ulrich> gdbarch_byte_order (c->arch),
Yeah ... I took another look and I still don't understand that use in
read_pieced_value. Maybe a complaint is in order here.
Tom> @@ -476,19 +474,17 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
Ulrich> Similiary here; why does this not simply use value_from_longest?
It didn't occur to me; but AFAIK, nothing prohibits a DWARF expression
from using DW_OP_stack_value to fill in a structure or union, and
value_from_longest won't work in that case.
Tom
More information about the Gdb-patches
mailing list