aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-cmd-prompt.py
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2025-10-17 08:02:02 +0200
committerTom de Vries <tdevries@suse.de>2025-10-17 08:02:02 +0200
commit0e4fd060ee7244d00c76f0d4815063dfcc9877f1 (patch)
treef9e128134f123a3a9e0eb4d4def780a2e24a955d /gdb/testsuite/gdb.python/py-cmd-prompt.py
parent9c9106213ab41185b0475cab3670f4055cc5901d (diff)
downloadbinutils-0e4fd060ee7244d00c76f0d4815063dfcc9877f1.zip
binutils-0e4fd060ee7244d00c76f0d4815063dfcc9877f1.tar.gz
binutils-0e4fd060ee7244d00c76f0d4815063dfcc9877f1.tar.bz2
[gdb/tdep] Fix inferior call return of small char array for ppc64 v1 abi some more
PR tdep/33534 reports a regression due to commit 13f1820106c ("[gdb/tdep] Fix inferior call return of small char array for ppc64 v1 abi"). The regression can be reproduced with the test-case introduced in the commit: gdb.ada/return-small-char-array.exp, on a ppc64-linux setup with v1 elf abi (cfarm121). The commit contains two changes to a piece of code in ppc64_sysv_abi_return_value: ... /* Small character arrays are returned, right justified, in r3. */ - if (valtype->code () == TYPE_CODE_ARRAY + if (tdep->elf_abi == POWERPC_ELF_V1 + && valtype->code () == TYPE_CODE_ARRAY && !valtype->is_vector () && valtype->length () <= 8 - && valtype->target_type ()->code () == TYPE_CODE_INT + && (valtype->target_type ()->code () == TYPE_CODE_INT + || valtype->target_type ()->code () == TYPE_CODE_CHAR) && valtype->target_type ()->length () == 1) ... The first change limits the effect of the if clause to the v1 elf abi. This change doesn't affect the regression, since it's on a ppc64-linux setup with v1 elf abi. Furthermore, it's correct in the sense that the v2 elf abi doesn't have this kind of special treatment of small character arrays. The second change is the part that causes the regression. The code itself seems correct, in the sense that it enables gdb to recognize small char arrays in ada. The regression stems from the following discrepancy. The comment in gdb states that "small character arrays are returned, right justified, in r3". This matches the v1 ABI [1]. OTOH, gcc produces code that is not in agreement with this. Instead, it passes the small character arrays in memory, in a caller-allocated storage buffer pointed at by r3. This turns out to be an gcc bug [2]. Fix this by treating this as an abi spec bug, and replacing the code handling the "Small character arrays" case with a comment. Doing so reveals that there are two problems in the test-case: - missing fvar-tracking, and - the "step 2" command doesn't land at the intended line. Fix these by: - adding fvar-tracking, and - setting a breakpoint at the intended line, and continuing to it. Tested on ppc64-linux (v1 abi), ppc64le-linux (v2 abi), and x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33534 [1] https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html. [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122282
Diffstat (limited to 'gdb/testsuite/gdb.python/py-cmd-prompt.py')
0 files changed, 0 insertions, 0 deletions