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

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