Fix test names starting with uppercase output by basic functions
[deliverable/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
f76495c8
TT
36if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
37 untested $testfile.exp
38 return -1
39}
c906108c 40
ad3986f0
MS
41gdb_test_no_output "set print sevenbit-strings"
42gdb_test_no_output "set print address off"
9cb709b6 43gdb_test_no_output "set print symbol off"
ad3986f0 44gdb_test_no_output "set width 0"
c906108c 45
c906108c
SS
46if ![runto_main] then {
47 perror "couldn't run to breakpoint"
48 continue
49}
50
97f2ed50
DJ
51set prev_timeout $timeout
52set timeout 120
53
dedad4e3 54gdb_test "next 2" \
ad3986f0
MS
55 "strcpy\\(buf, \"test string\"\\);" \
56 "step after assignment to s"
c906108c 57
37f8da45 58#next
ad3986f0
MS
59gdb_test "next" \
60 "str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);" \
61 "next over strcpy"
c906108c
SS
62
63#print buf
ad3986f0
MS
64gdb_test "print buf" \
65 "\"test string\",.*repeats 88 times.*"
c906108c
SS
66
67#print s
ad3986f0
MS
68gdb_test "print s" \
69 " = \"test string\".*"
c906108c
SS
70
71#print str_func1(s)
13a5e3b8 72if ![gdb_skip_stdio_test "print str_func1(s)"] {
452397af
PA
73 gdb_test_stdio "print str_func1(s)" \
74 "first string arg is: test string" \
75 "\"test string\".*"
13a5e3b8 76}
c906108c 77
c906108c 78#print str_func1("test string")
13a5e3b8 79if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
452397af
PA
80 gdb_test_stdio "print str_func1(\"test string\")" \
81 "first string arg is: test string" \
82 "\"test string\".*"
13a5e3b8 83}
c906108c
SS
84
85#call str_func1(s)
13a5e3b8 86if ![gdb_skip_stdio_test "call str_func1(s)"] {
452397af
PA
87 gdb_test_stdio "call str_func1(s)" \
88 "first string arg is: test string" \
89 "\"test string\".*"
13a5e3b8 90}
c906108c
SS
91
92#call str_func1("test string")
13a5e3b8 93if ![gdb_skip_stdio_test "call str_func1 (...)"] {
452397af
PA
94 gdb_test_stdio "call str_func1(\"test string\")" \
95 "first string arg is: test string" \
96 "\"test string\".*"
13a5e3b8 97}
c906108c
SS
98
99#print str_func1(buf)
13a5e3b8 100if ![gdb_skip_stdio_test "print str_func1(buf)"] {
452397af
PA
101 gdb_test_stdio "print str_func1(buf)" \
102 "first string arg is: test string" \
103 "\"test string\".*"
13a5e3b8 104}
c906108c
SS
105
106#call str_func1(buf)
13a5e3b8 107if ![gdb_skip_stdio_test "call str_func1(buf)"] {
452397af
PA
108 gdb_test_stdio "call str_func1(buf)" \
109 "first string arg is: test string" \
110 "\"test string\".*"
13a5e3b8 111}
c906108c
SS
112
113#print str_func("a","b","c","d","e","f","g")
13a5e3b8 114if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
452397af
PA
115 gdb_test_stdio "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
116 "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\]+" \
117 "= \"abcdefg\".*"
13a5e3b8 118}
c906108c
SS
119
120#call str_func("a","b","c","d","e","f","g")
13a5e3b8 121if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
452397af
PA
122 gdb_test_stdio "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
123 "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\]+" \
124 "= \"abcdefg\".*"
13a5e3b8 125}
c906108c 126
085dd6e6 127#print str_func(s,s,s,s,s,s,s)
13a5e3b8 128if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
452397af
PA
129 gdb_test_stdio "print str_func(s,s,s,s,s,s,s)" \
130 "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\]+" \
131 "\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
13a5e3b8 132}
c906108c 133
085dd6e6 134#call str_func(s,s,s,s,s,s,s)
13a5e3b8 135if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
452397af
PA
136 gdb_test_stdio "call str_func(s,s,s,s,s,s,s)" \
137 "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\]+" \
138 "\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
13a5e3b8 139}
c906108c
SS
140
141gdb_exit
97f2ed50
DJ
142
143set timeout $prev_timeout
144
This page took 1.685835 seconds and 4 git commands to generate.