OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [testsuite/] [gdb.base/] [condbreak.exp] - Blame information for rev 330

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

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 1997, 1998, 1999, 2000, 2001, 2003, 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
# This test was written by Rich Title.
18
# Purpose is to test conditional breakpoints.
19
# Modeled after "break.exp".
20
 
21
if $tracelevel then {
22
        strace $tracelevel
23
        }
24
 
25
global usestubs
26
 
27
#
28
# test running programs
29
#
30
 
31
set testfile "break"
32
set srcfile ${testfile}.c
33
set srcfile1 ${testfile}1.c
34
set binfile ${objdir}/${subdir}/${testfile}
35
 
36
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
37
     untested condbreak.exp
38
     return -1
39
}
40
 
41
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
42
     untested condbreak.exp
43
     return -1
44
}
45
 
46
if  { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
47
     untested condbreak.exp
48
     return -1
49
}
50
 
51
if [get_compiler_info ${binfile}] {
52
    return -1;
53
}
54
 
55
gdb_exit
56
gdb_start
57
gdb_reinitialize_dir $srcdir/$subdir
58
gdb_load ${binfile}
59
 
60
 
61
if [target_info exists gdb_stub] {
62
    gdb_step_for_stub;
63
}
64
 
65
set bp_location1  [gdb_get_line_number "set breakpoint 1 here"]
66
set bp_location6  [gdb_get_line_number "set breakpoint 6 here"]
67
set bp_location8  [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
68
set bp_location9  [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
69
set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
70
set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
71
set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
72
set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
73
set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1]
74
set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1]
75
 
76
#
77
# test break at function
78
#
79
gdb_test "break main" \
80
    "Breakpoint.*at.* file .*$srcfile, line.*" \
81
    "breakpoint function"
82
 
83
#
84
# test conditional break at function
85
#
86
gdb_test "break marker1 if 1==1" \
87
    "Breakpoint.*at.* file .*$srcfile1, line.*"
88
 
89
gdb_test_no_output "delete 2"
90
 
91
#
92
# test conditional break at line number
93
#
94
gdb_test "break $srcfile:$bp_location1 if 1==1" \
95
    "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\."
96
 
97
gdb_test_no_output "delete 3"
98
 
99
#
100
# test conditional break at function
101
#
102
gdb_test "break marker1 if (1==1)" \
103
    "Breakpoint.*at.* file .*$srcfile1, line.*"
104
 
105
#
106
# test conditional break at line number
107
#
108
gdb_test "break $srcfile:$bp_location1 if (1==1)" \
109
    "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\."
110
 
111
gdb_test "break marker2 if (a==43)" \
112
    "Breakpoint.*at.* file .*$srcfile1, line.*"
113
 
114
#
115
# Check break involving inferior function call.
116
# Ensure there is at least one additional breakpoint with higher VMA.
117
#
118
gdb_test "break marker3 if (multi_line_if_conditional(1,1,1)==0)" \
119
    "Breakpoint.*at.* file .*$srcfile1, line.*"
120
gdb_test "break marker4" \
121
    "Breakpoint.*at.* file .*$srcfile1, line.*"
122
 
123
#
124
# check to see what breakpoints are set
125
#
126
 
127
if {$hp_aCC_compiler} {
128
    set marker1_proto "\\(void\\)"
129
    set marker2_proto "\\(int\\)"
130
    # Not checked.
131
    set marker3_proto "\\(char \\*, char \\*\\)"
132
    set marker4_proto "\\(long\\)"
133
} else {
134
    set marker1_proto ""
135
    set marker2_proto ""
136
    set marker3_proto ""
137
    set marker4_proto ""
138
}
139
 
140
gdb_test "info break" \
141
    "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
142
\[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$bp_location6.*
143
\[0-9\]+\[\t \]+breakpoint     keep y.* in marker1$marker1_proto at .*$srcfile1:($bp_location15|$bp_location16).*
144
\[\t \]+stop only if \\(1==1\\).*
145
\[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$bp_location1.*
146
\[\t \]+stop only if \\(1==1\\).*
147
\[0-9\]+\[\t \]+breakpoint     keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).*
148
\[\t \]+stop only if \\(a==43\\).*
149
\[0-9\]+\[\t \]+breakpoint     keep y.* in marker3$marker3_proto at .*$srcfile1:($bp_location17|$bp_location18).*
150
\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*
151
\[0-9\]+\[\t \]+breakpoint     keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*" \
152
    "breakpoint info"
153
 
154
 
155
#
156
# run until the breakpoint at main is hit.
157
#
158
 
159
 
160
rerun_to_main
161
 
162
#
163
# run until the breakpoint at a line number
164
#
165
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \
166
                        "run until breakpoint set at a line number"
167
 
168
#
169
# run until the breakpoint at marker1
170
#
171
# If the inferior stops at the first instruction of a source line, GDB
172
# won't print the actual PC value; the source line is enough to
173
# exactly specify the PC.  But if the inferior is instead stopped in
174
# the midst of a source line, GDB will include the PC in the
175
# breakpoint hit message.  This way, GDB always provides the exact
176
# stop location, but avoids clutter when possible.
177
#
178
# Suppose you have a function written completely on one source line, like:
179
#    int foo (int x) { return 0; }
180
# Setting a breakpoint at `foo' actually places the breakpoint after
181
# foo's prologue.
182
#
183
# GCC's STABS writer always emits a line entry attributing the
184
# prologue instructions to the line containing the function's open
185
# brace, even if the first user instruction is also on that line.
186
# This means that, in the case of a one-line function, you will get
187
# two line entries in the debug info for the same line: one at the
188
# function's entry point, and another at the first user instruction.
189
# GDB preserves these duplicated line entries, and prefers the later
190
# one; thus, when the program stops after the prologue, at the first
191
# user instruction, GDB's search finds the second line entry, decides
192
# that the PC is indeed at the beginning of a source line, and doesn't
193
# print an address in the breakpoint hit message.
194
#
195
# GCC's Dwarf2 writer, on the other hand, squeezes out duplicate line
196
# entries, so GDB considers the source line to begin at the start of
197
# the function's prologue.  Thus, if the program stops at the
198
# breakpoint, GDB will decide that the PC is not at the beginning of a
199
# source line, and will print an address.
200
#
201
# I think the Dwarf2 writer's behavior is arguably correct, but not
202
# helpful.  If the user sets a breakpoint at that source line, they
203
# want that breakpoint to fall after the prologue.  Identifying the
204
# prologue's code with the opening brace is nice, but it shouldn't
205
# take precedence over real code.
206
#
207
# Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior.
208
gdb_test_multiple "continue" "run until breakpoint at marker1" {
209
    -re  "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
210
        pass "run until breakpoint at marker1"
211
    }
212
    -re  "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
213
        xfail "run until breakpoint at marker1"
214
    }
215
}
216
 
217
# run until the breakpoint at marker2
218
# Same issues here as above.
219
setup_xfail hppa2.0w-*-* 11512CLLbs
220
gdb_test_multiple "continue" "run until breakpoint at marker2" {
221
    -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
222
        pass "run until breakpoint at marker2"
223
    }
224
    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
225
        xfail "run until breakpoint at marker2"
226
    }
227
}
228
 
229
# Test combinations of conditional and thread-specific breakpoints.
230
gdb_test "break main if (1==1) thread 999" \
231
    "Unknown thread 999\\."
232
gdb_test "break main thread 999 if (1==1)" \
233
    "Unknown thread 999\\."
234
 
235
# Verify that both if and thread can be distinguished from a breakpoint
236
# address expression.
237
gdb_test "break *main if (1==1) thread 999" \
238
    "Unknown thread 999\\."
239
gdb_test "break *main thread 999 if (1==1)" \
240
    "Unknown thread 999\\."
241
 
242
# Similarly for task.
243
gdb_test "break *main if (1==1) task 999" \
244
    "Unknown task 999\\."
245
gdb_test "break *main task 999 if (1==1)" \
246
    "Unknown task 999\\."
247
 
248
# GDB accepts abbreviations for "thread" and "task".
249
gdb_test "break *main if (1==1) t 999" \
250
    "Unknown thread 999\\."
251
gdb_test "break *main if (1==1) th 999" \
252
    "Unknown thread 999\\."
253
gdb_test "break *main if (1==1) ta 999" \
254
    "Unknown task 999\\."
255
 
256
set test "run until breakpoint at marker3"
257
gdb_test_multiple "continue" $test {
258
    -re "Continuing\\..*Breakpoint \[0-9\]+, marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
259
        pass $test
260
    }
261
    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
262
        xfail $test
263
    }
264
}
265
 
266
set test "run until breakpoint at marker4"
267
gdb_test_multiple "continue" $test {
268
    -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
269
        pass $test
270
    }
271
    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
272
        xfail $test
273
    }
274
}

powered by: WebSVN 2.1.0

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