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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [testsuite/] [gdb.cp/] [mb-templates.exp] - Blame information for rev 341

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2007, 2008, 2009, 2010 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
# This test verifies that setting breakpoint on line in template
17
# function will fire in all instantiations of that template.
18
 
19
if $tracelevel then {
20
    strace $tracelevel
21
}
22
 
23
if { [skip_stl_tests] } { continue }
24
 
25
# On SPU this test fails because the executable exceeds local storage size.
26
if { [istarget "spu*-*-*"] } {
27
        return 0
28
}
29
 
30
 
31
set testfile "mb-templates"
32
set srcfile ${testfile}.cc
33
set binfile ${objdir}/${subdir}/${testfile}
34
 
35
if [get_compiler_info ${binfile} "c++"] {
36
    return -1
37
}
38
 
39
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
40
     untested mb-templates.exp
41
     return -1
42
}
43
 
44
gdb_exit
45
gdb_start
46
gdb_reinitialize_dir $srcdir/$subdir
47
gdb_load ${binfile}
48
 
49
set bp_location [gdb_get_line_number "set breakpoint here"]
50
 
51
# Set a breakpoint with multiple locations
52
# and a condition.
53
 
54
gdb_test "break $srcfile:$bp_location if i==1" \
55
    "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \
56
    "initial condition: set breakpoint"
57
 
58
gdb_run_cmd
59
gdb_expect {
60
    -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" {
61
        pass "initial condition: run to breakpoint"
62
    }
63
    -re "$gdb_prompt $" {
64
        fail "initial condition: run to breakpoint"
65
    }
66
    timeout {
67
        fail "initial condition: run to breakpoint (timeout)"
68
    }
69
}
70
 
71
gdb_test "continue" \
72
    ".*Breakpoint.*foo \\(i=1\\).*" \
73
    "initial condition: run to breakpoint 2"
74
 
75
# Set breakpoint with multiple locations.
76
# Separately set the condition.
77
gdb_exit
78
gdb_start
79
gdb_reinitialize_dir $srcdir/$subdir
80
gdb_load ${binfile}
81
 
82
gdb_test "break $srcfile:$bp_location" \
83
    "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \
84
    "separate condition: set breakpoint"
85
 
86
gdb_test_no_output "condition 1 i==1" \
87
    "separate condition: set condition"
88
 
89
gdb_run_cmd
90
gdb_expect {
91
    -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" {
92
        pass "separate condition: run to breakpoint"
93
    }
94
    -re "$gdb_prompt $" {
95
        fail "separate condition: run to breakpoint"
96
    }
97
    timeout {
98
        fail "separate condition: run to breakpoint (timeout)"
99
    }
100
}
101
 
102
gdb_test "continue" \
103
    ".*Breakpoint.*foo \\(i=1\\).*" \
104
    "separate condition: run to breakpoint 2"
105
 
106
# Try disabling a single location. We also test
107
# that at least in simple cases, the enable/disable
108
# state of locations surive "run".
109
gdb_test_no_output "disable 1.1" "disabling location: disable"
110
 
111
gdb_run_cmd
112
gdb_expect {
113
    -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" {
114
        pass "disabling location: run to breakpoint"
115
    }
116
    -re "$gdb_prompt $" {
117
        fail "disabling location: run to breakpoint"
118
    }
119
    timeout {
120
        fail "disabling location: run to breakpoint (timeout)"
121
    }
122
}
123
 
124
# Try disabling entire breakpoint
125
gdb_test_no_output "enable 1.1" "disabling location: enable"
126
 
127
 
128
gdb_test_no_output "disable 1" "disable breakpoint: disable"
129
 
130
gdb_run_cmd
131
gdb_expect {
132
    -re "Program exited normally.*$gdb_prompt $" {
133
        pass "disable breakpoint: run to breakpoint"
134
    }
135
    -re "$gdb_prompt $" {
136
        fail "disable breakpoint: run to breakpoint"
137
    }
138
    timeout {
139
        fail "disable breakpoint: run to breakpoint (timeout)"
140
    }
141
}
142
 
143
# Make sure breakpoint can be set on a specific instantion.
144
delete_breakpoints
145
gdb_test "break 'void foo(int)'" ".*" \
146
    "instantiation: set breakpoint"
147
 
148
 
149
gdb_run_cmd
150
gdb_expect {
151
    -re ".*Breakpoint \[0-9\]+,.*foo \\(i=0\\).*$gdb_prompt $" {
152
        pass "instantiation: run to breakpoint"
153
    }
154
    -re "$gdb_prompt $" {
155
        fail "instantiation: run to breakpoint"
156
    }
157
    timeout {
158
        fail "instantiation: run to breakpoint (timeout)"
159
    }
160
}
161
 
162
gdb_test "continue" \
163
    ".*Breakpoint.*foo \\(i=1\\).*" \
164
    "instantiation: run to breakpoint 2"
165
 
166
 
167
# Make sure we can set a breakpoint on a source statement that spans
168
# multiple lines.
169
 
170
delete_breakpoints
171
 
172
set bp_location [gdb_get_line_number "set multi-line breakpoint here"]
173
 
174
if { ![runto_main] } {
175
    fail "Can't run to main for multi_line_foo tests."
176
    return 0
177
}
178
 
179
gdb_test "break $srcfile:$bp_location" \
180
    "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \
181
    "set multi_line_foo breakpoint"
182
gdb_test "continue" \
183
    ".*Breakpoint.*multi_line_foo \\(i=0\\).*" \
184
    "run to multi_line_foo breakpoint 2 "
185
gdb_test "continue" \
186
    ".*Breakpoint.*multi_line_foo \\(i=0\\).*" \
187
    "run to multi_line_foo breakpoint 2 "

powered by: WebSVN 2.1.0

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