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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [testsuite/] [gdb.base/] [reread.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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