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

Subversion Repositories or1k

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

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

Line No. Rev Author Line
1 106 markom
# Copyright (C) 1998 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
set binfile1 ${objdir}/${subdir}/${testfile1}
34
 
35
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable {debug additional_flags=-w}] != "" } {
36
    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
37
}
38
 
39
# build the second test case
40
 
41
set testfile2 "reread2"
42
set srcfile2 ${testfile2}.c
43
set binfile2 ${objdir}/${subdir}/${testfile2}
44
 
45
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug additional_flags=-w}] != "" } {
46
    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
47
}
48
 
49
# Start with a fresh gdb.
50
 
51
set testfile "reread"
52
set binfile ${objdir}/${subdir}/${testfile}
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 older 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
gdb_run_cmd
101
gdb_expect {
102
#    -re ".*re-reading symbols.*Breakpoint.* foo .* at .*$srcfile2:9.*$gdb_prompt $" {}
103
    -re ".*Breakpoint.* foo .* at .*:9.*$gdb_prompt $" {
104
        pass "run to foo() second time ";
105
    }
106
    -re ".*$gdb_prompt $" {
107
        fail "run to foo() second time";
108
        gdb_suppress_tests;
109
    }
110
    timeout { fail "run to foo() second time (timeout)" ; gdb_suppress_tests }
111
}
112
 
113
# End of tests.
114
 
115
gdb_stop_suppressing_tests
116
 
117
return 0

powered by: WebSVN 2.1.0

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