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

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