From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1612 invoked by alias); 4 Jun 2010 07:35:32 -0000 Received: (qmail 1602 invoked by uid 22791); 4 Jun 2010 07:35:31 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT,TW_XP X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.152) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Jun 2010 07:35:26 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o547Ypp1085001 ; Fri, 4 Jun 2010 09:34:52 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o547YpaB071067 ; Fri, 4 Jun 2010 09:34:51 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o547YoLe041012 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Fri, 4 Jun 2010 09:34:50 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Cc: "'Joel Brobecker'" , References: <000001cb0250$e4034590$ac09d0b0$@muller@ics-cnrs.unistra.fr> <20100602212929.GX3019@adacore.com> <14482.3657036342$1275547225@news.gmane.org> In-Reply-To: Subject: RE: [RFC] Testsuite: permit simple transformation of gdb_expect code Date: Fri, 04 Jun 2010 07:35:00 -0000 Message-ID: <003701cb03b8$6c22d900$44688b00$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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: 2010-06/txt/msg00114.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Tom Tromey > Envoy=E9=A0: Thursday, June 03, 2010 5:40 PM > =C0=A0: Pierre Muller > Cc=A0: 'Joel Brobecker'; gdb-patches@sourceware.org > Objet=A0: Re: [RFC] Testsuite: permit simple transformation of gdb_expect > code >=20 > >>>>> "Pierre" =3D=3D Pierre Muller > writes: >=20 > Pierre> I thought about it, but I still didn't really > Pierre> understand all the tcl command details: > Pierre> info exists VAR_NAME > Pierre> will return 1 if VAR_NAME exists > Pierre> as either a global or a local variable, > Pierre> but it seems that > Pierre> info proc PROC_NAME > Pierre> works as a regular expression, >=20 > They both work using a glob-like syntax, not regular expressions... That=92s not what tcl 8.5 doc says... and indeed [info exists transform_gdb_expect_code] returns 1 while [info exists transform_gdb_expect_code*] returns 0 =20 > Pierre> and can thus return a list containing both PROC_NAME and > Pierre> PROC_NAME_VERSION_2 procedures ... >=20 > ... so this happens only if you do "info proc PROC_NAME*". But of course you are right on that,=20 which leaves us with two possibilities: use only a procedure, but this would mean that there is no way to insert its code inside gdb.exp itself. Thus I would still prefer that we do use a variable. So, here is a new proposal: - declare transform_gdb_expect_code as a global variable, without setting it, and give some information in "gdb.exp" about its use. - inside gdb_expect, test if the variable exists. If it exists, also test that it does refer to an existing proc. If the proc exists, call it, if not, issue a "perror" unless the value of the variable is empty. This allows to use either=20 unset transform_gdb_expect_code=20 or set transform_gdb_expect_code "" to disable the transformation at any point in the testsuite. =20=20 Tested on gcc16, no changes found. Comments? Pierre =20 2010-06-04 Pierre Muller * testsuite/lib/gdb.exp (transform_gdb_expect_code): New global=20 variable, not defined by default. (gdb_expect): Call TRANSFORM_GDB_EXPECT_CODE procedure if variable exists and refers to an existing procedure. Index: src/gdb/testsuite/lib/gdb.exp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.149 diff -u -p -r1.149 gdb.exp --- src/gdb/testsuite/lib/gdb.exp 3 Jun 2010 20:29:27 -0000 1.149 +++ src/gdb/testsuite/lib/gdb.exp 4 Jun 2010 07:09:01 -0000 @@ -98,6 +98,12 @@ if ![info exists env(EXEEXT)] { =20 set octal "\[0-7\]+" =20 +# The variable transform_gdb_expect_code can be set to the name of +# a procedure that will transform the code parameter of gdb_expect call +# in order to cope for some target dependant problems +# it can also be reset to an empty string to disable that operation +global transform_gdb_expect_code + ### Only procedures should come after this point. =20 # @@ -2171,6 +2177,14 @@ proc gdb_expect { args } { } } =20 + global transform_gdb_expect_code; + if [info exists transform_gdb_expect_code] { + if { "[info procs $transform_gdb_expect_code]" !=3D "" } { + set expcode [$transform_gdb_expect_code $expcode]; + } elseif { "$transform_gdb_expect_code" !=3D "" } { + perror "Procedure $transform_gdb_expect_code unknown" + } + } global suppress_flag; global remote_suppress_flag; if [info exists remote_suppress_flag] {