diff options
author | Joel Brobecker <brobecker@gnat.com> | 2010-05-17 17:11:28 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2010-05-17 17:11:28 +0000 |
commit | 47050449b98a72ed68d73dfac1351684d8d8f05b (patch) | |
tree | d07dbcc5824f95fd964f9e3e1f46bcea33f118cf /gdb/testsuite/lib | |
parent | 77c015860d3faf68c95bfff89374967f31b432e6 (diff) | |
download | gdb-47050449b98a72ed68d73dfac1351684d8d8f05b.zip gdb-47050449b98a72ed68d73dfac1351684d8d8f05b.tar.gz gdb-47050449b98a72ed68d73dfac1351684d8d8f05b.tar.bz2 |
testsuite: Prevent writes to prms_id and bug_id.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (banned_variables): New variable/constant.
(gdb_init): Add write trace on variables listed in banned_variables.
(gdb_finish): Remove write traces on variables listed in
banned_variables.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 8be2a72..70df5ea 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2480,6 +2480,11 @@ if ![info exists gdb_test_timeout] { set gdb_test_timeout $timeout } +# A list of global variables that GDB testcases should not use. +# We try to prevent their use by monitoring write accesses and raising +# an error when that happens. +set banned_variables { bug_id prms_id } + 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 @@ -2488,6 +2493,13 @@ proc gdb_init { args } { global timeout set timeout $gdb_test_timeout + # Block writes to all banned variables... + global banned_variables + foreach banned_var $banned_variables { + global "$banned_var" + trace variable "$banned_var" w error + } + return [eval default_gdb_init $args]; } @@ -2501,6 +2513,14 @@ proc gdb_finish { } { eval remote_file target delete $cleanfiles set cleanfiles {} } + + # 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 debug_format |