gdb
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / namespace.exp
index aac4b6a51575e198c6fa8301e37a583fe88e0307..fc59c5fc0a244f69956498aaf519e49a28d0cff5 100644 (file)
@@ -1,19 +1,18 @@
-# Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2007
+# Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009, 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 2 of the License, or
+# 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # tests for namespaces
 # Originally written by Satish Pai <pai@apollo.hp.com> 1997-07-23
@@ -164,14 +163,8 @@ gdb_expect {
        
 # Break on a function in a namespace
 
-send_gdb "break AAA::xyzq\n"
-gdb_expect {
-    -re "Breakpoint.*at $hex: file.*namespace.cc, line 42\\.\r\n$gdb_prompt $" {
-         pass "break AAA::xyzq"
-    }    
-   -re ".*$gdb_prompt $" { fail "break AAA::xyzq" }
-   timeout { fail "(timeout) break AAA::xyzq" }
-}
+gdb_test "break AAA::xyzq" \
+    "Breakpoint.*at $hex: file.*namespace.cc, line 47\\."
 
 # Call a function in a nested namespace
 
@@ -195,14 +188,8 @@ gdb_expect {
        
 # Break on a function in a nested namespace
 
-send_gdb "break BBB::CCC::xyzq\n"
-gdb_expect {
-    -re "Breakpoint.*at $hex: file.*namespace.cc, line 58\\.\r\n$gdb_prompt $" {
-         pass "break BBB::CCC::xyzq"
-    }    
-   -re ".*$gdb_prompt $" { fail "break BBB::CCC::xyzq" }
-   timeout { fail "(timeout) break BBB::CCC::xyzq" }
-}
+gdb_test "break BBB::CCC::xyzq" \
+    "Breakpoint.*at $hex: file.*namespace.cc, line 63\\."
 
 # Print address of a function in a class in a namespace
 
@@ -226,14 +213,8 @@ gdb_expect {
 
 # Break on a function in a class in a namespace
 
-send_gdb "break BBB::Class::xyzq\n"
-gdb_expect {
-    -re "Breakpoint.*at $hex: file.*namespace.cc, line 63\\.\r\n$gdb_prompt $" {
-         pass "break BBB::Class::xyzq"
-    }    
-   -re ".*$gdb_prompt $" { fail "break BBB::Class::xyzq" }
-   timeout { fail "(timeout) break BBB::Class::xyzq" }
-}
+gdb_test "break BBB::Class::xyzq" \
+    "Breakpoint.*at $hex: file.*namespace.cc, line 68\\."
 
 # Test to see if the appropriate namespaces are in scope when trying
 # to print out stuff from within a function defined within a
@@ -260,9 +241,7 @@ gdb_test "ptype E" "type = namespace C::D::E"
 gdb_test "ptype CClass" "type = (class C::CClass \{\r\n  public:|struct C::CClass \{)\r\n    int x;\r\n\}"
 gdb_test "ptype CClass::NestedClass" "type = (class C::CClass::NestedClass \{\r\n  public:|struct C::CClass::NestedClass \{)\r\n    int y;\r\n\}"
 gdb_test "ptype NestedClass" "No symbol \"NestedClass\" in current context."
-setup_kfail "gdb/1448" "*-*-*"
 gdb_test "ptype ::C::CClass" "type = class C::CClass \{\r\n  public:\r\n    int x;\r\n\}"
-setup_kfail "gdb/1448" "*-*-*"
 gdb_test "ptype ::C::CClass::NestedClass" "type = class C::CClass::NestedClass \{\r\n  public:\r\n    int y;\r\n\}"
 setup_kfail "gdb/1448" "*-*-*"
 gdb_test "ptype ::C::NestedClass" "No symbol \"NestedClass\" in namespace \"C\"."
@@ -274,7 +253,6 @@ gdb_test "ptype C::NestedClass" "No symbol \"NestedClass\" in namespace \"C::C\"
 
 gdb_test "print cOtherFile" "\\$\[0-9\].* = 316"
 gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n  public:|struct C::OtherFileClass \{)\r\n    int z;\r\n\}"
-setup_kfail "gdb/1448" "*-*-*"
 gdb_test "ptype ::C::OtherFileClass" "type = class C::OtherFileClass \{\r\n  public:\r\n    int z;\r\n\}"
 gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"."
 
@@ -290,3 +268,10 @@ gdb_test "print G::Xg" "\\$\[0-9\].* = 10"
 gdb_test "print G::XgX" "\\$\[0-9\].* = 11"
 gdb_test "print cXOtherFile" "No symbol \"cXOtherFile\" in current context."
 gdb_test "print XOtherFile" "No symbol \"XOtherFile\" in current context."
+
+# Enum tests.
+gdb_test "print AAA::ALPHA" "\\$\[0-9\].* = AAA::ALPHA"
+
+# Regression tests for PR 9496.
+gdb_test "whatis ::C::CClass::NestedClass" "type = C::CClass::NestedClass"
+gdb_test "whatis ::C::CClass::NestedClass *" "type = C::CClass::NestedClass \\*"
This page took 0.024649 seconds and 4 git commands to generate.