Re: [PATCH 1/4] gdb: fix length of array view returned by some value_contents functions

Tom Tromey
2021-11-16T20:42:04Z

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> From: Simon Marchi <simon.marchi@polymtl.ca>
Simon> In commit 50888e42dcd3 ("gdb: change functions returning value contents
Simon> to use gdb::array_view"), I believe I made a mistake with the length of
Simon> the array views returned by some functions. All functions return a view
Simon> of `TYPE_LENGTH (value_type (type))` length. This is not correct when
Simon> the value's enclosing type is larger than the value's type. In that
Simon> case, the value's contents buffer is of the size of the enclosing type,
Simon> and the value's actual contents is a slice of that (as returned by
Simon> value_contents). So, functions value_contents_all_raw,
Simon> value_contents_for_printing and value_contents_for_printing_const are
Simon> not correct. Since they are meant to return the value's contents buffer
Simon> as a whole, they should have the size of the enclosing type.

This looks good to me.

Tom