From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16140 invoked by alias); 5 Sep 2005 19:52:16 -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 16100 invoked by uid 22791); 5 Sep 2005 19:52:08 -0000 Received: from eastrmmtao02.cox.net (HELO eastrmmtao02.cox.net) (68.230.240.37) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 05 Sep 2005 19:52:08 +0000 Received: from white ([68.9.64.121]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20050905195207.WDUL20229.eastrmmtao02.cox.net@white>; Mon, 5 Sep 2005 15:52:07 -0400 Received: from bob by white with local (Exim 3.36 #1 (Debian)) id 1ECN0N-0006MV-00; Mon, 05 Sep 2005 15:51:47 -0400 Date: Mon, 05 Sep 2005 19:52:00 -0000 From: Bob Rossi To: Mark Kettenis Cc: gdb-patches@sources.redhat.com, Daniel Jacobowitz Subject: Re: MI testsuite to use PTY for inferior Message-ID: <20050905195147.GA20894@white> Mail-Followup-To: Mark Kettenis , gdb-patches@sources.redhat.com, Daniel Jacobowitz References: <20050727031758.GA15798@white> <200508132151.j7DLpnoR015475@elgar.sibelius.xs4all.nl> <20050819222721.GA20029@white> <20050830025203.GA16646@nevyn.them.org> <20050901005200.GA6990@white> <200509012211.j81MBfX1004484@elgar.sibelius.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200509012211.j81MBfX1004484@elgar.sibelius.xs4all.nl> User-Agent: Mutt/1.5.9i X-SW-Source: 2005-09/txt/msg00027.txt.bz2 > Fixes the problems in mi-console.exp, but I still see the following: > > 403-exec-continue > 403^running > (gdb) > FAIL: gdb.mi/mi-syn-frame.exp: testing exec continue > 403*stopped > (gdb) > 404-stack-list-frames 0 0 > 404^done,stack=[frame={level="0",addr="0x1c0006c8",func="main",file="../../../.. > /src/gdb/gdb/testsuite/gdb.mi/mi-syn-frame.c",fullname="/home/kettenis/src/gdb/g > db/testsuite/gdb.mi/mi-syn-frame.c",line="14"}] > (gdb) > PASS: gdb.mi/mi-syn-frame.exp: list stack frames OK, I think I finally have a solution that will scale nicely to other problems that pop up like this. The previous patch I posted is reposted here, along with a patch that fixes the mi-syn-frame.exp testcase. For an MI input command that can generate more than 1 MI output command (the normal MI output command response + at least 1 asynchronous MI output command), we can simply call mi_gdb_test multiple times, each with an MI output command to match. Here's an example, mi_gdb_test "47-exec-next" \ "47\\^running" \ "Testing console output" \ "Hello \\\\\"!\[\r\n\]+" mi_gdb_test "" "47\\*stopped.*" "Finished step over hello" When the first parameter is "", mi_gdb_test still matches the MI output command, even though no new data is sent to GDB. The attached patch solves the current issues found by Mark and I. What do you think? Thanks, Bob Rossi Index: gdb/testsuite/ChangeLog 2005-08-31 Bob Rossi + + * lib/mi-support.exp (mi_gdb_test): Change -re to not be anchored. + * gdb.mi/mi-syn-frame.exp: Call mi_gdb_test twice instead of once for + commands that return an MI output command and an asyncronous MI output + command. This avoids race conditions. + * gdb.mi/mi-console.exp: Ditto. Index: gdb/testsuite/gdb.mi/mi-console.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-console.exp,v retrieving revision 1.15 diff -u -r1.15 mi-console.exp --- gdb/testsuite/gdb.mi/mi-console.exp 4 Aug 2005 01:52:31 -0000 1.15 +++ gdb/testsuite/gdb.mi/mi-console.exp 5 Sep 2005 19:43:55 -0000 @@ -58,15 +58,8 @@ "47\\^running" \ "Testing console output" \ "Hello \\\\\"!\[\r\n\]+" - -gdb_expect { - -re "47\\*stopped.*$mi_gdb_prompt$" { - pass "Finished step over hello" - } - timeout { - fail "Finished step over hello (timeout)" - } -} +mi_gdb_test "" "47\\*stopped.*" "Finished step over hello" + mi_gdb_exit return 0 Index: gdb/testsuite/gdb.mi/mi-syn-frame.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-syn-frame.exp,v retrieving revision 1.6 diff -u -r1.6 mi-syn-frame.exp --- gdb/testsuite/gdb.mi/mi-syn-frame.exp 4 Aug 2005 01:52:31 -0000 1.6 +++ gdb/testsuite/gdb.mi/mi-syn-frame.exp 5 Sep 2005 19:43:55 -0000 @@ -35,8 +35,6 @@ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -set my_mi_gdb_prompt "\\(gdb\\)\[ \]*\[\r\n\]*" - mi_gdb_exit mi_gdb_start separate-inferior-tty mi_delete_breakpoints @@ -61,10 +59,12 @@ # Continue back to main() # mi_gdb_test "403-exec-continue" \ - "403\\^running\[\r\n\]+${my_mi_gdb_prompt}403\\\*stopped" \ + "403\\^running" \ "testing exec continue" \ "hi in foo\[\r\n\]\+" +mi_gdb_test "" "403\\*stopped" "finished exec continue" + mi_gdb_test "404-stack-list-frames 0 0" \ "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \ "list stack frames" @@ -91,8 +91,9 @@ "list stack frames" -mi_gdb_test "408-exec-continue" \ - "408\\^running\[\r\n\]+${my_mi_gdb_prompt}408\\\*stopped" +mi_gdb_test "408-exec-continue" "408\\^running" + +mi_gdb_test "" "408\\*stopped.*" "finished exec continue" mi_gdb_test "409-stack-list-frames 0 0" \ "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \ Index: gdb/testsuite/lib/mi-support.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v retrieving revision 1.30 diff -u -r1.30 mi-support.exp --- gdb/testsuite/lib/mi-support.exp 9 Aug 2005 19:00:16 -0000 1.30 +++ gdb/testsuite/lib/mi-support.exp 5 Sep 2005 19:43:55 -0000 @@ -659,7 +659,15 @@ gdb_start set result -1 } - -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" { + -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*" { + # NOTE, there is no trailing anchor because with GDB/MI, + # asynchronous responses can happen at any point, causing more + # data to be available. Normally an anchor is used to make + # sure the end of the output is matched, however, $mi_gdb_prompt + # is just as good of an anchor since mi_gdb_test is meant to + # match a single mi output command. If a second GDB/MI output + # response is sent, it will be in the buffer for the next + # time mi_gdb_test is called. if ![string match "" $message] then { pass "$message" }