[PATCH] [AArch64] Fix PR gdb/28681

Luis Machado luis.machado@linaro.org
Tue Jan 4 18:49:51 GMT 2022


On 1/4/22 3:47 PM, Simon Marchi wrote:
> 
> 
> On 2022-01-04 13:44, Luis Machado wrote:
>> On 1/4/22 3:09 PM, Simon Marchi wrote:
>>>
>>>
>>> On 2022-01-04 12:22, Luis Machado via Gdb-patches wrote:
>>>> This is the same as commit b1718fcdd1d2a5c514f8ee504ba07fb3f42b8608, but
>>>> fixing things for AArch64.
>>>>
>>>> With the patch, gdb.cp/non-trivial-retval.exp has full passes on
>>>> AArch64-Linux Ubuntu 20.04/18.04.
>>>> ---
>>>>    gdb/aarch64-tdep.c | 9 +++++++++
>>>>    1 file changed, 9 insertions(+)
>>>>
>>>> diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
>>>> index 70fb66954a4..802762f303c 100644
>>>> --- a/gdb/aarch64-tdep.c
>>>> +++ b/gdb/aarch64-tdep.c
>>>> @@ -2323,6 +2323,15 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
>>>>          valbuf += X_REGISTER_SIZE;
>>>>        }
>>>>        }
>>>> +  else if (!language_pass_by_reference (type).trivially_copyable)
>>>> +    {
>>>> +      /* If the object is a non-trivial C++ object, the result is passed as a
>>>> +     pointer stored in X0.  */
>>>> +      CORE_ADDR addr;
>>>> +
>>>> +      regs->cooked_read (AARCH64_X0_REGNUM, &addr);
>>>> +      read_memory (addr, valbuf, TYPE_LENGTH (type));
>>>> +    }
>>>>      else
>>>>        {
>>>>          /* For a structure or union the behaviour is as if the value had
>>>
>>> I'll let somebody else review this (probably Andrew), but please change the
>>> patch subject to something descriptive, not just the bug number.
>>
>> Did you want the entire bugzilla PR subject or something else? I can't really tell from your reply, sorry.
> 
> No, not the bugzilla title (which is `Wrong pretty-printed unique_ptr
> value when using "finish"`), since that is a distant symptom of the
> problem you fix.  The subject should state what you are fixing, so
> something about the handling of trivially copyable return values on
> AArch64 (something like that, I didn't follow the resolution of the bug
> close enough).

How about "gdb: on aarch64 non-trivial C++ objects are returned in memory"?


More information about the Gdb-patches mailing list