From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31887 invoked by alias); 18 Aug 2004 21:28:38 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 31878 invoked from network); 18 Aug 2004 21:28:37 -0000 Received: from unknown (HELO us.ibm.com) (32.97.110.142) by sourceware.org with SMTP; 18 Aug 2004 21:28:37 -0000 Received: by us.ibm.com (Postfix, from userid 1000) id 7FEB7F06F; Wed, 18 Aug 2004 14:26:30 -0700 (PDT) From: Paul Gilliam Reply-To: pgilliam@us.ibm.com To: gdb-patches@sources.redhat.com Subject: Avoid timeouts in call-sc.exp Date: Wed, 18 Aug 2004 21:28:00 -0000 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200408181426.30208.pgilliam@us.ibm.com> X-SW-Source: 2004-08/txt/msg00567.txt.bz2 The test "call-sc.exp" will attemt to "finish" from main if the prevous "return foo" failed. Here is what happens: 257 gdb_test_multiple "return foo" "${test}" { If this works, then we are in "main". If it doesn't work (say, due to a gdb bug) then we are left in the function "fun". 334 gdb_test "advance fun" \ If the "return foo" worked, then this positions us at the start of fun(). If it didn't work, then this acts like "finish" and we return from the current function. 356 gdb_test_multiple "finish" "${test}" { if the "return foo" worked, then we just finish fun(). If not, then we are attemting to "finish" from main() and the program under test is in an infinite loop (due to the way it's coded). This patch fixes this problem by checking to see if the "return foo" worked or not. If it worked, fine: things are as before. But if it didn't work, the "finish" is skipped. -=# Paul #=- PS: Trying this by hand, the "finish" would complain something like: "can't 'finish' from the outer most block" but only if I didn't follow the test case exactly. Here is the patch: diff new/call-sc.exp old/call-sc.exp 334,348c334,336 < set test "advance to fun for finish; ${tests}" < set skip_finish 0 < gdb_test_multiple "advance fun" "${test}" { < -re "fun .*\[\r\n\]+\[0-9\].*return foo.*" { < pass "${test}" < } < -re "in main" { < # This happens if the "return foo" failed to actually return: < # this "advance fun" will not stop on fun, but just return from < # the routine that "return foo" should have. Then the "finish" < # below will try to finish "main", which causes an infinte loop. < # So to avoid the timeout, skip the "finish". < set skip_finish 1 < } < } --- > gdb_test "advance fun" \ > "fun .*\[\r\n\]+\[0-9\].*return foo.*" \ > "advance to fun for finish; ${tests}" 357,368c345,352 < if $skip_finish { < fail "${test}" < } else { < 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 < pass "${test}" < } --- > 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 > pass "${test}"