|
|
190f2a |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
190f2a |
From: Fedora GDB patches <invalid@email.com>
|
|
|
190f2a |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
190f2a |
Subject: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
|
|
|
190f2a |
|
|
|
190f2a |
;; Import regression test for `gdb/findvar.c:417: internal-error:
|
|
|
190f2a |
;; read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5.
|
|
|
190f2a |
;;=fedoratest
|
|
|
190f2a |
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.cc b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc
|
|
|
190f2a |
@@ -0,0 +1,53 @@
|
|
|
190f2a |
+#include <iostream>
|
|
|
190f2a |
+#include <pthread.h>
|
|
|
190f2a |
+
|
|
|
190f2a |
+class x
|
|
|
190f2a |
+ {
|
|
|
190f2a |
+ public:
|
|
|
190f2a |
+ int n;
|
|
|
190f2a |
+
|
|
|
190f2a |
+ x() : n(0) {}
|
|
|
190f2a |
+ };
|
|
|
190f2a |
+
|
|
|
190f2a |
+class y
|
|
|
190f2a |
+ {
|
|
|
190f2a |
+ public:
|
|
|
190f2a |
+ int v;
|
|
|
190f2a |
+
|
|
|
190f2a |
+ y() : v(0) {}
|
|
|
190f2a |
+ static __thread x *xp;
|
|
|
190f2a |
+ };
|
|
|
190f2a |
+
|
|
|
190f2a |
+__thread x *y::xp;
|
|
|
190f2a |
+
|
|
|
190f2a |
+static void
|
|
|
190f2a |
+foo (y *yp)
|
|
|
190f2a |
+{
|
|
|
190f2a |
+ yp->v = 1; /* foo_marker */
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+static void *
|
|
|
190f2a |
+bar (void *unused)
|
|
|
190f2a |
+{
|
|
|
190f2a |
+ x xinst;
|
|
|
190f2a |
+ y::xp= &xinst;
|
|
|
190f2a |
+
|
|
|
190f2a |
+ y yy;
|
|
|
190f2a |
+ foo(&yy;;
|
|
|
190f2a |
+
|
|
|
190f2a |
+ return NULL;
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+int
|
|
|
190f2a |
+main(int argc, char *argv[])
|
|
|
190f2a |
+{
|
|
|
190f2a |
+ pthread_t t[2];
|
|
|
190f2a |
+
|
|
|
190f2a |
+ pthread_create (&t[0], NULL, bar, NULL);
|
|
|
190f2a |
+ pthread_create (&t[1], NULL, bar, NULL);
|
|
|
190f2a |
+
|
|
|
190f2a |
+ pthread_join (t[0], NULL);
|
|
|
190f2a |
+ pthread_join (t[1], NULL);
|
|
|
190f2a |
+
|
|
|
190f2a |
+ return 0;
|
|
|
190f2a |
+}
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.exp b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp
|
|
|
190f2a |
@@ -0,0 +1,75 @@
|
|
|
190f2a |
+# Copyright (C) 2013 Free Software Foundation, Inc.
|
|
|
190f2a |
+
|
|
|
190f2a |
+# This program is free software; you can redistribute it and/or modify
|
|
|
190f2a |
+# it under the terms of the GNU General Public License as published by
|
|
|
190f2a |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
190f2a |
+# (at your option) any later version.
|
|
|
190f2a |
+#
|
|
|
190f2a |
+# This program is distributed in the hope that it will be useful,
|
|
|
190f2a |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
190f2a |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
190f2a |
+# GNU General Public License for more details.
|
|
|
190f2a |
+#
|
|
|
190f2a |
+# You should have received a copy of the GNU General Public License
|
|
|
190f2a |
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
190f2a |
+
|
|
|
190f2a |
+set testfile tls-rhbz947564
|
|
|
190f2a |
+set srcfile ${testfile}.cc
|
|
|
190f2a |
+set binfile [standard_output_file ${testfile}]
|
|
|
190f2a |
+
|
|
|
190f2a |
+if [istarget "*-*-linux"] then {
|
|
|
190f2a |
+ set target_cflags "-D_MIT_POSIX_THREADS"
|
|
|
190f2a |
+} else {
|
|
|
190f2a |
+ set target_cflags ""
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list c++ debug]] != "" } {
|
|
|
190f2a |
+ return -1
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_exit
|
|
|
190f2a |
+gdb_start
|
|
|
190f2a |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_load ${binfile}
|
|
|
190f2a |
+
|
|
|
190f2a |
+if { ![runto_main] } {
|
|
|
190f2a |
+ fail "Can't run to function main"
|
|
|
190f2a |
+ return 0
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_breakpoint "foo"
|
|
|
190f2a |
+gdb_continue_to_breakpoint "foo" ".* foo_marker .*"
|
|
|
190f2a |
+
|
|
|
190f2a |
+proc get_xp_val {try} {
|
|
|
190f2a |
+ global expect_out
|
|
|
190f2a |
+ global gdb_prompt
|
|
|
190f2a |
+ global hex
|
|
|
190f2a |
+
|
|
|
190f2a |
+ set xp_val ""
|
|
|
190f2a |
+ gdb_test_multiple "print *yp" "print yp value" {
|
|
|
190f2a |
+ -re { = \{v = 0, static xp = (0x[0-9a-f]+)\}.* } {
|
|
|
190f2a |
+ pass "print $try value of *yp"
|
|
|
190f2a |
+ set xp_val $expect_out(1,string)
|
|
|
190f2a |
+ }
|
|
|
190f2a |
+ -re "$gdb_prompt $" {
|
|
|
190f2a |
+ fail "print $try value of *yp"
|
|
|
190f2a |
+ }
|
|
|
190f2a |
+ timeout {
|
|
|
190f2a |
+ fail "print $try value of *yp (timeout)"
|
|
|
190f2a |
+ }
|
|
|
190f2a |
+ }
|
|
|
190f2a |
+ return $xp_val
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+set first_run [get_xp_val "first"]
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_test "continue" "Breakpoint \[0-9\]+, foo \\\(yp=$hex\\\) at.*"
|
|
|
190f2a |
+
|
|
|
190f2a |
+set second_run [get_xp_val "second"]
|
|
|
190f2a |
+
|
|
|
190f2a |
+if { $first_run != $second_run } {
|
|
|
190f2a |
+ pass "different values for TLS variable"
|
|
|
190f2a |
+} else {
|
|
|
190f2a |
+ fail "different values for TLS variable"
|
|
|
190f2a |
+}
|