aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-06-28 16:59:47 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-06-28 16:59:47 +0000
commit6036c742216f95a45095562947749755601a61f5 (patch)
tree0455547cdd233ee4964d6522636feadbc43f6fda /gdb/testsuite
parentde6a04210ceecbe450212f60129740fc22330050 (diff)
downloadgdb-6036c742216f95a45095562947749755601a61f5.zip
gdb-6036c742216f95a45095562947749755601a61f5.tar.gz
gdb-6036c742216f95a45095562947749755601a61f5.tar.bz2
gdb/
* cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call obstack_begin after each obstack_free. gdb/testsuite/ * gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.cp/static-print-quit.cc32
-rw-r--r--gdb/testsuite/gdb.cp/static-print-quit.exp50
3 files changed, 86 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e046539..01c11d5 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
+
2010-06-28 Doug Evans <dje@google.com>
* gdb.base/break-interp.exp (reach): Relax expected output a bit.
diff --git a/gdb/testsuite/gdb.cp/static-print-quit.cc b/gdb/testsuite/gdb.cp/static-print-quit.cc
new file mode 100644
index 0000000..a62e340
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/static-print-quit.cc
@@ -0,0 +1,32 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ 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/>. */
+
+class D
+ {
+ public:
+ int loooooooooooooooooooooooooooooooooooooooooooooong;
+ };
+
+class C
+ {
+ public:
+ int loooooooooooooooooooooooooooooooooooooooooooooong;
+ static D field;
+ };
+
+D C::field;
+C c;
diff --git a/gdb/testsuite/gdb.cp/static-print-quit.exp b/gdb/testsuite/gdb.cp/static-print-quit.exp
new file mode 100644
index 0000000..8db13ed
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/static-print-quit.exp
@@ -0,0 +1,50 @@
+# 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/>.
+
+if { [skip_cplus_tests] } { continue }
+
+set testfile static-print-quit
+set srcfile ${testfile}.cc
+set executable $testfile.o
+set objfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile $srcdir/$subdir/$srcfile $objfile object {debug c++}] != ""} {
+ untested ${testfile}.exp
+ return -1
+}
+
+clean_restart $executable
+
+gdb_test_no_output "set width 80"
+gdb_test_no_output "set height 2"
+
+set test "print c"
+gdb_test_multiple $test $test {
+ -re " = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type <return> to continue, or q <return> to quit---$" {
+ pass $test
+ }
+ -re " to quit---$" {
+ fail $test
+ return -1
+ }
+}
+
+gdb_test "q" ".*"
+
+# Now the obstack is uninitialized. Excercise it.
+
+gdb_test_no_output "set pagination off"
+gdb_test "print c" ".*" "first print"
+gdb_test "print c" ".*" "second print"