]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix gdb.base/gcorebg.exp and --program-prefix
authorPedro Alves <pedro@palves.net>
Wed, 20 Aug 2025 09:30:25 +0000 (10:30 +0100)
committerPedro Alves <pedro@palves.net>
Tue, 16 Sep 2025 11:00:38 +0000 (12:00 +0100)
commitb655a89ff523f459f8effaf17694a7248517a99b
treec1543a50d0be6279fb833ff5d5c42896b2f04970
parent4d7d74c958e32e2a8aeb6794cc524d84aa180700
Fix gdb.base/gcorebg.exp and --program-prefix

When GDB is configured with --program-prefix, we see:

 Running /home/pedro/gdb/src/gdb/testsuite/gdb.base/gcorebg.exp ...
 FAIL: gdb.base/gcorebg.exp: detached=detached: Spawned gcore finished
 FAIL: gdb.base/gcorebg.exp: detached=detached: Core file generated by gcore
 FAIL: gdb.base/gcorebg.exp: detached=standard: Spawned gcore finished
 FAIL: gdb.base/gcorebg.exp: detached=standard: Core file generated by gcore

The problem is here (with --program-prefix=prefix-), from gdb.log:
 gcore: GDB binary (/home/pedro/gdb/build-program-prefix/gdb/testsuite/../../gdb/prefix-gdb) not found
 FAIL: gdb.base/gcorebg.exp: detached=detached: Spawned gcore finished

That is gcore (the script, not the GDB command) trying to run the
installed GDB:

if [ ! -f "$binary_path/@GDB_TRANSFORM_NAME@" ]; then
  echo "gcore: GDB binary (${binary_path}/@GDB_TRANSFORM_NAME@) not found"
  exit 1
fi
...
"$binary_path/@GDB_TRANSFORM_NAME@" </dev/null \
...

When running the testsuite with the just-built GDB, the GDB binary is
'gdb', not @GDB_TRANSFORM_NAME@.

Fix this by adding a new '-g gdb" option to the 'gcore' script, that
lets you override the GDB binary gcore runs, and then making
gdb.base/gcorebg.exp pass it to gcore.  The GDB binary we're testing
is always in the $GDB global.  This is similar to how it is already
possible to specify GDB's data directory with an option to gcore, and
then gdb.base/gcorebg.exp uses it.

NEWS and documentation changes included.

Approved-by: Kevin Buettner <kevinb@redhat.com>
Change-Id: I6c60fba8768618eeba8d8d03b131dc756b57ee78
gdb/NEWS
gdb/doc/gdb.texinfo
gdb/gcore-1.in [changed mode: 0644->0755]
gdb/testsuite/gdb.base/gcorebg.exp