From b5c0bfa20ecb42d620042caceb3a3fe4db16a9e3 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 9 Jun 2004 13:41:06 +0000 Subject: [PATCH] 2004-06-09 Andrew Cagney * 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". --- gdb/testsuite/ChangeLog | 8 ++++ gdb/testsuite/gdb.base/structs.exp | 70 +++++++++++++++--------------- 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 233751ca43a..9ce6bb2b52b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2004-06-09 Andrew Cagney + + * 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". + 2004-06-08 Martin Hunt * gdb.base/float.exp: Add pattern for mips targets. diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp index 4d282d2e58d..653c84c45c2 100644 --- a/gdb/testsuite/gdb.base/structs.exp +++ b/gdb/testsuite/gdb.base/structs.exp @@ -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; ${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 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 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; ${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}" } } -- 2.30.2