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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [condbreak.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) 1997, 1998, 1999 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
# This test was written by Rich Title.
21
# Purpose is to test conditional breakpoints.
22
# Modeled after "break.exp".
23
 
24
if $tracelevel then {
25
        strace $tracelevel
26
        }
27
 
28
global usestubs
29
 
30
#
31
# test running programs
32
#
33
set prms_id 0
34
set bug_id 0
35
 
36
set testfile "break"
37
set srcfile ${testfile}.c
38
set binfile ${objdir}/${subdir}/${testfile}
39
 
40
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
41
    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
42
}
43
 
44
if [get_compiler_info ${binfile}] {
45
    return -1;
46
}
47
 
48
gdb_exit
49
gdb_start
50
gdb_reinitialize_dir $srcdir/$subdir
51
gdb_load ${binfile}
52
 
53
 
54
if [target_info exists gdb_stub] {
55
    gdb_step_for_stub;
56
}
57
 
58
#
59
# test break at function
60
#
61
gdb_test "break main" \
62
    "Breakpoint.*at.* file .*$srcfile, line.*" \
63
    "breakpoint function"
64
 
65
#
66
# test conditional break at function
67
#
68
gdb_test "break marker1 if 1==1" \
69
    "Breakpoint.*at.* file .*$srcfile, line.*" \
70
    "break function if condition"
71
 
72
gdb_test "delete 2" \
73
    "" \
74
    "delete break"
75
 
76
#
77
# test conditional break at line number
78
#
79
gdb_test "break 79 if 1==1" \
80
    "Breakpoint.*at.* file .*$srcfile, line 79\\." \
81
    "break line if condition"
82
 
83
gdb_test "delete 3" \
84
    "" \
85
    "delete break"
86
 
87
#
88
# test conditional break at function
89
#
90
gdb_test "break marker1 if (1==1)" \
91
    "Breakpoint.*at.* file .*$srcfile, line.*" \
92
    "break function if (condition)"
93
 
94
#
95
# test conditional break at line number
96
#
97
gdb_test "break 79 if (1==1)" \
98
    "Breakpoint.*at.* file .*$srcfile, line 79\\." \
99
    "break line if (condition)"
100
 
101
gdb_test "break marker2 if (a==43)" \
102
    "Breakpoint.*at.* file .*$srcfile, line.*" \
103
    "break function if (condition)"
104
 
105
#
106
# check to see what breakpoints are set
107
#
108
 
109
if {$hp_aCC_compiler} {
110
    set marker1_proto "\\(void\\)"
111
    set marker2_proto "\\(int\\)"
112
} else {
113
    set marker1_proto ""
114
    set marker2_proto ""
115
}
116
 
117
set main_line 75
118
gdb_test "info break" \
119
    "Num Type\[ \]+Disp Enb Address\[ \]+What.*
120
\[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$main_line.*
121
\[0-9\]+\[\t \]+breakpoint     keep y.* in marker1$marker1_proto at .*$srcfile:4\[38\].*
122
\[\t \]+stop only if 1 == 1.*
123
\[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:79.*
124
\[\t \]+stop only if 1 == 1.*
125
\[0-9\]+\[\t \]+breakpoint     keep y.* in marker2$marker2_proto at .*$srcfile:4\[49\].*
126
\[\t \]+stop only if a == 43.*" \
127
    "breakpoint info"
128
 
129
 
130
#
131
# run until the breakpoint at main is hit.
132
#
133
 
134
 
135
rerun_to_main
136
 
137
#
138
# run until the breakpoint at a line number
139
#
140
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \
141
                        "run until breakpoint set at a line number"
142
 
143
#
144
# run until the breakpoint at marker1
145
#
146
# If the inferior stops at the first instruction of a source line, GDB
147
# won't print the actual PC value; the source line is enough to
148
# exactly specify the PC.  But if the inferior is instead stopped in
149
# the midst of a source line, GDB will include the PC in the
150
# breakpoint hit message.  This way, GDB always provides the exact
151
# stop location, but avoids clutter when possible.
152
#
153
# Suppose you have a function written completely on one source line, like:
154
#    int foo (int x) { return 0; }
155
# Setting a breakpoint at `foo' actually places the breakpoint after
156
# foo's prologue.
157
#
158
# GCC's STABS writer always emits a line entry attributing the
159
# prologue instructions to the line containing the function's open
160
# brace, even if the first user instruction is also on that line.
161
# This means that, in the case of a one-line function, you will get
162
# two line entries in the debug info for the same line: one at the
163
# function's entry point, and another at the first user instruction.
164
# GDB preserves these duplicated line entries, and prefers the later
165
# one; thus, when the program stops after the prologue, at the first
166
# user instruction, GDB's search finds the second line entry, decides
167
# that the PC is indeed at the beginning of a source line, and doesn't
168
# print an address in the breakpoint hit message.
169
#
170
# GCC's Dwarf2 writer, on the other hand, squeezes out duplicate line
171
# entries, so GDB considers the source line to begin at the start of
172
# the function's prologue.  Thus, if the program stops at the
173
# breakpoint, GDB will decide that the PC is not at the beginning of a
174
# source line, and will print an address.
175
#
176
# I think the Dwarf2 writer's behavior is arguably correct, but not
177
# helpful.  If the user sets a breakpoint at that source line, they
178
# want that breakpoint to fall after the prologue.  Identifying the
179
# prologue's code with the opening brace is nice, but it shouldn't
180
# take precedence over real code.
181
#
182
# Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior.
183
send_gdb "continue\n"
184
gdb_expect {
185
    -re  "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*$gdb_prompt $" {
186
        pass "run until breakpoint at marker1"
187
    }
188
    -re  "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*$gdb_prompt $" {
189
        xfail "run until breakpoint at marker1"
190
    }
191
    -re "$gdb_prompt $" {
192
        fail "run until breakpoint at marker1"
193
    }
194
    timeout {
195
        fail "(timeout) run until breakpoint at marker1"
196
    }
197
}
198
 
199
# run until the breakpoint at marker2
200
# Same issues here as above.
201
setup_xfail hppa2.0w-*-* 11512CLLbs
202
send_gdb "continue\n"
203
gdb_expect {
204
    -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" {
205
        pass "run until breakpoint at marker2"
206
    }
207
    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" {
208
        xfail "run until breakpoint at marker2"
209
    }
210
    -re "$gdb_prompt $" {
211
        fail "run until breakpoint at marker2"
212
    }
213
    timeout {
214
        fail "(timeout) run until breakpoint at marker2"
215
    }
216
}

powered by: WebSVN 2.1.0

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