Fix test names starting with uppercase output by basic functions
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / call-strs.exp
1 # Copyright 1998-2016 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 # 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
25
26 standard_testfile
27
28 # Some targets can't call functions, so don't even bother with this
29 # test.
30 if [target_info exists gdb,cannot_call_functions] {
31 unsupported "this target can not call functions"
32 continue
33 }
34
35
36 if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
37 untested $testfile.exp
38 return -1
39 }
40
41 gdb_test_no_output "set print sevenbit-strings"
42 gdb_test_no_output "set print address off"
43 gdb_test_no_output "set print symbol off"
44 gdb_test_no_output "set width 0"
45
46 if ![runto_main] then {
47 perror "couldn't run to breakpoint"
48 continue
49 }
50
51 set prev_timeout $timeout
52 set timeout 120
53
54 gdb_test "next 2" \
55 "strcpy\\(buf, \"test string\"\\);" \
56 "step after assignment to s"
57
58 #next
59 gdb_test "next" \
60 "str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);" \
61 "next over strcpy"
62
63 #print buf
64 gdb_test "print buf" \
65 "\"test string\",.*repeats 88 times.*"
66
67 #print s
68 gdb_test "print s" \
69 " = \"test string\".*"
70
71 #print str_func1(s)
72 if ![gdb_skip_stdio_test "print str_func1(s)"] {
73 gdb_test_stdio "print str_func1(s)" \
74 "first string arg is: test string" \
75 "\"test string\".*"
76 }
77
78 #print str_func1("test string")
79 if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
80 gdb_test_stdio "print str_func1(\"test string\")" \
81 "first string arg is: test string" \
82 "\"test string\".*"
83 }
84
85 #call str_func1(s)
86 if ![gdb_skip_stdio_test "call str_func1(s)"] {
87 gdb_test_stdio "call str_func1(s)" \
88 "first string arg is: test string" \
89 "\"test string\".*"
90 }
91
92 #call str_func1("test string")
93 if ![gdb_skip_stdio_test "call str_func1 (...)"] {
94 gdb_test_stdio "call str_func1(\"test string\")" \
95 "first string arg is: test string" \
96 "\"test string\".*"
97 }
98
99 #print str_func1(buf)
100 if ![gdb_skip_stdio_test "print str_func1(buf)"] {
101 gdb_test_stdio "print str_func1(buf)" \
102 "first string arg is: test string" \
103 "\"test string\".*"
104 }
105
106 #call str_func1(buf)
107 if ![gdb_skip_stdio_test "call str_func1(buf)"] {
108 gdb_test_stdio "call str_func1(buf)" \
109 "first string arg is: test string" \
110 "\"test string\".*"
111 }
112
113 #print str_func("a","b","c","d","e","f","g")
114 if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
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\".*"
118 }
119
120 #call str_func("a","b","c","d","e","f","g")
121 if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
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\".*"
125 }
126
127 #print str_func(s,s,s,s,s,s,s)
128 if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
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\".*"
132 }
133
134 #call str_func(s,s,s,s,s,s,s)
135 if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
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\".*"
139 }
140
141 gdb_exit
142
143 set timeout $prev_timeout
144
This page took 0.053137 seconds and 4 git commands to generate.