Remove Cell Broadband Engine debugging support
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / userdef.exp
index 4575249ce5a125b43cb2e196543858e194a44fa2..7907593ec3010807d4691325745b8ed59678f345 100644 (file)
@@ -1,68 +1,45 @@
 # Tests of overloaded operators resolution.
-# Copyright 1998, 1999, 2002 Free Software Foundation, Inc.
+# Copyright 1998-2019 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.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # written by Elena Zannoni (ezannoni@cygnus.com)
 #
 # source file "userdef.cc"
 #
 
-if $tracelevel then {
-        strace $tracelevel
-}
+if { [skip_stl_tests] } { continue }
 
-if { [skip_cplus_tests] } { continue }
+standard_testfile .cc
 
-set testfile "userdef"
-set srcfile ${testfile}.cc
-set binfile ${objdir}/${subdir}/${testfile}
-
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
+    return -1
 }
 
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-
 if ![runto_main] then {
     perror "couldn't run to breakpoint"
     continue
 }
 
-send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
-    send_gdb "cont\n"
-    gdb_expect {
-        -re "Break.* marker1(\\(\\)|) \\(\\) at .*:$decimal.*$gdb_prompt $" {
-            send_gdb "up\n"
-            gdb_expect {
-                -re ".*$gdb_prompt $" { pass "up from marker1" }
-                timeout { fail "up from marker1" }
-            }
-        }
-        -re "$gdb_prompt $" { fail "continue to marker1"  }
-        timeout { fail "(timeout) continue to marker1"  }
-    }
+gdb_test "break marker1" \
+    "Breakpoint .*${srcfile}.*" 
+
+gdb_test "cont" \
+    "Break.* marker1(\\(\\)|) \\(\\) at .*:$decimal.*" \
+    "continue to marker1"
 
+gdb_test "up" " in main .*" "up from marker1"
 
 gdb_test "print one + two" "\\\$\[0-9\]* = {x = 6, y = 8}"
 
@@ -110,6 +87,7 @@ gdb_test "print one > two" "\\\$\[0-9\]* = 0\[\r\n\]"
 gdb_test "print one >= two" "\\\$\[0-9\]* = 0\[\r\n\]"
 
 gdb_test "print one == two" "\\\$\[0-9\]* = 0\[\r\n\]"
+gdb_test "print one.operator== (two)" "\\\$\[0-9\]* = 0\[\r\n\]"
 
 gdb_test "print one != two" "\\\$\[0-9\]* = 1\[\r\n\]"
 
@@ -124,6 +102,8 @@ gdb_test "print one >> 31" "\\\$\[0-9\]* = {x = 0, y = 0}"
 gdb_test "print !one" "\\\$\[0-9\]* = 0\[\r\n\]"
 
 # Assumes 2's complement.  So does everything...
+gdb_test "print +one" "\\\$\[0-9\]* = {x = 2, y = 3}"
+
 gdb_test "print ~one" "\\\$\[0-9\]* = {x = -3, y = -4}"
 
 gdb_test "print -one" "\\\$\[0-9\]* = {x = -2, y = -3}"
@@ -141,8 +121,17 @@ gdb_test "print one += 7" "\\\$\[0-9\]* = {x = 9, y = 10}"
 gdb_test "print two = one" "\\\$\[0-9\]* = {x = 9, y = 10}"
 
 # Check that GDB tolerates whitespace in operator names.
-gdb_test "break A1::'operator+'" ".*Breakpoint $decimal at.*"
-gdb_test "break A1::'operator +'" ".*Breakpoint $decimal at.*"
+gdb_test "break A2::operator+" ".*Breakpoint $decimal at.*"
+gdb_test "break A2::operator +" ".*Breakpoint $decimal at.*"
+
+# Check that GDB handles operator* correctly.
+gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}"
+gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}"
+gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
+gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\].*} \\*"
+
+gdb_test "print operator== (mem1, mem2)" " = false"
+gdb_test "print operator== (mem1, mem1)" " = true"
 
 gdb_exit
 return 0
This page took 0.025479 seconds and 4 git commands to generate.