From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25535 invoked by alias); 20 Jun 2010 14:59:10 -0000 Received: (qmail 25522 invoked by uid 22791); 20 Jun 2010 14:59:09 -0000 X-SWARE-Spam-Status: No, hits=1.6 required=5.0 tests=AWL,BAYES_50,MSGID_MULTIPLE_AT,RCVD_IN_JMF_BL X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 20 Jun 2010 14:59:04 +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 o5KEwvMJ042185 ; Sun, 20 Jun 2010 16:58:57 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms6.u-strasbg.fr [IPv6:2001:660:2402:d::15]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o5KEwued009649 ; Sun, 20 Jun 2010 16:58:56 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller ([82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id o5KEws0K026733 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Sun, 20 Jun 2010 16:58:55 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: , Cc: "'Pedro Alves'" References: <20100517171128.29087.qmail@sourceware.org> <001201cb0f8b$472f8b00$d58ea100$@muller@ics-cnrs.unistra.fr> In-Reply-To: <001201cb0f8b$472f8b00$d58ea100$@muller@ics-cnrs.unistra.fr> Subject: [RFA] Fix Cygwin problem with banned variables Date: Sun, 20 Jun 2010 14:59:00 -0000 Message-ID: <003c01cb1089$208e45f0$61aad1d0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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/msg00438.txt.bz2 The problem may have two origins, and I didn't spend time to completely analyse it, but found a fix that seems to work. One problem is that while gdb_finish procedure is never used inside testsuite '.exp' files, gdb_init is present in lots of '.exp' files. But gdb_init and gdb_finsih are also called automatically by runtest procedure before and after sourcing the .exp file itself. This generates multiple calls to 'trace variable ' and only one call to 'trace remove variable '. But another problem is that we current implementation uses the old way for trace insertion 'trace variable var_name w error' and the new way for deletion 'trace remove variable var_name write error'. Apparently Cygwin's implementation of tcl doesn't like this mix, and does not remove the trace. Uses new version 'trace add variable var_name write error' allows the removal to work correctly. So here is a patch that adds a global variable avoiding multiple setting of those traces and using new `trace add variable ' syntax. I checked this manually on gcc16 (as automated tests are impossible currently due to the byte-code optimizer problem). Is this patch OK? Pierre Muller 2010-06-19 Pierre Muller * lib/gdb.exp (banned_variables_traced): New global variable. (gdb_init, gdb_finish): Use new variable to avoid multiple tracing. (gdb_init): Use `trace add variable ' instead of obsolete `trace variable '. Index: src/gdb/testsuite/lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.150 diff -u -p -r1.150 gdb.exp --- src/gdb/testsuite/lib/gdb.exp 11 Jun 2010 21:58:20 -0000 1.150 +++ src/gdb/testsuite/lib/gdb.exp 19 Jun 2010 12:53:19 -0000 @@ -2519,6 +2519,7 @@ if ![info exists gdb_test_timeout] { # We try to prevent their use by monitoring write accesses and raising # an error when that happens. set banned_variables { bug_id prms_id } +set banned_variables_traced 0 proc gdb_init { args } { # Reset the timeout value to the default. This way, any testcase @@ -2530,9 +2531,13 @@ proc gdb_init { args } { # Block writes to all banned variables... global banned_variables - foreach banned_var $banned_variables { - global "$banned_var" - trace variable "$banned_var" w error + global banned_variables_traced + if (!$banned_variables_traced) { + foreach banned_var $banned_variables { + global "$banned_var" + trace add variable "$banned_var" write error + } + set banned_variables_traced 1 } return [eval default_gdb_init $args]; @@ -2552,9 +2557,13 @@ proc gdb_finish { } { # Unblock write access to the banned variables. Dejagnu typically # resets some of them between testcases. global banned_variables - foreach banned_var $banned_variables { - global "$banned_var" - trace remove variable "$banned_var" write error + global banned_variables_traced + if ($banned_variables_traced) { + foreach banned_var $banned_variables { + global "$banned_var" + trace remove variable "$banned_var" write error + } + set banned_variables_traced 0 } }