Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Joel Brobecker'" <brobecker@adacore.com>
Cc: <gdb-patches@sourceware.org>, "'Pedro Alves'" <pedro@codesourcery.com>
Subject: RE: [RFA] Fix Cygwin problem with banned variables
Date: Tue, 22 Jun 2010 07:22:00 -0000	[thread overview]
Message-ID: <001801cb11db$9d553c30$d7ffb490$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <20100621170743.GD2595@adacore.com>



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Joel Brobecker
> Envoyé : Monday, June 21, 2010 7:08 PM
> À : Pierre Muller
> Cc : brobecke@sourceware.org; gdb-patches@sourceware.org; 'Pedro Alves'
> Objet : Re: [RFA] Fix Cygwin problem with banned variables
> 
> >   This generates multiple calls to 'trace variable ' and only one
> call
> >   to 'trace remove variable '.
> 
> The TCL documentation is not directly explicit about that, but
> some experimentation shows that this is indeed a problem. And
> rereading the docuemntation with that in mind, the duplicate traces
> are probably treated as distinct traces.  Thus, when doing only one
> remove for the trace, we're still left with at least one trace.
> 
> > 2010-06-19  Pierre Muller  <muller@ics.u-strasbg.fr>
> >
> > 	* 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 '.
> 
> Just one detail, but otherwise OK.

  Thanks for the approval
 
> > @@ -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
> 
> Please add a comment explaining what this global is used for and
> why it is necessary.

Here is what I checked in,
with an explanation added for the new variable `banned_variables_traced'.

  Please feel free to improve the comment,

Pierre Muller

testsuite/ChangLog entry:

2010-06-22  Pierre Muller  <muller@ics.u-strasbg.fr>

       * 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: 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
--- lib/gdb.exp 11 Jun 2010 21:58:20 -0000      1.150
+++ lib/gdb.exp 22 Jun 2010 07:16:58 -0000
@@ -2520,6 +2520,15 @@ if ![info exists gdb_test_timeout] {
 # an error when that happens.
 set banned_variables { bug_id prms_id }

+# gdb_init is called by runtest at start, but also by several
+# tests directly; gdb_finish is only called from within runtest after
+# each test source execution.
+# Placing several traces by repetitive calls to gdb_init leads
+# to problems, as only one trace is removed in gdb_finish.
+# To overcome this possible problem, we add a variable that records
+# if the banned variables are traced.
+set banned_variables_traced 0
+
 proc gdb_init { args } {
     # Reset the timeout value to the default.  This way, any testcase
     # that changes the timeout value without resetting it cannot affect
@@ -2530,9 +2539,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 +2565,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
     }
 }


      reply	other threads:[~2010-06-22  7:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100517171128.29087.qmail@sourceware.org>
2010-06-19  8:42 ` [Cygwin problem]:with " Pierre Muller
2010-06-20 14:59   ` [RFA] Fix Cygwin problem with " Pierre Muller
2010-06-21 17:08     ` Joel Brobecker
2010-06-22  7:22       ` Pierre Muller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001801cb11db$9d553c30$d7ffb490$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox