From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32246 invoked by alias); 9 Sep 2015 14:10:07 -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 32209 invoked by uid 89); 9 Sep 2015 14:10:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga14.intel.com Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Sep 2015 14:10:04 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 09 Sep 2015 07:09:46 -0700 X-ExtLoop1: 1 Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by fmsmga002.fm.intel.com with ESMTP; 09 Sep 2015 07:09:45 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.201]) by IRSMSX108.ger.corp.intel.com ([169.254.11.12]) with mapi id 14.03.0224.002; Wed, 9 Sep 2015 15:08:31 +0100 From: "Metzger, Markus T" To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: RE: [PATCH 13/17] btrace: non-stop Date: Wed, 09 Sep 2015 14:10:00 -0000 Message-ID: References: <1441794909-32718-1-git-send-email-markus.t.metzger@intel.com> <1441794909-32718-14-git-send-email-markus.t.metzger@intel.com> <55F01DEC.4030209@redhat.com> <55F03852.7030200@redhat.com> In-Reply-To: <55F03852.7030200@redhat.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00132.txt.bz2 > -----Original Message----- > From: Pedro Alves [mailto:palves@redhat.com] > Sent: Wednesday, September 9, 2015 3:47 PM > To: Metzger, Markus T > Cc: gdb-patches@sourceware.org > Subject: Re: [PATCH 13/17] btrace: non-stop >=20 > On 09/09/2015 01:20 PM, Metzger, Markus T wrote: > >> -----Original Message----- > >> From: Pedro Alves [mailto:palves@redhat.com] > >> Sent: Wednesday, September 9, 2015 1:54 PM > >> To: Metzger, Markus T > >> Cc: gdb-patches@sourceware.org > >> Subject: Re: [PATCH 13/17] btrace: non-stop > >> > >> On 09/09/2015 11:35 AM, Markus Metzger wrote: > >> > >>> +# make sure $line matches the full expected output per thread. > >>> +# and let's hope that GDB never mixes the output from different > threads. > >>> +# > >>> +# this is quite fragile, mostly because the prompt appears somewhere > in > >>> +# the middle of the output. > >>> +proc gdb_cont_to { threads cmd line nthreads } { > >>> + global gdb_prompt > >>> + set full_cmd "thread apply $threads $cmd" > >>> + set prompt_seen 0 > >>> + > >>> + send_gdb "$full_cmd\n" > >>> + > >>> + for {set i 0} {$i < $nthreads} {incr i} { > >>> + set test "$full_cmd: thread $i" > >>> + > >>> + # check for the prompt. it may be in front of one of the li= nes we > >>> + # try to match. > >>> + gdb_test_multiple "" "$test: check prompt" { > >>> + -notransfer -re "$gdb_prompt " { > >>> + set prompt_seen 1 > >>> + } > >>> + } > >>> + > >> > >> Hmmm. I'm not sure I'm missing some subtlety, but it seems to me > >> that if you used -notransfer, then the prompt will still be in the buf= fer, > >> and ... > >> > >>> + # check for the line. and for a typical error. > >>> + gdb_test_multiple "" $test { > >>> + -re "Cannot execute this command \[^\\\r\\\n\]* is runni= ng\." { > >>> + fail $test > >>> + } > >>> + -re "$line\[^\\\r\\\n\]*\r\n" { > >>> + pass $test > >>> + } > >>> + } > >> > >> ... thus this gdb_test_multiple can trip on it and issue a fail. > > > > As far as I understand expect, the above gdb_test_multiple would > > simply skip the $gdb_prompt at the beginning of the line. >=20 > Only if the buffer already holds enough data for the regex to match. > Expect reads data in chunks and puts it in the buffer, and then tries > a match. If nothing matches, it fetches more data, and retries matching. > On an on, until a timeout. So say $line is >=20 > [multi_line \ > "No more reverse-execution history\." \ > "\[^\\\r\\\n\]*" \ > "\[^\\\r\\\n\]*" \ > ] >=20 > It sometimes will happen that the expect buffer has: >=20 > "$gdb_prompt\r\n...No more reverse-exe" >=20 > Because that doesn't match any of the regexs you have, gdb_test_multiple's > internal regex for the prompt matches, and issues a FAIL. > Try "make check-read1". It may well be it catches this. It doesn't; "make check-read1" runs without fails. With my version as well as with your version. Both also catch errors if I revert one of the patche= s. Btw, the output is not "$gdb_prompt\r\n...No more reverse-exe" but "$gdb_prompt No more reverse-exe". The $gdb_prompt simply precedes some other output. > > That's why I'm trying to detect it with a separate gdb_test_multiple > > above. I use -notransfer so I can still analyse the line for the expec= ted > > output. > > > > > >> Wouldn't this instead work? > >> > >> gdb_test_multiple "" $test { > >> -re "Cannot execute this command \[^\\\r\\\n\]* is running= \." { > >> fail $test > >> } > >> -re "$line\[^\\\r\\\n\]*\r\n" { > >> pass $test > >> } > >> -re "$gdb_prompt " { > >> set prompt_seen 1 > >> exp_continue > >> } > >> } > > > > Wouldn't the 1st or 2nd pattern skip any $gdb_prompt before the pattern? >=20 > Yes. Is that a problem? Don't we always get another prompt after that > error? No, we don't. We have a single prompt that appears somewhere in the output. (gdb) thread apply all continue =09 Thread 1 (Thread 0x7ffff7fcc740 (LWP 22139)): Continuing. [New Thread 0x7ffff74fb700 (LWP 22143)] =09 Breakpoint 2, test (arg=3D0x0) at gdb.btrace/non-stop.c:27 27 i =3D 0; /* bp.1 */ PASS: gdb.btrace/non-stop.exp: thread apply all continue: thread 0 (gdb)=20 Breakpoint 2, test (arg=3D0x0) at gdb.btrace/non-stop.c:27 27 i =3D 0; /* bp.1 */ PASS: gdb.btrace/non-stop.exp: thread apply all continue: thread 1 record btrace Sometimes, the prompt appears on the same line as some other output. So far, I have only seen it at the beginning of a line. That's what makes it so difficult. The test needs to read past the prompt. > > For the "Cannot execute..." pattern, I could add "^" but this will be d= ifficult > > for the $line pattern. > > > > Does the 3rd pattern consume just the $gdb_prompt or the entire line? >=20 > Consumes everything up to the prompt. Whatever follows is left in the > buffer. Then putting the 3rd line first should work. > > This non-stop testing is quite difficult. I also have not found too ma= ny > > examples when I searched for "non-stop". >=20 > Could you push the series to a branch somewhere? The easiest would be > a users/ branch in the master repo. OK. This is temporary. I have not followed the discussion. Can I force-p= ush and remove such a user branch? Thanks, Markus. Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul Chairperson of the Supervisory Board: Tiffany Doon Silva Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928