diff options
author | Tom de Vries <tdevries@suse.de> | 2025-01-04 11:31:02 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2025-01-04 11:31:02 +0100 |
commit | 09859118ffc86b311d47aa461f722a720045e049 (patch) | |
tree | 86059f01d248e599203f234bc41ed12e557c446e /gdb/ppcfbsd-tdep.c | |
parent | d46fdacc0921666ce5e815529151aae07c6f8dd2 (diff) | |
download | gdb-09859118ffc86b311d47aa461f722a720045e049.zip gdb-09859118ffc86b311d47aa461f722a720045e049.tar.gz gdb-09859118ffc86b311d47aa461f722a720045e049.tar.bz2 |
[gdb/tdep] Fix gdb.base/finish-pretty.exp on s390x
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.
The hook is not guaranteed to work, because it attempts to get the value r2
had at function entry.
The hook can be called after function entry, and the ABI doesn't guarantee
that r2 is the same throughout the function.
Using -fvar-tracking adds debug information, which allows the hook to succeed
more often, and indeed after adding this to the test-case, it passes.
Do likewise in one more test-case.
Tested on s390x-linux.
Fixes:
- gdb.ada/finish-large.exp
- gdb.base/finish-pretty.exp
- gdb.base/retval-large-struct.exp
- gdb.cp/non-trivial-retval.exp
- gdb.ada/array_return.exp
AFAICT, I've also enabled the hook for s390 and from the ABI I get the
impression that it should work, but I haven't been able to test it.
[1] https://github.com/IBM/s390x-abi
Diffstat (limited to 'gdb/ppcfbsd-tdep.c')
0 files changed, 0 insertions, 0 deletions