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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [reread.exp] - Blame information for rev 833

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 1998, 2000, 2001, 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
if $tracelevel then {
18
        strace $tracelevel
19
}
20
 
21
set prms_id 0
22
set bug_id 0
23
 
24
set prototypes 1
25
 
26
# build the first test case
27
 
28
set testfile1 "reread1"
29
set srcfile1 ${testfile1}.c
30
# Cygwin needs $EXEEXT.
31
set binfile1 ${objdir}/${subdir}/${testfile1}$EXEEXT
32
 
33
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable {debug nowarnings}] != "" } {
34
    untested reread.exp
35
    return -1
36
}
37
 
38
# build the second test case
39
 
40
set testfile2 "reread2"
41
set srcfile2 ${testfile2}.c
42
set binfile2 ${objdir}/${subdir}/${testfile2}$EXEEXT
43
 
44
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug nowarnings}] != "" } {
45
    untested reread.exp
46
    return -1
47
}
48
 
49
# Start with a fresh gdb.
50
 
51
set testfile "reread"
52
set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
53
 
54
gdb_start
55
gdb_reinitialize_dir $srcdir/$subdir
56
 
57
set prms_id 13484
58
set bug_id 0
59
 
60
# Load the first executable.
61
 
62
gdb_test "shell mv ${binfile1} ${binfile}" "" ""
63
gdb_load ${binfile}
64
 
65
# Set a breakpoint at foo
66
 
67
gdb_test "break foo" \
68
    "Breakpoint.*at.* file .*$srcfile1, line 14.*" \
69
    "breakpoint foo in first file"
70
 
71
 
72
# Run, should see "Breakpoint 1, foo () at hello1.c:14"
73
 
74
gdb_run_cmd
75
 
76
gdb_expect {
77
    -re ".*Breakpoint.* foo .* at .*$srcfile1:14.*$gdb_prompt $"  {
78
        pass "run to foo()";
79
    }
80
    -re ".*$gdb_prompt $" {
81
        fail "run to foo()";
82
        gdb_suppress_tests;
83
    }
84
    timeout { fail "run to foo() (timeout)" ; gdb_suppress_tests }
85
}
86
 
87
# Restore first executable to its original name, and move
88
# second executable into its place.  Ensure that the new
89
# executable is at least a second newer than the old.
90
 
91
gdb_test "shell mv ${binfile} ${binfile1}" "" ""
92
gdb_test "shell mv ${binfile2} ${binfile}" "" ""
93
gdb_test "shell sleep 1" "" ""
94
gdb_test "shell touch ${binfile}" "" ""
95
 
96
# Run a second time; GDB should detect that the executable has changed
97
# and reset the breakpoints correctly.
98
# Should see "Breakpoint 1, foo () at reread2.c:9"
99
 
100
set prms_id 0
101
 
102
if [is_remote target] {
103
    unsupported "run to foo() second time ";
104
} else {
105
    gdb_run_cmd
106
    gdb_expect {
107
        #    -re ".*re-reading symbols.*Breakpoint.* foo .* at .*$srcfile2:9.*$gdb_prompt $" {}
108
        -re ".*Breakpoint.* foo .* at .*:9.*$gdb_prompt $" {
109
            pass "run to foo() second time ";
110
        }
111
        -re ".*$gdb_prompt $" {
112
            fail "run to foo() second time";
113
            gdb_suppress_tests;
114
        }
115
        timeout {
116
            fail "run to foo() second time (timeout)" ;
117
            gdb_suppress_tests
118
        }
119
    }
120
}
121
 
122
 
123
### Second pass: verify that GDB checks the executable file's
124
### timestamp when the program is *restarted*, not just when it exits.
125
 
126
if [is_remote target] {
127
    unsupported "second pass: GDB should check for changes before running"
128
} else {
129
 
130
    # Put the older executable back in place.
131
    gdb_test "shell mv ${binfile} ${binfile2}" "" ""
132
    gdb_test "shell mv ${binfile1} ${binfile}" "" ""
133
 
134
    # Restart GDB entirely.
135
    gdb_start
136
    gdb_reinitialize_dir $srcdir/$subdir
137
    gdb_load ${binfile}
138
 
139
    # Set a breakpoint on foo and run to it.
140
    gdb_test "break foo" \
141
            "Breakpoint.*at.* file .*$srcfile1, line 14.*" \
142
            "second pass: breakpoint foo in first file"
143
    gdb_run_cmd
144
    gdb_expect {
145
        -re ".*Breakpoint.* foo .* at .*$srcfile1:14.*$gdb_prompt $"  {
146
            pass "second pass: run to foo()";
147
        }
148
        -re ".*$gdb_prompt $" {
149
            fail "second pass: run to foo()";
150
            gdb_suppress_tests;
151
        }
152
        timeout {
153
            fail "second pass: run to foo() (timeout)"
154
            gdb_suppress_tests
155
        }
156
    }
157
 
158
    # This time, let the program run to completion.  If GDB checks the
159
    # executable file's timestamp now, it won't notice any change.
160
    gdb_test "continue" ".*Program exited.*" \
161
            "second pass: continue to completion"
162
 
163
    # Now move the newer executable into place, and re-run.  GDB
164
    # should still notice that the executable file has changed,
165
    # and still re-set the breakpoint appropriately.
166
    gdb_test "shell mv ${binfile} ${binfile1}" "" ""
167
    gdb_test "shell mv ${binfile2} ${binfile}" "" ""
168
    gdb_run_cmd
169
    gdb_expect {
170
        -re ".*Breakpoint.* foo .* at .*:9.*$gdb_prompt $" {
171
            pass "second pass: run to foo() second time ";
172
        }
173
        -re ".*$gdb_prompt $" {
174
            fail "second pass: run to foo() second time";
175
            gdb_suppress_tests;
176
        }
177
        timeout {
178
            fail "second pass: run to foo() second time (timeout)" ;
179
            gdb_suppress_tests
180
        }
181
    }
182
}
183
 
184
# End of tests.
185
 
186
gdb_stop_suppressing_tests
187
 
188
return 0

powered by: WebSVN 2.1.0

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