]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Speed up gdb.base/tls-dlobj.exp
authorTom de Vries <tdevries@suse.de>
Wed, 14 Jan 2026 20:41:45 +0000 (21:41 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 14 Jan 2026 20:41:45 +0000 (21:41 +0100)
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>
gdb/testsuite/gdb.base/tls-dlobj.exp

index 68c8b781473e585ea261081556ab7557c13462cd..2e1b50145413b62399ce63bdc24c5f085b6a2e7b 100644 (file)
@@ -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.