[binutils-gdb] Log gdb_do_cache misses only, not hits

Luis Machado via Gdb-cvs <[email protected]> Sun, 21 Jun 2026 10:55:43 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cb4f21e164991ca3748d8b3031244e40f0a7a821

commit cb4f21e164991ca3748d8b3031244e40f0a7a821
Author: Luis Machado <[email protected]>
Date:   Fri Jun 19 03:16:55 2026 -0500

    Log gdb_do_cache misses only, not hits
    
    The verbose -log in gdb_do_cache fired unconditionally on every call,
    including cache hits.  With many tests calling gdb_caching_procs like
    get_compiler_info_1 per compilation, this produced dozens of repeated
    identical lines per test file in the log, like so:
    
    gdb_do_cache: get_compiler_info_1 ( c )
    gdb_do_cache: get_compiler_info_1 ( c )
    gdb_do_cache: get_compiler_info_1 ( c )
    gdb_do_cache: get_compiler_info_1 ( c )
    gdb_do_cache: get_compiler_info_1 ( c )
    gdb_do_cache: get_compiler_info_1 ( c )
    gdb_do_cache: get_compiler_info_1 ( c )
    gdb_do_cache: get_compiler_info_1 ( c )
    
    Move the log to just before actual computation, after both the
    in-memory and on-disk cache checks. This helps keep the logs clean.
    
    Reviewed-By: Guinevere Larsen <[email protected]>

Diff:
---
 gdb/testsuite/lib/cache.exp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/testsuite/lib/cache.exp b/gdb/testsuite/lib/cache.exp
index 71688ee373e..1ba8c881716 100644
--- a/gdb/testsuite/lib/cache.exp
+++ b/gdb/testsuite/lib/cache.exp
@@ -103,8 +103,6 @@ proc gdb_do_cache {name args} {
     global gdb_data_cache objdir
     global GDB_PARALLEL
 
-    verbose -log "gdb_do_cache: $name ( $args )"
-
     # Normally, if we have a cached value, we skip computation and return
     # the cached value.  If set to 1, instead don't skip computation and
     # verify against the cached value.
@@ -195,6 +193,7 @@ proc gdb_do_cache {name args} {
     set old_gdb_nested_caching_proc_calls $::gdb_nested_caching_proc_calls
     set ::gdb_nested_caching_proc_calls {}
 
+    verbose -log "gdb_do_cache: $name ( $args )"
     set real_name gdb_real__$name
     set gdb_data_cache(${cache_name},value) [gdb_do_cache_wrap $real_name {*}$args]
     set gdb_data_cache(${cache_name},exit) $::gdb_exit_called