summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-08-11 22:50:28 +0100
committerPedro Alves <palves@redhat.com>2015-08-11 22:50:28 +0100
commit64254548aaa53374758967d8e486aaf4a1d0d306 (patch)
tree3aa6558c48bc2fe6e3760866fa84813b27755089
parent422f11824b3abf6c71042e2ee3aed572f250fc89 (diff)
downloadbinutils-gdb-users/palves/checkpoint-ns-stale-gdbflags.tar.gz
fix checkpoint-ns.exp stale GDBFLAGSusers/palves/checkpoint-ns-stale-gdbflags
-rw-r--r--gdb/testsuite/gdb.base/checkpoint-ns.exp29
1 files changed, 25 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.base/checkpoint-ns.exp b/gdb/testsuite/gdb.base/checkpoint-ns.exp
index d3698bab818..07c732d42d5 100644
--- a/gdb/testsuite/gdb.base/checkpoint-ns.exp
+++ b/gdb/testsuite/gdb.base/checkpoint-ns.exp
@@ -18,9 +18,30 @@
# We drive non-stop mode from a separate file because the whole test
# takes a while to run. This way, we can test both modes in parallel.
-set saved_gdbflags $GDBFLAGS
-append GDBFLAGS " -ex \"set non-stop on\""
+# Run BODY in the context of the caller, with EXTRA_GDBFLAGS appended
+# to the global GDBFLAGS. Returns the result of BODY.
+#
+proc with_extra_gdbflags { extra_gdbflags body } {
+ global GDBFLAGS
+
+ set saved_gdbflags $GDBFLAGS
+ append GDBFLAGS $extra_gdbflags
+
+ set code [catch {uplevel 1 $body} result]
+
+ set GDBFLAGS $saved_gdbflags
-source $srcdir/$subdir/checkpoint.exp
+ if {$code == 1} {
+ global errorInfo errorCode
+ return -code $code -errorinfo $errorInfo -errorcode $errorCode $result
+ } else {
+ return -code $code $result
+ }
+}
-set GDBFLAGS $saved_gdbflags
+# Wrap with with_extra_gdbflags to restore GDBFLAGS, as otherwise a
+# continue/return from the sourced script would return straight to our
+# caller.
+with_extra_gdbflags " -ex \"set non-stop on\"" {
+ source $srcdir/$subdir/checkpoint.exp
+}