diff options
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r-- | gdb/testsuite/gdb.cp/nsdecl.cc | 93 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/nsdecl.exp | 52 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/nsrecurs.cc | 30 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/nsrecurs.exp | 67 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/nsstress.cc | 60 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/nsstress.exp | 52 |
6 files changed, 354 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/nsdecl.cc b/gdb/testsuite/gdb.cp/nsdecl.cc new file mode 100644 index 0000000..01a9c75 --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsdecl.cc @@ -0,0 +1,93 @@ +int a; +int b; +int c; +int d; +int e; +int f; +int g; +int h; +int i; +int j; +int k; +int l; +int m; +int n; +int o; +int p; +int q; +int r; +int s; +int t; +int u; +int v; +int w; +int x; +int y; +int z; + +namespace A +{ + int xyz; + + using ::a; + using ::b; + using ::c; + using ::d; + using ::e; + using ::f; + using ::g; + using ::h; + using ::i; + using ::j; + using ::k; + using ::l; + using ::m; + using ::n; + using ::o; + using ::p; + using ::q; + using ::r; + using ::s; + using ::t; + using ::u; + using ::v; + using ::w; + using ::x; + using ::y; + using ::z; + +} + +using A::a; +using A::b; +using A::c; +using A::d; +using A::e; +using A::f; +using A::g; +using A::h; +using A::i; +using A::j; +using A::k; +using A::l; +using A::m; +using A::n; +using A::o; +using A::p; +using A::q; +using A::r; +using A::s; +using A::t; +using A::u; +using A::v; +using A::w; +using A::x; +using A::y; +using A::z; + +using namespace A; + +int main () +{ + return 0; +} diff --git a/gdb/testsuite/gdb.cp/nsdecl.exp b/gdb/testsuite/gdb.cp/nsdecl.exp new file mode 100644 index 0000000..6e0d875 --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsdecl.exp @@ -0,0 +1,52 @@ +# Copyright 2008 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/>. + +# Stress test the lookup of declarations + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile nsdecl +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + untested "Couldn't compile test program" + return -1 +} + +if [get_compiler_info ${binfile}] { + return -1; +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint main" + continue +} + +############################################ +# Test that the search can fail efficiently + +gdb_test "print fakex" "No symbol \"fakex\" in current context." diff --git a/gdb/testsuite/gdb.cp/nsrecurs.cc b/gdb/testsuite/gdb.cp/nsrecurs.cc new file mode 100644 index 0000000..84605a6 --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsrecurs.cc @@ -0,0 +1,30 @@ +namespace A{ + int ax = 9; +} + +namespace B{ + using namespace A; +} + +namespace C{ + using namespace B; +} + +//--------------- +namespace D{ + using namespace D; + int dx = 99; +} +using namespace C; + +//--------------- +namespace{ + namespace{ + int xx = 999; + } +} + +int main(){ + using namespace D; + return ax + dx + xx; +} diff --git a/gdb/testsuite/gdb.cp/nsrecurs.exp b/gdb/testsuite/gdb.cp/nsrecurs.exp new file mode 100644 index 0000000..9939a9f --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsrecurs.exp @@ -0,0 +1,67 @@ +# Copyright 2008 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/>. + +# Test recursive namespace lookup + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile nsrecurs +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + untested "Couldn't compile test program" + return -1 +} + +if [get_compiler_info ${binfile}] { + return -1 +} + + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint main" + continue +} + +############################################ +# test printing from namespace imported into +# imported namespace + +gdb_test "print ax" "= 9" + +############################################ +# test that gdb can print without falling +# into search loop + +gdb_test "print dx" "= 99" + +############################################ +# test printing from namespace imported into +# imported namespace where imports are implicit +# anonymous namespace imports. + +gdb_test "print xx" "= 999" diff --git a/gdb/testsuite/gdb.cp/nsstress.cc b/gdb/testsuite/gdb.cp/nsstress.cc new file mode 100644 index 0000000..de84ab1 --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsstress.cc @@ -0,0 +1,60 @@ + +namespace A{ int x; } +namespace B{ int x; } +namespace C{ int x; } +namespace D{ int x; } +namespace E{ int x; } +namespace F{ int x; } +namespace G{ int x; } +namespace H{ int x; } +namespace I{ int x; } +namespace J{ int x; } +namespace K{ int x; } +namespace L{ int x; } +namespace M{ int x; } +namespace N{ int x; } +namespace O{ int x; } +namespace P{ int x; } +namespace Q{ int x; } +namespace R{ int x; } +namespace S{ int x; } +namespace T{ int x; } +namespace U{ int x; } +namespace V{ int x; } +namespace W{ int x; } +namespace X{ int x; } +namespace Y{ int x; } +namespace Z{ int x; } + + +int main(){ + + using namespace A; + using namespace B; + using namespace C; + using namespace D; + using namespace E; + using namespace F; + using namespace G; + using namespace H; + using namespace I; + using namespace J; + using namespace K; + using namespace L; + using namespace M; + using namespace N; + using namespace O; + using namespace P; + using namespace Q; + using namespace R; + using namespace S; + using namespace T; + using namespace U; + using namespace V; + using namespace W; + using namespace X; + using namespace Y; + using namespace Z; + + return 0; +} diff --git a/gdb/testsuite/gdb.cp/nsstress.exp b/gdb/testsuite/gdb.cp/nsstress.exp new file mode 100644 index 0000000..afe1bb0 --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsstress.exp @@ -0,0 +1,52 @@ +# Copyright 2008 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/>. + +# Stress test namespace lookup + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile nsstress +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + untested "Couldn't compile test program" + return -1 +} + +if [get_compiler_info ${binfile}] { + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint main" + continue +} + +############################################ +# Test that the search can fail efficiently + +gdb_test "print y" "No symbol \"y\" in current context." |