From: Tom de Vries Date: Thu, 12 Mar 2026 20:16:59 +0000 (+0100) Subject: [gdb/testsuite] Handle debuginfod output in gdb.debuginfod/solib-with-dwz.exp X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e85a00d62afabe7fc29580527d799334fa45643;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Handle debuginfod output in gdb.debuginfod/solib-with-dwz.exp 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 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33901 --- diff --git a/gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp b/gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp index 15ad13a68ad..9808f6c3e87 100644 --- a/gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp +++ b/gdb/testsuite/gdb.debuginfod/solib-with-dwz.exp @@ -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 diff --git a/gdb/testsuite/lib/debuginfod-support.exp b/gdb/testsuite/lib/debuginfod-support.exp index 57a880ff177..66b4098d4f9 100644 --- a/gdb/testsuite/lib/debuginfod-support.exp +++ b/gdb/testsuite/lib/debuginfod-support.exp @@ -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.