]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.python/py-prompt.exp
[gdb/testsuite] Use save_vars to restore GDBFLAGS
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-prompt.exp
index f1f93bff572c823e9fa92e44f865ec3889fb3457..614fe9d82ea94dc1a1779dcf6f5829caf3d3a524 100644 (file)
@@ -27,11 +27,9 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
     return -1
 }
 
-save_vars { INTERNAL_GDBFLAGS } {
+save_vars { INTERNAL_GDBFLAGS GDBFLAGS } {
     set INTERNAL_GDBFLAGS [string map {"-q" ""} $INTERNAL_GDBFLAGS]
 
-    global GDBFLAGS
-    set saved_gdbflags $GDBFLAGS
     set GDBFLAGS [concat $GDBFLAGS " -ex \"python p = list()\""]
     set prompt_func "python def foo(x): global p; p.append(x);  return \'(Foo) \'"
     set GDBFLAGS [concat $GDBFLAGS " -ex \"$prompt_func\""]
@@ -72,7 +70,6 @@ save_vars { INTERNAL_GDBFLAGS } {
     }
 
     if {![can_spawn_for_attach]} {
-       set GDBFLAGS $saved_gdbflags
        return 0
     }
 
@@ -115,6 +112,5 @@ save_vars { INTERNAL_GDBFLAGS } {
        gdb_exit
     }
 
-    set GDBFLAGS $saved_gdbflags
     kill_wait_spawned_process $test_spawn_id
 }