Blame SOURCES/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch

7a6771
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-rhbz947564.cc
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-rhbz947564.cc	2016-02-15 23:39:21.791458927 +0100
7a6771
@@ -0,0 +1,53 @@
7a6771
+#include <iostream>
7a6771
+#include <pthread.h>
7a6771
+
7a6771
+class x
7a6771
+  {
7a6771
+  public:
7a6771
+    int n;
7a6771
+
7a6771
+    x() : n(0) {}
7a6771
+  };
7a6771
+
7a6771
+class y
7a6771
+  {
7a6771
+  public:
7a6771
+    int v;
7a6771
+
7a6771
+    y() : v(0) {}
7a6771
+    static __thread x *xp;
7a6771
+  };
7a6771
+
7a6771
+__thread x *y::xp;
7a6771
+
7a6771
+static void
7a6771
+foo (y *yp)
7a6771
+{
7a6771
+  yp->v = 1;   /* foo_marker */
7a6771
+}
7a6771
+
7a6771
+static void *
7a6771
+bar (void *unused)
7a6771
+{
7a6771
+  x xinst;
7a6771
+  y::xp= &xinst;
7a6771
+
7a6771
+  y yy;
7a6771
+  foo(&yy;;
7a6771
+
7a6771
+  return NULL;
7a6771
+}
7a6771
+
7a6771
+int
7a6771
+main(int argc, char *argv[])
7a6771
+{
7a6771
+  pthread_t t[2];
7a6771
+
7a6771
+  pthread_create (&t[0], NULL, bar, NULL);
7a6771
+  pthread_create (&t[1], NULL, bar, NULL);
7a6771
+
7a6771
+  pthread_join (t[0], NULL);
7a6771
+  pthread_join (t[1], NULL);
7a6771
+
7a6771
+  return 0;
7a6771
+}
7a6771
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-rhbz947564.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-rhbz947564.exp	2016-02-15 23:39:30.029517418 +0100
7a6771
@@ -0,0 +1,75 @@
7a6771
+# Copyright (C) 2013 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+set testfile tls-rhbz947564
7a6771
+set srcfile ${testfile}.cc
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
+
7a6771
+if [istarget "*-*-linux"] then {
7a6771
+    set target_cflags "-D_MIT_POSIX_THREADS"
7a6771
+} else {
7a6771
+    set target_cflags ""
7a6771
+}
7a6771
+
7a6771
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list c++ debug]] != "" } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+if { ![runto_main] } {
7a6771
+    fail "Can't run to function main"
7a6771
+    return 0
7a6771
+}
7a6771
+
7a6771
+gdb_breakpoint "foo"
7a6771
+gdb_continue_to_breakpoint "foo" ".* foo_marker .*"
7a6771
+
7a6771
+proc get_xp_val {try} {
7a6771
+    global expect_out
7a6771
+    global gdb_prompt
7a6771
+    global hex
7a6771
+
7a6771
+    set xp_val ""
7a6771
+    gdb_test_multiple "print *yp" "print yp value" {
7a6771
+	-re { = \{v = 0, static xp = (0x[0-9a-f]+)\}.* } {
7a6771
+	    pass "print $try value of *yp"
7a6771
+	    set xp_val $expect_out(1,string)
7a6771
+	}
7a6771
+	-re "$gdb_prompt $" {
7a6771
+	    fail "print $try value of *yp"
7a6771
+	}
7a6771
+	timeout {
7a6771
+	    fail "print $try value of *yp (timeout)"
7a6771
+	}
7a6771
+    }
7a6771
+    return $xp_val
7a6771
+}
7a6771
+
7a6771
+set first_run [get_xp_val "first"]
7a6771
+
7a6771
+gdb_test "continue" "Breakpoint \[0-9\]+, foo \\\(yp=$hex\\\) at.*"
7a6771
+
7a6771
+set second_run [get_xp_val "second"]
7a6771
+
7a6771
+if { $first_run != $second_run } {
7a6771
+    pass "different values for TLS variable"
7a6771
+} else {
7a6771
+    fail "different values for TLS variable"
7a6771
+}