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