Blame SOURCES/gdb-rhbz1182151-ibm-z13-20of22.patch

0b42f8
commit 77c365df78441f7b968ec0f62c7ed9f5de36dc60
0b42f8
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
0b42f8
Date:   Mon Aug 24 15:37:40 2015 +0200
0b42f8
0b42f8
    gnu_vector.exp: Avoid some more known FAILs
0b42f8
    
0b42f8
    This avoids two more types of FAILs with the gnu_vector test case.
0b42f8
    
0b42f8
    First, for POWER targets newer GCCs emit an ABI note when invoked with
0b42f8
    "-mcpu=native".  Then the test case fell back to non-native compile,
0b42f8
    producing code for a non-vector ABI.  But that is not supported by GDB.
0b42f8
    Thus the compiler note is now suppressed with "-Wno-psabi".
0b42f8
    
0b42f8
    Second, on s390 the test case produced FAILs after falling back to a
0b42f8
    non-vector ABI when using "finish" or "return" in a vector-valued
0b42f8
    function.  This was due to a long-standing known bug (Bug 8549).  This
0b42f8
    case is now detected, and KFAILs are emitted instead.
0b42f8
    
0b42f8
    gdb/testsuite/ChangeLog:
0b42f8
    
0b42f8
    	* gdb.base/gnu_vector.exp: Try compilation with "-mcpu=native
0b42f8
    	-Wno-psabi" if "-mcpu=native" fails.  For the tests with "finish"
0b42f8
    	and "return" use KFAIL when GDB can not read/write the vector
0b42f8
    	return value.
0b42f8
0b42f8
### a/gdb/testsuite/ChangeLog
0b42f8
### b/gdb/testsuite/ChangeLog
0b42f8
## -1,3 +1,10 @@
0b42f8
+2015-08-24  Andreas Arnez  <arnez@linux.vnet.ibm.com>
0b42f8
+
0b42f8
+	* gdb.base/gnu_vector.exp: Try compilation with "-mcpu=native
0b42f8
+	-Wno-psabi" if "-mcpu=native" fails.  For the tests with "finish"
0b42f8
+	and "return" use KFAIL when GDB can not read/write the vector
0b42f8
+	return value.
0b42f8
+
0b42f8
 2015-08-21  Gary Benson <gbenson@redhat.com>
0b42f8
 
0b42f8
 	* gdb.trace/pending.exp: Cope with remote transfer warnings.
0b42f8
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
0b42f8
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
0b42f8
@@ -25,11 +25,19 @@ standard_testfile .c
0b42f8
 # without a CPU option.  If all variants fail, assume that the
0b42f8
 # compiler can not handle GNU vectors.
0b42f8
 
0b42f8
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable {debug quiet additional_flags=-mcpu=native}] != ""
0b42f8
-     && [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable {debug quiet additional_flags=-march=native}] != ""
0b42f8
-     && [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable {debug quiet}] != ""} {
0b42f8
-    untested "compiler can't handle the vector_size attribute?"
0b42f8
-    return -1
0b42f8
+proc do_compile { {opts {}} } {
0b42f8
+    global srcdir subdir srcfile binfile
0b42f8
+    set ccopts {debug quiet}
0b42f8
+    foreach opt $opts {lappend ccopts "additional_flags=$opt"}
0b42f8
+    gdb_compile "${srcdir}/${subdir}/${srcfile}" "$binfile" executable $ccopts
0b42f8
+}
0b42f8
+
0b42f8
+if { [do_compile {-mcpu=native}] != ""
0b42f8
+     && [do_compile {-mcpu=native -Wno-psabi}] != ""
0b42f8
+     && [do_compile {-march=native}] != ""
0b42f8
+     && [do_compile] != ""} {
0b42f8
+	untested "compiler can't handle vector_size attribute?"
0b42f8
+	return -1
0b42f8
 }
0b42f8
 
0b42f8
 clean_restart ${binfile}
0b42f8
@@ -195,14 +203,46 @@ gdb_test "print add_structvecs(i2, (struct just_int2)\{2*i2\}, (struct two_int2)
0b42f8
 gdb_test "print add_singlevecs((char1) \{6\}, (int1) \{12\}, (double1) \{24\})" "= \\{42\\}" \
0b42f8
     "call add_singlevecs"
0b42f8
 
0b42f8
-# Test vector return value handling with "finish" and "return".
0b42f8
+# Test "finish" from vector-valued function.
0b42f8
 gdb_breakpoint "add_some_intvecs"
0b42f8
 gdb_continue "add_some_intvecs"
0b42f8
-gdb_test "finish" "Value returned is .* = \\{10, 20, 48, 72\\}" \
0b42f8
-    "finish shows vector return value"
0b42f8
+set test "finish shows vector return value"
0b42f8
+gdb_test_multiple "finish" $test {
0b42f8
+    -re "Value returned is .* = \\{10, 20, 48, 72\\}.*$gdb_prompt $" {
0b42f8
+	pass $test
0b42f8
+    }
0b42f8
+    -re "Value returned has type: .* Cannot determine contents.*$gdb_prompt $" {
0b42f8
+	kfail "gdb/8549" $test
0b42f8
+    }
0b42f8
+}
0b42f8
+
0b42f8
+# Test "return" from vector-valued function.
0b42f8
 gdb_continue "add_some_intvecs"
0b42f8
-gdb_test "return (int4) \{4, 2, 7, 6\}" \
0b42f8
-    "#0 .* main .*" \
0b42f8
-    "set vector return value" \
0b42f8
-    "Make add_some_intvecs return now. .y or n.*" "y"
0b42f8
-gdb_test "continue" "4 2 7 6\r\n.*" "verify vector return value"
0b42f8
+set test "return from vector-valued function"
0b42f8
+set should_kfail 0
0b42f8
+gdb_test_multiple "return (int4) \{4, 2, 7, 6\}" $test {
0b42f8
+    -re "#0 .* main .*$gdb_prompt $" {
0b42f8
+	pass $test
0b42f8
+    }
0b42f8
+    -re "The location .* is unknown.\r\n.* return value .* will be ignored.\r\n" {
0b42f8
+	set should_kfail 1
0b42f8
+	exp_continue
0b42f8
+    }
0b42f8
+    -re "Make add_some_intvecs return now. .y or n. $" {
0b42f8
+	send_gdb "y\n"
0b42f8
+	exp_continue
0b42f8
+    }
0b42f8
+}
0b42f8
+set test "verify vector return value"
0b42f8
+gdb_test_multiple "continue" $test {
0b42f8
+    -re "4 2 7 6\r\n.*$gdb_prompt $" {
0b42f8
+	pass $test
0b42f8
+    }
0b42f8
+    -re "10 20 48 72\r\n.*$gdb_prompt $" {
0b42f8
+	if { $should_kfail } {
0b42f8
+	    kfail "gdb/8549" $test
0b42f8
+	} else {
0b42f8
+	    fail $test
0b42f8
+	}
0b42f8
+    }
0b42f8
+}