[gdb/testsuite] Make gdb.base/dbx.exp more robust
authorTom de Vries <tdevries@suse.de>
Thu, 11 Jun 2020 12:10:05 +0000 (14:10 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 11 Jun 2020 12:10:05 +0000 (14:10 +0200)
commita8baf0a32b8f8fe151762c6c0136fef4bae2facd
treeb47647ab8cf287aec9c59115234a340e121d22bd
parent14962256b310efddf677ff4f5c9fa41047f48c39
[gdb/testsuite] Make gdb.base/dbx.exp more robust

Test-case gdb.base/dbx.exp overrides:
- the GDBFLAGS variable
- the gdb_file_cmd proc

There's code at the end of the test-case to restore both, but that's not
guaranteed to be executed.

Fix this by:
- using save_vars to restore GDBFLAGS
- using a new proc with_override to restore gdb_file_cmd

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-11  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (with_override): New proc, factored out of ...
* gdb.base/dbx.exp: ... here.  Use with_override and save_vars.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/dbx.exp
gdb/testsuite/lib/gdb.exp