Skip to content

Commit 4256651

Browse files
ivanivanov884jeffmahoney
authored andcommitted
gdb-test-expr-cumulative-archer.patch
;; [archer-keiths-expr-cumulative+upstream] Import C++ testcases. ;;=fedoratest archer archer-keiths-expr-cumulative b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc
1 parent 07a8d14 commit 4256651

File tree

4 files changed

+192
-0
lines changed

4 files changed

+192
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
namespace A
2+
{
3+
namespace B
4+
{
5+
int ab = 11;
6+
}
7+
}
8+
9+
namespace C
10+
{
11+
namespace D
12+
{
13+
using namespace A::B;
14+
15+
int
16+
second()
17+
{
18+
ab;
19+
return 0;
20+
}
21+
}
22+
23+
int
24+
first()
25+
{
26+
//ab;
27+
return D::second();
28+
}
29+
}
30+
31+
int
32+
main()
33+
{
34+
//ab;
35+
return C::first();
36+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2008 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 namespace-nested-imports
17+
set srcfile ${testfile}.cc
18+
set binfile [standard_output_file ${testfile}]
19+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
20+
untested "Couldn't compile test program"
21+
return -1
22+
}
23+
24+
# Get things started.
25+
26+
gdb_exit
27+
gdb_start
28+
gdb_reinitialize_dir $srcdir/$subdir
29+
gdb_load ${binfile}
30+
31+
############################################
32+
if ![runto_main] then {
33+
perror "couldn't run to breakpoint main"
34+
continue
35+
}
36+
37+
gdb_test "print ab" "No symbol .* in current context."
38+
39+
############################################
40+
gdb_breakpoint C::first
41+
gdb_continue_to_breakpoint "C::first"
42+
43+
gdb_test "print ab" "No symbol .* in current context."
44+
gdb_test "print C::D::ab" "= 11"
45+
46+
############################################
47+
gdb_breakpoint C::D::second
48+
gdb_continue_to_breakpoint "C::D::second"
49+
50+
gdb_test "print ab" "= 11"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
namespace A
3+
{
4+
int _a = 11;
5+
6+
namespace B{
7+
8+
int ab = 22;
9+
10+
namespace C{
11+
12+
int abc = 33;
13+
14+
int second(){
15+
return 0;
16+
}
17+
18+
}
19+
20+
int first(){
21+
_a;
22+
ab;
23+
C::abc;
24+
return C::second();
25+
}
26+
}
27+
}
28+
29+
30+
int
31+
main()
32+
{
33+
A::_a;
34+
A::B::ab;
35+
A::B::C::abc;
36+
return A::B::first();
37+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright 2008 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 namespace-no-imports
17+
set srcfile ${testfile}.cc
18+
set binfile [standard_output_file ${testfile}]
19+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
20+
untested "Couldn't compile test program"
21+
return -1
22+
}
23+
24+
# Get things started.
25+
26+
gdb_exit
27+
gdb_start
28+
gdb_reinitialize_dir $srcdir/$subdir
29+
gdb_load ${binfile}
30+
31+
############################################
32+
if ![runto_main] then {
33+
perror "couldn't run to breakpoint main"
34+
continue
35+
}
36+
37+
gdb_test "print A::_a" "= 11"
38+
gdb_test "print A::B::ab" "= 22"
39+
gdb_test "print A::B::C::abc" "= 33"
40+
41+
gdb_test "print _a" "No symbol .* in current context."
42+
gdb_test "print ab" "No symbol .* in current context."
43+
gdb_test "print abc" "No symbol .* in current context."
44+
45+
############################################
46+
gdb_breakpoint A::B::first
47+
gdb_continue_to_breakpoint "A::B::first"
48+
49+
gdb_test "print A::_a" "= 11"
50+
gdb_test "print A::B::ab" "= 22"
51+
gdb_test "print A::B::C::abc" "= 33"
52+
53+
gdb_test "print _a" "= 11"
54+
gdb_test "print ab" "= 22"
55+
gdb_test "print C::abc" "= 33"
56+
57+
gdb_test "print abc" "No symbol .* in current context."
58+
59+
############################################
60+
gdb_breakpoint A::B::C::second
61+
gdb_continue_to_breakpoint "A::B::C::second"
62+
63+
gdb_test "print A::_a" "= 11"
64+
gdb_test "print A::B::ab" "= 22"
65+
gdb_test "print A::B::C::abc" "= 33"
66+
67+
gdb_test "print _a" "= 11"
68+
gdb_test "print ab" "= 22"
69+
gdb_test "print abc" "= 33"

0 commit comments

Comments
 (0)