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

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