diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-06-03 09:23:18 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-07-28 09:51:52 +0100 |
commit | 8db172ae38714452e2b36f66988c560c9ce69fc0 (patch) | |
tree | 46943d2d1ba3362c00f37781292e4cdaaafb0142 | |
parent | 64a565589c0c79b93b1c222fbba7f27701835ff7 (diff) | |
download | gdb-8db172ae38714452e2b36f66988c560c9ce69fc0.zip gdb-8db172ae38714452e2b36f66988c560c9ce69fc0.tar.gz gdb-8db172ae38714452e2b36f66988c560c9ce69fc0.tar.bz2 |
gdb/testsuite: restructure gdb_data_cache (lib/cache.exp)
In the next commit I want to add more information to
gdb_data_cache (see lib/cache.exp). Specifically I want to track if
the underlying function of a caching proc calls gdb_exit or not.
Currently gdb_data_cache is an associative array, the keys of which
are the name of the caching proc.
In this commit I add a ',value' suffix to the gdb_data_cache keys. In
the next commit I'll add additional entries with a different suffix.
There should be no noticable changes after this commit, this is just a
restructuring.
-rw-r--r-- | gdb/testsuite/lib/cache.exp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gdb/testsuite/lib/cache.exp b/gdb/testsuite/lib/cache.exp index 8066734..e7b9114 100644 --- a/gdb/testsuite/lib/cache.exp +++ b/gdb/testsuite/lib/cache.exp @@ -70,8 +70,8 @@ proc gdb_do_cache {name args} { set cache_name [file join [target_info name] $name {*}$args] set is_cached 0 - if {[info exists gdb_data_cache($cache_name)]} { - set cached $gdb_data_cache($cache_name) + if {[info exists gdb_data_cache(${cache_name},value)]} { + set cached $gdb_data_cache(${cache_name},value) verbose "$name: returning '$cached' from cache" 2 if { $cache_verify == 0 } { return $cached @@ -83,9 +83,9 @@ proc gdb_do_cache {name args} { set cache_filename [make_gdb_parallel_path cache $cache_name] if {[file exists $cache_filename]} { set fd [open $cache_filename] - set gdb_data_cache($cache_name) [read -nonewline $fd] + set gdb_data_cache(${cache_name},value) [read -nonewline $fd] close $fd - set cached $gdb_data_cache($cache_name) + set cached $gdb_data_cache(${cache_name},value) verbose "$name: returning '$cached' from file cache" 2 if { $cache_verify == 0 } { return $cached @@ -95,9 +95,9 @@ proc gdb_do_cache {name args} { } set real_name gdb_real__$name - set gdb_data_cache($cache_name) [gdb_do_cache_wrap $real_name {*}$args] + set gdb_data_cache(${cache_name},value) [gdb_do_cache_wrap $real_name {*}$args] if { $cache_verify == 1 && $is_cached == 1 } { - set computed $gdb_data_cache($cache_name) + set computed $gdb_data_cache(${cache_name},value) if { $cached != $computed } { error [join [list "Inconsistent results for $cache_name:" "cached: $cached vs. computed: $computed"]] @@ -105,15 +105,15 @@ proc gdb_do_cache {name args} { } if {[info exists GDB_PARALLEL]} { - verbose "$name: returning '$gdb_data_cache($cache_name)' and writing file" 2 + verbose "$name: returning '$gdb_data_cache(${cache_name},value)' and writing file" 2 file mkdir [file dirname $cache_filename] # Make sure to write the results file atomically. set fd [open $cache_filename.[pid] w] - puts $fd $gdb_data_cache($cache_name) + puts $fd $gdb_data_cache(${cache_name},value) close $fd file rename -force -- $cache_filename.[pid] $cache_filename } - return $gdb_data_cache($cache_name) + return $gdb_data_cache(${cache_name},value) } # Define a new proc named NAME, with optional args ARGS. BODY is the body of |