Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@broadcom.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PATCH] Call get_compiler_info directly from test_compiler_info if needed.
Date: Tue, 10 Dec 2013 14:43:00 -0000	[thread overview]
Message-ID: <52A728A0.1050208@broadcom.com> (raw)

Ran into a case where we call test_compiler_info without
first calling get_compiler_info.

I was going to just add an extra call to get_compiler_info,
but then I got all carried away.... with this patch
test_compiler_info now calls get_compiler_info if needed.

I also remove a couple of uses of the compiler_info
variable and replace with calls to test_compiler_info instead.

OK to apply?


    gdb/testsuite/ChangeLog
    
    	* gdb.base/watchpoint.exp (test_complex_watchpoint): Remove use of
    	compiler_info global, instead call test_compiler_info.
    	* gdb.cp/temargs.exp: Same.
    	* lib/gdb.exp (compiler_info): Change initial value to empty string.
    	(test_compiler_info): Call get_compiler_info if compiler_info is
    	empty string.
    	(skip_vsx_tests): No longer need to call get_compiler_info.
    	(skip_altivec_tests): Same.

diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 9576a9e..73dc5cc 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -464,12 +464,12 @@ proc test_complex_watchpoint {} {
 		pass $test
 	    }
 	    -re "can't compute CFA for this frame.*\r\n$gdb_prompt $" {
-		global compiler_info no_hw
+		global no_hw
 
 		# GCC < 4.5.0 does not get LOCATIONS_VALID set by dwarf2read.c.
 		# Therefore epilogue unwinder gets applied which is
 		# incompatible with dwarf2_frame_cfa.
-		verbose -log "compiler_info: $compiler_info"
+		verbose -log "compiler_info: [test_compiler_info]"
 		if {$no_hw && ([test_compiler_info {gcc-[0-3]-*}]
 			       || [test_compiler_info {gcc-4-[0-4]-*}])} {
 		    xfail "$test (old GCC has broken watchpoints in epilogues)"
diff --git a/gdb/testsuite/gdb.cp/temargs.exp b/gdb/testsuite/gdb.cp/temargs.exp
index 4cd9da5..31cde41 100644
--- a/gdb/testsuite/gdb.cp/temargs.exp
+++ b/gdb/testsuite/gdb.cp/temargs.exp
@@ -34,7 +34,7 @@ if {![runto_main]} {
 # NOTE: prepare_for_testing calls get_compiler_info, which we need
 # for the test_compiler_info calls.
 # gcc 4.4 and earlier don't emit enough info for some of our template tests.
-verbose -log "compiler_info: $compiler_info"
+verbose -log "compiler_info: [test_compiler_info]"
 set have_older_template_gcc 0
 set have_pr_41736_fixed 1
 set have_pr_45024_fixed 1
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2c1cf29..6340e80 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2027,10 +2027,6 @@ gdb_caching_proc skip_altivec_tests {
 
     # Make sure we have a compiler that understands altivec.
     set compile_flags {debug nowarnings}
-    if [get_compiler_info] {
-       warning "Could not get compiler info"
-       return 1
-    }
     if [test_compiler_info gcc*] {
         set compile_flags "$compile_flags additional_flags=-maltivec"
     } elseif [test_compiler_info xlc*] {
@@ -2110,10 +2106,6 @@ gdb_caching_proc skip_vsx_tests {
 
     # Make sure we have a compiler that understands altivec.
     set compile_flags {debug nowarnings quiet}
-    if [get_compiler_info] {
-       warning "Could not get compiler info"
-       return 1
-    }
     if [test_compiler_info gcc*] {
         set compile_flags "$compile_flags additional_flags=-mvsx"
     } elseif [test_compiler_info xlc*] {
@@ -2401,7 +2393,7 @@ proc skip_libstdcxx_probe_tests {} {
     return $ok
 }
 
-set compiler_info		"unknown"
+set compiler_info		""
 set gcc_compiled		0
 set hp_cc_compiler		0
 set hp_aCC_compiler		0
@@ -2552,6 +2544,14 @@ proc get_compiler_info {{arg ""}} {
 proc test_compiler_info { {compiler ""} } {
     global compiler_info
 
+    # Check that compiler_info has been initialised
+    if [string match "" $compiler_info] {
+	if [get_compiler_info] {
+	    warning "Could not get compiler info"
+	    return -1
+	}
+    }
+
      # if no arg, return the compiler_info string
 
      if [string match "" $compiler] {


             reply	other threads:[~2013-12-10 14:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10 14:43 Andrew Burgess [this message]
2013-12-10 15:07 ` Pedro Alves
2013-12-10 15:16   ` Andrew Burgess
2013-12-10 15:49     ` Pedro Alves
2013-12-10 16:10       ` Call get_compiler_info before test_compiler_info. (was: Re: [PATCH] Call get_compiler_info directly from test_compiler_info if needed.) Andrew Burgess
2013-12-10 16:26         ` Call get_compiler_info before test_compiler_info Pedro Alves
2013-12-10 17:10           ` Andrew Burgess

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=52A728A0.1050208@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=gdb-patches@sourceware.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