This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug testsuite/11936] New: gdb.base/call-sc.exp incorrectly reports failure of "return" command


The test of the GDB "return" command in gdb.base/call-sc.exp appears incorrect.
"return <foo>" where <foo> uses a struct style return leads to the GDB message:

The location at which to store the function's return value is unknown.
If you continue, the return value that you specified will be ignored.
Make fun return now? (y or n) 

On responding "y", the function returns, and no value is written into the struct
for the return value (see return_command () in stack.c). However the calling
function's code on return will extract the result from that location, which will
be some random value.

This test however assumes erroneously that any result value is left unchanged,
causing it to fail (unless the random value happens to be correct) under these
circumstances.

I believe the fix is to alter the test in proc test_scalar_returns in
call_sc.exp to pass the test when this message is seen, irrespective of the
result value. The code should read from line 322 (GDB 7.1 version).

	-re ".*${gdb_prompt} $" {
	    if $return_value_unimplemented {
		# What a suprize.  The architecture hasn't implemented
		# return_value, and hence has to fail.
		kfail "$test" gdb/1444
	    } elseif $return_value_unknown {
		# If the return value is unknown, the caller will pick up
		# whatever random value is in the return structure location.
		pass "$test"
	    } else {
		fail "$test"
	    }

If someone would verify this is correct, I'll submit the appropriate patch for
top of tree.

-- 
           Summary: gdb.base/call-sc.exp incorrectly reports failure of
                    "return" command
           Product: gdb
           Version: 7.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: testsuite
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jeremy dot bennett at embecosm dot com
                CC: gdb-prs at sourceware dot org,jeremy dot bennett at
                    embecosm dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: or32-*-elf


http://sourceware.org/bugzilla/show_bug.cgi?id=11936

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]