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