public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Carl Love <cel@us.ibm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: cel@us.ibm.com, Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	Will Schmidt <will_schmidt@vnet.ibm.com>
Subject: [PATCH] PowerPC, fix gdb.base/retval-large-struct.exp
Date: Wed, 16 Nov 2022 14:11:33 -0800	[thread overview]
Message-ID: <71926c391f43cee2051ea0c9b449ec0aecc847ec.camel@us.ibm.com> (raw)

GDB maintainers:

Currently the test gdb.base/retval-large-struct.exp is not able to
access the return buffer address for the data being returned by the
function.  The functionality needed to obtain the value of r3 which
holds the return buffer address on entry to the function was recently
added in a new gdb method.  This new method can be used by this test to
allow it to correctly access the data being returned by the function.

This patch adds the needed command line argument to the test compile
line thus allowing GDB to access the data via the return buffer address
stored in register r3.  

The patch has been tested on Power 10 with no additional regressions.

Please let me know if this patch is acceptable.  Thanks.

                       Carl 


-----------------------------------
PowerPC, fix gdb.base/retval-large-struct.exp

Support for printining non-trivial return values was recently added in
commit:

  commit a0eda3df5b750ae32576a9be092b361281a41787
  Author: Carl Love <cel@us.ibm.com>
  Date:   Mon Nov 14 16:22:37 2022 -0500

    PowerPC, fix support for printing the function return value for non-trivial values.

The functionality can no be used by test fix gdb.base/retval-large-struct.exp.
The test just needs to be compiled with -fvar-tracking to enable GDB to
determine the address off the return buffere when the function is called.

The current output from the test:

34        return big_struct;
(gdb) PASS: gdb.base/retval-large-struct.exp: continue to breakpoint: Break in print_large_struct
finish
warning: Cannot determine the function return value.
Try compiling with -fvar-tracking.
Run till exit from #0  return_large_struct () at binutils-gdb-current/gdb/testsuite/gdb.base/retval-large-struct.c:34
main (argc=1, argv=0x7fffffffcd58) at binutils-gdb-current/gdb/testsuite/gdb.base/retval-large-struct.c:44
44        return 0;^M
Value returned has type: struct big_struct_t. Cannot determine contents
(gdb) FAIL: gdb.base/retval-large-struct.exp: finish from return_large_struct
testcase binutils-gdb-current/gdb/testsuite/gdb.base/retval-large-struct.exp completed in 1 seconds

This patch adds the command line argument -fvar-tracking to enable gdb to
determine the return vaule and thus fixing the test.

Patch tested on Power 10 with no regressions.
---
 gdb/testsuite/gdb.base/retval-large-struct.exp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/retval-large-struct.exp b/gdb/testsuite/gdb.base/retval-large-struct.exp
index 11bc4d5fbdf..f7aa1df81fa 100644
--- a/gdb/testsuite/gdb.base/retval-large-struct.exp
+++ b/gdb/testsuite/gdb.base/retval-large-struct.exp
@@ -20,7 +20,13 @@
 
 standard_testfile
 
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
+set additional_flags ""
+
+if {[have_fvar_tracking]} {
+    set additional_flags "additional_flags= -fvar-tracking"
+}
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile [list debug $additional_flags]]} {
     return -1
 }
 
-- 
2.31.1



             reply	other threads:[~2022-11-16 22:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 22:11 Carl Love [this message]
2022-11-17 12:57 ` Ulrich Weigand
2022-11-17 16:18   ` Carl Love
2022-11-18 14:46 ` Tom de Vries
2022-11-18 16:04   ` Ulrich Weigand
2022-11-18 16:14     ` Carl Love
2022-11-18 16:25     ` Tom de Vries
2022-11-18 19:11       ` Carl Love
2022-11-19  6:42         ` Tom de Vries
2022-11-23 12:44           ` Ulrich Weigand
2023-03-07 18:59     ` Tom Tromey
2023-03-08 13:48       ` Ulrich Weigand
2023-03-08 15:15         ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71926c391f43cee2051ea0c9b449ec0aecc847ec.camel@us.ibm.com \
    --to=cel@us.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=will_schmidt@vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).