]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/call-strs.exp
Fix more cases of improper test names
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / call-strs.exp
CommitLineData
618f726f 1# Copyright 1998-2016 Free Software Foundation, Inc.
c906108c
SS
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 15
c906108c
SS
16# This file was written by Elena Zannoni (ezannoni@cygnus.com)
17
18# This test deals with calling functions which have strings as parameters.
19# it plays around with constant strings.
20# the corresponding source file is call-strs.c
21#
22
23#debug strarg
24
c906108c 25
f76495c8 26standard_testfile
c906108c 27
9fbfe2dc
AC
28# Some targets can't call functions, so don't even bother with this
29# test.
c906108c 30if [target_info exists gdb,cannot_call_functions] {
bc6c7af4 31 unsupported "this target can not call functions"
c906108c
SS
32 continue
33}
34
c906108c 35
5b362f04 36if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
f76495c8
TT
37 return -1
38}
c906108c 39
ad3986f0
MS
40gdb_test_no_output "set print sevenbit-strings"
41gdb_test_no_output "set print address off"
9cb709b6 42gdb_test_no_output "set print symbol off"
ad3986f0 43gdb_test_no_output "set width 0"
c906108c 44
c906108c
SS
45if ![runto_main] then {
46 perror "couldn't run to breakpoint"
47 continue
48}
49
97f2ed50
DJ
50set prev_timeout $timeout
51set timeout 120
52
dedad4e3 53gdb_test "next 2" \
ad3986f0
MS
54 "strcpy\\(buf, \"test string\"\\);" \
55 "step after assignment to s"
c906108c 56
37f8da45 57#next
ad3986f0
MS
58gdb_test "next" \
59 "str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);" \
60 "next over strcpy"
c906108c
SS
61
62#print buf
ad3986f0
MS
63gdb_test "print buf" \
64 "\"test string\",.*repeats 88 times.*"
c906108c
SS
65
66#print s
ad3986f0
MS
67gdb_test "print s" \
68 " = \"test string\".*"
c906108c
SS
69
70#print str_func1(s)
13a5e3b8 71if ![gdb_skip_stdio_test "print str_func1(s)"] {
452397af
PA
72 gdb_test_stdio "print str_func1(s)" \
73 "first string arg is: test string" \
74 "\"test string\".*"
13a5e3b8 75}
c906108c 76
c906108c 77#print str_func1("test string")
13a5e3b8 78if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
452397af
PA
79 gdb_test_stdio "print str_func1(\"test string\")" \
80 "first string arg is: test string" \
81 "\"test string\".*"
13a5e3b8 82}
c906108c
SS
83
84#call str_func1(s)
13a5e3b8 85if ![gdb_skip_stdio_test "call str_func1(s)"] {
452397af
PA
86 gdb_test_stdio "call str_func1(s)" \
87 "first string arg is: test string" \
88 "\"test string\".*"
13a5e3b8 89}
c906108c
SS
90
91#call str_func1("test string")
13a5e3b8 92if ![gdb_skip_stdio_test "call str_func1 (...)"] {
452397af
PA
93 gdb_test_stdio "call str_func1(\"test string\")" \
94 "first string arg is: test string" \
95 "\"test string\".*"
13a5e3b8 96}
c906108c
SS
97
98#print str_func1(buf)
13a5e3b8 99if ![gdb_skip_stdio_test "print str_func1(buf)"] {
452397af
PA
100 gdb_test_stdio "print str_func1(buf)" \
101 "first string arg is: test string" \
102 "\"test string\".*"
13a5e3b8 103}
c906108c
SS
104
105#call str_func1(buf)
13a5e3b8 106if ![gdb_skip_stdio_test "call str_func1(buf)"] {
452397af
PA
107 gdb_test_stdio "call str_func1(buf)" \
108 "first string arg is: test string" \
109 "\"test string\".*"
13a5e3b8 110}
c906108c
SS
111
112#print str_func("a","b","c","d","e","f","g")
13a5e3b8 113if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
452397af
PA
114 gdb_test_stdio "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
115 "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+" \
116 "= \"abcdefg\".*"
13a5e3b8 117}
c906108c
SS
118
119#call str_func("a","b","c","d","e","f","g")
13a5e3b8 120if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
452397af
PA
121 gdb_test_stdio "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
122 "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+" \
123 "= \"abcdefg\".*"
13a5e3b8 124}
c906108c 125
085dd6e6 126#print str_func(s,s,s,s,s,s,s)
13a5e3b8 127if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
452397af
PA
128 gdb_test_stdio "print str_func(s,s,s,s,s,s,s)" \
129 "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+" \
130 "\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
13a5e3b8 131}
c906108c 132
085dd6e6 133#call str_func(s,s,s,s,s,s,s)
13a5e3b8 134if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
452397af
PA
135 gdb_test_stdio "call str_func(s,s,s,s,s,s,s)" \
136 "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+" \
137 "\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
13a5e3b8 138}
c906108c
SS
139
140gdb_exit
97f2ed50
DJ
141
142set timeout $prev_timeout
143