Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv2 1/2] gdb/testsuite: restructure gdb_data_cache (lib/cache.exp)
Date: Wed,  5 Jun 2024 14:27:03 +0100	[thread overview]
Message-ID: <2d45fbe4624a71dd07864737383dc5f37d3275a4.1717593822.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1717593822.git.aburgess@redhat.com>

In a later 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 ',value' suffix to the gdb_data_cache keys.  In
later commits I'll add additional entries with different suffixes.

There should be no noticable changes after this commit, this is just a
restructuring.
---
 gdb/testsuite/lib/cache.exp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/lib/cache.exp b/gdb/testsuite/lib/cache.exp
index 80667349f52..e7b9114058b 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
-- 
2.25.4


  reply	other threads:[~2024-06-05 13:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 18:16 [PATCH 0/4] gdb/testsuite: remove can_spawn_for_attach_1 Andrew Burgess
2024-06-03 18:16 ` [PATCH 1/4] gdb/testsuite: remove trailing \r from rust_llvm_version result Andrew Burgess
2024-06-04 13:51   ` Tom Tromey
2024-06-05  9:20     ` Andrew Burgess
2024-06-03 18:16 ` [PATCH 2/4] gdb/testsuite: improve with_override Andrew Burgess
2024-06-03 18:16 ` [PATCH 3/4] gdb/testsuite: restructure gdb_data_cache (lib/cache.exp) Andrew Burgess
2024-06-03 18:16 ` [PATCH 4/4] gdb/testsuite: track if a caching proc calls gdb_exit or not Andrew Burgess
2024-08-07  6:05   ` Luis Machado
2024-08-07  9:16     ` Andrew Burgess
2024-08-07 10:00       ` Andrew Burgess
2024-08-07 10:08         ` Luis Machado
2024-08-07 10:12           ` Luis Machado
2024-08-07 12:45             ` Andrew Burgess
2024-08-07 14:31     ` Andrew Burgess
2024-08-07 18:35       ` Luis Machado
2024-08-08 10:20       ` Luis Machado
2024-08-08 10:50         ` Luis Machado
2024-08-08 11:08           ` Luis Machado
2024-08-08 14:50             ` Andrew Burgess
2024-08-09 11:29               ` Luis Machado
2024-08-13 16:30                 ` Andrew Burgess
2024-08-14 13:06                   ` Luis Machado
2024-08-14 17:00                     ` Andrew Burgess
2024-08-15  6:03                       ` Luis Machado
2024-08-20 15:25                         ` Andrew Burgess
2024-06-04  9:06 ` [PATCH 0/4] gdb/testsuite: remove can_spawn_for_attach_1 Andrew Burgess
2024-06-05 13:27 ` [PATCHv2 0/2] " Andrew Burgess
2024-06-05 13:27   ` Andrew Burgess [this message]
2024-06-05 13:27   ` [PATCHv2 2/2] gdb/testsuite: track if a caching proc calls gdb_exit or not Andrew Burgess
2024-07-28  8:54   ` [PUSHED 0/2] gdb/testsuite: remove can_spawn_for_attach_1 Andrew Burgess
2024-07-28  8:54     ` [PUSHED 1/2] gdb/testsuite: restructure gdb_data_cache (lib/cache.exp) Andrew Burgess
2024-07-28  8:54     ` [PUSHED 2/2] gdb/testsuite: track if a caching proc calls gdb_exit or not Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d45fbe4624a71dd07864737383dc5f37d3275a4.1717593822.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox