]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Handle debuginfod output in gdb.debuginfod/solib-with-dwz.exp
authorTom de Vries <tdevries@suse.de>
Thu, 12 Mar 2026 20:16:59 +0000 (21:16 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 12 Mar 2026 20:16:59 +0000 (21:16 +0100)
I ran into a timeout in test-case gdb.debuginfod/solib-with-dwz.exp.

GDB times out like this:
...
Download failed: Timer expired. \
  Continuing without source file solib-with-dwz-bar.c.
...

My theory is that the download fails because debuginfod becomes unresponsive,
because it's stuck trying to write output into some buffer that is already
full.

Fix this by regularly draining debuginfod output in the test-case, using a new
proc drain_debuginfod.

Debuginfod is run with "-vvvv", which makes it rather verbose, and dropping
that also fixes the timeouts, but it might be useful for debugging, so I went
with the output draining method, and left the "-vvvv" as is.

Reviewed-By: Keith Seitz <keiths@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33901

gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp
gdb/testsuite/lib/debuginfod-support.exp

index 15ad13a68ad683e5d5c20f49a26acb7ca7c649bd..9808f6c3e87751ae0a52289ce1922d7093de0e3d 100644 (file)
@@ -201,6 +201,7 @@ proc run_test { cache db debug_dir use_filename } {
        unresolved "start debuginfod server"
        return
     }
+    drain_debuginfod
 
     # Point the client to the server.
     setenv DEBUGINFOD_URLS $url
@@ -225,10 +226,12 @@ proc run_test { cache db debug_dir use_filename } {
 
     # Now GDB is configured, load the executable.
     gdb_load $::binfile
+    drain_debuginfod
 
     if { ![runto_main] } {
        return
     }
+    drain_debuginfod
 
     # This test relies on reading address zero triggering a SIGSEGV.
     # If address zero is readable then give up now.
@@ -241,6 +244,7 @@ proc run_test { cache db debug_dir use_filename } {
 
     gdb_test "continue" \
        "\r\n$crash_line_num\\s+[string_to_regexp {*ptr = 0;    /* Crash here.  */}]"
+    drain_debuginfod
 
     set call_line_num [gdb_get_line_number "Call line" $::srcfile3]
 
@@ -250,6 +254,7 @@ proc run_test { cache db debug_dir use_filename } {
     gdb_test "list" \
        "\r\n$call_line_num\\s+[string_to_regexp {cb ();        /* Call line.  */}]\r\n.*" \
        "list default location in $::srcfile3"
+    drain_debuginfod
 
     set list_line_num [gdb_get_line_number "Second line to list" $::srcfile3]
 
@@ -304,6 +309,7 @@ proc run_test { cache db debug_dir use_filename } {
            exp_continue
        }
     }
+    drain_debuginfod
 
     # Use 'maint info symtabs' to list all symtabs and find the
     # symtabs that are associated with libbar.so (actually with the
index 57a880ff1775e07e94d7617321c7066e5121f2ef..66b4098d4f9beea61f799d2e3dc4ade1d33d0c38 100644 (file)
@@ -185,6 +185,17 @@ proc start_debuginfod { db debugdir } {
     return $url
 }
 
+# Drain output from debuginfod.
+
+proc drain_debuginfod {} {
+    verbose -log "drain debuginfod output --- start"
+    expect {
+       -i $::debuginfod_spawn_id ".*" {
+       }
+    }
+    verbose -log "drain debuginfod output --- end"
+}
+
 # If the global debuginfod_spawn_id exists, then kill that process and unset
 # the debuginfod_spawn_id global.  This can be used to shutdown the
 # debuginfod server.