PR c++/8888:
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / cpexprs.exp
index 6b5e14e1205d113a344b8b4a32cea3f2a79e8926..aa37315fd6e16045375dd502455c8d35a686723d 100644 (file)
@@ -663,10 +663,6 @@ add {policyd5::function} \
     {operation_1<T>::function}
 
 # Start the test
-if {$tracelevel} {
-    strace $tracelevel
-}
-
 if {[skip_cplus_tests]} { continue }
 
 # On SPU this test fails because the executable exceeds local storage size.
@@ -678,25 +674,16 @@ if { [istarget "spu*-*-*"] } {
 # test running programs
 #
 
-set testfile "cpexprs"
-set srcfile "${testfile}.cc"
-set binfile [file join $objdir $subdir $testfile]
+standard_testfile .cc
 
-if  {[gdb_compile [file join $srcdir $subdir $srcfile] $binfile \
-         executable {debug c++}] != "" } {
-    untested "$testfile.exp"
+if {[get_compiler_info "c++"]} {
     return -1
 }
 
-if {[get_compiler_info $binfile "c++"]} {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir [file join $srcdir $subdir]
-gdb_load $binfile
-
 if {![runto_main]} {
     perror "couldn't run to breakpoint"
     continue
@@ -723,5 +710,26 @@ foreach name [get_functions list] {
     }
 }
 
+# Test c/v gets recognized even without quoting.
+foreach cv {{} { const} { volatile} { const volatile}} {
+  set test "p 'CV::m(int)$cv'"
+  gdb_test_multiple $test $test {
+      -re "( = {.*} 0x\[0-9a-f\]+ <CV::m.*>)\r\n$gdb_prompt $" {
+         # = {void (CV * const, CV::t)} 0x400944 <CV::m(int)>
+         set correct $expect_out(1,string)
+         pass $test
+      }
+  }
+  if {"$cv" != ""} {
+      setup_kfail c++/14186 *-*-*
+  }
+  gdb_test "p CV::m(int)$cv" [string_to_regexp $correct]
+}
+
+# Test TYPENAME:: gets recognized even in parentheses.
+gdb_test "p CV_f(int)"   { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
+gdb_test "p CV_f(CV::t)" { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
+gdb_test "p CV_f(CV::i)" " = 43"
+
 gdb_exit
 return 0
This page took 0.024083 seconds and 4 git commands to generate.