From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15394 invoked by alias); 9 Oct 2014 17:55:01 -0000 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 Received: (qmail 15383 invoked by uid 89); 9 Oct 2014 17:55:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 09 Oct 2014 17:54:59 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s99HsuUd006175 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 9 Oct 2014 13:54:56 -0400 Received: from host2.jankratochvil.net (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s99HsrFV027292 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Thu, 9 Oct 2014 13:54:55 -0400 Date: Thu, 09 Oct 2014 17:55:00 -0000 From: Jan Kratochvil To: Yao Qi Cc: gdb-patches@sourceware.org, Miroslav Franc Subject: Re: [patch] save breakpoints does not save signal catchpoints correctly Message-ID: <20141009175452.GA26010@host2.jankratochvil.net> References: <20141003203219.GA30562@host2.jankratochvil.net> <87r3yhs6sr.fsf@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r3yhs6sr.fsf@codesourcery.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00212.txt.bz2 On Thu, 09 Oct 2014 15:37:24 +0200, Yao Qi wrote: > Jan Kratochvil writes: > > The fix looks right to me. Just one comment on the test case... > > > - set contents [read -nonewline $fd] > > + set contents [read $fd] > > close $fd > > > > IWBN to split the contents into a list and match each element in the > list one by one, so that ... > > > + set nl "\r?\n" > > if {$arg == ""} { > > - set pattern "catch signal" > > + set pattern "catch signal$nl" > > } else { > > - set pattern "catch signal $arg" > > + set pattern "catch signal $arg$nl" > > } > > - if {[string match $pattern $contents]} { > > + set pattern "${pattern}break main$nl" > > + if {[regexp "$pattern" $contents]} { > > ... the pattern can be simplified and we can still use "string match". > > On the other hand, in this way, the test can be easily extended in the > future, for example, saving more breakpoints in the file. Sorry but be more specific how you wanted to simplify the code. Any idea I have is 10x more complicated. With the list I have Googled What is the right way of comparing two lists in TCL? https://stackoverflow.com/questions/5195153/what-is-the-right-way-of-comparing-two-lists-in-tcl and those solutions seem too complicated to me. gdb_expect_list or gdb_test_sequence are not usable here as this is not an output from inferior but just contents of a file. Thanks, Jan