Skip to content

Commit 00d1e2a

Browse files
ivanivanov884jeffmahoney
authored andcommitted
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
1 parent 4800fd2 commit 00d1e2a

File tree

2 files changed

+128
-0
lines changed

2 files changed

+128
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <iostream>
2+
#include <pthread.h>
3+
4+
class x
5+
{
6+
public:
7+
int n;
8+
9+
x() : n(0) {}
10+
};
11+
12+
class y
13+
{
14+
public:
15+
int v;
16+
17+
y() : v(0) {}
18+
static __thread x *xp;
19+
};
20+
21+
__thread x *y::xp;
22+
23+
static void
24+
foo (y *yp)
25+
{
26+
yp->v = 1; /* foo_marker */
27+
}
28+
29+
static void *
30+
bar (void *unused)
31+
{
32+
x xinst;
33+
y::xp= &xinst;
34+
35+
y yy;
36+
foo(&yy);
37+
38+
return NULL;
39+
}
40+
41+
int
42+
main(int argc, char *argv[])
43+
{
44+
pthread_t t[2];
45+
46+
pthread_create (&t[0], NULL, bar, NULL);
47+
pthread_create (&t[1], NULL, bar, NULL);
48+
49+
pthread_join (t[0], NULL);
50+
pthread_join (t[1], NULL);
51+
52+
return 0;
53+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copyright (C) 2013 Free Software Foundation, Inc.
2+
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation; either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
15+
16+
set testfile tls-rhbz947564
17+
set srcfile ${testfile}.cc
18+
set binfile [standard_output_file ${testfile}]
19+
20+
if [istarget "*-*-linux"] then {
21+
set target_cflags "-D_MIT_POSIX_THREADS"
22+
} else {
23+
set target_cflags ""
24+
}
25+
26+
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list c++ debug]] != "" } {
27+
return -1
28+
}
29+
30+
gdb_exit
31+
gdb_start
32+
gdb_reinitialize_dir $srcdir/$subdir
33+
34+
gdb_load ${binfile}
35+
36+
if { ![runto_main] } {
37+
fail "Can't run to function main"
38+
return 0
39+
}
40+
41+
gdb_breakpoint "foo"
42+
gdb_continue_to_breakpoint "foo" ".* foo_marker .*"
43+
44+
proc get_xp_val {try} {
45+
global expect_out
46+
global gdb_prompt
47+
global hex
48+
49+
set xp_val ""
50+
gdb_test_multiple "print *yp" "print yp value" {
51+
-re { = \{v = 0, static xp = (0x[0-9a-f]+)\}.* } {
52+
pass "print $try value of *yp"
53+
set xp_val $expect_out(1,string)
54+
}
55+
-re "$gdb_prompt $" {
56+
fail "print $try value of *yp"
57+
}
58+
timeout {
59+
fail "print $try value of *yp (timeout)"
60+
}
61+
}
62+
return $xp_val
63+
}
64+
65+
set first_run [get_xp_val "first"]
66+
67+
gdb_test "continue" "Breakpoint \[0-9\]+, foo \\\(yp=$hex\\\) at.*"
68+
69+
set second_run [get_xp_val "second"]
70+
71+
if { $first_run != $second_run } {
72+
pass "different values for TLS variable"
73+
} else {
74+
fail "different values for TLS variable"
75+
}

0 commit comments

Comments
 (0)