[binutils-gdb] [gdb/testsuite] Use expect_build_id_in_core_file a bit more

Tom de Vries vries@sourceware.org
Mon Oct 13 18:54:31 GMT 2025


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

commit 54603750398b63263fd7924677ab0fe0affc4bad
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Oct 13 20:54:43 2025 +0200

    [gdb/testsuite] Use expect_build_id_in_core_file a bit more
    
    Recent commit c1950dcc04c ("gdb/testsuite: fix failure from
    gdb.python/py-corefile.exp") introduced proc expect_build_id_in_core_file,
    which detects the problem that:
    ...
        ... some versions of the linker didn't place the build-id within the first
        page of an ELF.  As a result, the Linux kernel would not include the
        build-id in the generated core file, ...
    ...
    
    Use this proc in a few more test-cases, to deal with the same problem.
    
    Tested on x86_64-linux, openSUSE Tumbleweed with ld 2.43.1.
    
    Approved-By: Andrew Burgess <aburgess@redhat.com>
    
    PR testsuite/33528
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33528

Diff:
---
 gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp | 3 +++
 gdb/testsuite/gdb.debuginfod/solib-with-soname.exp    | 4 ++++
 gdb/testsuite/gdb.python/py-missing-objfile.exp       | 5 +++++
 3 files changed, 12 insertions(+)

diff --git a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp
index c85cfb1f837..83472f00bb0 100644
--- a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp
+++ b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp
@@ -82,6 +82,9 @@ if {[prepare_for_testing_full "build exec which loads the shared library" \
     return
 }
 
+require {expect_build_id_in_core_file $binfile2}
+require {expect_build_id_in_core_file $library_filename}
+
 if {![runto_main]} {
     return
 }
diff --git a/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp b/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp
index 67d9237d43c..a22fa597602 100644
--- a/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp
+++ b/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp
@@ -96,6 +96,10 @@ if { [build_executable "build executable" ${binfile} ${srcfile2} \
     return
 }
 
+require {expect_build_id_in_core_file $library_1_filename}
+require {expect_build_id_in_core_file $library_2_filename}
+require {expect_build_id_in_core_file $binfile}
+
 # If the board file is automatically splitting the debug information
 # into a separate file (e.g. the cc-with-gnu-debuglink.exp board) then
 # this test isn't going to work.
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.exp b/gdb/testsuite/gdb.python/py-missing-objfile.exp
index ce4dc76b71e..2cc7dc87926 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-missing-objfile.exp
@@ -183,6 +183,11 @@ with_test_prefix "no objfiles available" {
     check_loaded_debug false false
 }
 
+# The following tests assume that the build-ids of binfile and libfile can be
+# found in the core file.
+require {expect_build_id_in_core_file $binfile}
+require {expect_build_id_in_core_file $libfile}
+
 with_test_prefix "all objfiles available" {
     # Another sanity check that GDB can find the files via the
     # debug-file-directory.


More information about the Gdb-cvs mailing list