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

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