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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [condbreak.exp] - Blame information for rev 853

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

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

powered by: WebSVN 2.1.0

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