This is the mail archive of the gdb-patches@sources.redhat.com 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]

[commit/testsuite] "return" value IMPLIES "finish" value


Hello,

This patch fixes those annoying KFAILs seen in the i386 structs.exp test. When the test was added, the "return"'s value found IFF the "finish" value was also found - they had (or should have) identical code paths.

The introduction of RETURN_VALUE_ABI_RETURNS_ADDRESS and RETURN_VALUE_ABI_PRESERVES_ADDRESS changes all that. There are now cases where "finish" works, but "return" doesn't. This patch updates (weakens) that final cross check, changing it to the equivalent of:

"return VALUE" works IMPLIES "finish" works

(to avoid a double negative (!return_value_unknown) it also did a variable rename)

tested before/after on fc2

committed,
Andrew
2004-06-09  Andrew Cagney  <cagney@gnu.org>

	* gdb.base/structs.exp (test_struct_returns): Replace
	"return_value_unknown" and "finish_value_unknown" by
	"return_value_known" and "finish_value_known".  Instead of
	"return_value_unknown" iff "finish_value_unknown", check
	"return_value_known" implies "finish_value_known".

Index: gdb.base/structs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/structs.exp,v
retrieving revision 1.17
diff -p -u -r1.17 structs.exp
--- gdb.base/structs.exp	4 Jan 2004 15:04:41 -0000	1.17
+++ gdb.base/structs.exp	9 Jun 2004 13:40:36 -0000
@@ -304,21 +304,21 @@ proc test_struct_returns { n } {
 
     # The test is writen so that it only reports one FAIL/PASS for the
     # entire operation.  The value returned is checked further down.
-    # "return_value_unknown", if non-empty, records why GDB realised
-    # that it didn't know where the return value was.
+    # "return_value_known", if non-zero, indicates that GDB knew where
+    # the return value was located.
 
     set test "return foo<n>; ${tests}"
-    set return_value_unknown 0
+    set return_value_known 1
     set return_value_unimplemented 0
     gdb_test_multiple "return foo${n}" "${test}" {
 	-re "The location" {
 	    # Ulgh, a struct return, remember this (still need prompt).
-	    set return_value_unknown 1
+	    set return_value_known 0
 	    exp_continue
 	}
 	-re "A structure or union" {
 	    # Ulgh, a struct return, remember this (still need prompt).
-	    set return_value_unknown 1
+	    set return_value_known 0
 	    # Double ulgh.  Architecture doesn't use return_value and
 	    # hence hasn't implemented small structure return.
 	    set return_value_unimplemented 1
@@ -339,7 +339,7 @@ proc test_struct_returns { n } {
 
     # Check that the return-value is as expected.  At this stage we're
     # just checking that GDB has returned a value consistent with
-    # "return_value_unknown" set above.
+    # "return_value_known" set above.
 
     set test "value foo<n> returned; ${tests}"
     setup_kfails structs-*tld* i*86-*-* gdb/1447
@@ -348,25 +348,25 @@ proc test_struct_returns { n } {
     setup_kfails structs-*tld* x86_64-*-* gdb/1447
     gdb_test_multiple "p/c L${n}" "${test}" {
 	-re " = [foo ${n}].*${gdb_prompt} $" {
-	    if $return_value_unknown {
+	    if $return_value_known {
+		pass "${test}"
 		# This contradicts the above claim that GDB didn't
 		# know the location of the return-value.
-		fail "${test}"
 	    } else {
-		pass "${test}"
+		fail "${test}"
 	    }
 	}
 	-re " = [zed ${n}].*${gdb_prompt} $" {
-	    if $return_value_unknown {
+	    if $return_value_known {
+		# This contradicts the above claim that GDB knew
+		# the location of the return-value.
+		fail "${test}"
+	    } else {
 		# The struct return case.  Since any modification
 		# would be by reference, and that can't happen, the
 		# value should be unmodified and hence Z is expected.
 		# Is this a reasonable assumption?
 		pass "${test}"
-	    } else {
-		# This contradicts the above claim that GDB knew
-		# the location of the return-value.
-		fail "${test}"
 	    }
 	}
 	-re ".*${gdb_prompt} $" {
@@ -402,17 +402,18 @@ proc test_struct_returns { n } {
     setup_kfails structs-tld x86_64-*-* gdb/1447
     gdb_test "p/c L${n}" " = [zed $n]" "zed L<n> for finish; ${tests}"
 
-    # Finish the function, set 'finish_value_unknown" to non-empty if the
-    # return-value was not found.
+    # Finish the function, set 'finish_value_known" to non-empty if
+    # the return-value was found.
+
     set test "finish foo<n>; ${tests}"
-    set finish_value_unknown 0
+    set finish_value_known 1
     gdb_test_multiple "finish" "${test}" {
 	-re "Value returned is .*${gdb_prompt} $" {
 	    pass "${test}"
 	}
 	-re "Cannot determine contents.*${gdb_prompt} $" {
 	    # Expected bad value.  For the moment this is ok.
-	    set finish_value_unknown 1
+	    set finish_value_known 0
 	    pass "${test}"
 	}
     }
@@ -427,22 +428,22 @@ proc test_struct_returns { n } {
     setup_kfails structs-*tld* x86_64-*-* gdb/1447
     gdb_test_multiple "p/c" "${test}" {
 	-re "[foo ${n}]\[\r\n\]+${gdb_prompt} $" {
-	    if $finish_value_unknown {
+	    if $finish_value_known {
+		pass "${test}"
+	    } else {
 		# This contradicts the above claim that GDB didn't
 		# know the location of the return-value.
 		fail "${test}"
-	    } else {
-		pass "${test}"
 	    }
 	}
 	-re "[zed ${n}]\[\r\n\]+${gdb_prompt} $" {
 	    # The value didn't get found.  This is "expected".
-	    if $finish_value_unknown {
-		pass "${test}"
-	    } else {
+	    if $finish_value_known {
 		# This contradicts the above claim that GDB did
 		# know the location of the return-value.
 		fail "${test}"
+	    } else {
+		pass "${test}"
 	    }
 	}
     }
@@ -450,20 +451,17 @@ proc test_struct_returns { n } {
     # Finally, check that "return" and finish" have consistent
     # behavior.
 
-    # Since both "return" and "finish" use equivalent "which
-    # return-value convention" logic, both commands should have
-    # identical can/can-not find return-value messages.
-
-    # Note that since "call" and "finish" use common code paths, a
-    # failure here is a strong indicator of problems with "store
-    # return-value" code paths.  Suggest looking at "return_value"
-    # when investigating a fix.
+    # Since "finish" works in more cases than "return" (see
+    # RETURN_VALUE_ABI_RETURNS_ADDRESS and
+    # RETURN_VALUE_ABI_PRESERVES_ADDRESS), the "return" value being
+    # known implies that the "finish" value is known (but not the
+    # reverse).
 
-    set test "return and finish use same convention; ${tests}"
-    if {$finish_value_unknown == $return_value_unknown} {
-	pass "${test}"
-    } else {
+    set test "return value known implies finish value known; ${tests}"
+    if {$return_value_known && ! $finish_value_known} {
 	kfail gdb/1444 "${test}"
+    } else {
+	pass "${test}"
     }
 }
 

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