Re: [PATCH 14/43] Make value_copy also copy the stack data member

Simon Marchi via Gdb-patches
2021-04-28T02:01:39Z

On 2021-03-01 9:45 a.m., Zoran Zaric via Gdb-patches wrote:
> Fixing a bug where the value_copy function did not copy the stack data
> member of the struct value. This is needed for the next patch where the
> DWARF expression evaluator is changed to return a single struct value
> object.
>
> * value.c (value_copy): Change to also copy the stack data
> member.

`member` should be aligned with the asterisk.

> ---
> gdb/value.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/gdb/value.c b/gdb/value.c
> index bddf9a47923..9f3914a5bc5 100644
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -1690,6 +1690,7 @@ value_copy (struct value *arg)
> val->embedded_offset = value_embedded_offset (arg);
> val->pointed_to_offset = arg->pointed_to_offset;
> val->modifiable = arg->modifiable;
> + val->stack = arg->stack;
> if (!value_lazy (val))
> {
> memcpy (value_contents_all_raw (val), value_contents_all_raw (arg),
>

LGTM. Although it would be good to check if there are other leftovers.
For example it seems like the `initialized` field should be copied as
well?

Simon