[gdb/testsuite] Allow args in gdb_caching_proc
commit71f1ab80f1aabd70bce526635f84c7b849e8a0f4
authorTom de Vries <tdevries@suse.de>
Mon, 6 Mar 2023 15:49:19 +0000 (6 16:49 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 6 Mar 2023 15:49:19 +0000 (6 16:49 +0100)
treebe4ec728a4f9e2fc433a46fcc44310e8b9fb260c
parentb50420fd058824ecc737709f49f87d622b0f3371
[gdb/testsuite] Allow args in gdb_caching_proc

Test-case gdb.base/morestack.exp contains:
...
require {have_compile_flag -fsplit-stack}
...
and I want to cache the result of have_compile_flag.

Currently gdb_caching_proc doesn't allow args, so I could add:
...
gdb_caching_proc have_compile_flag_fsplit_stack {
    return [have_compile_flag -fsplit-stack]
}
...
and then use that proc instead, but I find this cumbersome and
maintenance-unfriendly.

Instead, allow args in a gdb_caching_proc, such that I can simply do:
...
-proc have_compile_flag { flag } {
+gdb_caching_proc have_compile_flag { flag } {
...

Note that gdb_caching_procs with args do not work with the
gdb.base/gdb-caching-procs.exp test-case, so those procs are skipped.

Tested on x86_64-linux.

Reviewed-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.base/gdb-caching-proc.exp
gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp
gdb/testsuite/lib/cache.exp
gdb/testsuite/lib/gdb.exp