public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: gcc-patches@gcc.gnu.org
Subject: [COMMITTED V10 2/7] dejagnu: modularize gcc-dg-debug-runtest a bit
Date: Mon, 28 Jun 2021 19:35:18 +0200	[thread overview]
Message-ID: <20210628173523.29350-3-jose.marchesi@oracle.com> (raw)
In-Reply-To: <20210628173523.29350-1-jose.marchesi@oracle.com>

Move some functionality into a procedure of its own. This is only so that when
the patch for ctf comes along, the gcc-dg-debug-runtest procedure looks bit
more uniform.

gcc/testsuite/ChangeLog:

	* lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): New procedure.
---
 gcc/testsuite/lib/gcc-dg.exp | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index fce0989cd9c..c7722ba07da 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -621,18 +621,27 @@ proc gcc-dg-runtest { testcases flags default-extra-flags } {
     }
 }
 
-proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
+# Check if the target system supports the debug format
+proc gcc-dg-target-supports-debug-format { target_compile trivial type } {
     global srcdir subdir
 
+    set comp_output [$target_compile \
+	    "$srcdir/$subdir/$trivial" "trivial.S" assembly \
+	    "additional_flags=$type"]
+    if { ! [string match "*: target system does not support the * debug format*" \
+	    $comp_output] } {
+	remove-build-file "trivial.S"
+	return 1
+    }
+    return 0
+}
+
+proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
     if ![info exists DEBUG_TORTURE_OPTIONS] {
 	set DEBUG_TORTURE_OPTIONS ""
 	foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+} {
-	    set comp_output [$target_compile \
-		    "$srcdir/$subdir/$trivial" "trivial.S" assembly \
-		    "additional_flags=$type"]
-	    if { ! [string match "*: target system does not support the * debug format*" \
-		    $comp_output] } {
-		remove-build-file "trivial.S"
+	    if [expr [gcc-dg-target-supports-debug-format \
+		      $target_compile $trivial $type]] {
 		foreach level {1 "" 3} {
 		    if { ($type == "-gdwarf-2") && ($level != "") } {
 			lappend DEBUG_TORTURE_OPTIONS [list "${type}" "-g${level}"]
-- 
2.25.0.2.g232378479e


  parent reply	other threads:[~2021-06-28 17:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 17:35 [COMMITTED V10 0/7] Support for the CTF and BTF debug formats Jose E. Marchesi
2021-06-28 17:35 ` [COMMITTED V10 1/7] dwarf: externalize some DWARF internals for needs of CTF/BTF Jose E. Marchesi
2021-06-28 17:35 ` Jose E. Marchesi [this message]
2021-06-28 17:35 ` [COMMITTED V10 3/7] CTF/BTF debug formats Jose E. Marchesi
2021-06-28 17:35 ` [COMMITTED V10 4/7] CTF/BTF testsuites Jose E. Marchesi
2021-06-30 11:46   ` Christophe Lyon
2021-06-28 17:35 ` [COMMITTED V10 5/7] CTF/BTF documentation Jose E. Marchesi
2021-06-28 17:35 ` [COMMITTED V10 6/7] Enable BTF generation in the BPF backend Jose E. Marchesi
2021-06-28 17:35 ` [COMMITTED V10 7/7] libiberty: copy over .BTF section when using LTO Jose E. Marchesi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210628173523.29350-3-jose.marchesi@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).