}
# Call proc real_name and return the result, while ignoring calls to pass.
-proc gdb_do_cache_wrap {real_name} {
+proc gdb_do_cache_wrap {real_name args} {
if { [info procs save_pass] != "" } {
return [uplevel 2 $real_name]
}
rename pass save_pass
rename ignore_pass pass
- set code [catch {uplevel 2 $real_name} result]
+ set code [catch {uplevel 2 [list $real_name {*}$args]} result]
rename pass ignore_pass
rename save_pass pass
# A helper for gdb_caching_proc that handles the caching.
-proc gdb_do_cache {name} {
+proc gdb_do_cache {name args} {
global gdb_data_cache objdir
global GDB_PARALLEL
# "board" to handle runs with multiple options
# (e.g. unix/{-m32,-64}) correctly. We use "file join" here
# because we later use this in a real filename.
- set cache_name [file join [target_info name] $name]
+ set cache_name [file join [target_info name] $name {*}$args]
set is_cached 0
if {[info exists gdb_data_cache($cache_name)]} {
}
set real_name gdb_real__$name
- set gdb_data_cache($cache_name) [gdb_do_cache_wrap $real_name]
+ set gdb_data_cache($cache_name) [gdb_do_cache_wrap $real_name {*}$args]
if { $cache_verify == 1 && $is_cached == 1 } {
set computed $gdb_data_cache($cache_name)
if { $cached != $computed } {
return $gdb_data_cache($cache_name)
}
-# Define a new proc named NAME that takes no arguments. BODY is the
-# body of the proc. The proc will evaluate BODY and cache the
-# results, both in memory and, if GDB_PARALLEL is defined, in the
-# filesystem for use across invocations of dejagnu.
+# Define a new proc named NAME, with optional args ARGS. BODY is the body of
+# the proc. The proc will evaluate BODY and cache the results, both in memory
+# and, if GDB_PARALLEL is defined, in the filesystem for use across
+# invocations of dejagnu.
+#
proc gdb_caching_proc {name arglist body} {
- if { [llength $arglist] != 0 } {
- error "gdb_caching_proc with non-empty args list"
- }
# Define the underlying proc that we'll call.
set real_name gdb_real__$name
- proc $real_name {} $body
+ proc $real_name $arglist $body
# Define the advertised proc.
- proc $name {} [list gdb_do_cache $name]
+ set caching_proc_body [list gdb_do_cache $name]
+ foreach arg $arglist {
+ lappend caching_proc_body $$arg
+ }
+ set caching_proc_body [join $caching_proc_body]
+ proc $name $arglist $caching_proc_body
}