]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/condbreak.exp
Typo.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / condbreak.exp
CommitLineData
c906108c
SS
1# Copyright (C) 1997, 1998 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
25
26if $tracelevel then {
27 strace $tracelevel
28 }
29
30global usestubs
31
32#
33# test running programs
34#
35set prms_id 0
36set bug_id 0
37
38set testfile "condbreak"
39set srcfile ${testfile}.c
40set binfile ${objdir}/${subdir}/${testfile}
41
42if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
43 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
44}
45
46gdb_exit
47gdb_start
48gdb_reinitialize_dir $srcdir/$subdir
49gdb_load ${binfile}
50
51
52if [target_info exists gdb_stub] {
53 gdb_step_for_stub;
54}
55
56#
57# test break at function
58#
59gdb_test "break main" \
60 "Breakpoint.*at.* file .*$srcfile, line.*" \
61 "breakpoint function"
62
63#
64# test conditional break at function
65#
66gdb_test "break marker1 if 1==1" \
67 "Breakpoint.*at.* file .*$srcfile, line.*" \
68 "break function if condition"
69
70gdb_test "delete 2" \
71 "" \
72 "delete break"
73
74#
75# test conditional break at line number
76#
77gdb_test "break 64 if 1==1" \
78 "Breakpoint.*at.* file .*$srcfile, line 64\\." \
79 "break line if condition"
80
81gdb_test "delete 3" \
82 "" \
83 "delete break"
84
85#
86# test conditional break at function
87#
88gdb_test "break marker1 if (1==1)" \
89 "Breakpoint.*at.* file .*$srcfile, line.*" \
90 "break function if (condition)"
91
92#
93# test conditional break at line number
94#
95gdb_test "break 64 if (1==1)" \
96 "Breakpoint.*at.* file .*$srcfile, line 64\\." \
97 "break line if (condition)"
98
99gdb_test "break marker2 if (a==43)" \
100 "Breakpoint.*at.* file .*$srcfile, line.*" \
101 "break function if (condition)"
102
103#
104# check to see what breakpoints are set
105#
106
107set main_line 60
108gdb_test "info break" \
109 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
110\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
111\[0-9\]+\[\t \]+breakpoint keep y.* in marker1 at .*$srcfile:41.*
112\[\t \]+stop only if 1 == 1.*
113\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.*
114\[\t \]+stop only if 1 == 1.*
115\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile:42.*
116\[\t \]+stop only if a == 43.*" \
117 "breakpoint info"
118
119
120#
7a292a7a 121# run until the breakpoint at main is hit.
c906108c 122#
7a292a7a
SS
123
124
125gdb_run_cmd
c906108c
SS
126
127#
128# run until the breakpoint at a line number
129#
130gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:64.*64\[\t \]+printf.*factorial.*" \
131 "run until breakpoint set at a line number"
132
133#
134# run until the breakpoint at marker1
135#
136gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:41.*41\[\t \]+.*" \
137 "run until breakpoint at marker1"
138
139#
140# run until the breakpoint at marker2
141#
142gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:42.*42\[\t \]+.*" \
143 "run until breakpoint at marker2"
144
145
146
147
148
149
150
151
152
153
154
155
156
157