SHA256
9
0
forked from pool/gdb
Files
gdb/gdb-testsuite-fix-build-id-check-in-gdb.python-py-mi.patch
Tom de Vries fcf6764793 Fix bsc#1251213
- Patches added:
  * avoid-crash-with-length.patch
  * correct-bounds-check-when-working-around-gas-dwarf-5.patch
  * fix-crash-in-f-typeprint.c.patch
- Patches added (swo#33560, bsc#1251213):
  * bfd-elf-handle-prstatus-of-156-bytes-in-elf32_arm_na.patch
  * gdb-corefiles-fix-segfault-in-add_thread_silent.patch
- Patches added (swo#32542, swo#33354):
  * change-return-value-of-_bfd_mmap_temporary.patch
- Patches added (swo#33068, swo#33069):
  * gdb-fix-handling-of-aborted-inferior-call.patch
- Patches added (swo#33620):
  * gdb-rust-fix-handling-of-unsigned-discriminant.patch
- Patches added (swo#33444):
  * have-gdb.threadexitedevent-inherit-from-gdb.threadev.patch
- Patches added (swo#33617):
  * mark-pascal-as-case-insensitive.patch
- Patches added (testsuite):
  * check-gnatmake-version-in-gnat_version_compare.patch
  * gdb-testsuite-fix-build-id-check-in-gdb.python-py-mi.patch
  * gdb-testsuite-fix-gdb.mi-mi-sym-info.exp.patch
  * gdb-testsuite-fix-gdb.rust-methods.exp-on-i686-linux.patch
  * gdb-testsuite-fix-main-in-gdb.trace-mi-trace-frame-c.patch
  * gdb-testsuite-fix-possible-tcl-errors-in-gdb.threads.patch
  * gdb-testsuite-fix-sizeof-test-in-gdb.rust-simple.exp.patch
  * gdb-testsuite-fix-xfail-in-gdb.ada-array_of_variant..patch
  * gdb-testsuite-fix-xfail-in-gdb.ada-variant_record_fi.patch
  * gdb-testsuite-force-dwarf-in-gdb.pascal.patch
  * gdb-testsuite-rust-fix-for-empty-array.patch
  * gdb-testsuite-use-expect_build_id_in_core_file-a-bit.patch
  * gdb-testsuite-use-std-c99-in-gdb.base-callfuncs.exp.patch
  * gdb-testsuite-use-std-c99-in-gdb.base-nodebug.exp.patch
  * powerpc-mark-rtti-typeid-tests-as-expected-fail-befo.patch
- Maintenance script import-patches.sh:
  * Use git instead of osc.
- Maintenance script qa.sh:
  * Add PR32893 kfail.
2025-11-26 08:34:17 +01:00

73 lines
2.8 KiB
Diff

From b29fe2547e14caabc04ff35f0dc3b2ed9043bbd0 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 20 Nov 2025 21:54:47 +0100
Subject: [PATCH 07/25] [gdb/testsuite] Fix build-id check in
gdb.python/py-missing-objfile.exp
I recently added two requires in test-case gdb.python/py-missing-objfile.exp:
...
require {expect_build_id_in_core_file $binfile}
require {expect_build_id_in_core_file $libfile}
...
However, at the point where the check is done, the files are no longer
available at that location, which makes the require fail.
First, make the problem visible, by making proc expect_build_id_in_core_file
throw an error if the filename argument specifies a non-existing file.
Then, fix test-case gdb.python/py-missing-objfile.exp by moving the calls to
expect_build_id_in_core_file to a point where the files exist.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.python/py-missing-objfile.exp | 9 +++++++--
gdb/testsuite/lib/gdb.exp | 4 ++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.exp b/gdb/testsuite/gdb.python/py-missing-objfile.exp
index 2786bdfb2ed..9ecf53a7024 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-missing-objfile.exp
@@ -34,6 +34,11 @@ if { [build_executable "build exec" $binfile $srcfile $opts] == -1} {
return
}
+set expect_build_id_in_core_file_binfile \
+ [expect_build_id_in_core_file $binfile]
+set expect_build_id_in_core_file_libfile \
+ [expect_build_id_in_core_file $libfile]
+
# The cc-with-gnu-debuglink board will split the debug out into the
# .debug directory. This test script relies on having GDB lookup the
# objfile and debug via the build-id, which this test sets up. Trying
@@ -185,8 +190,8 @@ with_test_prefix "no objfiles available" {
# 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}
+require {expr $expect_build_id_in_core_file_binfile}
+require {expr $expect_build_id_in_core_file_libfile}
with_test_prefix "all objfiles available" {
# Another sanity check that GDB can find the files via the
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 47cff389a41..ac1de76a696 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -11057,6 +11057,10 @@ gdb_caching_proc root_user {} {
# Otherwise, return false.
proc expect_build_id_in_core_file { filename } {
+ if {![file exists $filename]} {
+ error "File not found: $filename"
+ }
+
# I'm not sure if other kernels take care to add the first page of
# each ELF into the core file. If they do then this test can be
# relaxed.
--
2.51.0