aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2010-06-22 07:21:29 +0000
committerPierre Muller <muller@sourceware.org>2010-06-22 07:21:29 +0000
commit41b2c92d4c9fdd2904527d63d401ab48f024351a (patch)
tree6aaac78ba3c5a3a3c50e9551522edf08ac968a2e
parente4c0cfae7efd91407b425c45ec0dcfbfc35da09e (diff)
downloadgdb-41b2c92d4c9fdd2904527d63d401ab48f024351a.zip
gdb-41b2c92d4c9fdd2904527d63d401ab48f024351a.tar.gz
gdb-41b2c92d4c9fdd2904527d63d401ab48f024351a.tar.bz2
* 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'.
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/lib/gdb.exp29
2 files changed, 30 insertions, 6 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e324c56..c53fc02 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+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'.
+
2010-06-21 Doug Evans <dje@google.com>
* gdb.gdb/selftest.exp: Remove support for gpl v1 and v2 gdb's.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 833fbf2..c2014dd 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -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
}
}