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

Zoran Zaric via Gdb-patches
2021-04-28T11:43:19Z

On 4/28/21 3:01 AM, Simon Marchi wrote:
> [CAUTION: External Email]
>
> 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.

Thanks, I will fix it in the next iteration.

>
>> ---
>> 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
>

Yeah, I need to add the initialized there too and run the test to see
what happens.

I am confused how this wasn't noticed before though. There might be more
information that is missing.

Zoran