aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
authorChris Moller <cmoller@cygnus>2010-04-21 17:33:54 +0000
committerChris Moller <cmoller@cygnus>2010-04-21 17:33:54 +0000
commit0b66f3173809e422f3dfbab2a8afff7fb9fc0ef3 (patch)
treed01b4a9ce867591f4a06247baf0d6f481cffeb0e /gdb/testsuite/gdb.cp
parent34a7d6c6d367a964e24ea7f0f8c868cc531736f8 (diff)
downloadgdb-0b66f3173809e422f3dfbab2a8afff7fb9fc0ef3.zip
gdb-0b66f3173809e422f3dfbab2a8afff7fb9fc0ef3.tar.gz
gdb-0b66f3173809e422f3dfbab2a8afff7fb9fc0ef3.tar.bz2
PR 9167
* cp-valprint.c (cp_print_value_fields): Replaced obstack_base() method of popping recursion-detection stack with a method based on obstack_object_size(). * gdb.cp/Makefile.in (EXECUTABLES): Added pr9167. * gdb.cp/pr9167.cc: New file. * gdb.cp/pr9167.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/Makefile.in2
-rw-r--r--gdb/testsuite/gdb.cp/pr9167.cc36
-rw-r--r--gdb/testsuite/gdb.cp/pr9167.exp31
3 files changed, 68 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in
index 721094d..5b00a61 100644
--- a/gdb/testsuite/gdb.cp/Makefile.in
+++ b/gdb/testsuite/gdb.cp/Makefile.in
@@ -5,7 +5,7 @@ EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \
derivation inherit local member-ptr method misc \
overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \
ref-types ref-params method2 pr9594 gdb2495 virtfunc2 pr9067 \
- pr1072 pr10687
+ pr1072 pr10687 pr9167
all info install-info dvi install uninstall installcheck check:
@echo "Nothing to be done for $@..."
diff --git a/gdb/testsuite/gdb.cp/pr9167.cc b/gdb/testsuite/gdb.cp/pr9167.cc
new file mode 100644
index 0000000..a0c5002
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr9167.cc
@@ -0,0 +1,36 @@
+#include <iostream>
+
+template<typename DATA>
+struct ATB
+{
+ int data;
+ ATB() : data(0) {}
+};
+
+
+template<typename DATA,
+ typename DerivedType >
+class A : public ATB<DATA>
+{
+public:
+ static DerivedType const DEFAULT_INSTANCE;
+};
+
+template<typename DATA, typename DerivedType>
+const DerivedType A<DATA, DerivedType>::DEFAULT_INSTANCE;
+
+class B : public A<int, B>
+{
+
+};
+
+int main()
+{
+ B b;
+ // If this if-block is removed then GDB shall
+ // not infinitely recurse when trying to print b.
+
+ return 0; // marker
+}
+
+
diff --git a/gdb/testsuite/gdb.cp/pr9167.exp b/gdb/testsuite/gdb.cp/pr9167.exp
new file mode 100644
index 0000000..7d05ae9
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr9167.exp
@@ -0,0 +1,31 @@
+#Copyright 2010 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 pr9167
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+ return -1
+}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return
+}
+
+gdb_breakpoint [gdb_get_line_number "marker"]
+gdb_continue_to_breakpoint "marker"
+
+gdb_test "p b" "{<A<int, B>> = {<ATB<int>> = {data = 0}, static DEFAULT_INSTANCE = <optimized out>}, <No data fields>}"
+