[binutils-gdb] [gdb/testsuite] Speed up gdb.base/tls-dlobj.exp

Tom de Vries vries@sourceware.org
Wed Jan 14 20:41:49 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6b2a7b23db0eb381a87369f2f593c113c3beb42

commit e6b2a7b23db0eb381a87369f2f593c113c3beb42
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Jan 14 21:41:45 2026 +0100

    [gdb/testsuite] Speed up gdb.base/tls-dlobj.exp
    
    In test-case gdb.base/tls-dlobj.exp we use breakpoints to step through the
    executable.  The breakpoints are used only once, but they are permanent, so we
    end up with 11 breakpoints, 10 of which of the form $srcfile:$n.
    
    The executable loads and unloads shared libraries, triggering solib events in
    gdb, which will re-set the breakpoints.
    
    Setting a breakpoint of the form $srcfile:$n triggers a filename search that
    iterates over all CUs in all objfiles for which we have debuginfo.
    
    In case glibc debuginfo is installed, and in case we have a slow gdb, for
    instance because of building with -O0 and Address Sanitizer, this might become
    noticeable.
    
    While it's a good idea to try to speed up this search (see for instance
    PR33781), measuring this speed is not the point of this test-case, so fix this
    by making the breakpoints temporary.
    
    Tested on x86_64-linux.
    
    Approved-by: Kevin Buettner <kevinb@redhat.com>

Diff:
---
 gdb/testsuite/gdb.base/tls-dlobj.exp | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/gdb.base/tls-dlobj.exp b/gdb/testsuite/gdb.base/tls-dlobj.exp
index 68c8b781473..2e1b5014541 100644
--- a/gdb/testsuite/gdb.base/tls-dlobj.exp
+++ b/gdb/testsuite/gdb.base/tls-dlobj.exp
@@ -57,7 +57,7 @@ proc gdb_test_with_xfail { cmd re cond} {
 
 proc do_tests {force_internal_tls} {
     clean_restart $::testfile
-    if {![runto_main]} {
+    if {![runto main temporary]} {
 	return
     }
 
@@ -65,7 +65,7 @@ proc do_tests {force_internal_tls} {
 	gdb_test_no_output "maint set force-internal-tls-address-lookup on"
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-1"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-1"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-1"
 
     with_test_prefix "before assignments" {
@@ -100,7 +100,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-2"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-2"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-2"
 
     with_test_prefix "at main-breakpoint-2" {
@@ -117,7 +117,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-3"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-3"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-3"
 
     # At this point lib2 and lib3 have been unloaded.  Also, TLS vars
@@ -137,7 +137,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-4"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-4"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-4"
 
     # lib3 has been loaded again; lib2 is the only one not loaded.
@@ -157,7 +157,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-5"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-5"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-5"
 
     # lib2 and lib3 are loaded; lib1 and lib4 are not.
@@ -177,7 +177,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-6"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-6"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-6"
 
     # lib1, lib3 and lib4 are loaded; lib2 is not loaded.
@@ -197,7 +197,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-7"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-7"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-7"
 
     # lib2 and lib3 are loaded; lib1 and lib4 are not.
@@ -217,7 +217,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-8"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-8"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-8"
 
     # lib1, lib2, lib3, and lib4 are all loaded.
@@ -236,7 +236,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-9"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-9"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-9"
 
     # lib2 is loaded; lib1, lib3, and lib4 are not.
@@ -255,7 +255,7 @@ proc do_tests {force_internal_tls} {
 	}
     }
 
-    gdb_breakpoint [gdb_get_line_number "main-breakpoint-10"]
+    gdb_breakpoint [gdb_get_line_number "main-breakpoint-10"] temporary
     gdb_continue_to_breakpoint "main-breakpoint-10"
 
     # lib3 and lib4 are loaded; lib1 and lib2 are not.


More information about the Gdb-cvs mailing list