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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [chng-syms.exp] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 2004, 2007, 2008 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
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@prep.ai.mit.edu
18
 
19
# Author: Paul N. Hilfinger (Hilfinger@gnat.com)
20
 
21
# Test that GDB cleans up properly after errors that result when a
22
# breakpoint is reset.
23
 
24
if $tracelevel then {
25
        strace $tracelevel
26
}
27
 
28
set prms_id 0
29
set bug_id 0
30
 
31
# IDT/SIM apparently doesn't have enough file descriptors to allow the
32
# problem checked by this test to occur.
33
if [istarget "mips-idt-*"] {
34
    return 0;
35
}
36
 
37
set testfile "chng-syms"
38
set srcfile ${testfile}.c
39
set binfile ${objdir}/${subdir}/${testfile}
40
 
41
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var1}] != "" } {
42
    untested chng-syms.exp
43
    return -1
44
}
45
 
46
set oldtimeout $timeout
47
set timeout 10
48
verbose "Timeout is now 10 seconds" 2
49
 
50
proc expect_to_stop_here { ident } {
51
    global gdb_prompt
52
    global decimal
53
 
54
    # the "at foo.c:36" output we get with -g.
55
    # the "in func" output we get without -g.
56
    gdb_expect {
57
        -re "Breakpoint \[0-9\]*, stop_here .*$gdb_prompt $" {
58
            return 1
59
        }
60
        -re "$gdb_prompt $" {
61
            fail "running to stop_here $ident"
62
            return 0
63
        }
64
        timeout {
65
            fail "running to stop_here $ident (timeout)"
66
            return 0
67
        }
68
    }
69
    return 1
70
}
71
 
72
gdb_exit
73
gdb_start
74
gdb_reinitialize_dir $srcdir/$subdir
75
gdb_load ${binfile}
76
 
77
gdb_test "break stop_here if (var1 == 42)" \
78
    "Breakpoint.*at.* file .*$srcfile, line.*" \
79
    "setting conditional breakpoint on function"
80
gdb_run_cmd
81
 
82
expect_to_stop_here "first time"
83
 
84
gdb_continue_to_end "breakpoint first time through"
85
 
86
# Now we recompile the executable, but without a variable named "var1", first
87
# waiting to insure that even on fast machines, the file modification times
88
# are distinct. This will force GDB to reload the file on the
89
# next "run" command, causing an error when GDB tries to tries to reset
90
# the breakpoint.
91
 
92
sleep 2
93
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var2}] != "" } {
94
 
95
# Complication: Since GDB generally holds an open file descriptor on the
96
# executable at this point, there are some systems in which the
97
# re-compilation will fail. In such cases, we'll consider the test
98
# (vacuously) passed providing that re-running it succeeds as before.
99
 
100
    gdb_run_cmd
101
    expect_to_stop_here "after re-compile fails"
102
    gdb_continue_to_end "after re-compile fails"
103
 
104
} else {
105
 
106
    gdb_run_cmd
107
    gdb_expect {
108
        -re ".*No symbol .var1..*Program exited normally.*$gdb_prompt $" {
109
            pass "running with invalidated bpt condition after executable changes"
110
        }
111
        -re "No symbol .var1..*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" {
112
            pass "running with invalidated bpt condition after executable changes"
113
        }
114
        -re "$gdb_prompt $" {
115
            fail "running with invalidated bpt condition after executable changes"
116
        }
117
        timeout {
118
            fail "(timeout) running with invalidated bpt condition after executable changes"
119
        }
120
    }
121
 
122
}
123
 
124
set timeout $oldtimeout
125
verbose "Timeout is now $timeout seconds" 2
126
return 0

powered by: WebSVN 2.1.0

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