[RHEL-6] Regression test for RH BZ 947564.

This commit is contained in:
Sergio Durigan Junior 2013-04-22 03:55:56 -03:00
parent cf0b61abc0
commit 9dd2140456
2 changed files with 148 additions and 1 deletions

View File

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

View File

@ -34,7 +34,7 @@ Version: 7.5.91.%{snap}
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 18%{?dist}
Release: 19%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
Group: Development/Debuggers
@ -557,6 +557,11 @@ Patch816: gdb-rhbz795424-bitpos-25of25.patch
Patch817: gdb-rhbz795424-bitpos-25of25-test.patch
Patch818: gdb-rhbz795424-bitpos-lazyvalue.patch
# Import regression test for `gdb/findvar.c:417: internal-error:
# read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5.
#=fedoratest
Patch832: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
# Patch642: gdb-readline62-ask-more-rh.patch
@ -875,6 +880,7 @@ find -name "*.info*"|xargs rm -f
%patch816 -p1
%patch817 -p1
%patch818 -p1
%patch832 -p1
%patch393 -p1
%if 0%{!?el5:1} || 0%{?scl:1}
@ -1374,6 +1380,9 @@ fi
%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
%changelog
* Mon Apr 22 2013 Sergio Durigan Junior <sergiodj@redhat.com> - 7.5.91.20130407-19.fc19
- [RHEL-6] Regression test for RH BZ 947564.
* Thu Apr 11 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.91.20130407-18.fc19
- Provide man page for gcore.1 and gdb-add-index.1 (BZ 881892).