This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Call get_compiler_info directly from test_compiler_info if needed.


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] {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]