From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12295 invoked by alias); 20 Aug 2004 10:34:55 -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 12287 invoked from network); 20 Aug 2004 10:34:53 -0000 Received: from unknown (HELO blount.mail.mindspring.net) (207.69.200.226) by sourceware.org with SMTP; 20 Aug 2004 10:34:53 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by blount.mail.mindspring.net with esmtp (Exim 3.33 #1) id 1By6jO-0006z3-00; Fri, 20 Aug 2004 06:34:46 -0400 Received: from mindspring.com (localhost [127.0.0.1]) by berman.michael-chastain.com (Postfix) with SMTP id E269E4B102; Fri, 20 Aug 2004 06:35:07 -0400 (EDT) Date: Fri, 20 Aug 2004 10:34:00 -0000 From: Michael Chastain To: pgilliam@us.ibm.com, gdb-patches@sources.redhat.com Subject: Re: Avoid timeouts in call-sc.exp Cc: cagney@redhat.com Message-ID: <4125D3DA.nailK4211PQ8Y@mindspring.com> References: <200408181426.30208.pgilliam@us.ibm.com> In-Reply-To: <200408181426.30208.pgilliam@us.ibm.com> User-Agent: nail 10.8 6/28/04 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-08/txt/msg00589.txt.bz2 Paul Gilliam wrote: > 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". First, can you post the gdb.log section for call-sc.exp on your platform that is failing. Also, what system is it and what compiler are you using to run the test suite? Good analysis, but I think your fix is too complicated and stateful. I'd like a different approach to this. Rather than handling various different places where the program counter could be, it would be better to do this at the end of the "return foo" test. Something like this: # If the previous test did not work, the program counter might # still be inside foo() rather than main(). Get the program # counter back to main(). # # This happens on [system] with [compiler]. set try_finish 0 set test "return foo; synchronize pc to main" gdb_test_multiple "backtrace 1" $test { -re "#0.*main \\(\\).*$gdb_prompt $" { pass $test } -re "#0.*fun \\(\\).*$gdb_prompt $" { if { $try_finish == 0 } { incr try_finish gdb_test "finish" ".*" "" exp_continue } fail $test } } Also there is a pre-existing cut-and-paste error in the body of "Make fun return now": -re "Make fun return now.*y or n. $" { gdb_test_multiple "y" "${test}" { -re "L *= fun.*${gdb_prompt} $" { # Need to step off the function call gdb_test "next" "zed.*" "${test}" } -re "L[expr + 1] *= fun[expr + 1].*${gdb_prompt} $" { pass "${test}" } } } The second arm, "L[expr + 1] *= ...", is supposed to handle the case where returning from "fun" lands on the line after the call to "fun". This happens when the compiler generates code so that the last assembly instruction in "L = fun ();" is the actual assembly-language call instruction. But the regular expression is wrong, it was copied from structs.exp and it was meant for structs.c and does not work with call-sc.c. I'll make a patch for the cut-and-pasto first. If you want to turn the code snippet with "try_finish" into a patch and do some testing, that would be great. Or I could make that into a patch. Michael