OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [ending-run.exp] - Blame information for rev 227

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

Line No. Rev Author Line
1 227 jeremybenn
# This testcase is part of GDB, the GNU debugger.
2
 
3
# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009,
4
# 2010 Free Software Foundation, Inc.
5
 
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see .
18
 
19
# use this to debug:
20
#
21
#log_user 1
22
 
23
# ending-run.exp -- Expect script to test ending a test run in gdb
24
 
25
if { [prepare_for_testing ending-run.exp ending-run] } {
26
    return -1
27
}
28
remote_exec build "rm -f core"
29
 
30
# CHFts23469: Test that you can "clear" a bp set at
31
# a line _before_ the routine (which will default to the
32
# first line in the routine, which turns out to correspond
33
# to the prolog--that's another bug...)
34
#
35
 
36
gdb_test "b ending-run.c:1" ".*Breakpoint.*ending-run.c, line 1.*" \
37
        "bpt at line before routine"
38
 
39
gdb_test "b ending-run.c:14" \
40
        ".*Note.*also.*Breakpoint 2.*ending-run.c, line 14.*" \
41
        "b ending-run.c:14, one"
42
 
43
# Set up to go to the next-to-last line of the program
44
#
45
gdb_test "b ending-run.c:31" ".*Breakpoint 3.*ending-run.c, line 31.*"
46
 
47
# Expect to hit the bp at line "1", but symbolize this
48
# as line "13".  Then try to clear it--this should work.
49
#
50
gdb_run_cmd
51
gdb_test "" ".*Breakpoint.*1.*callee.*14.*" "run"
52
 
53
gdb_test "cle" ".*Deleted breakpoints 1 2.*" "clear worked"
54
send_gdb "i b\n"
55
gdb_expect {
56
    -re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
57
        fail "cleared bp at line before routine"
58
    }
59
    -re ".*3.*main.*31.*$gdb_prompt $" {
60
        pass "cleared bp at line before routine"
61
    }
62
    -re ".*$gdb_prompt $" {
63
        fail "cleared bp at line before routine (info b)"
64
    }
65
}
66
 
67
# Test some other "clear" combinations
68
#
69
gdb_test "b ending-run.c:1" ".*Breakpoint.*4.*"
70
gdb_test "b ending-run.c:14" ".*Note.*also.*Breakpoint.*5.*" "b ending-run.c:14, two"
71
gdb_test "cle ending-run.c:14" \
72
        ".*Deleted breakpoint 5.*" "Cleared 2 by line"
73
 
74
send_gdb "info line ending-run.c:14\n"
75
gdb_expect {
76
    -re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" {
77
        set line_nine $expect_out(1,string)
78
        gdb_test "b ending-run.c:14" ".*Breakpoint 6.*ending-run.c, line 14.*"
79
        gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint 7.*" "Breakpoint 7 at *ending-run.c:14"
80
        gdb_test "cle" ".*Deleted breakpoints 4 6 7.*" "Clear 2 by default"
81
    }
82
    -re ".*$gdb_prompt $" {
83
        fail "need to fix test for new compile outcome"
84
    }
85
}
86
 
87
send_gdb "i b\n"
88
gdb_expect {
89
    -re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
90
        fail "all set to continue (didn't clear bps)"
91
    }
92
    -re ".*3.*main.*31.*$gdb_prompt $" {
93
        pass "all set to continue"
94
    }
95
    -re ".*$gdb_prompt $" {
96
        fail "all set to continue (missing bp at end)"
97
    }
98
}
99
 
100
 
101
# See if we can step out with control.  The "1 2 3" stuff
102
# is output from the program.
103
#
104
if ![gdb_skip_stdio_test "cont"] {
105
    gdb_test "cont" ".*1 2 7 14 23 34 47 62 79.*Breakpoint.*31.*"
106
} else {
107
    gdb_test "cont" ".*Breakpoint.*31.*"
108
}
109
 
110
if ![gdb_skip_stdio_test "Step to return"] {
111
    gdb_test "next" ".*Goodbye!.*32.*" \
112
            "Step to return"
113
} else {
114
    gdb_test "next" "" ""
115
}
116
 
117
set old_timeout $timeout
118
set timeout 50
119
set program_exited 0
120
send_gdb "next\n"
121
set nexted 0
122
gdb_expect {
123
    -re "33\[ \t\]+\}.*$gdb_prompt $" {
124
        # sometimes we stop at the closing brace, if so, do another next
125
        if { $nexted } {
126
            fail "step out of main"
127
        } else {
128
            set nexted 1
129
            send_gdb "next\n"
130
            exp_continue
131
        }
132
    }
133
    -re ".*Unable to find return pc for this frame.*$gdb_prompt $" {
134
        fail "step out of main"
135
        gdb_test "n" ".*" ""
136
    }
137
    -re ".*in.*start.*$gdb_prompt $" {
138
        pass "step out of main"
139
    }
140
    -re ".*in.*bsp_trap.*$gdb_prompt $" {
141
        pass "step out of main"
142
    }
143
    -re ".*in.*init.*$gdb_prompt $" {
144
        # This is what happens on sparc64-elf ultra.
145
        pass "step out of main"
146
    }
147
    -re ".*in.*dll_crt0_1.*$gdb_prompt $" {
148
        # This is what happens on Cygwin.
149
        pass "step out of main"
150
    }
151
    -re ".*WinMain.*$gdb_prompt $" {
152
        # This is what happens on mingw32ce.
153
        pass "step out of main"
154
    }
155
    -re ".*Program exited normally.*$gdb_prompt $" {
156
        # This is what happens on Linux i86 (and I would expect others)
157
        set program_exited 1
158
        pass "step out of main"
159
    }
160
    -re ".*in .nope ().*$gdb_prompt $" {
161
        # This is what happens on Solaris currently -sts 1999-08-25
162
        pass "step out of main"
163
    }
164
    -re ".*in _int_reset ().*$gdb_prompt $" {
165
        # This is what happens on Sanyo XStormy16
166
        pass "step out of main"
167
    }
168
    -re ".*init ().*$gdb_prompt $" {
169
        # This is what happens on many Mips targets
170
        pass "step out of main"
171
    }
172
    -re ".*in ..change.mode ().*$gdb_prompt $" {
173
        # This is what happens on ARM in thumb mode -fn 2000-02-01
174
        pass "step out of main"
175
    }
176
    -re ".*__rt_entry ().*$gdb_prompt $" {
177
        # This is what happens on the ARM RVDS runtime
178
        pass "step out of main"
179
    }
180
    -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" {
181
        pass "step out of main"
182
    }
183
    -re ".*in __wrap__?main ().*$gdb_prompt $" {
184
        pass "step out of main"
185
    }
186
    -re "__setup_argv_for_main (.*).*$gdb_prompt $" {
187
        # On sh, another wrapper function (start_l) exists, so
188
        # another `next' is necessary.
189
        gdb_test "next" ".*in start_l ().*" "step out of main"
190
    }
191
    -re ".*in.*currently asm.*$gdb_prompt $" {
192
        pass "step out of main"
193
    }
194
    -re "_*start\[0-9\]* \\(\[^)\]*\\).*$gdb_prompt $" {
195
        pass "step out of main"
196
    }
197
    -re ".*Program received signal SIGTRAP.*$gdb_prompt $" {
198
        pass "step out of main"
199
    }
200
    -re ".*$gdb_prompt $" { fail "step out of main" }
201
    timeout { fail "step out of main" }
202
}
203
 
204
# When we're talking to a program running on a real stand-alone board,
205
# every BSP's exit function behaves differently, so there's no single
206
# way to tell whether we've exited gracefully or not.  So don't run
207
# these tests when use_gdb_stub is set, or when we're running under Cygmon.
208
set program_exited_normally 0
209
set program_not_exited 0
210
set program_in_exit 0
211
if {! [target_info exists use_gdb_stub]
212
    && (! [target_info exists use_cygmon] || ! [target_info use_cygmon])} {
213
    global program_exited;
214
    if {[eval expr $program_exited == 0]} {
215
        send_gdb "n\n"
216
        gdb_expect {
217
            -re "Program exited normally.*$gdb_prompt $" {
218
                # If we actually have debug info for the start function,
219
                # then we won't get the "Single-stepping until function
220
                # exit" message.
221
                pass "step to end of run"
222
                set program_exited_normally 1
223
            }
224
            -re "Single.*EXIT code 0\r\n.*Program exited normally.*$gdb_prompt $" {
225
                pass "step to end of run (status wrapper)"
226
                set program_exited_normally 1
227
            }
228
            -re "Single.*EXIT code 0\r\n.*$gdb_prompt $" {
229
                pass "step to end of run (status wrapper)"
230
            }
231
            -re ".*Single.*Program exited.*$gdb_prompt $" {
232
                pass "step to end of run"
233
                set program_exited_normally 1
234
            }
235
            -re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" {
236
                pass "step to end of run"
237
                set program_in_exit 1
238
            }
239
            -re ".*Single.*_int_reset.*$gdb_prompt $" {
240
                pass "step to end of run"
241
                if {![istarget "xstormy16-*-*"]} {
242
                    set program_exited_normally 1
243
                }
244
            }
245
            -re ".*$gdb_prompt $" {
246
                fail "step to end of run"
247
                set program_not_exited 1
248
            }
249
            timeout {
250
                fail "(timeout) step to end of run"
251
                set program_not_exited 1
252
            }
253
        }
254
    }
255
 
256
    if {$program_in_exit} {
257
        if {[gdb_test "c" ".*" "continue after exit"] == 0} {
258
            set program_exited_normally 1
259
        }
260
    } else {
261
        unsupported "continue after exit"
262
    }
263
 
264
    if {$program_exited_normally} {
265
        gdb_test "n" ".*The program is not being run.*" "don't step after run"
266
    } elseif {$program_not_exited} {
267
        unresolved "don't step after run"
268
    } else {
269
        unsupported "don't step after run"
270
    }
271
 
272
    set exec_output [remote_exec host "ls core"]
273
 
274
    if [ regexp "core not found" $exec_output]  {
275
        pass "No core dumped on quit"
276
    } else {
277
        if [ regexp "No such file or directory" $exec_output] {
278
            pass "ls: core (No core dumped on quit)"
279
        } else {
280
            remote_exec build "rm -f core"
281
            fail "ls: core (Core dumped on quit)"
282
        }
283
    }
284
}
285
 
286
set timeout $old_timeout
287
 
288
#remote_exec build "rm -f ${binfile}"
289
return 0
290
 
291
 
292
 
293
 

powered by: WebSVN 2.1.0

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