Index: gdb/testsuite/gdb.cp/namespace.exp |
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp |
index e0789de7db8afedb43f84338c08b0ebae1ebd397..fefd796ec9af84ce725dac16d833fea94d5c20ec 100644 |
--- a/gdb/testsuite/gdb.cp/namespace.exp |
+++ b/gdb/testsuite/gdb.cp/namespace.exp |
@@ -25,21 +25,12 @@ |
# Note: As of 2000-06-03, they passed under g++ - djb |
-if $tracelevel then { |
- strace $tracelevel |
- } |
- |
if { [skip_cplus_tests] } { continue } |
-set testfile "namespace" |
-set srcfile ${testfile}.cc |
-set objfile ${objdir}/${subdir}/${testfile}.o |
-set srcfile1 ${testfile}1.cc |
-set objfile1 ${objdir}/${subdir}/${testfile}1.o |
-set binfile ${objdir}/${subdir}/${testfile} |
+standard_testfile .cc namespace1.cc |
-if [get_compiler_info ${binfile} c++] { |
+if [get_compiler_info c++] { |
return -1; |
} |
@@ -50,26 +41,12 @@ if {[test_compiler_info {gcc-[0-3]-*}] |
set xfail_class_types 1 |
} |
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug c++}] != "" } { |
- untested namespace.exp |
- return -1 |
-} |
- |
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${objfile1}" object {debug c++}] != "" } { |
- untested namespace.exp |
- return -1 |
-} |
- |
-if { [gdb_compile "${objfile} ${objfile1}" "${binfile}" executable {debug c++}] != "" } { |
- untested namespace.exp |
- return -1 |
+if {[prepare_for_testing $testfile.exp $testfile \ |
+ [list $srcfile $srcfile2] {debug c++}]} { |
+ return -1 |
} |
-gdb_exit |
-gdb_start |
-gdb_reinitialize_dir $srcdir/$subdir |
-gdb_load ${binfile} |
- |
+gdb_test "show lang" "auto; currently c\\+\\+.*" |
# |
# set it up at a breakpoint so we can play with the variable values |
@@ -142,6 +119,11 @@ gdb_test "print AAA::xyzq('x')" \ |
gdb_test "break AAA::xyzq" \ |
"Breakpoint.*at $hex: file.*namespace.cc, line 47\\." |
+# Break on a function in the global namespace. |
+ |
+gdb_test "break ::ensureOtherRefs" \ |
+ "Breakpoint.*at $hex: file.*$srcfile2, line $decimal\\." |
+ |
# Call a function in a nested namespace |
gdb_test "print 'BBB::CCC::xyzq'('x')" \ |
@@ -157,6 +139,11 @@ gdb_test "print BBB::CCC::xyzq('x')" \ |
gdb_test "break BBB::CCC::xyzq" \ |
"Breakpoint.*at $hex: file.*namespace.cc, line 63\\." |
+# Break on the same function, starting with the global namespace. |
+ |
+gdb_test "break ::BBB::CCC::xyzq" \ |
+ ".*Breakpoint.*at $hex: file.*$srcfile, line 63\\." |
+ |
# Print address of a function in a class in a namespace |
gdb_test "print 'BBB::Class::xyzq'" \ |