public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function
@ 2019-10-15 22:09 Andrew Burgess (Code Review)
  2019-10-16 18:02 ` Tom Tromey (Code Review)
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Andrew Burgess (Code Review) @ 2019-10-15 22:09 UTC (permalink / raw)
  To: gdb-patches

Andrew Burgess has uploaded a new change for review.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................

gdb/testsuite: Introduce compiler_supports_ctf_debug guard function

Most versions of GCC in the wild don't support CTF debug format right
now, so, rather than attempting to compile the tests and failing each
time, this patch introduces a guard function to check if the compiler
supports CTF.  If we don't have CTF support then the CTF tests are
skipped.

This patch only updates 3 of the 4 CTF tests, the fourth will be
handled in the next patch.

gdb/testsuite/ChangeLog:

	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
	the compiler.  Clean up header comment a little.
	* gdb.base/ctf-ptype.exp: Likewise.
	* gdb.base/ctf-whatis.exp: Likewise.
	* lib/gdb.exp (compiler_supports_ctf_debug): New proc.

Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.base/ctf-constvars.exp
M gdb/testsuite/gdb.base/ctf-ptype.exp
M gdb/testsuite/gdb.base/ctf-whatis.exp
M gdb/testsuite/lib/gdb.exp
5 files changed, 39 insertions(+), 20 deletions(-)



diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ce6e0f2..245b8f9 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-10-15  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
+	the compiler.  Clean up header comment a little.
+	* gdb.base/ctf-ptype.exp: Likewise.
+	* gdb.base/ctf-whatis.exp: Likewise.
+	* lib/gdb.exp (compiler_supports_ctf_debug): New proc.
+
 2019-10-14  Simon Marchi <simon.marchi@polymtl.ca>
 
 	* gdb.mi/list-thread-groups-available.exp: Read entries one by
diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp
index 4a81a94..58c0bad 100644
--- a/gdb/testsuite/gdb.base/ctf-constvars.exp
+++ b/gdb/testsuite/gdb.base/ctf-constvars.exp
@@ -18,20 +18,20 @@
 #
 # This file is part of the gdb testsuite
 #
-# tests for const variables
-#           const pointers to vars
-#           pointers to const variables
-#           const pointers to const vars
-# with mixed types
+# Tests for: const variables,
+#            const pointers to vars
+#            pointers to const variables
+#            const pointers to const vars
+# with mixed types.
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if ![compiler_supports_ctf_debug] {
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index 9f54582..172f6d1 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -15,14 +15,14 @@
 
 # This file is a subset of ptype.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if ![compiler_supports_ctf_debug] {
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-whatis.exp b/gdb/testsuite/gdb.base/ctf-whatis.exp
index 3f26fc3..377eeb3 100644
--- a/gdb/testsuite/gdb.base/ctf-whatis.exp
+++ b/gdb/testsuite/gdb.base/ctf-whatis.exp
@@ -15,14 +15,14 @@
 
 # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if ![compiler_supports_ctf_debug] {
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
           [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index fed46ec..aa93a4b 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6737,5 +6737,16 @@
     }
 }
 
+# Does the compiler support CTF debug output using '-gt' compiler
+# flag?
+gdb_caching_proc compiler_supports_ctf_debug {
+    verbose -log "APB: Got here."
+    return [gdb_can_simple_compile ctfdebug {
+	int main () {
+	    return 0;
+	}
+    } executable "additional_flags=-gt"]
+}
+
 # Always load compatibility stuff.
 load_lib future.exp

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

* [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
@ 2019-10-16 18:02 ` Tom Tromey (Code Review)
  2019-10-16 20:02 ` Andrew Burgess (Code Review)
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-16 18:02 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................


Patch Set 1:

(1 comment)

Thanks for the patch.

I tend to suspect this should wait for the other patch (mentioned below).
What do you think?

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121/1/gdb/testsuite/gdb.base/ctf-whatis.exp 
File gdb/testsuite/gdb.base/ctf-whatis.exp:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121/1/gdb/testsuite/gdb.base/ctf-whatis.exp@19 
PS1, Line 19:     return 0
https://sourceware.org/ml/gdb-patches/2019-10/msg00450.html reviews a very similar patch.  There I suggested using "unsupported" in these cases, since I think this is the current style.



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

* [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
  2019-10-16 18:02 ` Tom Tromey (Code Review)
@ 2019-10-16 20:02 ` Andrew Burgess (Code Review)
  2019-10-22 16:11 ` Tom Tromey (Code Review)
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Andrew Burgess (Code Review) @ 2019-10-16 20:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Andrew Burgess has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................


Patch Set 1:

> Patch Set 1:
> 
> (1 comment)
> 
> Thanks for the patch.
> 
> I tend to suspect this should wait for the other patch (mentioned below).
> What do you think?

That's fine.  I originally posted this to the m/l while back[1], I hadn't noticed that Nick had duplicated the work since then.  My main interest is the other two patches in this series.

[1] https://sourceware.org/ml/gdb-patches/2019-10/msg00220.html


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

* [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
  2019-10-16 18:02 ` Tom Tromey (Code Review)
  2019-10-16 20:02 ` Andrew Burgess (Code Review)
@ 2019-10-22 16:11 ` Tom Tromey (Code Review)
  2019-11-16 22:45 ` Simon Marchi (Code Review)
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-22 16:11 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................


Patch Set 1:

> > I tend to suspect this should wait for the other patch (mentioned below).
> > What do you think?
> 
> That's fine.  I originally posted this to the m/l while back[1], I hadn't noticed that Nick had duplicated the work since then.  My main interest is the other two patches in this series.
> 
> [1] https://sourceware.org/ml/gdb-patches/2019-10/msg00220.html

If yours came first, I'm ok if you want to get it in earlier so you can
unblock your other patches.  I do think it should use `unsupported` though.

Thanks again for doing this.


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

* [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
                   ` (2 preceding siblings ...)
  2019-10-22 16:11 ` Tom Tromey (Code Review)
@ 2019-11-16 22:45 ` Simon Marchi (Code Review)
  2019-11-18 17:53 ` [review v2] " Andrew Burgess (Code Review)
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Simon Marchi (Code Review) @ 2019-11-16 22:45 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: Tom Tromey

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................


Patch Set 1:

(2 comments)

| --- gdb/testsuite/gdb.base/ctf-whatis.exp
| +++ gdb/testsuite/gdb.base/ctf-whatis.exp
| @@ -14,13 +14,13 @@ # You should have received a copy of the GNU General Public License
|  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
|  
|  # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com)
|  
| -#
| -# test running programs
| -#
| -# -gt generates full-fledged CTF.
| +if ![compiler_supports_ctf_debug] {
| +    return 0

PS1, Line 19:

> https://sourceware.org/ml/gdb-patches/2019-10/msg00450.html reviews a very similar patch.  There I suggested using "unsupported" in these cases, since I think this is the current style.

I think that makes sense, as it leaves a trace in the .sum file.

| +}
|  
|  standard_testfile .c
| -set opts "additional_flags=-gt"
| -
| +
| +# Using `-gt` generates full-fledged CTF debug information.
| +set opts "additional_flags=-gt"
|  if { [prepare_for_testing "failed to prepare" ${testfile} \
| --- gdb/testsuite/lib/gdb.exp
| +++ gdb/testsuite/lib/gdb.exp
| @@ -6734,8 +6734,19 @@ proc cmp_file_string { file str msg } {
|  	pass "$msg"
|      } else {
|  	fail "$msg"
|      }
|  }
|  
| +# Does the compiler support CTF debug output using '-gt' compiler
| +# flag?
| +gdb_caching_proc compiler_supports_ctf_debug {
| +    verbose -log "APB: Got here."

PS1, Line 6743:

Was it your intention to leave this logging line here?

| +    return [gdb_can_simple_compile ctfdebug {
| +	int main () {
| +	    return 0;
| +	}
| +    } executable "additional_flags=-gt"]
| +}
| +
|  # Always load compatibility stuff.
|  load_lib future.exp

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
Gerrit-Change-Number: 121
Gerrit-PatchSet: 1
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Sat, 16 Nov 2019 22:45:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: comment

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

* [review v2] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
                   ` (3 preceding siblings ...)
  2019-11-16 22:45 ` Simon Marchi (Code Review)
@ 2019-11-18 17:53 ` Andrew Burgess (Code Review)
  2019-11-18 17:57 ` [review v3] gdb/testsuite: Introduce skip_ctf_tests " Andrew Burgess (Code Review)
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Andrew Burgess (Code Review) @ 2019-11-18 17:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey, Simon Marchi

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................

gdb/testsuite: Introduce compiler_supports_ctf_debug guard function

Most versions of GCC in the wild don't support CTF debug format right
now, so, rather than attempting to compile the tests and failing each
time, this patch introduces a guard function to check if the compiler
supports CTF.  If we don't have CTF support then the CTF tests are
skipped.

This patch only updates 3 of the 4 CTF tests, the fourth will be
handled in the next patch.

gdb/testsuite/ChangeLog:

	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
	the compiler.  Clean up header comment a little.
	* gdb.base/ctf-ptype.exp: Likewise.
	* gdb.base/ctf-whatis.exp: Likewise.
	* lib/gdb.exp (compiler_supports_ctf_debug): New proc.

Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.base/ctf-constvars.exp
M gdb/testsuite/gdb.base/ctf-ptype.exp
M gdb/testsuite/gdb.base/ctf-whatis.exp
M gdb/testsuite/lib/gdb.exp
5 files changed, 42 insertions(+), 20 deletions(-)



diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3a4d229..aef247f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-10-15  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
+	the compiler.  Clean up header comment a little.
+	* gdb.base/ctf-ptype.exp: Likewise.
+	* gdb.base/ctf-whatis.exp: Likewise.
+	* lib/gdb.exp (skip_ctf_tests): New proc.
+
 2019-11-14  Tom Tromey  <tromey@adacore.com>
 
 	* gdb.base/gdbvars.exp (test_convenience_variables): Add
diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp
index 4a81a94..fd46d64 100644
--- a/gdb/testsuite/gdb.base/ctf-constvars.exp
+++ b/gdb/testsuite/gdb.base/ctf-constvars.exp
@@ -18,20 +18,21 @@
 #
 # This file is part of the gdb testsuite
 #
-# tests for const variables
-#           const pointers to vars
-#           pointers to const variables
-#           const pointers to const vars
-# with mixed types
+# Tests for: const variables,
+#            const pointers to vars
+#            pointers to const variables
+#            const pointers to const vars
+# with mixed types.
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index 9f54582..68a9662 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -15,14 +15,15 @@
 
 # This file is a subset of ptype.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-whatis.exp b/gdb/testsuite/gdb.base/ctf-whatis.exp
index 3f26fc3..626aecb 100644
--- a/gdb/testsuite/gdb.base/ctf-whatis.exp
+++ b/gdb/testsuite/gdb.base/ctf-whatis.exp
@@ -15,14 +15,15 @@
 
 # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
           [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2d395ef..828c91d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6787,5 +6787,16 @@
     }
 }
 
+# Does the compiler support CTF debug output using '-gt' compiler
+# flag?  If not then we should skip these tests.
+
+gdb_caching_proc skip_ctf_tests {
+    return ![gdb_can_simple_compile ctfdebug {
+	int main () {
+	    return 0;
+	}
+    } executable "additional_flags=-gt"]
+}
+
 # Always load compatibility stuff.
 load_lib future.exp

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
Gerrit-Change-Number: 121
Gerrit-PatchSet: 2
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

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

* [review v3] gdb/testsuite: Introduce skip_ctf_tests guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
                   ` (4 preceding siblings ...)
  2019-11-18 17:53 ` [review v2] " Andrew Burgess (Code Review)
@ 2019-11-18 17:57 ` Andrew Burgess (Code Review)
  2019-11-18 18:03 ` Andrew Burgess (Code Review)
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Andrew Burgess (Code Review) @ 2019-11-18 17:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey, Simon Marchi

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................

gdb/testsuite: Introduce skip_ctf_tests guard function

Most versions of GCC in the wild don't support CTF debug format right
now, so, rather than attempting to compile the tests and failing each
time, this patch introduces a guard function to check if the compiler
supports CTF.  If we don't have CTF support then the CTF tests are
skipped.

This patch only updates 3 of the 4 CTF tests, the fourth will be
handled in the next patch.

gdb/testsuite/ChangeLog:

	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
	the compiler.  Clean up header comment a little.
	* gdb.base/ctf-ptype.exp: Likewise.
	* gdb.base/ctf-whatis.exp: Likewise.
	* lib/gdb.exp (skip_ctf_tests): New proc.

Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.base/ctf-constvars.exp
M gdb/testsuite/gdb.base/ctf-ptype.exp
M gdb/testsuite/gdb.base/ctf-whatis.exp
M gdb/testsuite/lib/gdb.exp
5 files changed, 42 insertions(+), 20 deletions(-)



diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3a4d229..e424248 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-11-18  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
+	the compiler.  Clean up header comment a little.
+	* gdb.base/ctf-ptype.exp: Likewise.
+	* gdb.base/ctf-whatis.exp: Likewise.
+	* lib/gdb.exp (skip_ctf_tests): New proc.
+
 2019-11-14  Tom Tromey  <tromey@adacore.com>
 
 	* gdb.base/gdbvars.exp (test_convenience_variables): Add
diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp
index 4a81a94..fd46d64 100644
--- a/gdb/testsuite/gdb.base/ctf-constvars.exp
+++ b/gdb/testsuite/gdb.base/ctf-constvars.exp
@@ -18,20 +18,21 @@
 #
 # This file is part of the gdb testsuite
 #
-# tests for const variables
-#           const pointers to vars
-#           pointers to const variables
-#           const pointers to const vars
-# with mixed types
+# Tests for: const variables,
+#            const pointers to vars
+#            pointers to const variables
+#            const pointers to const vars
+# with mixed types.
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index 9f54582..68a9662 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -15,14 +15,15 @@
 
 # This file is a subset of ptype.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-whatis.exp b/gdb/testsuite/gdb.base/ctf-whatis.exp
index 3f26fc3..626aecb 100644
--- a/gdb/testsuite/gdb.base/ctf-whatis.exp
+++ b/gdb/testsuite/gdb.base/ctf-whatis.exp
@@ -15,14 +15,15 @@
 
 # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
           [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2d395ef..828c91d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6787,5 +6787,16 @@
     }
 }
 
+# Does the compiler support CTF debug output using '-gt' compiler
+# flag?  If not then we should skip these tests.
+
+gdb_caching_proc skip_ctf_tests {
+    return ![gdb_can_simple_compile ctfdebug {
+	int main () {
+	    return 0;
+	}
+    } executable "additional_flags=-gt"]
+}
+
 # Always load compatibility stuff.
 load_lib future.exp

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
Gerrit-Change-Number: 121
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

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

* [review v3] gdb/testsuite: Introduce skip_ctf_tests guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
                   ` (5 preceding siblings ...)
  2019-11-18 17:57 ` [review v3] gdb/testsuite: Introduce skip_ctf_tests " Andrew Burgess (Code Review)
@ 2019-11-18 18:03 ` Andrew Burgess (Code Review)
  2019-11-18 18:46 ` Simon Marchi (Code Review)
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Andrew Burgess (Code Review) @ 2019-11-18 18:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi, Tom Tromey

Andrew Burgess has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................


Patch Set 3:

In this revision I've:

1. Changed the name of the guard function to skip_cft_tests, this matches what Nick used in his patch series.  I liked that name more,

2. Made use of unsupported when we skip ctf test files,

3. Removed the stray logging line I left in.

This patch does overlap with https://sourceware.org/ml/gdb-patches/2019-10/msg00450.html in its introduction of the guard function, but that patch covers other issues too.  This series goes on to rewrite some of the ctf test files, something that's not covered in Nick's patch.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
Gerrit-Change-Number: 121
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Mon, 18 Nov 2019 18:03:49 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

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

* [review v3] gdb/testsuite: Introduce skip_ctf_tests guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
                   ` (6 preceding siblings ...)
  2019-11-18 18:03 ` Andrew Burgess (Code Review)
@ 2019-11-18 18:46 ` Simon Marchi (Code Review)
  2019-11-18 18:47 ` Simon Marchi (Code Review)
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Simon Marchi (Code Review) @ 2019-11-18 18:46 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: Tom Tromey

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................


Patch Set 3:

(2 comments)

| --- gdb/testsuite/gdb.base/ctf-whatis.exp
| +++ gdb/testsuite/gdb.base/ctf-whatis.exp
| @@ -14,13 +14,13 @@ # You should have received a copy of the GNU General Public License
|  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
|  
|  # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com)
|  
| -#
| -# test running programs
| -#
| -# -gt generates full-fledged CTF.
| +if ![compiler_supports_ctf_debug] {
| +    return 0

PS1, Line 19:

> > https://sourceware.org/ml/gdb-patches/2019-10/msg00450.html reviews a very similar patch.  There I suggested using "unsupported" in these cases, since I think this is the current style.
> 
> I think that makes sense, as it leaves a trace in the .sum file.

Done.

| +}
|  
|  standard_testfile .c
| -set opts "additional_flags=-gt"
| -
| +
| +# Using `-gt` generates full-fledged CTF debug information.
| +set opts "additional_flags=-gt"
|  if { [prepare_for_testing "failed to prepare" ${testfile} \
| --- gdb/testsuite/lib/gdb.exp
| +++ gdb/testsuite/lib/gdb.exp
| @@ -6734,8 +6734,19 @@ proc cmp_file_string { file str msg } {
|  	pass "$msg"
|      } else {
|  	fail "$msg"
|      }
|  }
|  
| +# Does the compiler support CTF debug output using '-gt' compiler
| +# flag?
| +gdb_caching_proc compiler_supports_ctf_debug {
| +    verbose -log "APB: Got here."

PS1, Line 6743:

> Was it your intention to leave this logging line here?

Done.

| +    return [gdb_can_simple_compile ctfdebug {
| +	int main () {
| +	    return 0;
| +	}
| +    } executable "additional_flags=-gt"]
| +}
| +
|  # Always load compatibility stuff.
|  load_lib future.exp

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
Gerrit-Change-Number: 121
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Mon, 18 Nov 2019 18:46:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment

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

* [review v3] gdb/testsuite: Introduce skip_ctf_tests guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
                   ` (7 preceding siblings ...)
  2019-11-18 18:46 ` Simon Marchi (Code Review)
@ 2019-11-18 18:47 ` Simon Marchi (Code Review)
  2019-11-19  0:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-11-19  0:47 ` Sourceware to Gerrit sync (Code Review)
  10 siblings, 0 replies; 12+ messages in thread
From: Simon Marchi (Code Review) @ 2019-11-18 18:47 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: Tom Tromey

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................


Patch Set 3: Code-Review+2


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
Gerrit-Change-Number: 121
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Mon, 18 Nov 2019 18:47:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

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

* [pushed] gdb/testsuite: Introduce skip_ctf_tests guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
                   ` (9 preceding siblings ...)
  2019-11-19  0:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-11-19  0:47 ` Sourceware to Gerrit sync (Code Review)
  10 siblings, 0 replies; 12+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-19  0:47 UTC (permalink / raw)
  To: Andrew Burgess, Simon Marchi, gdb-patches; +Cc: Tom Tromey

The original change was created by Andrew Burgess.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................

gdb/testsuite: Introduce skip_ctf_tests guard function

Most versions of GCC in the wild don't support CTF debug format right
now, so, rather than attempting to compile the tests and failing each
time, this patch introduces a guard function to check if the compiler
supports CTF.  If we don't have CTF support then the CTF tests are
skipped.

This patch only updates 3 of the 4 CTF tests, the fourth will be
handled in the next patch.

gdb/testsuite/ChangeLog:

	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
	the compiler.  Clean up header comment a little.
	* gdb.base/ctf-ptype.exp: Likewise.
	* gdb.base/ctf-whatis.exp: Likewise.
	* lib/gdb.exp (skip_ctf_tests): New proc.

Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.base/ctf-constvars.exp
M gdb/testsuite/gdb.base/ctf-ptype.exp
M gdb/testsuite/gdb.base/ctf-whatis.exp
M gdb/testsuite/lib/gdb.exp
5 files changed, 42 insertions(+), 20 deletions(-)



diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index de8712a..f924966 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-11-19  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
+	the compiler.  Clean up header comment a little.
+	* gdb.base/ctf-ptype.exp: Likewise.
+	* gdb.base/ctf-whatis.exp: Likewise.
+	* lib/gdb.exp (skip_ctf_tests): New proc.
+
 2019-11-18  Sergio Durigan Junior  <sergiodj@redhat.com>
 
 	https://bugzilla.redhat.com/show_bug.cgi?id=1765117
diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp
index 4a81a94..fd46d64 100644
--- a/gdb/testsuite/gdb.base/ctf-constvars.exp
+++ b/gdb/testsuite/gdb.base/ctf-constvars.exp
@@ -18,20 +18,21 @@
 #
 # This file is part of the gdb testsuite
 #
-# tests for const variables
-#           const pointers to vars
-#           pointers to const variables
-#           const pointers to const vars
-# with mixed types
+# Tests for: const variables,
+#            const pointers to vars
+#            pointers to const variables
+#            const pointers to const vars
+# with mixed types.
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index 9f54582..68a9662 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -15,14 +15,15 @@
 
 # This file is a subset of ptype.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-whatis.exp b/gdb/testsuite/gdb.base/ctf-whatis.exp
index 3f26fc3..626aecb 100644
--- a/gdb/testsuite/gdb.base/ctf-whatis.exp
+++ b/gdb/testsuite/gdb.base/ctf-whatis.exp
@@ -15,14 +15,15 @@
 
 # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
           [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2d395ef..828c91d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6787,5 +6787,16 @@
     }
 }
 
+# Does the compiler support CTF debug output using '-gt' compiler
+# flag?  If not then we should skip these tests.
+
+gdb_caching_proc skip_ctf_tests {
+    return ![gdb_can_simple_compile ctfdebug {
+	int main () {
+	    return 0;
+	}
+    } executable "additional_flags=-gt"]
+}
+
 # Always load compatibility stuff.
 load_lib future.exp

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
Gerrit-Change-Number: 121
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

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

* [pushed] gdb/testsuite: Introduce skip_ctf_tests guard function
  2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
                   ` (8 preceding siblings ...)
  2019-11-18 18:47 ` Simon Marchi (Code Review)
@ 2019-11-19  0:47 ` Sourceware to Gerrit sync (Code Review)
  2019-11-19  0:47 ` Sourceware to Gerrit sync (Code Review)
  10 siblings, 0 replies; 12+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-19  0:47 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: Simon Marchi, Tom Tromey

Sourceware to Gerrit sync has submitted this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/121
......................................................................

gdb/testsuite: Introduce skip_ctf_tests guard function

Most versions of GCC in the wild don't support CTF debug format right
now, so, rather than attempting to compile the tests and failing each
time, this patch introduces a guard function to check if the compiler
supports CTF.  If we don't have CTF support then the CTF tests are
skipped.

This patch only updates 3 of the 4 CTF tests, the fourth will be
handled in the next patch.

gdb/testsuite/ChangeLog:

	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
	the compiler.  Clean up header comment a little.
	* gdb.base/ctf-ptype.exp: Likewise.
	* gdb.base/ctf-whatis.exp: Likewise.
	* lib/gdb.exp (skip_ctf_tests): New proc.

Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.base/ctf-constvars.exp
M gdb/testsuite/gdb.base/ctf-ptype.exp
M gdb/testsuite/gdb.base/ctf-whatis.exp
M gdb/testsuite/lib/gdb.exp
5 files changed, 42 insertions(+), 20 deletions(-)


diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index de8712a..f924966 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-11-19  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
+	the compiler.  Clean up header comment a little.
+	* gdb.base/ctf-ptype.exp: Likewise.
+	* gdb.base/ctf-whatis.exp: Likewise.
+	* lib/gdb.exp (skip_ctf_tests): New proc.
+
 2019-11-18  Sergio Durigan Junior  <sergiodj@redhat.com>
 
 	https://bugzilla.redhat.com/show_bug.cgi?id=1765117
diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp
index 4a81a94..fd46d64 100644
--- a/gdb/testsuite/gdb.base/ctf-constvars.exp
+++ b/gdb/testsuite/gdb.base/ctf-constvars.exp
@@ -18,20 +18,21 @@
 #
 # This file is part of the gdb testsuite
 #
-# tests for const variables
-#           const pointers to vars
-#           pointers to const variables
-#           const pointers to const vars
-# with mixed types
+# Tests for: const variables,
+#            const pointers to vars
+#            pointers to const variables
+#            const pointers to const vars
+# with mixed types.
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index 9f54582..68a9662 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -15,14 +15,15 @@
 
 # This file is a subset of ptype.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/gdb.base/ctf-whatis.exp b/gdb/testsuite/gdb.base/ctf-whatis.exp
index 3f26fc3..626aecb 100644
--- a/gdb/testsuite/gdb.base/ctf-whatis.exp
+++ b/gdb/testsuite/gdb.base/ctf-whatis.exp
@@ -15,14 +15,15 @@
 
 # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com)
 
-#
-# test running programs
-#
-# -gt generates full-fledged CTF.
+if [skip_ctf_tests] {
+    unsupported "no ctf debug format support"
+    return 0
+}
 
 standard_testfile .c
-set opts "additional_flags=-gt"
 
+# Using `-gt` generates full-fledged CTF debug information.
+set opts "additional_flags=-gt"
 if { [prepare_for_testing "failed to prepare" ${testfile} \
           [list $srcfile] [list $opts nowarnings]] } {
     return 0
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2d395ef..828c91d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6787,5 +6787,16 @@
     }
 }
 
+# Does the compiler support CTF debug output using '-gt' compiler
+# flag?  If not then we should skip these tests.
+
+gdb_caching_proc skip_ctf_tests {
+    return ![gdb_can_simple_compile ctfdebug {
+	int main () {
+	    return 0;
+	}
+    } executable "additional_flags=-gt"]
+}
+
 # Always load compatibility stuff.
 load_lib future.exp

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
Gerrit-Change-Number: 121
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged

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

end of thread, other threads:[~2019-11-19  0:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 22:09 [review] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Andrew Burgess (Code Review)
2019-10-16 18:02 ` Tom Tromey (Code Review)
2019-10-16 20:02 ` Andrew Burgess (Code Review)
2019-10-22 16:11 ` Tom Tromey (Code Review)
2019-11-16 22:45 ` Simon Marchi (Code Review)
2019-11-18 17:53 ` [review v2] " Andrew Burgess (Code Review)
2019-11-18 17:57 ` [review v3] gdb/testsuite: Introduce skip_ctf_tests " Andrew Burgess (Code Review)
2019-11-18 18:03 ` Andrew Burgess (Code Review)
2019-11-18 18:46 ` Simon Marchi (Code Review)
2019-11-18 18:47 ` Simon Marchi (Code Review)
2019-11-19  0:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-19  0:47 ` Sourceware to Gerrit sync (Code Review)

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).