[PATCH v2] [gdb/tdep] Fix gdb.base/finish-pretty.exp on s390x

Tom de Vries tdevries@suse.de
Tue Jan 7 11:28:08 GMT 2025


On 1/4/25 11:32, Tom de Vries wrote:
> On 12/18/24 01:24, Tom de Vries wrote:
>> On s390x-linux, with test-case gdb.base/finish-pretty.exp I ran into:
>> ...
>> (gdb) finish
>> Run till exit from #0  foo () at finish-pretty.c:28
>> main () at finish-pretty.c:40
>> 40      return v.a + v.b;
>> Value returned has type: struct s. Cannot determine contents
>> (gdb) FAIL: $exp: finish foo prettyprinted function result
>> ...
>>
>> The function being finished is foo, which returns a value of type 
>> struct s.
>>
>> The ABI [1] specifies:
>> - that the value is returned in a storage buffer allocated by the 
>> caller, and
>> - that the address of this buffer is passed as a hidden argument in r2.
>>
>> GDB fails to print the value when finishing foo, because it doesn't 
>> know the
>> address of the buffer.
>>
>> Implement the gdbarch_get_return_buf_addr hook for s390x to fix this.
>>
>> This is based on ppc_sysv_get_return_buf_addr, the only other 
>> implementation
>> of gdbarch_get_return_buf_addr.  For readability I've factored out
>> dwarf_reg_on_entry.
>>
>> There is one difference with ppc_sysv_get_return_buf_addr: only
>> NO_ENTRY_VALUE_ERROR is caught.  If this patch is approved, I intend 
>> to submit
>> a follow-up patch to fix this in ppc_sysv_get_return_buf_addr as well.

Submitted follow-up patch (
https://sourceware.org/pipermail/gdb-patches/2025-January/214513.html ).

Thanks,
- Tom



More information about the Gdb-patches mailing list