summaryrefslogtreecommitdiff
path: root/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-08-06 05:48:09 +0000
committerCoprDistGit <infra@openeuler.org>2024-08-06 05:48:09 +0000
commitab322c77aab87050c6ca0ce58e18f31e269e519b (patch)
tree7ff9c6a18efd867f35cb6f8fb08893c6b655376f /gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
parent19677e130f0cd283f7884cc4b6b3d52f8812dae5 (diff)
automatic import of gdbopeneuler24.03_LTS
Diffstat (limited to 'gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch')
-rw-r--r--gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch147
1 files changed, 147 insertions, 0 deletions
diff --git a/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch b/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
new file mode 100644
index 0000000..0df5ee5
--- /dev/null
+++ b/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
@@ -0,0 +1,147 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches <invalid@email.com>
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.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
+
+diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.cc b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc
+new file mode 100644
+--- /dev/null
++++ b/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;
++}
+diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.exp b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp
+new file mode 100644
+--- /dev/null
++++ b/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 [standard_output_file ${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"
++}