public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile
@ 2022-09-05 18:26 Lancelot SIX
  2022-09-05 18:30 ` Lancelot SIX
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lancelot SIX @ 2022-09-05 18:26 UTC (permalink / raw)
  To: gdb-patches; +Cc: lsix, Lancelot SIX

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 REHL-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 REHL-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
---
 gdb/testsuite/lib/future.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 36dd611d61c..17736ed360a 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -403,7 +403,11 @@ proc gdb_default_target_compile_1 {source destfile type options} {
     }
 
     if { $compiler == "" } {
-	set compiler [board_info $dest compiler]
+	if { [board_info $dest exists compiler] } {
+	    set compiler [board_info $dest compiler]
+	} elseif { $compiler_type eq "c" } {
+	    set compiler [find_gcc]
+	}
 	if { $compiler == "" } {
 	    return "default_target_compile: No compiler to compile with"
 	}

base-commit: b9593cb70533f28d276ab8d582dfe622aa4591d5
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile
  2022-09-05 18:26 [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile Lancelot SIX
@ 2022-09-05 18:30 ` Lancelot SIX
  2022-09-20 14:16 ` Six, Lancelot
  2022-09-22 16:26 ` Simon Marchi
  2 siblings, 0 replies; 5+ messages in thread
From: Lancelot SIX @ 2022-09-05 18:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: lsix


> Recent version of dejagnu (1.6.3, installed on REHL-9) includes ba60272
Hi

I spotted this typo: s/REHL/RHEL/g.  Fixed locally.

Best,
Lancelot.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile
  2022-09-05 18:26 [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile Lancelot SIX
  2022-09-05 18:30 ` Lancelot SIX
@ 2022-09-20 14:16 ` Six, Lancelot
  2022-09-22 16:26 ` Simon Marchi
  2 siblings, 0 replies; 5+ messages in thread
From: Six, Lancelot @ 2022-09-20 14:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: lsix

[Public]

Hi,

Kindly pinging.

Best,
Lancelot.

> -----Original Message-----
> From: Six, Lancelot <Lancelot.Six@amd.com>
> Sent: 05 September 2022 19:26
> To: gdb-patches@sourceware.org
> Cc: lsix@lancelotsix.com; Six, Lancelot <Lancelot.Six@amd.com>
> Subject: [PATCH] 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 REHL-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 REHL-9 and ubuntu-20.04 on top of GDB and
> ROCgdb.
> 
> [1]
> http://git.savannah.gnu.org/gitweb/?p=dejagnu.git;a=commit;h=ba60272a5a
> c6f6a7012acca03f596a6ed003f044
> [2] https://github.com/ROCm-Developer-Tools/ROCgdb
> 
> Change-Id: Ibff52684d9cab8243a7c6748ecbd29f50c37e669
> ---
>  gdb/testsuite/lib/future.exp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
> index 36dd611d61c..17736ed360a 100644
> --- a/gdb/testsuite/lib/future.exp
> +++ b/gdb/testsuite/lib/future.exp
> @@ -403,7 +403,11 @@ proc gdb_default_target_compile_1 {source destfile
> type options} {
>      }
> 
>      if { $compiler == "" } {
> -	set compiler [board_info $dest compiler]
> +	if { [board_info $dest exists compiler] } {
> +	    set compiler [board_info $dest compiler]
> +	} elseif { $compiler_type eq "c" } {
> +	    set compiler [find_gcc]
> +	}
>  	if { $compiler == "" } {
>  	    return "default_target_compile: No compiler to compile with"
>  	}
> 
> base-commit: b9593cb70533f28d276ab8d582dfe622aa4591d5
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile
  2022-09-05 18:26 [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile Lancelot SIX
  2022-09-05 18:30 ` Lancelot SIX
  2022-09-20 14:16 ` Six, Lancelot
@ 2022-09-22 16:26 ` Simon Marchi
  2022-09-22 16:55   ` Lancelot SIX
  2 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2022-09-22 16:26 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches; +Cc: lsix



On 2022-09-05 14:26, Lancelot SIX via Gdb-patches wrote:
> 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 REHL-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 REHL-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

Thanks, this is ok.

OOC, does this mean we can remove the "find_gcc" calls in our own
boards?  The override in future.exp does not systematically get used
when running on a system with an older DejaGNU, so I would guess not.

Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile
  2022-09-22 16:26 ` Simon Marchi
@ 2022-09-22 16:55   ` Lancelot SIX
  0 siblings, 0 replies; 5+ messages in thread
From: Lancelot SIX @ 2022-09-22 16:55 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches; +Cc: lsix


> 
> Thanks, this is ok.

Hi,

Thanks.

I'll push this in a moment.

> 
> OOC, does this mean we can remove the "find_gcc" calls in our own
> boards?  The override in future.exp does not systematically get used
> when running on a system with an older DejaGNU, so I would guess not.


As long as we do not need the override and can use dejagnu<1.6.3, we 
should maintain the find_gcc calls in the board files.

Thanks
Lancelot.

> Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-22 16:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 18:26 [PATCH] gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile Lancelot SIX
2022-09-05 18:30 ` Lancelot SIX
2022-09-20 14:16 ` Six, Lancelot
2022-09-22 16:26 ` Simon Marchi
2022-09-22 16:55   ` Lancelot SIX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).