OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.base/] [call-strs.exp] - Blame information for rev 357

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 1998, 1999, 2000, 2007, 2008, 2009, 2010
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see .
16
 
17
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
18
 
19
# This test deals with calling functions which have strings as parameters.
20
# it plays around with constant strings.
21
# the corresponding source file is call-strs.c
22
#
23
 
24
#debug strarg
25
 
26
if $tracelevel then {
27
        strace $tracelevel
28
}
29
 
30
 
31
set testfile "call-strs"
32
set srcfile ${testfile}.c
33
set binfile ${objdir}/${subdir}/${testfile}
34
 
35
# Test depends on printf, which the sparclet stub doesn't support.
36
if { [istarget "sparclet-*-*"] } {
37
    return 0;
38
}
39
 
40
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
41
    untested call-strs.exp
42
    return -1
43
}
44
 
45
 
46
 
47
# Some targets can't call functions, so don't even bother with this
48
# test.
49
if [target_info exists gdb,cannot_call_functions] {
50
    setup_xfail "*-*-*" 2416
51
    fail "This target can not call functions"
52
    continue
53
}
54
 
55
 
56
# Start with a fresh gdb.
57
 
58
gdb_exit
59
gdb_start
60
gdb_reinitialize_dir $srcdir/$subdir
61
gdb_load ${binfile}
62
gdb_test_no_output "set print sevenbit-strings"
63
gdb_test_no_output "set print address off"
64
gdb_test_no_output "set width 0"
65
 
66
if ![runto_main] then {
67
    perror "couldn't run to breakpoint"
68
    continue
69
}
70
 
71
set prev_timeout $timeout
72
set timeout 120
73
 
74
#step
75
gdb_test "step" \
76
    "strcpy\\(buf, \"test string\"\\);" \
77
    "step after assignment to s"
78
 
79
#next
80
gdb_test "next" \
81
    "str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);" \
82
    "next over strcpy"
83
 
84
#print buf
85
gdb_test "print buf" \
86
    "\"test string\",.*repeats 88 times.*"
87
 
88
#print s
89
gdb_test "print s" \
90
    " = \"test string\".*"
91
 
92
#print str_func1(s)
93
if ![gdb_skip_stdio_test "print str_func1(s)"] {
94
    gdb_test "print str_func1(s)" \
95
        "first string arg is: test string.*\"test string\".*"
96
}
97
 
98
#print str_func1("test string")
99
if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
100
    gdb_test "print str_func1(\"test string\")" \
101
        "first string arg is: test string.*\"test string\".*"
102
}
103
 
104
#call str_func1(s)
105
if ![gdb_skip_stdio_test "call str_func1(s)"] {
106
    gdb_test "call str_func1(s)" \
107
        "first string arg is: test string.*\"test string\".*"
108
}
109
 
110
#call str_func1("test string")
111
if ![gdb_skip_stdio_test "call str_func1 (...)"] {
112
    gdb_test "call str_func1(\"test string\")" \
113
        "first string arg is: test string.*\"test string\".*"
114
}
115
 
116
#print str_func1(buf)
117
if ![gdb_skip_stdio_test "print str_func1(buf)"] {
118
    gdb_test "print str_func1(buf)" \
119
        "first string arg is: test string.*\"test string\".*"
120
}
121
 
122
#call str_func1(buf)
123
if ![gdb_skip_stdio_test "call str_func1(buf)"] {
124
    gdb_test "call str_func1(buf)" \
125
        "first string arg is: test string.*\"test string\".*"
126
}
127
 
128
#print str_func("a","b","c","d","e","f","g")
129
if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
130
    gdb_test "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
131
        "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\]+.*= \"abcdefg\".*"
132
}
133
 
134
#call str_func("a","b","c","d","e","f","g")
135
if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
136
    gdb_test "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
137
        "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\]+.*= \"abcdefg\".*"
138
}
139
 
140
#print str_func(s,s,s,s,s,s,s)
141
if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
142
    gdb_test "print str_func(s,s,s,s,s,s,s)" \
143
        "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\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
144
}
145
 
146
#call str_func(s,s,s,s,s,s,s)
147
if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
148
    gdb_test "call str_func(s,s,s,s,s,s,s)" \
149
        "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\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
150
}
151
 
152
gdb_exit
153
 
154
set timeout $prev_timeout
155
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.