From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21287 invoked by alias); 1 Apr 2008 14:51:53 -0000 Received: (qmail 21271 invoked by uid 22791); 1 Apr 2008 14:51:52 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 01 Apr 2008 14:51:32 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Jghpa-0006uo-Sk for gdb-patches@sources.redhat.com; Tue, 01 Apr 2008 14:51:23 +0000 Received: from 78.158.192.230 ([78.158.192.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Apr 2008 14:51:22 +0000 Received: from ghost by 78.158.192.230 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Apr 2008 14:51:22 +0000 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: linux native async mode support Date: Tue, 01 Apr 2008 15:17:00 -0000 Message-ID: References: <200803140810.22883.pedro@codesourcery.com> <20080322220542.4DF038FC6D@kahikatea.snap.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit User-Agent: KNode/0.10.5 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00017.txt.bz2 Nick Roberts wrote: > # > # Test asynchronous Machine Interface (MI) operations > # > > # This currently only works with native linux and the async remote protocol. > if { !([isnative] && [istarget *-linux*]) \ >      && [board_info gdb_protocol] != "async" } then { >   return > } > > # The plan is for async mode to become the default but toggle for now. > set saved_gdbflags $GDBFLAGS > set GDBFLAGS "-ex \"maint set linux-async on\"" > > load_lib mi-support.exp > > gdb_exit > if [mi_gdb_start] { >     continue > } > > set testfile "basics" > set srcfile ${testfile}.c > set binfile ${objdir}/${subdir}/${testfile} > if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { >      untested mi-async.exp >      return -1 > } > > mi_delete_breakpoints > mi_gdb_reinitialize_dir $srcdir/$subdir > mi_gdb_load ${binfile} > > # mi_gdb_test cannot be used for asynchronous commands because there are > # two prompts involved and this can lead to a race condition. > > proc linux_async_tests {} { >     global mi_gdb_prompt >     global hex > >     set line_main_head     [gdb_get_line_number "main ("] >     set line_main_body     [expr $line_main_head + 2] >     set line_main_next     [expr $line_main_head + 3] > >     send_gdb "start\n" >     gdb_expect { >         -re ".*\\^running\r\n\\^done\r\n$mi_gdb_prompt" { I don't think this is right. MI is (supposed to be) extensible. In particular, new async notification may be added. The above will break if any notification will be emitted between ^running and ^done and the prompt. >             gdb_expect { >                 -re "\\*stopped,thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" >                 { >                     pass "Asynchronous response after start command" >                 } >                 -re ".*$mi_gdb_prompt$" { >                     fail "Asynchronous response after start command (2)" >                 } >                 timeout { >                     fail "Asynchronous response after start command (timeout 2)" >                 } >             } >         } >         -re ".*$mi_gdb_prompt$" { >             fail "Asynchronous response after start command (1)" >         } >         timeout {fail "Asynchronous response after start command (timeout 1)"} >     } > >     send_gdb "next\n" >     gdb_expect { >         -re "\\^running\r\n\\^done\r\n$mi_gdb_prompt" { >             gdb_expect { >                 -re "\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_next\"\}\r\n$mi_gdb_prompt$" { >                     pass "Asynchronous response after next command" >                 } >                 -re ".*$mi_gdb_prompt$" { >                     fail "Asynchronous response after next command (2)" >                 } >                 timeout { >                     fail "Asynchronous response after next command (timeout 2)" >                 } >             } >         } It appears there's a lot of duplicated logic above. Can we please have factor it out into a helper function? This is not for the sake of abstract clarify -- I've already spend hours updating the current MI testsuite for non-stop mode. - Volodya