public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] PowerPC: Fix test gdb.ada/finish-large.exp
@ 2023-11-16 22:10 Carl Love
  2023-11-17 13:33 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Carl Love @ 2023-11-16 22:10 UTC (permalink / raw)
  To: Luis Machado, Tom Tromey, gdb-patches, keiths; +Cc: cel


GDB maintainers:

The following patch fixes a single regression error in test
gdb.ada/finish-large.exp on the PowerPC platform.

The patch compiles the test with the -fvar-tracking command line option
enabled so the DWARF DW_TAG_call_site information will be included in
the binary.  This DWARF information is used by PowerPC to obtain the
value of r3 on entry to a function.  The address to return a structure
is passed into a function in r3.  But r3 is not guaranteed to be the
same at the end of the function when the finish command prints the
function return value.  With -fvar-tracking enabled, GDB can now print
the return value of a function returning a large structure on the
PowerPC platform.

The patch has been tested on Power 10 and X86-64 with no regression
errors.

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

Thanks to Luis, Tom and Keith for their help.

                           Carl

------------------------------------
PowerPC: Fix test gdb.ada/finish-large.exp

Function Create_large returns a large data structure.  On PowerPC, register
r3 contains the address of where the data structure to be returned is to
be stored.  However, on exit the ABI does not guarantee that r3 has not
been changed.  The GDB finish command prints the return value of the
function at the end of the function.  GDB needs to use the
DW_TAG_call_site information to determine the value of r3 on entry to
the function to correctly print the return value at the end of the
function.  The test must be compiled with -fvar-tracking for the
DW_TAG_call_site information to be included in the executable file.

This patch adds the -fvar-tracking option to the compile line if the
option is supported.

The patch fixes the one regression error for the test on PowerPC.

The patch has been tested on Power 10 and X86-64 with no regressions.
---
 gdb/testsuite/gdb.ada/finish-large.exp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.ada/finish-large.exp b/gdb/testsuite/gdb.ada/finish-large.exp
index 5661d132a18..6c8b1b2648d 100644
--- a/gdb/testsuite/gdb.ada/finish-large.exp
+++ b/gdb/testsuite/gdb.ada/finish-large.exp
@@ -19,7 +19,13 @@ require allow_ada_tests
 
 standard_ada_testfile p
 
-if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
+set flags {debug}
+
+if {[have_fvar_tracking]} {
+  lappend flags "additional_flags=-fvar-tracking"
+}
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
   return -1
 }
 
-- 
2.41.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PowerPC: Fix test gdb.ada/finish-large.exp
  2023-11-16 22:10 [PATCH] PowerPC: Fix test gdb.ada/finish-large.exp Carl Love
@ 2023-11-17 13:33 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2023-11-17 13:33 UTC (permalink / raw)
  To: Carl Love; +Cc: Luis Machado, Tom Tromey, gdb-patches, keiths

>>>>> "Carl" == Carl Love <cel@linux.ibm.com> writes:

Carl> Please let me know if this patch is acceptable for mainline.  Thanks.

Thanks, this is ok.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-17 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16 22:10 [PATCH] PowerPC: Fix test gdb.ada/finish-large.exp Carl Love
2023-11-17 13:33 ` Tom Tromey

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).