aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/maint.exp
diff options
context:
space:
mode:
authorMichael Chastain <mec@google.com>2003-08-23 03:55:59 +0000
committerMichael Chastain <mec@google.com>2003-08-23 03:55:59 +0000
commit1105b7eff4c333814e2f260a4ff3df45057a78a4 (patch)
tree7cf20e2e8c5617c7de559da699df9c0b3dc813ae /gdb/testsuite/gdb.cp/maint.exp
parentdd21ace235665bd33a51862fe2293c43224c0e59 (diff)
downloadgdb-1105b7eff4c333814e2f260a4ff3df45057a78a4.zip
gdb-1105b7eff4c333814e2f260a4ff3df45057a78a4.tar.gz
gdb-1105b7eff4c333814e2f260a4ff3df45057a78a4.tar.bz2
2003-08-22 Michael Chastain <mec@shout.net>
* gdb.cp: New directory. * gdb.cp/*: Copy from gdb.c++/*. * gdb.c++/*: Remove. * Makefile.in: Change gdb.c++ to gdb.cp. * configure.in: Ditto. * configure: Regnerate.
Diffstat (limited to 'gdb/testsuite/gdb.cp/maint.exp')
-rw-r--r--gdb/testsuite/gdb.cp/maint.exp113
1 files changed, 113 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/maint.exp b/gdb/testsuite/gdb.cp/maint.exp
new file mode 100644
index 0000000..1042c91
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/maint.exp
@@ -0,0 +1,113 @@
+# Copyright 2003 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 2 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+
+# This file tests C++-specific maintenance commands and help on those.
+
+# Currently, no source file is used.
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+# Test the help messages.
+
+proc test_help {} {
+ gdb_test "help maintenance cplus" "C\\+\\+ maintenance commands.\r\n\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
+
+ gdb_test "help maint cp" "C\\+\\+ maintenance commands.\r\n\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
+
+ gdb_test "maint cp" "\"maintenance cplus\" must be followed by the name of a command.\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
+
+ gdb_test "help maint cp first_component" "Print the first class/namespace component of NAME."
+}
+
+# This is used when NAME should contain only a single component. Be
+# careful to make sure that parentheses get escaped properly.
+proc test_single_component {name} {
+ set matchname [string_to_regexp "$name"]
+ gdb_test "maint cp first_component $name" "$matchname"
+}
+
+# This is used when NAME is invalid.
+proc test_invalid_name {name} {
+ set matchname [string_to_regexp "$name"]
+ gdb_test "maint cp first_component $name" \
+ "During symbol reading, unexpected demangled name '$matchname'.\r\n$matchname"
+}
+
+proc test_first_component {} {
+ # The function in question might complain; make sure that we see
+ # all complaints.
+
+ gdb_test "set complaints -1" ""
+
+ test_single_component "foo"
+ test_single_component "operator<<"
+ test_single_component "operator>>"
+ test_single_component "operator ->"
+ test_single_component "operator()"
+ test_single_component "operator>"
+ test_single_component "operator<"
+ test_single_component "operator ->"
+ test_single_component "operator ->"
+
+ test_single_component "foo()"
+ test_single_component "foo(int)"
+ test_single_component "foo(X::Y)"
+ test_single_component "foo(X::Y, A::B)"
+ test_single_component "foo(std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >)"
+ test_single_component "operator>(X::Y)"
+
+ # Operator names can show up in weird places.
+
+ test_single_component "int operator<< <char>()"
+ test_single_component "T<Cooperator>"
+
+ # NOTE: carlton/2003-04-23: I've only seen the first of these
+ # produced by the demangler, but I'm including two more just to be
+ # on the safe side.
+ test_single_component "int foo<&(operator<<(C, C))>()"
+ test_single_component "int foo<&operator<<(C, C)>()"
+ test_single_component "int foo<operator<<(C, C)>()"
+
+ gdb_test "maint cp first_component foo::bar" "foo"
+ gdb_test "maint cp first_component foo::bar::baz" "foo"
+ gdb_test "maint cp first_component C<A>::bar" "C<A>"
+ gdb_test "maint cp first_component C<std::basic_streambuf<wchar_t,std::char_traits<wchar_t> > >::bar" "C<std::basic_streambuf<wchar_t,std::char_traits<wchar_t> > >"
+
+ # Make sure we behave appropriately on invalid input.
+
+ # NOTE: carlton/2003-06-25: As of today, the demangler can in fact
+ # produce examples like the third case below: there really should
+ # be a space between the two <'s. See PR gdb/1245.
+
+ test_invalid_name "foo<"
+ test_invalid_name "foo("
+ test_invalid_name "bool operator<<char>"
+}
+
+gdb_exit
+gdb_start
+
+test_help
+test_first_component
+
+gdb_exit
+return 0