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

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [testsuite/] [gdb.gdb/] [complaints.exp] - Blame information for rev 341

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2002, 2004, 2007, 2008, 2009, 2010 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 .
15
 
16
# This file was written by Andrew Cagney (cagney at redhat dot com),
17
# derived from xfullpath.exp (written by Joel Brobecker), derived from
18
# selftest.exp (written by Rob Savoye).
19
 
20
if $tracelevel then {
21
    strace $tracelevel
22
}
23
 
24
 
25
# are we on a target board
26
if { [is_remote target] || ![isnative] } then {
27
    return
28
}
29
 
30
proc setup_test { executable } {
31
    global gdb_prompt
32
    global timeout
33
 
34
    # load yourself into the debugger
35
    # This can take a relatively long time, particularly for testing where
36
    # the executable is being accessed over a network, or where gdb does not
37
    # support partial symbols for a particular target and has to load the
38
    # entire symbol table.  Set the timeout to 10 minutes, which should be
39
    # adequate for most environments (it *has* timed out with 5 min on a
40
    # SPARCstation SLC under moderate load, so this isn't unreasonable).
41
    # After gdb is started, set the timeout to 30 seconds for the duration
42
    # of this test, and then back to the original value.
43
 
44
    set oldtimeout $timeout
45
    set timeout 600
46
    verbose "Timeout is now $timeout seconds" 2
47
 
48
    global gdb_file_cmd_debug_info
49
    set gdb_file_cmd_debug_info "unset"
50
 
51
    set result [gdb_load $executable]
52
    set timeout $oldtimeout
53
    verbose "Timeout is now $timeout seconds" 2
54
 
55
    if { $result != 0 } then {
56
        return -1
57
    }
58
 
59
    if { $gdb_file_cmd_debug_info != "debug" } then {
60
        untested "No debug information, skipping testcase."
61
        return -1
62
    }
63
 
64
    # Set a breakpoint at main
65
    gdb_test "break captured_command_loop" \
66
            "Breakpoint.*at.* file.*, line.*" \
67
            "breakpoint in captured_command_loop"
68
 
69
    # run yourself
70
    # It may take a very long time for the inferior gdb to start (lynx),
71
    # so we bump it back up for the duration of this command.
72
    set timeout 600
73
 
74
    set description "run until breakpoint at captured_command_loop"
75
    gdb_test_multiple "run -nw" "$description" {
76
        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.* at .*main.c:.*$gdb_prompt $" {
77
            pass "$description"
78
        }
79
        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.*$gdb_prompt $" {
80
            xfail "$description (line numbers scrambled?)"
81
        }
82
        -re "vfork: No more processes.*$gdb_prompt $" {
83
            fail "$description (out of virtual memory)"
84
            set timeout $oldtimeout
85
            verbose "Timeout is now $timeout seconds" 2
86
            return -1
87
        }
88
        -re ".*$gdb_prompt $" {
89
            fail "$description"
90
            set timeout $oldtimeout
91
            verbose "Timeout is now $timeout seconds" 2
92
            return -1
93
        }
94
    }
95
 
96
    set timeout $oldtimeout
97
    verbose "Timeout is now $timeout seconds" 2
98
 
99
    return 0
100
}
101
 
102
proc test_initial_complaints { } {
103
 
104
    global gdb_prompt
105
 
106
    # Unsupress complaints
107
    gdb_test "set stop_whining = 2"
108
 
109
    # Prime the system
110
    gdb_test "call complaint (&symfile_complaints, \"Register a complaint\")" \
111
            "During symbol reading, Register a complaint."
112
 
113
    # Check that the complaint was inserted and where
114
    gdb_test "print symfile_complaints->root->fmt" \
115
            ".\[0-9\]+ =.*\"Register a complaint\""
116
 
117
    # Re-issue the first message #1
118
    gdb_test "call complaint (&symfile_complaints, symfile_complaints->root->fmt)" \
119
            "During symbol reading, Register a complaint."
120
 
121
    # Check that there is only one thing in the list
122
    gdb_test "print symfile_complaints->root->next == &complaint_sentinel" \
123
            ".\[0-9\]+ = 1" "list has one entry"
124
 
125
    # Add a second complaint, expect it
126
    gdb_test "call complaint (&symfile_complaints, \"Testing! Testing! Testing!\")" \
127
            "During symbol reading, Testing. Testing. Testing.."
128
 
129
    return 0
130
}
131
 
132
proc test_serial_complaints { } {
133
 
134
    global gdb_prompt
135
 
136
    gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 0)" "" "serial start"
137
 
138
    # Prime the system
139
    gdb_test_multiple "call complaint (&symfile_complaints, \"serial line  1\")" "serial line 1" {
140
        -re "During symbol reading...serial line  1...$gdb_prompt $" {
141
            pass "serial line 1"
142
        }
143
    }
144
 
145
    # Add a second complaint, expect it
146
    gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 2\")" "serial line 2" {
147
        -re "serial line 2...$gdb_prompt " {
148
            pass "serial line 2"
149
        }
150
    }
151
 
152
    gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "serial end" {
153
        -re "\r\n\r\n$gdb_prompt " {
154
            pass "serial end"
155
        }
156
    }
157
 
158
    return 0
159
}
160
 
161
# For short complaints, all are the same
162
 
163
proc test_short_complaints { } {
164
 
165
    global gdb_prompt
166
 
167
    gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 1)" "" "short start"
168
 
169
    # Prime the system
170
    gdb_test_multiple "call complaint (&symfile_complaints, \"short line 1\")" "short line 1" {
171
        -re "short line 1...$gdb_prompt " {
172
            pass "short line 1"
173
        }
174
    }
175
 
176
    # Add a second complaint, expect it
177
    gdb_test_multiple "call complaint (&symfile_complaints, \"short line 2\")" "short line 2" {
178
        -re "short line 2...$gdb_prompt " {
179
            pass "short line 2"
180
        }
181
    }
182
 
183
    gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "short end" {
184
        -re "\r\n\r\n$gdb_prompt " {
185
            pass "short end"
186
        }
187
    }
188
 
189
    return 0
190
}
191
 
192
# Check that nothing comes out when there haven't been any real
193
# complaints.  Note that each test is really checking the previous
194
# command.
195
 
196
proc test_empty_complaint { cmd msg } {
197
    global gdb_prompt
198
    gdb_test_multiple $cmd $msg {
199
        -re "\r\n\r\n$gdb_prompt $" {
200
            fail $msg
201
        }
202
        "\r\n$gdb_prompt $" {
203
            pass $msg
204
        }
205
    }
206
}
207
 
208
proc test_empty_complaints { } {
209
 
210
    test_empty_complaint "call clear_complaints(&symfile_complaints,0,0)" \
211
            "empty non-verbose non-noisy clear"
212
    test_empty_complaint "call clear_complaints(&symfile_complaints,1,0)" \
213
            "empty verbose non-noisy clear"
214
    test_empty_complaint "call clear_complaints(&symfile_complaints,1,1)" \
215
            "empty verbose noisy clear"
216
    test_empty_complaint "call clear_complaints(&symfile_complaints,0,1)" \
217
            "empty non-verbose noisy clear"
218
 
219
    return 0
220
}
221
 
222
# Find a pathname to a file that we would execute if the shell was asked
223
# to run $arg using the current PATH.
224
 
225
proc find_gdb { arg } {
226
 
227
    # If the arg directly specifies an existing executable file, then
228
    # simply use it.
229
 
230
    if [file executable $arg] then {
231
        return $arg
232
    }
233
 
234
    set result [which $arg]
235
    if [string match "/" [ string range $result 0 0 ]] then {
236
        return $result
237
    }
238
 
239
    # If everything fails, just return the unqualified pathname as default
240
    # and hope for best.
241
 
242
    return $arg
243
}
244
 
245
# Run the test with self.
246
# Copy the file executable file in case this OS doesn't like to edit its own
247
# text space.
248
 
249
set GDB_FULLPATH [find_gdb $GDB]
250
 
251
# Remove any old copy lying around.
252
remote_file host delete x$tool
253
 
254
gdb_start
255
 
256
set file [remote_download host $GDB_FULLPATH x$tool]
257
 
258
set setup_result [setup_test $file ]
259
if {$setup_result <0} then {
260
    return -1
261
}
262
 
263
test_initial_complaints
264
test_serial_complaints
265
test_short_complaints
266
test_empty_complaints
267
 
268
gdb_exit;
269
catch "remote_file host delete $file";

powered by: WebSVN 2.1.0

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