summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.c++/maint.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.c++/maint.exp')
-rw-r--r--gdb/testsuite/gdb.c++/maint.exp24
1 files changed, 23 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.c++/maint.exp b/gdb/testsuite/gdb.c++/maint.exp
index 77bfff698be..710e14ae648 100644
--- a/gdb/testsuite/gdb.c++/maint.exp
+++ b/gdb/testsuite/gdb.c++/maint.exp
@@ -51,7 +51,19 @@ proc test_single_component {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>>"
@@ -85,12 +97,22 @@ proc test_first_component {} {
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>"
}
proc test_namespace {} {
# There's not a lot we can do to test this.
- gdb_test "maint cp namespace" "Definite namespaces:\r\nPossible namespaces:"
+ gdb_test "maint cp namespace" "Possible namespaces:"
}
gdb_exit