Skip to content
Commit 5d19bc37 authored by Lancelot SIX's avatar Lancelot SIX
Browse files

gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile

GDB's testsuite can override dejagnu's default_target_compile if the
system provided dejagnu installation does not provide support to compile
languages GDB needs.

Recent version of dejagnu (1.6.3, installed on RHEL-9) includes ba60272
"Establish a default C compiler by evaluating [find_gcc] if no other
compiler is given."[1].  This commit removed calls such as
`set_board_info compiler  "[find_gcc]"` from the various baseboards
and has default_target_compile call `find_gcc` itself to find a compiler
if none was specified by the board description.

On systems with dejagnu-1.6.3, if GDB's overrides is needed to support
languages still unknown to dejagnu, we end up in the following
situation:
  - The system board files do not set the C compiler anymore,
  - GDB's replacement for default_target_compile assumes that the
    compiler should have been set up by the board file.

In this situation, no one sets the C compiler for the board and as a
result many test are not compiled and not executed:

    [...]
    Running .../gdb/testsuite/gdb.base/bt-on-error-and-warning.exp ...
    gdb compile failed, default_target_compile: No compiler to compile with
    Running .../gdb/testsuite/gdb.base/dprintf-non-stop.exp ...
    gdb compile failed, default_target_compile: No compiler to compile with
    Running .../gdb/testsuite/gdb.base/structs3.exp ...
    gdb compile failed, default_target_compile: No compiler to compile with
    [...]

We are observing this error with ROCgdb[2], a downstream port of GDB
supporting AMD GPUs.  This port needs to use GDB's override of
default_target_compile to compile HIP programs since dejagnu does not
provide support for this language yet.

This patch changes gdb_default_target_compile_1 in a similar way
default_target_compile has been updated so both implementations remain
compatible.  Even if this is not strictly required by GDB just yet,
I believe keeping both implementations in sync desirable.

Using board files provided with dejagnu <=1.6.2 is still supported: if
the compiler is set by the board file, gdb_default_target_compile_1 uses
it and does not need `find_gcc`.

Patch tested on x86_64 RHEL-9 and ubuntu-20.04 on top of GDB and ROCgdb.

[1] http://git.savannah.gnu.org/gitweb/?p=dejagnu.git;a=commit;h=ba60272a5ac6f6a7012acca03f596a6ed003f044
[2] https://github.com/ROCm-Developer-Tools/ROCgdb

Change-Id: Ibff52684d9cab8243a7c6748ecbd29f50c37e669
parent 6e17ae62
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment