This patch address five testcase failures in gdb.cp/non-trivial-retval.exp.
The following commit resulted in the five testcases failures on PowerPC.
The value returned by the function is being reported incorrectly.
commit
b1718fcdd1d2a5c514f8ee504ba07fb3f42b8608
Author: Andrew Burgess <aburgess@redhat.com>
Date: Mon Dec 13 16:56:16 2021 +0000
gdb: on x86-64 non-trivial C++ objects are returned in memory
Fixes PR gdb/28681. It was observed that after using the `finish`
command an incorrect value was displayed in some cases. Specifically,
this behaviour was observed on an x86-64 target.
The function:
enum return_value_convention
ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
should return RETURN_VALUE_STRUCT_CONVENTION if the valtype->code() is
TYPE_CODE_STRUCT and if the language_pass_by_reference is not
trivially_copyable.
This patch adds the needed code to return the value
RETURN_VALUE_STRUCT_CONVENTION in this case.
With this patch, the five test cases still fail but with the message "Value
returned has type: A. Cannot determine contents". The PowerPC ABI stores
the address of the buffer containing the function return value in register
r3 on entry to the function. However, the PowerPC ABI does not guarentee
that r3 will not be modified in the function. So when the function returns,
the return buffer address cannot be reliably obtained from register r3.
Thus the message "Cannot determine contents" is appropriate in this case.