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

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