bs15503.exp revision 1.1
1# Copyright 1992-2014 Free Software Foundation, Inc. 2 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 3 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 16# Test case for CLLbs15503 17# This file was written by Sue Kimura (sue_kimura@hp.com) 18# Rewritten by Michael Chastain (mec.gnu@mindspring.com) 19 20if { [skip_stl_tests] } { continue } 21 22# On SPU this test fails because the executable exceeds local storage size. 23if { [istarget "spu*-*-*"] } { 24 return 0 25} 26 27standard_testfile .cc 28 29if [get_compiler_info] { 30 return -1 31} 32 33if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { 34 return -1 35} 36 37if ![runto_main] then { 38 perror "couldn't run to breakpoint" 39 continue 40} 41 42# Set breakpoint on template function 43 44gdb_test "break StringTest<wchar_t>::testFunction" \ 45 "Breakpoint $decimal at $hex: file .*${srcfile}, line $decimal." 46 47gdb_test "continue" \ 48 ".*Breakpoint $decimal, StringTest<wchar_t>::testFunction \\(this=$hex\\).*" \ 49 "continue to StringTest<wchar_t>" 50 51# Run to some random point in the middle of the function. 52 53gdb_breakpoint [gdb_get_line_number "find position where blank needs to be inserted"] 54gdb_continue_to_breakpoint "find position where blank needs to be inserted" 55 56# Call some string methods. 57 58gdb_test "print s.length()" "\\$\[0-9\]+ = 42" 59gdb_test "print s\[0\]" "\\$\[0-9\]+ =.* 'I'" 60gdb_test "print s\[s.length()-1\]" "\\$\[0-9\]+ =.* 'g'" 61gdb_test "print (const char *) s" \ 62 "\\$\[0-9\]+ = $hex \"I am a short stringand now a longer string\"" 63 64# TODO: tests that do not work with gcc 2.95.3 65# -- chastain 2004-01-07 66# 67# gdb_test "print s.compare(s)" "\\$\[0-9\]+ = 0" 68# gdb_test "print s.compare(\"AAA\")" "\\$\[0-9\]+ = 1" 69# gdb_test "print s.compare(\"ZZZ\")" "\\$\[0-9\]+ = -1" 70 71# TODO: tests that do not work with gcc 2.95.3 and gcc 3.3.2. 72# cannot call overloaded non-member operator. -- chastain 2004-01-07 73# 74# gdb_test "print s == s" "\\$\[0-9\]+ = true" 75# gdb_test "print s > "AAA" "\\$\[0-9\]+ = true" 76# gdb_test "print s < "ZZZ" "\\$\[0-9\]+ = true" 77 78# TODO: GDB doesn't know to convert the string to a const char *, and 79# instead tries to use the string as a structure initializer. 80# 81# gdb_test "print s == \"I am a short stringand now a longer string\"" \ 82# "\\$\[0-9\]+ = true" 83 84gdb_test "print (const char *) s.substr(0,4)" "\\$\[0-9\]+ = $hex \"I am\"" 85gdb_test "print (const char *) (s=s.substr(0,4))" \ 86 "\\$\[0-9\]+ = $hex \"I am\"" 87 88# TODO: cannot call overloaded non-member operator again. 89# -- chastain 2004-01-07 90# 91# gdb_test "print (const char *) (s + s)" \ 92# "\\$\[0-9\]+ = $hex \"I amI am\"" 93# gdb_test "print (const char *) (s + \" \" + s)" \ 94# "\\$\[0-9\]+ = $hex \"I am I am\"" 95